cubething_psync 0.1.0.dev4__tar.gz → 0.1.0.dev6__tar.gz

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.
Files changed (21) hide show
  1. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/PKG-INFO +1 -1
  2. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/pyproject.toml +1 -1
  3. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/client/main.py +0 -1
  4. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/PKG-INFO +1 -1
  5. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/server/main.py +8 -9
  6. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/LICENSE +0 -0
  7. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/README.md +0 -0
  8. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/setup.cfg +0 -0
  9. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/client/__init__.py +0 -0
  10. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/client/__main__.py +0 -0
  11. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/client/args.py +0 -0
  12. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/common/__init__.py +0 -0
  13. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/common/data.py +0 -0
  14. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/common/log.py +0 -0
  15. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/SOURCES.txt +0 -0
  16. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/dependency_links.txt +0 -0
  17. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/entry_points.txt +0 -0
  18. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/requires.txt +0 -0
  19. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/cubething_psync.egg-info/top_level.txt +0 -0
  20. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/server/__init__.py +0 -0
  21. {cubething_psync-0.1.0.dev4 → cubething_psync-0.1.0.dev6}/src/server/__main__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cubething_psync
3
- Version: 0.1.0.dev4
3
+ Version: 0.1.0.dev6
4
4
  Summary: Simple project synchronization tool.
5
5
  Author-email: ada mandala <ada@cubething.dev>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cubething_psync"
3
- version = "0.1.0.dev4"
3
+ version = "0.1.0.dev6"
4
4
  description = "Simple project synchronization tool."
5
5
  authors = [{name = "ada mandala", email="ada@cubething.dev"}]
6
6
  readme = "README.md"
@@ -87,7 +87,6 @@ class PsyncClient:
87
87
  ssl_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
88
88
  ssl_ctx.load_verify_locations(pathlib.Path(SSL_CERT_PATH).expanduser())
89
89
  ssl_ctx.check_hostname = False # not ideal
90
- print(ssl_ctx.get_ca_certs())
91
90
  async with websockets.connect(
92
91
  f"wss://{SERVER_IP}:{SERVER_PORT}", ssl=ssl_ctx
93
92
  ) as ws:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cubething_psync
3
- Version: 0.1.0.dev4
3
+ Version: 0.1.0.dev6
4
4
  Summary: Simple project synchronization tool.
5
5
  Author-email: ada mandala <ada@cubething.dev>
6
6
  License-Expression: MIT
@@ -34,12 +34,6 @@ import logging
34
34
  from common.log import InterceptHandler
35
35
 
36
36
 
37
- def __get_host(ws: ServerConnection) -> str:
38
- addrs: tuple[str, str] = ws.remote_address # pyright: ignore[reportAny]
39
- (host, _port) = addrs
40
- return host
41
-
42
-
43
37
  SSL_CERT_PATH: str = environ.get("SSL_CERT_PATH", "./cert.pem")
44
38
  SSL_KEY_PATH: str = environ.get("SSL_KEY_PATH", "./key.pem")
45
39
  PSYNC_HOST: str = environ.get("PSYNC_SERVER_IP", "0.0.0.0")
@@ -88,6 +82,11 @@ class PsyncServer:
88
82
  __coroutine: Task[None] | None = None
89
83
  """The main coroutine for this server."""
90
84
 
85
+ def __get_host(self, ws: ServerConnection) -> str:
86
+ addrs: tuple[str, str] = ws.remote_address # pyright: ignore[reportAny]
87
+ (host, _port) = addrs
88
+ return host
89
+
91
90
  async def serve(self) -> None:
92
91
  """
93
92
  The main interface for the server. Will serve forever, or until exited with SIGINT/Ctrl-C.
@@ -124,7 +123,7 @@ class PsyncServer:
124
123
  return inner
125
124
 
126
125
  async def __end_session(self, ws: ServerConnection):
127
- host = __get_host(ws)
126
+ host = self.__get_host(ws)
128
127
  try:
129
128
  _ = self.__sessions.pop(host)
130
129
  except Exception:
@@ -179,7 +178,7 @@ class PsyncServer:
179
178
  return inner
180
179
 
181
180
  async def __open(self, req: OpenReq, ws: ServerConnection):
182
- host = __get_host(ws)
181
+ host = self.__get_host(ws)
183
182
  if self.__sessions.get(host) is not None:
184
183
  self.__sessions[host]
185
184
  resp = ErrorResp(msg="Process already open for this client.")
@@ -228,7 +227,7 @@ class PsyncServer:
228
227
  pass
229
228
 
230
229
  async def __kill(self, _req: KillReq, ws: ServerConnection):
231
- host = __get_host(ws)
230
+ host = self.__get_host(ws)
232
231
  p = self.__sessions.get(host)
233
232
  task = self.__tasks.get(host)
234
233
  if p is not None and task is not None: