preload all pages.

This commit is contained in:
ArabCoders 2025-03-06 02:06:53 +03:00
parent 241efc8d5f
commit 0b04f098de

View file

@ -208,14 +208,15 @@ class HttpAPI(Common):
app.router.add_get(urlPath, self._static_file) app.router.add_get(urlPath, self._static_file)
preloaded += 1 preloaded += 1
if urlPath.endswith("/index.html") and urlPath != "/index.html": if urlPath.endswith("/index.html"):
parentSlash = urlPath.replace("/index.html", "/") paths_list = ["/console", "/presets", "/tasks", "/notifications"]
parentNoSlash = urlPath.replace("/index.html", "") for path in paths_list:
self._static_holder[parentSlash] = {"content": content, "content_type": contentType} self._static_holder[path] = {"content": content, "content_type": contentType}
self._static_holder[parentNoSlash] = {"content": content, "content_type": contentType} app.router.add_get(path, self._static_file)
app.router.add_get(parentSlash, self._static_file) self._static_holder[path + "/"] = {"content": content, "content_type": contentType}
app.router.add_get(parentNoSlash, self._static_file) app.router.add_get(path + "/", self._static_file)
preloaded += 2 LOG.debug(f"Preloading '{path}'.")
preloaded += 1
if preloaded < 1: if preloaded < 1:
message = f"Failed to find any static files in '{staticDir}'." message = f"Failed to find any static files in '{staticDir}'."