forked from rDrama/rDrama
settings: convert all to snek_case
parent
d395bcab69
commit
69a44baea7
|
@ -134,28 +134,28 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-flag',
|
"icon": 'fa-flag',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'disable_Bots': {
|
'disable_bots': {
|
||||||
"str": 'disabled Bots',
|
"str": 'disabled bots',
|
||||||
"icon": 'fa-robot',
|
"icon": 'fa-robot',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'disable_Fart mode': {
|
'disable_fart_mode': {
|
||||||
"str": 'disabled fart mode',
|
"str": 'disabled fart mode',
|
||||||
"icon": 'fa-gas-pump-slash',
|
"icon": 'fa-gas-pump-slash',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'disable_Read-only mode': {
|
'disable_read_only_mode': {
|
||||||
"str": 'disabled readonly mode',
|
"str": 'disabled read only mode',
|
||||||
"icon": 'fa-book',
|
"icon": 'fa-book',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'disable_Signups': {
|
'disable_signups': {
|
||||||
"str": 'disabled Signups',
|
"str": 'disabled signups',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'disable_login_required': {
|
'disable_login_required': {
|
||||||
"str": 'disabled Login Required',
|
"str": 'disabled login required',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
|
@ -164,6 +164,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-shield',
|
"icon": 'fa-shield',
|
||||||
"color": 'bg-muted'
|
"color": 'bg-muted'
|
||||||
},
|
},
|
||||||
|
'disable_under_siege': {
|
||||||
|
"str": 'disabled under siege mode',
|
||||||
|
"icon": 'fa-shield',
|
||||||
|
"color": 'bg-muted'
|
||||||
|
},
|
||||||
'distinguish_comment': {
|
'distinguish_comment': {
|
||||||
"str": 'distinguished {self.target_link}',
|
"str": 'distinguished {self.target_link}',
|
||||||
"icon": 'fa-crown',
|
"icon": 'fa-crown',
|
||||||
|
@ -189,28 +194,28 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-edit',
|
"icon": 'fa-edit',
|
||||||
"color": 'bg-primary'
|
"color": 'bg-primary'
|
||||||
},
|
},
|
||||||
'enable_Bots': {
|
'enable_bots': {
|
||||||
"str": 'enabled Bots',
|
"str": 'enabled bots',
|
||||||
"icon": 'fa-robot',
|
"icon": 'fa-robot',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
'enable_Fart mode': {
|
'enable_fart_mode': {
|
||||||
"str": 'enabled fart mode',
|
"str": 'enabled fart mode',
|
||||||
"icon": 'fa-gas-pump',
|
"icon": 'fa-gas-pump',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
'enable_Read-only mode': {
|
'enable_read_only_mode': {
|
||||||
"str": 'enabled readonly mode',
|
"str": 'enabled read only mode',
|
||||||
"icon": 'fa-book',
|
"icon": 'fa-book',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
'enable_Signups': {
|
'enable_signups': {
|
||||||
"str": 'enabled Signups',
|
"str": 'enabled signups',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
'enable_login_required': {
|
'enable_login_required': {
|
||||||
"str": 'enabled Login Required',
|
"str": 'enabled login required',
|
||||||
"icon": 'fa-users',
|
"icon": 'fa-users',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
|
@ -219,6 +224,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-shield',
|
"icon": 'fa-shield',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
|
'enable_under_siege': {
|
||||||
|
"str": 'enabled under siege mode',
|
||||||
|
"icon": 'fa-shield',
|
||||||
|
"color": 'bg-success',
|
||||||
|
},
|
||||||
'flair_post': {
|
'flair_post': {
|
||||||
"str": 'set a flair on {self.target_link}',
|
"str": 'set a flair on {self.target_link}',
|
||||||
"icon": 'fa-tag',
|
"icon": 'fa-tag',
|
||||||
|
|
|
@ -28,7 +28,7 @@ def before_request():
|
||||||
|
|
||||||
if request.headers.get("CF-Worker"): return {"error": "Cloudflare workers are not allowed to access this website."}, 403
|
if request.headers.get("CF-Worker"): return {"error": "Cloudflare workers are not allowed to access this website."}, 403
|
||||||
|
|
||||||
if not get_setting('Bots') and request.headers.get("Authorization"): abort(403)
|
if not get_setting('bots') and request.headers.get("Authorization"): abort(403)
|
||||||
|
|
||||||
g.webview = '; wv) ' in ua
|
g.webview = '; wv) ' in ua
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,10 @@ def logout(v):
|
||||||
@app.get("/signup")
|
@app.get("/signup")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def sign_up_get(v:Optional[User]):
|
def sign_up_get(v:Optional[User]):
|
||||||
if not get_setting('Signups'):
|
if not get_setting('signups'):
|
||||||
abort(403, "New account registration is currently closed. Please come back later.")
|
abort(403, "New account registration is currently closed. Please come back later.")
|
||||||
|
|
||||||
if v: return redirect(SITE_FULL)
|
if v: return redirect(SITE_FULL)
|
||||||
|
|
||||||
ref = request.values.get("ref")
|
ref = request.values.get("ref")
|
||||||
|
|
||||||
if ref:
|
if ref:
|
||||||
|
@ -198,7 +197,7 @@ def sign_up_get(v:Optional[User]):
|
||||||
@limiter.limit("1/second;10/day")
|
@limiter.limit("1/second;10/day")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def sign_up_post(v:Optional[User]):
|
def sign_up_post(v:Optional[User]):
|
||||||
if not get_setting('Signups'):
|
if not get_setting('signups'):
|
||||||
abort(403, "New account registration is currently closed. Please come back later.")
|
abort(403, "New account registration is currently closed. Please come back later.")
|
||||||
|
|
||||||
if v: abort(403)
|
if v: abort(403)
|
||||||
|
|
|
@ -227,7 +227,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
|
|
||||||
return render_template(template, v=v, p=post, ids=list(ids),
|
return render_template(template, v=v, p=post, ids=list(ids),
|
||||||
sort=sort, render_replies=True, offset=offset, sub=post.subr,
|
sort=sort, render_replies=True, offset=offset, sub=post.subr,
|
||||||
fart=get_setting('Fart mode'))
|
fart=get_setting('fart_mode'))
|
||||||
|
|
||||||
@app.get("/viewmore/<pid>/<sort>/<offset>")
|
@app.get("/viewmore/<pid>/<sort>/<offset>")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||||
|
|
|
@ -42,7 +42,7 @@ def get_logged_in_user():
|
||||||
|
|
||||||
g.is_api_or_xhr = bool((v and v.client) or request.headers.get("xhr"))
|
g.is_api_or_xhr = bool((v and v.client) or request.headers.get("xhr"))
|
||||||
|
|
||||||
if request.method.lower() != "get" and get_setting('Read-only mode') and not (v and v.admin_level >= PERMS['SITE_BYPASS_READ_ONLY_MODE']):
|
if request.method.lower() != "get" and get_setting('read_only_mode') and not (v and v.admin_level >= PERMS['SITE_BYPASS_READ_ONLY_MODE']):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
g.v = v
|
g.v = v
|
||||||
|
|
|
@ -106,34 +106,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['SITE_SETTINGS'] %}
|
{% if v.admin_level >= PERMS['SITE_SETTINGS'] %}
|
||||||
<div class="custom-control custom-switch mt-1">
|
{% for setting in site_settings.keys() %}
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="signups" {% if site_settings['Signups'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/Signups');">
|
<div class="custom-control custom-switch{% if loop.index > 1 %} mt-1{% endif %}" id="settings-{{setting}}-container">
|
||||||
<label class="custom-control-label" for="signups">Signups</label>
|
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{settings-{{setting}}-checkbox" {% if site_settings[setting] %}checked{% endif %} onchange="postToastSwitch(this, '/admin/site_settings/{{setting}}');">
|
||||||
</div>
|
<label class="custom-control-label" for="settings-{{setting}}-checkbox">{{setting.replace('_', ' ').title()}}</label>
|
||||||
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="bots" {% if site_settings['Bots'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/Bots');">
|
|
||||||
<label class="custom-control-label" for="bots">Bots</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="login_required" {% if site_settings['login_required'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/login_required');">
|
|
||||||
<label class="custom-control-label" for="login_required">Login Required</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="Fart mode" {% if site_settings['Fart mode'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/Fart mode');">
|
|
||||||
<label class="custom-control-label" for="Fart mode">Fart mode</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="Read-only mode" {% if site_settings['Read-only mode'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/Read-only mode');">
|
|
||||||
<label class="custom-control-label" for="Read-only mode">Read-only mode</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
{% if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK'] %}
|
{% if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK'] %}
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch" id="settings-under_attack-container">
|
||||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="under_attack" name="under_attack" {% if under_attack%}checked{% endif %} onchange="postToastSwitch(this,'/admin/under_attack');">
|
<input autocomplete="off" type="checkbox" class="custom-control-input" id="under_attack" name="under_attack" {% if under_attack%}checked{% endif %} onchange="postToastSwitch(this,'/admin/under_attack');">
|
||||||
<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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in New Issue