forked from MarseyWorld/MarseyWorld
put custom CSS into HTML templates
parent
e34cbeca31
commit
19c82b7ea1
|
@ -417,15 +417,6 @@ def post_sub_css(v, sub):
|
|||
return redirect(f'/h/{sub.name}/settings')
|
||||
|
||||
|
||||
@app.get("/h/<sub>/css")
|
||||
def get_sub_css(sub):
|
||||
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
|
||||
if not sub: abort(404)
|
||||
resp=make_response(sub.css or "")
|
||||
resp.headers.add("Content-Type", "text/css")
|
||||
return resp
|
||||
|
||||
|
||||
@app.post("/h/<sub>/banner")
|
||||
@limiter.limit("1/second;10/day")
|
||||
@limiter.limit("1/second;10/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
|
||||
|
|
|
@ -584,34 +584,6 @@ def leaderboard(v):
|
|||
users13=users13_25, pos13=pos13, users14=users14, pos14=pos14, users15=users15, pos15=pos15,
|
||||
usersBlk=usersBlk)
|
||||
|
||||
@app.get("/@<username>/css")
|
||||
def get_css(username):
|
||||
user = get_user(username)
|
||||
resp = make_response(user.css or "")
|
||||
resp.headers["Content-Type"] = "text/css"
|
||||
resp.headers["Referrer-Policy"] = "no-referrer"
|
||||
return resp
|
||||
|
||||
@app.get("/@<username>/profilecss")
|
||||
def get_profilecss(username):
|
||||
user = get_user(username)
|
||||
if user.profilecss: profilecss = user.profilecss
|
||||
else: profilecss = ""
|
||||
resp = make_response(profilecss)
|
||||
resp.headers["Content-Type"] = "text/css"
|
||||
resp.headers["Referrer-Policy"] = "no-referrer"
|
||||
return resp
|
||||
|
||||
@app.get("/id/<id>/profilecss")
|
||||
def get_profilecss_id(id):
|
||||
user = get_account(id)
|
||||
if user.profilecss: profilecss = user.profilecss
|
||||
else: profilecss = ""
|
||||
resp = make_response(profilecss)
|
||||
resp.headers["Content-Type"] = "text/css"
|
||||
resp.headers["Referrer-Policy"] = "no-referrer"
|
||||
return resp
|
||||
|
||||
@app.get("/@<username>/song")
|
||||
def usersong(username):
|
||||
user = get_user(username)
|
||||
|
|
|
@ -40,7 +40,9 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
<link rel="stylesheet" href="{{asset('css/main.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('css/' + v.theme + '.css')}}">
|
||||
{% if v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
@ -61,7 +63,9 @@
|
|||
{% endif %}
|
||||
|
||||
{% if sub and sub.css and not request.path.endswith('settings') %}
|
||||
<link rel="stylesheet" href="/h/{{sub.name}}/css" type="text/css">
|
||||
<style>
|
||||
{{sub.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
|
||||
{% if v and v.themecolor == '30409f' %}
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -56,7 +56,9 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css and not request.path.startswith('/settings/css') %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<style>
|
||||
{{v.css}}
|
||||
</style>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
{% block title %}
|
||||
|
||||
{% if u and u.profilecss and not request.values.get('nocss') %}
|
||||
<link rel="stylesheet" href="/@{{u.username}}/profilecss">
|
||||
<style>
|
||||
{{v.profilecss}}
|
||||
</style>
|
||||
{% endif %}
|
||||
|
||||
<title>{{u.username}}'s profile - {{SITE_NAME}}</title>
|
||||
|
|
Loading…
Reference in New Issue