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

Compare commits

...

2 Commits

Author SHA1 Message Date
krateng
6171d1d2e1 Restored custom CSS file functionality, fix GH-135 2022-04-26 19:43:35 +02:00
krateng
0c948561a8 Added more generalized support for static user files, GH-135 2022-04-26 19:41:23 +02:00
4 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,6 @@
from . import filters
from ..pkg_global.conf import malojaconfig
from ..pkg_global import conf
from .. import database, malojatime, images, malojauri, thirdparty, __pkginfo__
from ..database import jinjaview
@ -32,6 +33,7 @@ def update_jinja_environment():
"mlj_uri": malojauri,
"settings": malojaconfig,
"thirdparty": thirdparty,
"conf":conf,
"pkginfo": __pkginfo__,
# external
"urllib": urllib,

View File

@ -326,6 +326,9 @@ config(
custom_css_files = [f for f in os.listdir(data_dir['css']()) if f.lower().endswith('.css')]
# what the fuck did i just write
# this spaghetti file is proudly sponsored by the rice crackers i'm eating at the

View File

@ -182,6 +182,15 @@ def static(path):
response.set_header("Cache-Control", "public, max-age=3600")
return response
# static files not supplied by the package
@webserver.get("/static_custom/<category>/<path:path>")
def static_custom(category,path):
rootpath = {
'css':data_dir['css']()
}
response = static_file(path,root=rootpath[category])
response.set_header("Cache-Control", "public, max-age=3600")
return response
### DYNAMIC

View File

@ -14,6 +14,9 @@
<link rel="stylesheet" href="/maloja.css" />
<link rel="stylesheet" href="/static/css/themes/{{ settings.theme }}.css" />
{% for cssf in conf.custom_css_files %}
<link rel="stylesheet" href="/static_custom/css/{{ cssf }}" />
{% endfor %}
<script src="/search.js"></script>
<script src="/neopolitan.js"></script>