diff --git a/maloja/server.py b/maloja/server.py index bc322f4..e00ab47 100755 --- a/maloja/server.py +++ b/maloja/server.py @@ -25,7 +25,7 @@ from doreah import settings from doreah.logging import log from doreah.timing import Clock from doreah.pyhp import file as pyhpfile -from doreah.auth import get_login_page, authapi, authenticated +from doreah import auth # technical #from importlib.machinery import SourceFileLoader import importlib @@ -56,7 +56,7 @@ STATICFOLDER = pkg_resources.resource_filename(__name__,"static") DATAFOLDER = DATA_DIR webserver = Bottle() -authapi.mount(server=webserver) +auth.authapi.mount(server=webserver) pthjoin = os.path.join @@ -162,7 +162,7 @@ def get_css(): @webserver.route("/login") def login(): - return get_login_page() + return auth.get_login_page() @webserver.route("/.") def static(name,ext): @@ -223,7 +223,7 @@ jinjaenv.globals.update(JINJA_CONTEXT) @webserver.route("/") -@authenticated +@auth.authenticated def static_html_private(name): return static_html(name) @@ -242,7 +242,7 @@ def static_html(name): pyhp_pref = settings.get_settings("USE_PYHP") jinja_pref = settings.get_settings("USE_JINJA") - adminmode = request.cookies.get("adminmode") == "true" and database.checkAPIkey(request.cookies.get("apikey")) is not False + adminmode = request.cookies.get("adminmode") == "true" and auth.check(request) clock = Clock() clock.start() diff --git a/maloja/web/jinja/admin.jinja b/maloja/web/jinja/admin.jinja new file mode 100644 index 0000000..5499184 --- /dev/null +++ b/maloja/web/jinja/admin.jinja @@ -0,0 +1,98 @@ +{% extends "base.jinja" %} +{% block title %}Maloja - Admin Panel{% endblock %} + +{% block scripts %} + + +{% endblock %} + + +{% block content %} + + + + + + + + + +
+
+
+

Admin Panel

+ +
+ +

Update

+ + Currently installed Maloja version: Loading...
+ Latest recommended Maloja version: Loading...
+ + + +

Admin Mode

+ + Admin Mode allows you to manually scrobble from various places on the web interface instead of just the dedicated page.

+ {% if adminmode %} + Deactivate + {% else %} + Activate + {% endif %} + +

Links

+ + Server Setup
+ Manual Scrobbling
+ Database Maintenance + +

External

+ + Report Issue
+ + +{% endblock %} diff --git a/maloja/web/jinja/track.jinja b/maloja/web/jinja/track.jinja index d1ff053..69e1deb 100644 --- a/maloja/web/jinja/track.jinja +++ b/maloja/web/jinja/track.jinja @@ -4,8 +4,8 @@ {% block scripts %} {% endblock %} @@ -45,7 +45,10 @@ #{{ info.position }}
-

{{ info['scrobbles'] }} Scrobbles

+

+ {% if adminmode %}Scrobble now{% endif %} + {{ info['scrobbles'] }} Scrobbles +

diff --git a/maloja/web/pyhp/admin.pyhp b/maloja/web/pyhp/admin.pyhp deleted file mode 100644 index 8b00718..0000000 --- a/maloja/web/pyhp/admin.pyhp +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - Maloja - - - - - - - - - - - - - - - - - -
-
-
-

Admin Panel

- -
- -

Update

- - Currently installed Maloja version: Loading...
- Latest recommended Maloja version: Loading...
- - - -

Admin Mode

- - Admin Mode allows you to manually scrobble from various places on the web interface instead of just the dedicated page.

- Deactivate - Activate - -

Links

- - Server Setup
- Manual Scrobbling
- Database Maintenance - -

External

- - Report Issue
- - - -