Compare commits
10 Commits
88d349090e
...
0.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a024bbfc6 | ||
| e5ca1066fd | |||
|
61be674258
|
|||
|
72d51b451f
|
|||
|
efbf99f356
|
|||
|
f46d27164b
|
|||
|
f13f243b5b
|
|||
|
fbb75c263c
|
|||
|
0e7c948668
|
|||
|
35899d3668
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -45,3 +45,6 @@ logs/
|
|||||||
# Sphinx
|
# Sphinx
|
||||||
docs/_build/
|
docs/_build/
|
||||||
docs/ref/modules/
|
docs/ref/modules/
|
||||||
|
|
||||||
|
# known clients
|
||||||
|
config/known_clients.yaml
|
||||||
|
|||||||
53
CHANGELOG.md
53
CHANGELOG.md
@@ -2,6 +2,59 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.6.0] - 2026-03-05
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- [`fbb75c2`](https://github.com/pufereq/template-repo/commit/fbb75c263c13726d7e1c3fa28fb4e8f1f8cf0a17) **backend_server.py**: fix double-connection handling
|
||||||
|
- [`88d3490`](https://github.com/pufereq/template-repo/commit/88d349090e6e3605800656cc3e85779bf4b417c3) **backend_server.py**: fix double disconnect if client.inbound empty
|
||||||
|
- [`e308a07`](https://github.com/pufereq/template-repo/commit/e308a07dabcf20d9b080ce12a8928760dcde3057) **backend_server.py**: call `_initialize_handlers()` on init
|
||||||
|
- [`ead2224`](https://github.com/pufereq/template-repo/commit/ead22240660ff9f723c36ee35fa5918c33a0c66d) **backend_server.py**: do not disconnect a client if Exception raised on msg handling
|
||||||
|
- [`6446fe8`](https://github.com/pufereq/template-repo/commit/6446fe883cea4268992efc9f97cdb493af416576) **backend_server.py**: check if client to disconnect has an open socket
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- [`72d51b4`](https://github.com/pufereq/template-repo/commit/72d51b451fc11ebe2f38d5e50bf263f9f441b03c) **backend_server.py**: add notice to known_clients.yaml
|
||||||
|
- [`0e7c948`](https://github.com/pufereq/template-repo/commit/0e7c9486683be4ceb91203109986f0b9fc83eb8b) **config/**: add `config/` directory
|
||||||
|
- [`97fc17f`](https://github.com/pufereq/template-repo/commit/97fc17fbb3ed5d681a4f5a0d488b7a2b09ab35df) **hello_handler.py**: remove client from `pending_hello` if recv'd HELLO
|
||||||
|
- [`f5b14fc`](https://github.com/pufereq/template-repo/commit/f5b14fc6109e83730c4b13aaecf6f4314c0136a4) **backend_server.py**: add timeout on HELLO
|
||||||
|
- [`bf1ad0e`](https://github.com/pufereq/template-repo/commit/bf1ad0ead0e4fc35c20d0d747cca05388b223d35) **ack_handler.py**: add handling for ACKs
|
||||||
|
- [`a9bace8`](https://github.com/pufereq/template-repo/commit/a9bace8acaab07e6e5d02155a9966c6381ad107e) **backend_server.py**: add `ACK_TIMEOUT` constant
|
||||||
|
- [`c88e39c`](https://github.com/pufereq/template-repo/commit/c88e39c7355b6f8c982198e6e56da2d09d17c61f) **backend_server.py**: track message ACKs and resend if no ACK recv'd within 5 seconds
|
||||||
|
- [`dafe418`](https://github.com/pufereq/template-repo/commit/dafe418916485258694949538eda151d7da33695) **backend_server.py**: add warning if received an unknown message (no handler)
|
||||||
|
- [`0ed478a`](https://github.com/pufereq/template-repo/commit/0ed478a88efa46f2f28b24371ad68010ecbf88d0) **backend_server.py**: implement message handling
|
||||||
|
- [`c952413`](https://github.com/pufereq/template-repo/commit/c952413d912b7a5d2000bc48c11a4d9274533caf) **hello_handler.py**: add HELLO message handler
|
||||||
|
- [`882c878`](https://github.com/pufereq/template-repo/commit/882c8780e15ec827fac1854cf7419b71d9a41a4f) **base_handler.py**: add `BaseHandler` class for message handling
|
||||||
|
- [`faecc38`](https://github.com/pufereq/template-repo/commit/faecc382610daf890c90074809085560931fd178) **client_status.py**: move `ClientStatus` enum to own module
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- [`61be674`](https://github.com/pufereq/template-repo/commit/61be674258dcce8a5b54efddb7d1d856c6cba9bc) remove `cache/` directory
|
||||||
|
- [`f46d271`](https://github.com/pufereq/template-repo/commit/f46d27164b79107abe405b221c9d424add55a723) **.gitignore**: ignore `config/known_clients.yaml` as it's generated automatically
|
||||||
|
- [`f13f243`](https://github.com/pufereq/template-repo/commit/f13f243b5b389d84acaa4ab933a234a00c6a981c) **__main__.py**: set logging level for werkzeug to WARNING
|
||||||
|
- [`332238b`](https://github.com/pufereq/template-repo/commit/332238b403782a08a8974b9267071f8d0ff5f006) **__init__.py**: correct version
|
||||||
|
- [`e54cc47`](https://github.com/pufereq/template-repo/commit/e54cc479b5f6bb3fb887803122fea0c551e27ee2) **handler/__init__.py**: add `AckHandler` to `__all__`
|
||||||
|
- [`ee38141`](https://github.com/pufereq/template-repo/commit/ee381414a931ed9d7562410e08c9de5cdc7b94e7) **backend_server.py**: remove redundant HELLO msg handling
|
||||||
|
- [`ec58a52`](https://github.com/pufereq/template-repo/commit/ec58a5257a3007a6edd502eb3967d92a9b652358) **handler/__init__.py**: add module init
|
||||||
|
- [`d3f68d3`](https://github.com/pufereq/template-repo/commit/d3f68d3baff8b903be125b0da7a88b415cd56bac) **backend/__init__.py**: add `Client` and `ClientStatus` to `__all__`
|
||||||
|
- [`bda10a6`](https://github.com/pufereq/template-repo/commit/bda10a6248478e99dfb42d8c605996cafdaf1e6e) **cache/**: add cache/ directory
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- [`efbf99f`](https://github.com/pufereq/template-repo/commit/efbf99f356c20fbd48937f1c4e8df0a2d57f0651) **backend_server.py**: if known_clients.yaml not present, call `_save_known_clients()`
|
||||||
|
- [`35899d3`](https://github.com/pufereq/template-repo/commit/35899d366823c2878330eb06dc703f2965f61c3f) **backend_server.py**: move `known_clients.yaml` to `config/`
|
||||||
|
- [`3eb681e`](https://github.com/pufereq/template-repo/commit/3eb681e233fa151c2476581854c947bdc77b4900) **backend_server.py**: move loading known clients to its own method
|
||||||
|
- [`fa2da20`](https://github.com/pufereq/template-repo/commit/fa2da207a9cf3d90cdbfb5977033fee21d449528) **backend_server.py**: refactor calls to Message class constructors after protocol changes
|
||||||
|
|
||||||
|
### Styling
|
||||||
|
|
||||||
|
- [`62acc4b`](https://github.com/pufereq/template-repo/commit/62acc4b181cd359557909fa94f0cb0e6a4109255) **client.py**: correct property typing
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
- [`c64a258`](https://github.com/pufereq/template-repo/commit/c64a2582439e5ef1ab68bb9c588f7c4644bb4e07) **uv.lock**: update judas_protocol to 0.8.0
|
||||||
|
- [`f41a777`](https://github.com/pufereq/template-repo/commit/f41a7774ec5cb4997005ac8e31ed7bdc3541a8d6) **uv.lock**: update judas_protocol to 0.7.0
|
||||||
|
|
||||||
## [0.5.0] - 2026-02-28
|
## [0.5.0] - 2026-02-28
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "judas_server"
|
name = "judas_server"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
description = "The backbone of the remote PC fleet management system."
|
description = "The backbone of the remote PC fleet management system."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = []
|
authors = []
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ if __name__ == "__main__":
|
|||||||
format="%(asctime)s : [%(levelname)s] : %(threadName)s : %(name)s :: %(message)s",
|
format="%(asctime)s : [%(levelname)s] : %(threadName)s : %(name)s :: %(message)s",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lg.getLogger("werkzeug").setLevel(lg.WARNING)
|
||||||
|
|
||||||
ladygaga_logger = lg.getLogger(f"{__name__}.LAGA_DYGA")
|
ladygaga_logger = lg.getLogger(f"{__name__}.LAGA_DYGA")
|
||||||
ladygaga_logger.info(LADY_GAGA)
|
ladygaga_logger.info(LADY_GAGA)
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ class BackendServer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.clients: dict[str, Client] = {}
|
self.clients: dict[str, Client] = {}
|
||||||
self.known_clients: dict[str, dict[str, str | float]] = (
|
|
||||||
self._load_known_clients()
|
self.known_clients: dict[str, dict[str, str | float]] = {}
|
||||||
)
|
self.known_clients = self._load_known_clients()
|
||||||
|
|
||||||
self.message_handlers: dict[
|
self.message_handlers: dict[
|
||||||
tuple[Category, ActionType], Callable[[Client, Message], None]
|
tuple[Category, ActionType], Callable[[Client, Message], None]
|
||||||
@@ -77,7 +77,7 @@ class BackendServer:
|
|||||||
known_clients: dict[str, dict[str, str | float]] = {}
|
known_clients: dict[str, dict[str, str | float]] = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("cache/known_clients.yaml", "r") as f:
|
with open("config/known_clients.yaml", "r") as f:
|
||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
|
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
@@ -114,8 +114,7 @@ class BackendServer:
|
|||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
"known_clients.yaml not found, creating empty known clients list"
|
"known_clients.yaml not found, creating empty known clients list"
|
||||||
)
|
)
|
||||||
with open("cache/known_clients.yaml", "w") as f:
|
self._save_known_clients()
|
||||||
yaml.safe_dump({"known_clients": {}}, f)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"Error loading known clients: {e}")
|
self.logger.error(f"Error loading known clients: {e}")
|
||||||
raise
|
raise
|
||||||
@@ -124,7 +123,12 @@ class BackendServer:
|
|||||||
|
|
||||||
def _save_known_clients(self) -> None:
|
def _save_known_clients(self) -> None:
|
||||||
"""Save the list of known clients to a YAML file."""
|
"""Save the list of known clients to a YAML file."""
|
||||||
with open("cache/known_clients.yaml", "w") as f:
|
with open("config/known_clients.yaml", "w") as f:
|
||||||
|
f.write(
|
||||||
|
"# This file is automatically generated by BackendServer.\n"
|
||||||
|
+ "# Do not edit manually.\n"
|
||||||
|
+ f"# Generated at: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}\n\n"
|
||||||
|
)
|
||||||
yaml.safe_dump({"known_clients": self.known_clients}, f)
|
yaml.safe_dump({"known_clients": self.known_clients}, f)
|
||||||
self.logger.debug("Saved known clients")
|
self.logger.debug("Saved known clients")
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class HelloHandler(BaseHandler):
|
|||||||
# check if client already connected, if so disconnect old client and register new one
|
# check if client already connected, if so disconnect old client and register new one
|
||||||
if (
|
if (
|
||||||
client.id in self.backend_server.clients
|
client.id in self.backend_server.clients
|
||||||
and self.backend_server.clients[client.id].status == "connected"
|
and self.backend_server.clients[client.id].status
|
||||||
|
== ClientStatus.ONLINE
|
||||||
):
|
):
|
||||||
old_client: Client = self.backend_server.clients[client.id]
|
old_client: Client = self.backend_server.clients[client.id]
|
||||||
self.backend_server.logger.warning(
|
self.backend_server.logger.warning(
|
||||||
|
|||||||
2
uv.lock
generated
2
uv.lock
generated
@@ -363,7 +363,7 @@ source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#a805ccf38edf
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "judas-server"
|
name = "judas-server"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "flask" },
|
{ name = "flask" },
|
||||||
|
|||||||
Reference in New Issue
Block a user