From 2a642c5f808e84806c4a304eba9f890f97280b0d Mon Sep 17 00:00:00 2001 From: krateng Date: Sat, 25 Dec 2021 02:51:26 +0100 Subject: [PATCH] Automated admin interface tabs --- maloja/database.py | 2 +- maloja/web/jinja/abstracts/admin.jinja | 46 +++++++++----------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/maloja/database.py b/maloja/database.py index 34cdcfc..3fa840f 100644 --- a/maloja/database.py +++ b/maloja/database.py @@ -107,7 +107,7 @@ def add_known_server(url): log("Authenticated Machines: " + ", ".join([k for k in apikeystore])) def checkAPIkey(key): - return any((key == apikeystore[k]) for k in apikeystore) + return apikeystore.check_key(key) def allAPIkeys(): return [apikeystore[k] for k in apikeystore] diff --git a/maloja/web/jinja/abstracts/admin.jinja b/maloja/web/jinja/abstracts/admin.jinja index 0e0a271..9096375 100644 --- a/maloja/web/jinja/abstracts/admin.jinja +++ b/maloja/web/jinja/abstracts/admin.jinja @@ -16,36 +16,22 @@

Admin Panel


- {% if page=='admin_overview' %} - Overview - {% else %} - Overview - {% endif %} | - {% if page=='admin_setup' %} - Server Setup - {% else %} - Server Setup - {% endif %} | - {% if page=='admin_manual' %} - Manual Scrobbling - {% else %} - Manual Scrobbling - {% endif %} | - {% if page=='admin_issues' %} - Database Maintenance - {% else %} - Database Maintenance - {% endif %} | - {% if page=='admin_settings' %} - Settings - {% else %} - Settings - {% endif %} | - {% if page=='admin_apikeys' %} - API Keys - {% else %} - API Keys - {% endif %} + {% for tab_url,tab_name in [ + ['overview','Overview'], + ['setup','Setup'], + ['manual','Manual Scrobbling'], + ['issues','Database Maintenance'], + ['settings','Settings'], + ['apikeys','API Keys'] + ] %} + {% if page=='admin_' + tab_url %} + {{ tab_name }} + {% else %} + {{ tab_name }} + {% endif %} {%- if not loop.last %}|{% endif %} + {% endfor %} + +