diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 3325692..2bcd551 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -370,3 +370,9 @@ def get_backup(**keys): archivefile = backup(tmpfolder) return static_file(os.path.basename(archivefile),root=tmpfolder) + + +@api.post("delete_scrobble") +@authenticated_api +def delete_scrobble(timestamp): + pass diff --git a/maloja/globalconf.py b/maloja/globalconf.py index 1800afb..8dffcb2 100644 --- a/maloja/globalconf.py +++ b/maloja/globalconf.py @@ -193,7 +193,8 @@ malojaconfig = Configuration( "use_local_images":(tp.Boolean(), "Use Local Images", True), #"local_image_rotate":(tp.Integer(), "Local Image Rotate", 3600), "timezone":(tp.Integer(), "UTC Offset", 0), - "time_format":(tp.String(), "Time Format", "%d. %b %Y %I:%M %p") + "time_format":(tp.String(), "Time Format", "%d. %b %Y %I:%M %p"), + "theme":(tp.String(), "Theme", "maloja") } }, configfile=newsettingsfile, diff --git a/maloja/server.py b/maloja/server.py index 4d09583..f0520a7 100644 --- a/maloja/server.py +++ b/maloja/server.py @@ -56,8 +56,9 @@ def generate_css(): with resources.files('maloja') / 'web' / 'static' as staticfolder: for file in os.listdir(os.path.join(staticfolder,"css")): - with open(os.path.join(staticfolder,"css",file),"r") as filed: - cssstr += filed.read() + if file.endswith(".css"): + with open(os.path.join(staticfolder,"css",file),"r") as filed: + cssstr += filed.read() for file in os.listdir(data_dir['css']()): if file.endswith(".css"): @@ -214,6 +215,7 @@ def get_css(): def login(): return auth.get_login_page() +# old @webserver.route("/<name>.<ext>") @webserver.route("/media/<name>.<ext>") def static(name,ext): @@ -223,6 +225,14 @@ def static(name,ext): response.set_header("Cache-Control", "public, max-age=3600") return response +# new, direct reference +@webserver.route("/static/<path:path>") +def static(path): + with resources.files('maloja') / 'web' / 'static' as staticfolder: + response = static_file(path,root=staticfolder) + response.set_header("Cache-Control", "public, max-age=3600") + return response + ### DYNAMIC diff --git a/maloja/web/jinja/abstracts/base.jinja b/maloja/web/jinja/abstracts/base.jinja index abc3924..10f554e 100644 --- a/maloja/web/jinja/abstracts/base.jinja +++ b/maloja/web/jinja/abstracts/base.jinja @@ -11,6 +11,7 @@ <meta name="darkreader" content="wat" /> <link rel="stylesheet" href="/style.css" /> + <link rel="stylesheet" href="/static/css/themes/{{ settings.theme }}.css" /> <script src="/search.js"></script> <script src="/neopolitan.js"></script> diff --git a/maloja/web/static/css/themes/constantinople.css b/maloja/web/static/css/themes/constantinople.css new file mode 100644 index 0000000..617aa45 --- /dev/null +++ b/maloja/web/static/css/themes/constantinople.css @@ -0,0 +1,23 @@ +:root { + --base-color: #140c12; + --base-color-dark: #080507; + --base-color-light: #2c1b28; + --base-color-accent: #452a3e; + --base-color-accent-dark: #442b3e; + --base-color-accent-light: #dfcad9; + + --text-color: #d8b700; + --text-color-selected: fadeout(var(--text-color),40%); + --text-color-secondary: #6a7600; + --text-color-tertiary: #474f00; + --text-color-focus: #3D428B; + + --ctrl-element-color-bg: rgba(0,255,255,0.1); + --ctrl-element-color-main: rgba(103,85,0,0.7); + --ctrl-element-color-focus: gold; + + --button-color-bg: var(--text-color); + --button-color-bg-focus: var(--text-color-focus); + --button-color-fg: var(--base-color); + --button-color-fg-focus: var(--base-color); +} diff --git a/maloja/web/static/css/themes/kda.css b/maloja/web/static/css/themes/kda.css new file mode 100644 index 0000000..f778bd7 --- /dev/null +++ b/maloja/web/static/css/themes/kda.css @@ -0,0 +1,23 @@ +:root { + --base-color: #2f3493; + --base-color-dark: #000000; + --base-color-light: #59ebfc; + --base-color-accent: #9821a5; + --base-color-accent-dark: #740C7F; + --base-color-accent-light: #D41BE8; + + --text-color: #e5b48f; + --text-color-selected: fadeout(var(--text-color),40%); + --text-color-secondary: #f9f9f9; + --text-color-tertiary: #f7f7f7; + --text-color-focus: #59ebfc; + + --ctrl-element-color-bg: rgba(0,255,255,0.1); + --ctrl-element-color-main: rgba(103,85,0,0.7); + --ctrl-element-color-focus: gold; + + --button-color-bg: var(--text-color); + --button-color-bg-focus: var(--text-color-focus); + --button-color-fg: var(--base-color); + --button-color-fg-focus: var(--base-color); +} diff --git a/maloja/web/static/css/themes/maloja.css b/maloja/web/static/css/themes/maloja.css new file mode 100644 index 0000000..e69de29