File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -486,9 +486,7 @@ def Draw(
486486
487487 def _webgpu_js (server ):
488488 js = _link_js_code + """
489- const __is_vscode = (typeof location !== 'undefined' && location.protocol === 'vscode-webview:');
490- const __webgpu_host = __is_vscode ? '127.0.0.1' : ((typeof location !== 'undefined' && location.hostname) || '127.0.0.1');
491- WebsocketLink('ws://' + __webgpu_host + ':{port}?token={token}');
489+ WebsocketLink('ws://127.0.0.1:{port}?token={token}');
492490""" .format (port = server .port , token = server .auth_token )
493491 display (Javascript (js ))
494492
Original file line number Diff line number Diff line change 11import asyncio
22import json
3+ import os
34import secrets
45import threading
56from concurrent .futures import ThreadPoolExecutor
67from urllib .parse import parse_qs , urlparse
78
9+ # Browser WebSocket handshakes automatically attach cookies for the target
10+ # (loopback) host, and the JS WebSocket API exposes no way to omit them. On
11+ # machines with large cookies for localhost/127.0.0.1 the resulting Cookie
12+ # header line can exceed websockets' default 8192-byte limit, making the
13+ # handshake fail with SecurityError("line too long"). Raise the limit before
14+ # importing websockets (the value is read at import time of websockets.http11).
15+ # Note: only honored on websockets versions that support this env var.
16+ os .environ .setdefault ("WEBSOCKETS_MAX_LINE_LENGTH" , "32768" )
17+
818import websockets
919from websockets .http11 import Response
1020from websockets .datastructures import Headers
You can’t perform that action at this time.
0 commit comments