vuer 0.0.29rc6__py3-none-any.whl → 0.0.29rc7__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.

Potentially problematic release.


This version of vuer might be problematic. Click here for more details.

vuer/base.py CHANGED
@@ -1,12 +1,12 @@
1
1
  import asyncio
2
+ import ssl
2
3
  import traceback
3
- import aiohttp_cors
4
-
5
4
  from collections.abc import Coroutine
6
5
  from concurrent.futures import CancelledError
7
6
  from functools import partial
8
7
  from pathlib import Path
9
8
 
9
+ import aiohttp_cors
10
10
  from aiohttp import web
11
11
  from params_proto import Proto
12
12
 
@@ -50,11 +50,16 @@ async def handle_file_request(request, root, filename=None):
50
50
 
51
51
 
52
52
  class Server:
53
+ """Base TCP server"""
53
54
  host = Proto(env="HOST", default="localhost")
54
55
  cors = Proto(help="Enable CORS", default="*")
55
56
  port = Proto(env="PORT", default=8012)
56
57
 
57
- WEBSOCKET_MAX_SIZE = 2 ** 28
58
+ cert = Proto(None, dtype=str, help="the path to the SSL certificate")
59
+ key = Proto(None, dtype=str, help="the path to the SSL key")
60
+ ca_cert = Proto(None, dtype=str, help="the trusted root CA certificates")
61
+
62
+ WEBSOCKET_MAX_SIZE = 2**28
58
63
 
59
64
  def __post_init__(self):
60
65
  self.app = web.Application()
@@ -70,10 +75,10 @@ class Server:
70
75
  self.cors_context = aiohttp_cors.setup(self.app, defaults=cors_config)
71
76
 
72
77
  def _route(
73
- self,
74
- path: str,
75
- handler: callable,
76
- method: str = "GET",
78
+ self,
79
+ path: str,
80
+ handler: callable,
81
+ method: str = "GET",
77
82
  ):
78
83
  route = self.app.router.add_resource(path).add_route(method, handler)
79
84
  self.cors_context.add(route)
@@ -99,9 +104,22 @@ class Server:
99
104
 
100
105
  def run(self):
101
106
  async def init_server():
107
+ ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
108
+ ssl_context.load_cert_chain(certfile=self.cert, keyfile=self.key)
109
+ if self.ca_crt:
110
+ ssl_context.load_verify_locations(self.ca_crt)
111
+ ssl_context.verify_mode = ssl.CERT_REQUIRED
112
+ else:
113
+ ssl_context.verify_mode = ssl.CERT_OPTIONAL
114
+
102
115
  runner = web.AppRunner(self.app)
103
116
  await runner.setup()
104
- site = web.TCPSite(runner, self.host, self.port)
117
+ if self.cert:
118
+ site = web.TCPSite(
119
+ runner, self.host, self.port, ssl_context=ssl_context
120
+ )
121
+ else:
122
+ site = web.TCPSite(runner, self.host, self.port)
105
123
  await site.start()
106
124
 
107
125
  # This print has been very confusing to the user. Remove. - Ge
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vuer
3
- Version: 0.0.29rc6
3
+ Version: 0.0.29rc7
4
4
  Home-page: https://github.com/geyang/vuer
5
5
  Author: Ge Yang<ge.ike.yang@gmail.com>
6
6
  Author-email: ge.ike.yang@gmail.com
@@ -1,5 +1,5 @@
1
1
  vuer/__init__.py,sha256=kbjORSc64WWVHcx3eJB1wnCzhIF76eX5g-JAXYEDM4Q,519
2
- vuer/base.py,sha256=iBYQFu0pnM67dj7iPg11YNMLplWIfLlS-NQ8My6bNpo,3289
2
+ vuer/base.py,sha256=chIs9cM8kRu3lRUvXb-96rNzKysC-FiMvodjNkNG4ck,4087
3
3
  vuer/events.py,sha256=8AAzkfbm5jHkeMh17Z57n8YTxF4mheWC3Qbya4XkQSc,7291
4
4
  vuer/schemas.py,sha256=aZOocE02gO43SLLfeYSxxac0x38TmyTcfs_iFh5hsJ4,18152
5
5
  vuer/serdes.py,sha256=gD2iA9Yypu1QjocneOT3Nc0y6q_mdHn9zW1ko5j3I7c,2600
@@ -101,9 +101,9 @@ vuer/schemas/__pycache__/__init__.cpython-38.pyc,sha256=NRnVrpIDBKne93xOUY1-Wpav
101
101
  vuer/schemas/__pycache__/drei_components.cpython-38.pyc,sha256=g_ufcKxf-XKfZLdUV-HqKnjIrgxGWFv51aHLWQgH-ws,7712
102
102
  vuer/schemas/__pycache__/html_components.cpython-38.pyc,sha256=sk2gDqu_zNQMS-PC8d3L90bvjFjTBb8-UKK9Ka5aoAw,8348
103
103
  vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=FCBjSZs-lX5YvhcL3K0s_T_oz2Fm8NAdd-XsPoXQc9s,22109
104
- vuer-0.0.29rc6.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
105
- vuer-0.0.29rc6.dist-info/METADATA,sha256=DDD_6sD6h5H5R6TORL1cl4DPh2obx6lMjOT4BVNLMv4,5349
106
- vuer-0.0.29rc6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
107
- vuer-0.0.29rc6.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
108
- vuer-0.0.29rc6.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
109
- vuer-0.0.29rc6.dist-info/RECORD,,
104
+ vuer-0.0.29rc7.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
105
+ vuer-0.0.29rc7.dist-info/METADATA,sha256=n73wBJ2lMtvXtC11ej_S8lE0tYYoKPnf1g9_6wwmln4,5349
106
+ vuer-0.0.29rc7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
107
+ vuer-0.0.29rc7.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
108
+ vuer-0.0.29rc7.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
109
+ vuer-0.0.29rc7.dist-info/RECORD,,