1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Removed special handling of css

This commit is contained in:
krateng 2022-04-23 17:32:05 +02:00
parent 29a6a74c37
commit 6c5f08aa5a
5 changed files with 9 additions and 53 deletions

View File

@ -3,7 +3,6 @@ import sys
import os
from threading import Thread
from importlib import resources
from css_html_js_minify import html_minify, css_minify
import datauri
import time
@ -44,46 +43,6 @@ webserver = Bottle()
######
### CSS
#####
def generate_css():
cssstr = ""
with resources.files('maloja') / 'web' / 'static' as staticfolder:
for file in os.listdir(os.path.join(staticfolder,"css")):
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"):
with open(os.path.join(data_dir['css'](file)),"r") as filed:
cssstr += filed.read()
cssstr = css_minify(cssstr)
return cssstr
css = generate_css()
######
### MINIFY
#####
def clean_html(inp):
return inp
#if malojaconfig["DEV_MODE"]: return inp
#else: return html_minify(inp)
######
### ERRORS
@ -201,13 +160,6 @@ def static_image(pth):
return resp
@webserver.route("/style.css")
def get_css():
response.content_type = 'text/css'
if malojaconfig["DEV_MODE"]: return generate_css()
else: return css
@webserver.route("/login")
def login():
return auth.get_login_page()
@ -216,7 +168,7 @@ def login():
@webserver.route("/<name>.<ext>")
@webserver.route("/media/<name>.<ext>")
def static(name,ext):
assert ext in ["txt","ico","jpeg","jpg","png","less","js","ttf"]
assert ext in ["txt","ico","jpeg","jpg","png","less","js","ttf","css"]
with resources.files('maloja') / 'web' / 'static' as staticfolder:
response = static_file(ext + "/" + name + "." + ext,root=staticfolder)
response.set_header("Cache-Control", "public, max-age=3600")
@ -260,7 +212,7 @@ def jinja_page(name):
if malojaconfig["DEV_MODE"]: jinja_environment.cache.clear()
return clean_html(res)
return res
@webserver.route("/<name:re:admin.*>")
@auth.authenticated

View File

@ -12,7 +12,7 @@
<meta name="color-scheme" content="dark" />
<meta name="darkreader" content="wat" />
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="/maloja.css" />
<link rel="stylesheet" href="/static/css/themes/{{ settings.theme }}.css" />
<script src="/search.js"></script>

View File

@ -2,6 +2,8 @@
COMMON STYLES FOR MALOJA, ALBULA AND POSSIBLY OTHERS
**/
@import url("/grisonsfont.css");
:root {
--base-color: #232327;
--base-color-dark: #090909;

View File

@ -1,3 +1,6 @@
@import url("/grisons.css");
body {
padding:15px;
padding-bottom:35px;

View File

@ -27,7 +27,6 @@ dependencies = [
#"pyvips>=2.1.16",
"jinja2>=2.11",
"lru-dict>=1.1.6",
"css_html_js_minify>=2.5.5",
"psutil>=5.8.0",
"sqlalchemy>=1.4",
"python-datauri>=1.1.0",