cubevis 1.0.49__py3-none-any.whl → 1.0.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cubevis/__version__.py +1 -1
- cubevis/bokeh/sources/transport/__init__.py +29 -10
- {cubevis-1.0.49.dist-info → cubevis-1.0.52.dist-info}/METADATA +1 -1
- {cubevis-1.0.49.dist-info → cubevis-1.0.52.dist-info}/RECORD +6 -6
- {cubevis-1.0.49.dist-info → cubevis-1.0.52.dist-info}/WHEEL +0 -0
- {cubevis-1.0.49.dist-info → cubevis-1.0.52.dist-info}/licenses/LICENSE +0 -0
cubevis/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.0.
|
|
1
|
+
__version__ = '1.0.52'
|
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
import websockets
|
|
2
|
-
from cubevis.utils import is_colab
|
|
3
|
-
from websockets.http import Headers
|
|
4
2
|
import http
|
|
3
|
+
from websockets.http import Headers
|
|
4
|
+
|
|
5
|
+
log_path = "/content/package_debug.txt"
|
|
5
6
|
|
|
6
7
|
class ColabWebSocketServerProtocol(websockets.WebSocketServerProtocol):
|
|
7
8
|
async def process_request(self, path, request_headers):
|
|
8
9
|
is_upgrade = "upgrade" in request_headers.get("Connection", "").lower()
|
|
9
10
|
|
|
11
|
+
# Get the request method
|
|
12
|
+
request_method = self.request_method
|
|
13
|
+
with open(log_file_path, "w") as f:
|
|
14
|
+
print(f"Handling request method: {request_method}", file=f)
|
|
15
|
+
|
|
10
16
|
if not is_upgrade:
|
|
11
|
-
# 1. Prepare CORS headers so the 'fetch' succeeds
|
|
12
17
|
response_headers = Headers()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
origin = request_headers.get("Origin")
|
|
19
|
+
|
|
20
|
+
if origin:
|
|
21
|
+
response_headers["Access-Control-Allow-Origin"] = origin
|
|
22
|
+
response_headers["Access-Control-Allow-Credentials"] = "true"
|
|
23
|
+
# Add necessary headers for the OPTIONS preflight response
|
|
24
|
+
response_headers["Access-Control-Allow-Methods"] = "GET, OPTIONS"
|
|
25
|
+
response_headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
|
|
26
|
+
|
|
17
27
|
response_headers["Content-Type"] = "text/plain"
|
|
28
|
+
response_headers["Connection"] = "close"
|
|
29
|
+
|
|
30
|
+
# If it is an OPTIONS request, return 204 No Content immediately
|
|
31
|
+
if request_method == "OPTIONS":
|
|
32
|
+
return http.HTTPStatus.NO_CONTENT, response_headers, b"" # 204 Status and empty body
|
|
18
33
|
|
|
19
|
-
|
|
34
|
+
# If it is a GET request (the priming fetch), return 200 OK
|
|
35
|
+
if request_method == "GET":
|
|
36
|
+
return http.HTTPStatus.OK, response_headers, b"OK"
|
|
20
37
|
|
|
38
|
+
# Proceed with standard WS handshake
|
|
21
39
|
return None
|
|
22
40
|
|
|
23
41
|
def create_ws_server(callback, ip_address, port):
|
|
@@ -25,8 +43,9 @@ def create_ws_server(callback, ip_address, port):
|
|
|
25
43
|
Uniform wrapper for creating a WebSocket server.
|
|
26
44
|
"""
|
|
27
45
|
if is_colab( ):
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
with open(log_file_path, "w") as f:
|
|
47
|
+
print( f'''websocket startup: {ip_address}/{port} (bind IP 0.0.0.0)
|
|
48
|
+
with websockets.serve( callback, "0.0.0.0", {port}, origins=None, create_protocol={ColabWebSocketServerProtocol} )"''' , file=f)
|
|
30
49
|
return websockets.serve( callback,
|
|
31
50
|
"0.0.0.0",
|
|
32
51
|
port,
|
|
@@ -55,7 +55,7 @@ cubevis/bokeh/sources/_image_data_source.py,sha256=5sEWdfqoMk08HQ0JWg6bHJ34dWmph
|
|
|
55
55
|
cubevis/bokeh/sources/_image_pipe.py,sha256=pQ05VynLuJbedGja7aXDbVXFkOYbdMceOuOEj-QuluQ,28692
|
|
56
56
|
cubevis/bokeh/sources/_spectra_data_source.py,sha256=qL1IOjSefWlycaqS4Pz5EHwg-1EwCVmNwxysP9lxDeM,2451
|
|
57
57
|
cubevis/bokeh/sources/_updatable_data_source.py,sha256=mjV1u3ZpRE5KCHtZA4tV1JxMf09Ifh4elSWlf6jNXQo,10985
|
|
58
|
-
cubevis/bokeh/sources/transport/__init__.py,sha256=
|
|
58
|
+
cubevis/bokeh/sources/transport/__init__.py,sha256=XqzCpN6zvwQGOE_Y7MvLIiZMElxZnxa3__ifhr5oE5I,2431
|
|
59
59
|
cubevis/bokeh/state/__init__.py,sha256=PZ2-7I5XHkMTc-vguYarYCYSJ1pKyEYnSAFa-n8AuTE,1826
|
|
60
60
|
cubevis/bokeh/state/_current.py,sha256=owPMQTme5SBYvIVP3Q4y9hpWHPmyhLHsS2O0sCAAqqo,967
|
|
61
61
|
cubevis/bokeh/state/_initialize.py,sha256=eX06VU1KyTEyoFiAdPBA_XucCKFEgNImv1qVXfXaIkE,12881
|
|
@@ -128,8 +128,8 @@ cubevis/utils/_pkgs.py,sha256=mu2CCzndmJZYP81UkFhxveW_CisWLUvagJVolHOEVgM,2294
|
|
|
128
128
|
cubevis/utils/_regions.py,sha256=TdAg4ZUUyhg3nFmX9_KLboqmc0LkyOdEW8M1WDR5Udk,1669
|
|
129
129
|
cubevis/utils/_static.py,sha256=rN-sqXNqQ5R2M3wmPHU1GPP5OTyyWQlUPRuimCrht-g,2347
|
|
130
130
|
cubevis/utils/_tiles.py,sha256=A9W1X61VOhBMTOKXVajzOIoiV2FBdO5N2SFB9SUpDOo,7336
|
|
131
|
-
cubevis/__version__.py,sha256=
|
|
132
|
-
cubevis-1.0.
|
|
133
|
-
cubevis-1.0.
|
|
134
|
-
cubevis-1.0.
|
|
135
|
-
cubevis-1.0.
|
|
131
|
+
cubevis/__version__.py,sha256=vkQb1ceaEbldzWt1_XgBPzjkDQeeVWFlJPshnx5v1OQ,22
|
|
132
|
+
cubevis-1.0.52.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
|
|
133
|
+
cubevis-1.0.52.dist-info/METADATA,sha256=1EOdvakK1r99OsUebAMHRGuv_oLdT_eXf7gIri0RQKY,2632
|
|
134
|
+
cubevis-1.0.52.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
|
135
|
+
cubevis-1.0.52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|