forked from rDrama/rDrama
1
0
Fork 0

Revert "put custom CSS into HTML templates"

This reverts commit 19c82b7ea1.
master
Aevann1 2022-06-26 07:07:28 +02:00
parent 49e39b94bc
commit 74978bfbf7
9 changed files with 45 additions and 24 deletions

View File

@ -417,6 +417,15 @@ 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")}')

View File

@ -584,6 +584,34 @@ 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)

View File

@ -40,9 +40,7 @@
}
</style>
{% elif v.css %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
{% else %}
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>

View File

@ -19,9 +19,7 @@
<link rel="stylesheet" href="{{asset('css/main.css')}}">
<link rel="stylesheet" href="{{asset('css/' + v.theme + '.css')}}">
{% if v.css %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
<style>

View File

@ -47,9 +47,7 @@
}
</style>
{% elif v.css %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
{% else %}
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>
@ -63,9 +61,7 @@
{% endif %}
{% if sub and sub.css and not request.path.endswith('settings') %}
<style>
{{sub.css}}
</style>
<link rel="stylesheet" href="/h/{{sub.name}}/css" type="text/css">
{% endif %}
{% if v and v.themecolor == '30409f' %}

View File

@ -27,9 +27,7 @@
}
</style>
{% elif v.css %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
{% else %}
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>

View File

@ -56,9 +56,7 @@
}
</style>
{% elif v.css and not request.path.startswith('/settings/css') %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
</head>

View File

@ -49,9 +49,7 @@
}
</style>
{% elif v.css %}
<style>
{{v.css}}
</style>
<link rel="stylesheet" href="/@{{v.username}}/css">
{% endif %}
{% else %}
<style>:root{--primary:#{{DEFAULT_COLOR}}</style>

View File

@ -6,9 +6,7 @@
{% block title %}
{% if u and u.profilecss and not request.values.get('nocss') %}
<style>
{{v.profilecss}}
</style>
<link rel="stylesheet" href="/@{{u.username}}/profilecss">
{% endif %}
<title>{{u.username}}'s profile - {{SITE_NAME}}</title>