]> git.mar77i.info Git - hublib/commitdiff
move common.js to root
authormar77i <mar77i@protonmail.ch>
Mon, 1 Jan 2024 20:02:32 +0000 (21:02 +0100)
committermar77i <mar77i@protonmail.ch>
Mon, 1 Jan 2024 20:20:57 +0000 (21:20 +0100)
hub/app.py
hub/hubapp.py
webroot/common.js [moved from webroot/first/common.js with 100% similarity]
webroot/first/index.html.j2
webroot/first/master.html.j2
webroot/index.html.j2

index 959024f2c2a41bd2bd3e223e6b58bc12a0c444db..2a0a712f515c6984a53f56ff562094c14433508d 100644 (file)
@@ -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)
index bd2540b4876c01d5d1db242235c91d02bcf1ce1f..91c9c5434847d02adebf85bccf30810a844cc455 100644 (file)
@@ -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):
similarity index 100%
rename from webroot/first/common.js
rename to webroot/common.js
index 8ac692c2cf4fb6f65bf6eb2a8fa9f219a7df3444..5a338a515f3f15dc2ce04cc1ce90a7edf87f2253 100644 (file)
@@ -8,7 +8,7 @@
         <!-- <link rel="stylesheet" href="{% static 'style.css' %}"> -->
     </head>
     <body>
-        <script src="{% static 'common.js' %}"></script>
+        <script src="{% static 'common.js', 'root' %}"></script>
         <script type="text/javascript">
             var ws_uri = "{% static 'ws_client' %}";
         </script>
index 4de2a3809896100a507178063557f00636c541c9..d0ab1f9633a8316e9cfe9234ebd5fab649d0b8e4 100644 (file)
@@ -8,7 +8,7 @@
         <!-- <link rel="stylesheet" href="{% static 'style.css' %}"> -->
     </head>
     <body>
-        <script src="{% static 'common.js' %}"></script>
+        <script src="{% static 'common.js', 'root' %}"></script>
         <script type="text/javascript">
             var ws_uri = "{% static 'ws_master' %}";
         </script>
index 8203a3d04db214a8032f541f5f471e3845e316ce..04f905970961dd7362d2cca6a7624a46587de3e4 100644 (file)
     <body>
         <h1>App list</h1>
         <ul>
-        {% for hubapp in hubapp.app.hubapps %}
-            <li>
-                <span>{{ hubapp.name }}</span>
-                <span><a href="{% static 'master.html', hubapp %}">master</a></span>
-                <span><a href="/{{ hubapp.name }}">/{{ hubapp.name }}</a></span>
-            </li>
+        {% for name, hubapp in hubapp.app.hubapps.items() %}
+            {% if name != 'root' %}
+                <li>
+                    <span>{{ name }}</span>
+                    <span><a href="{% static 'master.html', hubapp %}">master</a></span>
+                    <span><a href="/{{ name }}">/{{ name }}</a></span>
+                </li>
+            {% endif %}{# name != 'root' #}
         {% endfor %}{# hubapps #}
         </ul>
     </body>