Fixing issues with differents handlers and differents html base files

This commit is contained in:
Silversthorn 2024-03-04 18:07:03 +01:00
parent a07a550125
commit 8786e5c8dd
6 changed files with 23 additions and 3 deletions

View File

@ -83,6 +83,8 @@ class Helpers:
self.crafty_starting = False
self.minimum_password_length = 8
self.theme_list = self.load_themes()
@staticmethod
def auto_installer_fix(ex):
logger.critical(f"Import Error: Unable to load {ex.name} module", exc_info=True)
@ -585,7 +587,7 @@ class Helpers:
)
return False
def get_themes(self):
def load_themes(self):
theme_list = []
themes_path = os.path.join(self.webroot, "static", "assets", "css", "themes")
theme_files = [
@ -597,6 +599,9 @@ class Helpers:
theme_list.append(theme.split(".css")[0])
return theme_list
def get_themes(self):
return self.theme_list
@staticmethod
def get_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

View File

@ -45,6 +45,7 @@ class PublicHandler(BaseHandler):
"query": "",
"background": self.controller.cached_login,
"login_opacity": self.controller.management.get_login_opacity(),
"themes": self.helper.get_themes(),
}
if self.request.query:

View File

@ -130,6 +130,7 @@ class ServerHandler(BaseHandler):
else None
),
"superuser": superuser,
"themes": self.helper.get_themes(),
}
if superuser:

View File

@ -12,6 +12,7 @@ class StatusHandler(BaseHandler):
"lang": self.helper.get_setting("language"),
"lang_page": self.helper.get_lang_page(self.helper.get_setting("language")),
"servers": self.controller.servers.get_all_servers_stats(),
"themes": self.helper.get_themes(),
}
running = 0
for srv in page_data["servers"]:

View File

@ -24,9 +24,16 @@
<!-- endinject -->
<!-- Plugin css for this page -->
<!-- End Plugin css for this page -->
<!-- Layout styles -->
<link rel="stylesheet" href="/static/assets/css/dark/style.css">
{% for theme in data['themes'] %}
<link rel="stylesheet" href="/static/assets/css/themes/{{ theme }}.css">
{% end %}
<!--<link rel="stylesheet" href="/static/assets/css/dark/style.css">-->
<link rel="stylesheet" href="/static/assets/css/base-style.css">
<link rel="stylesheet" href="/static/assets/css/crafty.css">
<!-- End Layout styles -->
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/images/logo_small.svg">
<link rel="alternate icon" href="/static/assets/images/favicon.png" />
</head>

View File

@ -25,7 +25,12 @@
<!-- Plugin css for this page -->
<!-- End Plugin css for this page -->
<!-- Layout styles -->
<link rel="stylesheet" href="/static/assets/css/dark/style.css" />
{% for theme in data['themes'] %}
<link rel="stylesheet" href="/static/assets/css/themes/{{ theme }}.css">
{% end %}
<!--<link rel="stylesheet" href="/static/assets/css/dark/style.css">-->
<link rel="stylesheet" href="/static/assets/css/base-style.css">
<link rel="stylesheet" href="/static/assets/css/crafty.css">
<!-- End Layout styles -->
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/images/logo_small.svg" />
<link rel="alternate icon" href="/static/assets/images/favicon.png" />