fart mode
This commit is contained in:
parent
6082c2dad5
commit
ccacd78fa8
19 changed files with 69 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@ venv/
|
||||||
flask_session/
|
flask_session/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
disable_signups
|
disable_signups
|
||||||
|
fart_mode
|
|
@ -17,7 +17,7 @@ from sys import stdout, argv
|
||||||
import faulthandler
|
import faulthandler
|
||||||
from json import loads
|
from json import loads
|
||||||
|
|
||||||
for f in (f'files/templates/sidebar_{environ.get("SITE_NAME").strip()}.html', 'disable_signups'):
|
for f in (f'files/templates/sidebar_{environ.get("SITE_NAME").strip()}.html', 'disable_signups', 'fart_mode'):
|
||||||
if not path.exists(f):
|
if not path.exists(f):
|
||||||
with open(f, 'w', encoding="utf-8"): pass
|
with open(f, 'w', encoding="utf-8"): pass
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -175,6 +175,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-flag',
|
"icon": 'fa-flag',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
|
'disable_fart_mode': {
|
||||||
|
"str": 'disabled fart mode',
|
||||||
|
"icon": 'fa-gas-pump-slash',
|
||||||
|
"color": 'bg-danger'
|
||||||
|
},
|
||||||
'disable_signups': {
|
'disable_signups': {
|
||||||
"str": 'disabled signups',
|
"str": 'disabled signups',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
|
@ -210,6 +215,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-edit',
|
"icon": 'fa-edit',
|
||||||
"color": 'bg-primary'
|
"color": 'bg-primary'
|
||||||
},
|
},
|
||||||
|
'enable_fart_mode': {
|
||||||
|
"str": 'enabled fart mode',
|
||||||
|
"icon": 'fa-gas-pump',
|
||||||
|
"color": 'bg-success'
|
||||||
|
},
|
||||||
'enable_signups': {
|
'enable_signups': {
|
||||||
"str": 'enabled signups',
|
"str": 'enabled signups',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
|
|
|
@ -528,7 +528,9 @@ def admin_home(v):
|
||||||
|
|
||||||
x2 = response == 'under_attack'
|
x2 = response == 'under_attack'
|
||||||
|
|
||||||
return render_template("admin/admin_home.html", v=v, x=x, x2=x2)
|
with open('fart_mode', 'r') as f: x3 = f.read()
|
||||||
|
|
||||||
|
return render_template("admin/admin_home.html", v=v, x=x, x2=x2, x3=x3)
|
||||||
|
|
||||||
@app.post("/admin/disable_signups")
|
@app.post("/admin/disable_signups")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
|
@ -555,6 +557,31 @@ def disable_signups(v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Signups disabled!"}
|
return {"message": "Signups disabled!"}
|
||||||
|
|
||||||
|
@app.post("/admin/fart_mode")
|
||||||
|
@admin_level_required(3)
|
||||||
|
def fart_mode(v):
|
||||||
|
with open('fart_mode', 'r') as f: content = f.read()
|
||||||
|
|
||||||
|
with open('fart_mode', 'w') as f:
|
||||||
|
if content == "yes":
|
||||||
|
f.write("no")
|
||||||
|
ma = ModAction(
|
||||||
|
kind="enable_fart_mode",
|
||||||
|
user_id=v.id,
|
||||||
|
)
|
||||||
|
g.db.add(ma)
|
||||||
|
g.db.commit()
|
||||||
|
return {"message": "Fart mode enabled!"}
|
||||||
|
else:
|
||||||
|
f.write("yes")
|
||||||
|
ma = ModAction(
|
||||||
|
kind="disable_fart_mode",
|
||||||
|
user_id=v.id,
|
||||||
|
)
|
||||||
|
g.db.add(ma)
|
||||||
|
g.db.commit()
|
||||||
|
return {"message": "Fart mode disabled!"}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/admin/purge_cache")
|
@app.post("/admin/purge_cache")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
|
|
|
@ -253,9 +253,13 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if request.headers.get("Authorization"): return post.json
|
if request.headers.get("Authorization"): return post.json
|
||||||
else:
|
else:
|
||||||
|
with open('fart_mode', 'r') as f:
|
||||||
|
if f.read() == "yes": fart = True
|
||||||
|
else: fart = False
|
||||||
|
|
||||||
if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html"
|
if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html"
|
||||||
else: template = "submission.html"
|
else: template = "submission.html"
|
||||||
return render_template(template, v=v, p=post, ids=list(ids), sort=sort, render_replies=True, offset=offset, sub=post.subr)
|
return render_template(template, v=v, p=post, ids=list(ids), sort=sort, render_replies=True, offset=offset, sub=post.subr, fart=fart)
|
||||||
|
|
||||||
@app.get("/viewmore/<pid>/<sort>/<offset>")
|
@app.get("/viewmore/<pid>/<sort>/<offset>")
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
|
|
|
@ -68,6 +68,11 @@
|
||||||
<label class="custom-control-label" for="under_attack">Under attack mode</label>
|
<label class="custom-control-label" for="under_attack">Under attack mode</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input autocomplete="off" type="checkbox" class="custom-control-input" id="fart_mode" name="fart_mode" {% if x3 == "yes" %}checked{% endif %} onchange="post_toast(this,'/admin/fart_mode');">
|
||||||
|
<label class="custom-control-label" for="fart_mode">Fart mode</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/purge_cache');">PURGE CACHE</button>
|
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/purge_cache');">PURGE CACHE</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<title>Chat</title>
|
<title>Chat</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.css %}
|
{% if v.css %}
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<script src="/assets/js/bootstrap.js?v=245"></script>
|
<script src="/assets/js/bootstrap.js?v=245"></script>
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222">
|
||||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="row justify-content-around">
|
<div class="row justify-content-around">
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222">
|
||||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<title>2-Step Login - {{SITE_NAME}}</title>
|
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if SITE_NAME == 'rDrama' and not (v and v.has_badge(128)) %}
|
{% if fart and not (v and v.has_badge(128)) %}
|
||||||
<script>
|
<script>
|
||||||
fart = Math.floor(Math.random() * 4) + 1
|
fart = Math.floor(Math.random() * 4) + 1
|
||||||
let audio = new Audio(`/assets/images/${fart}.webp`);
|
let audio = new Audio(`/assets/images/${fart}.webp`);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=41">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=221">
|
<link rel="stylesheet" href="/assets/css/main.css?v=222">
|
||||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=41">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue