forked from rDrama/rDrama
rework custom css a little
parent
e36adb5bf4
commit
e022b29ef6
|
@ -419,7 +419,7 @@ def post_sub_css(v, sub):
|
|||
|
||||
@app.get("/h/<sub>/css")
|
||||
def get_sub_css(sub):
|
||||
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
|
||||
sub = g.db.query(Sub.css).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")
|
||||
|
|
|
@ -584,32 +584,28 @@ 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 "")
|
||||
@app.get("/<id>/css")
|
||||
def get_css(id):
|
||||
try: id = int(id)
|
||||
except: abort(404)
|
||||
|
||||
css = g.db.query(User.css).filter_by(id=id).one_or_none()
|
||||
if not css: abort(404)
|
||||
|
||||
resp = make_response(css[0] 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>/profilecss")
|
||||
def get_profilecss(id):
|
||||
try: id = int(id)
|
||||
except: abort(404)
|
||||
|
||||
@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)
|
||||
css = g.db.query(User.profilecss).filter_by(id=id).one_or_none()
|
||||
if not css: abort(404)
|
||||
|
||||
resp = make_response(css[0] or "")
|
||||
resp.headers["Content-Type"] = "text/css"
|
||||
resp.headers["Referrer-Policy"] = "no-referrer"
|
||||
return resp
|
||||
|
||||
@app.get("/@<username>/song")
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<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">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css and not request.path.startswith('/settings/css') %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
</style>
|
||||
{% elif v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
<link rel="stylesheet" href="/{{v.id}}/css">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block title %}
|
||||
|
||||
{% if u and u.profilecss and not request.values.get('nocss') %}
|
||||
<link rel="stylesheet" href="/@{{u.username}}/profilecss">
|
||||
<link rel="stylesheet" href="/{{u.id}}/profilecss">
|
||||
{% endif %}
|
||||
|
||||
<title>{{u.username}}'s profile - {{SITE_NAME}}</title>
|
||||
|
|
Loading…
Reference in New Issue