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

Adjusted structure to be closer to albula

This commit is contained in:
Krateng 2019-12-04 20:41:53 +01:00
parent c74cb7010f
commit fd0033e1c0
36 changed files with 38 additions and 33 deletions

View File

@ -7,7 +7,7 @@ author = {
"email":"maloja@krateng.dev", "email":"maloja@krateng.dev",
"github": "krateng" "github": "krateng"
} }
version = 2,0,3 version = 2,0,4
versionstr = ".".join(str(n) for n in version) versionstr = ".".join(str(n) for n in version)
@ -23,6 +23,7 @@ requires = [
resources = [ resources = [
"web/*/*", "web/*/*",
"web/*", "web/*",
"static/*/*",
"data_files/*/*", "data_files/*/*",
"data_files/.doreah" "data_files/.doreah"
] ]

View File

@ -45,8 +45,9 @@ MAIN_PORT = settings.get_settings("WEB_PORT")
HOST = settings.get_settings("HOST") HOST = settings.get_settings("HOST")
THREADS = 12 THREADS = 12
BaseRequest.MEMFILE_MAX = 15 * 1024 * 1024 BaseRequest.MEMFILE_MAX = 15 * 1024 * 1024
WEBFOLDER = pkg_resources.resource_filename(__name__,"web")
WEBFOLDER = pkg_resources.resource_filename(__name__,"web")
STATICFOLDER = pkg_resources.resource_filename(__name__,"static")
webserver = Bottle() webserver = Bottle()
@ -56,8 +57,8 @@ def generate_css():
import lesscpy import lesscpy
from io import StringIO from io import StringIO
less = "" less = ""
for f in os.listdir(pthjoin(WEBFOLDER,"less")): for f in os.listdir(pthjoin(STATICFOLDER,"less")):
with open(pthjoin(WEBFOLDER,"less",f),"r") as lessf: with open(pthjoin(STATICFOLDER,"less",f),"r") as lessf:
less += lessf.read() less += lessf.read()
css = lesscpy.compile(StringIO(less),minify=True) css = lesscpy.compile(StringIO(less),minify=True)
@ -153,27 +154,30 @@ def static_image(pth):
return response return response
@webserver.route("/css/style.css") @webserver.route("/style.css")
def get_css(): def get_css():
response.content_type = 'text/css' response.content_type = 'text/css'
return css return css
#@webserver.route("/<name:re:.*\\.html>")
@webserver.route("/<name:re:.*\\.js>") @webserver.route("/<name>.<ext>")
@webserver.route("/<name:re:.*\\.less>") def static(name,ext):
@webserver.route("/<name:re:.*\\.png>") assert ext in ["txt","ico","jpeg","jpg","png","less","js"]
@webserver.route("/<name:re:.*\\.jpeg>") response = static_file(ext + "/" + name + "." + ext,root=STATICFOLDER)
@webserver.route("/<name:re:.*\\.ico>") response.set_header("Cache-Control", "public, max-age=3600")
@webserver.route("/<name:re:.*\\.txt>") return response
def static(name):
response = static_file(name,root=WEBFOLDER) @webserver.route("/media/<name>.<ext>")
def static(name,ext):
assert ext in ["ico","jpeg","jpg","png"]
response = static_file(ext + "/" + name + "." + ext,root=STATICFOLDER)
response.set_header("Cache-Control", "public, max-age=3600") response.set_header("Cache-Control", "public, max-age=3600")
return response return response
@webserver.route("/<name>") @webserver.route("/<name>")
def static_html(name): def static_html(name):
linkheaders = ["</css/style.css>; rel=preload; as=style"] linkheaders = ["</style.css>; rel=preload; as=style"]
keys = remove_identical(FormsDict.decode(request.query)) keys = remove_identical(FormsDict.decode(request.query))
pyhp_file = os.path.exists(pthjoin(WEBFOLDER,name + ".pyhp")) pyhp_file = os.path.exists(pthjoin(WEBFOLDER,name + ".pyhp"))

View File

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

View File

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View File

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 239 B

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 240 B

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -5,7 +5,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja</title> <title>Maloja</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<pyhp include="common/header.html" /> <pyhp include="common/header.html" />

View File

@ -4,8 +4,8 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - KEY_ARTISTNAME</title> <title>Maloja - KEY_ARTISTNAME</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<script src="javascript/rangeselect.js"></script> <script src="/rangeselect.js"></script>
</head> </head>
<body> <body>

View File

@ -37,7 +37,7 @@
<title>Maloja - <pyhp echo="artist" /></title> <title>Maloja - <pyhp echo="artist" /></title>
<pyhp include="common/header.html" /> <pyhp include="common/header.html" />
<script src="javascript/rangeselect.js"></script> <script src="/rangeselect.js"></script>
</head> </head>
<body> <body>

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - Artist Charts</title> <title>Maloja - Artist Charts</title>
<script src="javascript/datechange.js" async></script> <script src="/datechange.js" async></script>
</head> </head>
<body> <body>

View File

@ -5,7 +5,7 @@
<link rel="stylesheet" href="/css/maloja.css" /> <link rel="stylesheet" href="/css/maloja.css" />
<link rel="stylesheet" href="/css/grisons.css" /> <link rel="stylesheet" href="/css/grisons.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js" ></script> --> <script src="//cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js" ></script> -->
<link rel="stylesheet" href="/css/style.css" /> <link rel="stylesheet" href="/style.css" />
<script src="/javascript/search.js" async></script> <script src="/search.js" async></script>
<script src="/javascript/neopolitan.js"></script> <script src="/neopolitan.js"></script>
<script src="/javascript/upload.js"></script> <script src="/upload.js"></script>

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - Issues</title> <title>Maloja - Issues</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
</head> </head>
<body> <body>

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja</title> <title>Maloja</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<script> <script>
function keyDetect(event) { function keyDetect(event) {

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - Proxyscrobble</title> <title>Maloja - Proxyscrobble</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<script> <script>
window.addEventListener("load",function(){ window.addEventListener("load",function(){

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - Setup</title> <title>Maloja - Setup</title>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<script> <script>

View File

@ -8,8 +8,8 @@
<script>document.addEventListener('DOMContentLoaded',function() { <script>document.addEventListener('DOMContentLoaded',function() {
KEY_JS_INIT_RANGES KEY_JS_INIT_RANGES
})</script> })</script>
<script src="javascript/cookies.js"></script> <script src="/cookies.js"></script>
<script src="javascript/rangeselect.js"></script> <script src="/rangeselect.js"></script>
</head> </head>

View File

@ -4,8 +4,8 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - KEY_TRACKTITLE</title> <title>Maloja - KEY_TRACKTITLE</title>
<script src="javascript/cookies.js" ></script> <script src="/cookies.js" ></script>
<script src="javascript/rangeselect.js"></script> <script src="/rangeselect.js"></script>
</head> </head>
<body> <body>

View File

@ -18,7 +18,7 @@
<title>Maloja - <pyhp echo="track['title']" /></title> <title>Maloja - <pyhp echo="track['title']" /></title>
<pyhp include="common/header.html" /> <pyhp include="common/header.html" />
<script src="javascript/rangeselect.js"></script> <script src="/rangeselect.js"></script>
<script> <script>
function scrobble(encodedtrack,apikey) { function scrobble(encodedtrack,apikey) {
neo.xhttprequest('/api/newscrobble?' + encodedtrack + "key=" + apikey).then(response=>{window.location.reload()}); neo.xhttprequest('/api/newscrobble?' + encodedtrack + "key=" + apikey).then(response=>{window.location.reload()});