forked from rDrama/rDrama
fgd
parent
83aff7ba5c
commit
04b0088987
|
@ -100,6 +100,8 @@ allowed_styles = ['color', 'background-color', 'font-weight', 'transform', '-web
|
||||||
|
|
||||||
def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
|
|
||||||
|
if sanitized.count(':') > 100: abort(418)
|
||||||
|
|
||||||
sanitized = markdown(sanitized)
|
sanitized = markdown(sanitized)
|
||||||
|
|
||||||
sanitized = sanitized.replace("\ufeff", "").replace("𒐪","").replace("<script","").replace('','')
|
sanitized = sanitized.replace("\ufeff", "").replace("𒐪","").replace("<script","").replace('','')
|
||||||
|
|
|
@ -5,6 +5,7 @@ import time
|
||||||
from files.__main__ import app, limiter
|
from files.__main__ import app, limiter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(400)
|
@app.errorhandler(400)
|
||||||
def error_400(e):
|
def error_400(e):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "400 Bad Request"}, 400
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "400 Bad Request"}, 400
|
||||||
|
@ -20,7 +21,6 @@ def error_401(e):
|
||||||
argval = quote(f"{path}?{qs}", safe='')
|
argval = quote(f"{path}?{qs}", safe='')
|
||||||
return redirect(f"{SITE_FULL}/login?redirect={argval}")
|
return redirect(f"{SITE_FULL}/login?redirect={argval}")
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(403)
|
@app.errorhandler(403)
|
||||||
def error_403(e):
|
def error_403(e):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "403 Forbidden"}, 403
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "403 Forbidden"}, 403
|
||||||
|
@ -32,17 +32,19 @@ def error_404(e):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "404 Not Found"}, 404
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "404 Not Found"}, 404
|
||||||
else: return render_template('errors/404.html', err=True), 404
|
else: return render_template('errors/404.html', err=True), 404
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(405)
|
@app.errorhandler(405)
|
||||||
def error_405(e):
|
def error_405(e):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "405 Method Not Allowed"}, 405
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "405 Method Not Allowed"}, 405
|
||||||
else: return render_template('errors/405.html', err=True), 405
|
else: return render_template('errors/405.html', err=True), 405
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(413)
|
@app.errorhandler(413)
|
||||||
def error_413(e):
|
def error_413(e):
|
||||||
return {"error": "Max file size is 4 MB (8 MB for paypigs)"}, 413
|
return {"error": "Max file size is 4 MB (8 MB for paypigs)"}, 413
|
||||||
|
|
||||||
|
@app.errorhandler(418)
|
||||||
|
def error_418(e):
|
||||||
|
return {"error": "Too many emojis!"}, 418
|
||||||
|
|
||||||
@app.errorhandler(429)
|
@app.errorhandler(429)
|
||||||
def error_429(e):
|
def error_429(e):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "429 Too Many Requests"}, 429
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "429 Too Many Requests"}, 429
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<label class="custom-control-label" for="{{badge.id}}"></label>
|
<label class="custom-control-label" for="{{badge.id}}"></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1010" width=64.16 height=70></label></td>
|
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1011" width=64.16 height=70></label></td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
<td>{{badge.description}}</td>
|
<td>{{badge.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<label class="custom-control-label" for="{{badge.id}}"></label>
|
<label class="custom-control-label" for="{{badge.id}}"></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1010" width=64.16 height=70></label></td>
|
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1011" width=64.16 height=70></label></td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
<td>{{badge.description}}</td>
|
<td>{{badge.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-weight:bold">{{loop.index}}</td>
|
<td style="font-weight:bold">{{loop.index}}</td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
<td><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1010" width=45.83 height=50>
|
<td><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=1011" width=45.83 height=50>
|
||||||
<td>{{badge.description}}</td>
|
<td>{{badge.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<td style="font-weight:bold;">{{loop.index}}</td>
|
<td style="font-weight:bold;">{{loop.index}}</td>
|
||||||
<td><a style="color:#{{u.namecolor}}; font-weight:bold;" href="/@{{u.username}}"><img alt="@{{u.username}}'s profile picture" loading="lazy" src="{{u.profile_url}}" class="pp20"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}}"{% endif %}>{{u.username}}</span></a></td>
|
<td><a style="color:#{{u.namecolor}}; font-weight:bold;" href="/@{{u.username}}"><img alt="@{{u.username}}'s profile picture" loading="lazy" src="{{u.profile_url}}" class="pp20"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}}"{% endif %}>{{u.username}}</span></a></td>
|
||||||
|
|
||||||
<td><img alt="2{{u.patron}}" loading="lazy" width=29.33 height=32 src="/static/assets/images/badges/2{{u.patron}}.webp?a=1010"></td>
|
<td><img alt="2{{u.patron}}" loading="lazy" width=29.33 height=32 src="/static/assets/images/badges/2{{u.patron}}.webp?a=1011"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -258,7 +258,7 @@
|
||||||
|
|
||||||
<script src="/static/assets/js/marked.js?a=240"></script>
|
<script src="/static/assets/js/marked.js?a=240"></script>
|
||||||
<script src="/static/assets/js/formatting.js?a=240"></script>
|
<script src="/static/assets/js/formatting.js?a=240"></script>
|
||||||
<script src="/static/assets/js/submit.js?a=242"></script>
|
<script src="/static/assets/js/submit.js?a=243"></script>
|
||||||
{% include "emoji_modal.html" %}
|
{% include "emoji_modal.html" %}
|
||||||
{% include "gif_modal.html" %}
|
{% include "gif_modal.html" %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue