From 6d1d482531b77da3cff5616ee40cf558a45c9fda Mon Sep 17 00:00:00 2001 From: mar77i Date: Mon, 1 Jan 2024 21:02:32 +0100 Subject: [PATCH] move common.js to root --- hub/app.py | 4 +--- hub/hubapp.py | 4 +++- webroot/{first => }/common.js | 0 webroot/first/index.html.j2 | 2 +- webroot/first/master.html.j2 | 2 +- webroot/index.html.j2 | 14 ++++++++------ 6 files changed, 14 insertions(+), 12 deletions(-) rename webroot/{first => }/common.js (100%) diff --git a/hub/app.py b/hub/app.py index 959024f..2a0a712 100644 --- a/hub/app.py +++ b/hub/app.py @@ -36,8 +36,6 @@ class App(FalconApp): self.add_error_handler(Exception, self.print_exception) def get_hubapp_by_name(self, name): - if name == "root": - name = "" return self.hubapps[name] async def print_exception(self, req, resp, ex, params): @@ -72,7 +70,7 @@ class HubServer(Server): host = f"{host}:{port}" app = config.loaded_app.app print("Secret:", app.secret) - for key, value in app.root_app.files_per_uris.items(): + for key, value in app.hubapps["root"].files_per_uris.items(): if Path(value.path.name).stem == "index.html": url = urlunsplit((protocol_name, host, key, "", "")) print("URL:", url) diff --git a/hub/hubapp.py b/hub/hubapp.py index bd2540b..91c9c54 100644 --- a/hub/hubapp.py +++ b/hub/hubapp.py @@ -97,6 +97,8 @@ class BaseHubApp: elif uri_tail == "index.html": uri_tail = "" name = self.name + if name == "root": + name = "" if name and uri_tail: name = f"{name}/" return f"/{name}{uri_tail}" @@ -143,7 +145,7 @@ class RootApp(BaseHubApp): SCAN_FILES_RECURSIVELY = False def __init__(self, app, base_dir): - super().__init__(app, base_dir, "") + super().__init__(app, base_dir, "root") @staticmethod def is_master_uri(uri_tail): diff --git a/webroot/first/common.js b/webroot/common.js similarity index 100% rename from webroot/first/common.js rename to webroot/common.js diff --git a/webroot/first/index.html.j2 b/webroot/first/index.html.j2 index 8ac692c..5a338a5 100644 --- a/webroot/first/index.html.j2 +++ b/webroot/first/index.html.j2 @@ -8,7 +8,7 @@ - + diff --git a/webroot/first/master.html.j2 b/webroot/first/master.html.j2 index 4de2a38..d0ab1f9 100644 --- a/webroot/first/master.html.j2 +++ b/webroot/first/master.html.j2 @@ -8,7 +8,7 @@ - + diff --git a/webroot/index.html.j2 b/webroot/index.html.j2 index 8203a3d..04f9059 100644 --- a/webroot/index.html.j2 +++ b/webroot/index.html.j2 @@ -10,12 +10,14 @@

App list

-- 2.45.2