Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Cross origin websockets not allowed #463

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions web/handlers/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import time
import traceback
from typing import Any, Dict
from urllib.parse import quote
from urllib.parse import quote, urlparse

import aiohttp
from tornado import httputil
from tornado.web import Application

from config import proxies
from config import proxies, domain

from .base import *

Expand Down Expand Up @@ -57,6 +57,10 @@ class SubscribeUpdatingHandler(BaseWebSocketHandler):
updating = False
updating_start_time = 0

def check_origin(self, origin):
parsed_origin = urlparse(origin)
return parsed_origin.netloc.endswith(domain)

async def update(self, userid):
SubscribeUpdatingHandler.updating = True
SubscribeUpdatingHandler.updating_start_time = int(time.time())
Expand Down
Loading