diff --git a/flake.lock b/flake.lock index add9b0c..314e233 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1696343447, - "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", "type": "github" }, "original": { @@ -42,11 +42,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { @@ -56,11 +56,28 @@ "type": "github" } }, + "nixpkgs-for-iosl": { + "locked": { + "lastModified": 1700505490, + "narHash": "sha256-MLF5dkExensQoByZCmsR/kdcwZoaY/j6/ctSvmQHBJc=", + "owner": "Luis-Hebendanz", + "repo": "nixpkgs", + "rev": "5f9d94794badee6fcb3230ccea75628a802baeab", + "type": "github" + }, + "original": { + "owner": "Luis-Hebendanz", + "ref": "iosl", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", "floco": "floco", "nixpkgs": "nixpkgs", + "nixpkgs-for-iosl": "nixpkgs-for-iosl", "treefmt-nix": "treefmt-nix" } }, @@ -71,11 +88,11 @@ ] }, "locked": { - "lastModified": 1695822946, - "narHash": "sha256-IQU3fYo0H+oGlqX5YrgZU3VRhbt2Oqe6KmslQKUO4II=", + "lastModified": 1699786194, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "720bd006d855b08e60664e4683ccddb7a9ff614a", + "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9e1a4e3..6c73ad1 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; floco.url = "github:aakropotkin/floco"; floco.inputs.nixpkgs.follows = "nixpkgs"; + nixpkgs-for-iosl.url = "github:Luis-Hebendanz/nixpkgs/iosl"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; treefmt-nix.url = "github:numtide/treefmt-nix"; diff --git a/pkgs/clan-cli/.vscode/settings.json b/pkgs/clan-cli/.vscode/settings.json index e5c2632..0c7964c 100644 --- a/pkgs/clan-cli/.vscode/settings.json +++ b/pkgs/clan-cli/.vscode/settings.json @@ -18,5 +18,5 @@ "python.linting.mypyPath": "mypy", "python.linting.mypyEnabled": true, "python.linting.enabled": true, - "python.defaultInterpreterPath": "python" + "python.defaultInterpreterPath": "/nix/store/k34qdl5397mwg3k00jsl3xcynij7n0z9-python3-3.11.6-env/bin/python" } \ No newline at end of file diff --git a/pkgs/clan-cli/clan_cli/webui/app.py b/pkgs/clan-cli/clan_cli/webui/app.py index 88ff380..a9f1d2d 100644 --- a/pkgs/clan-cli/clan_cli/webui/app.py +++ b/pkgs/clan-cli/clan_cli/webui/app.py @@ -8,7 +8,7 @@ from fastapi.staticfiles import StaticFiles from ..errors import ClanError from .assets import asset_path from .error_handlers import clan_error_handler -from .routers import health, root +from .routers import health, root, socket_manager origins = [ "http://localhost:3000", @@ -29,9 +29,11 @@ def setup_app() -> FastAPI: app.include_router(health.router) + app.include_router(socket_manager.router) + # Needs to be last in register. Because of wildcard route app.include_router(root.router) - app.add_exception_handler(ClanError, clan_error_handler) + app.add_exception_handler(ClanError, clan_error_handler) # type: ignore app.mount("/static", StaticFiles(directory=asset_path()), name="static") diff --git a/pkgs/clan-cli/clan_cli/webui/routers/socket_manager.py b/pkgs/clan-cli/clan_cli/webui/routers/socket_manager.py new file mode 100644 index 0000000..cdfa46e --- /dev/null +++ b/pkgs/clan-cli/clan_cli/webui/routers/socket_manager.py @@ -0,0 +1,79 @@ +from fastapi import FastAPI, WebSocket, WebSocketDisconnect +from fastapi.responses import HTMLResponse +from fastapi import APIRouter, Response + +router = APIRouter() + +html = """ + + +
+