forked from rDrama/rDrama
settings: convert all to snek_case
parent
d395bcab69
commit
69a44baea7
|
@ -134,28 +134,28 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-flag',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Bots': {
|
||||
"str": 'disabled Bots',
|
||||
'disable_bots': {
|
||||
"str": 'disabled bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Fart mode': {
|
||||
'disable_fart_mode': {
|
||||
"str": 'disabled fart mode',
|
||||
"icon": 'fa-gas-pump-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Read-only mode': {
|
||||
'disable_read_only_mode': {
|
||||
"str": 'disabled read only mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Signups': {
|
||||
"str": 'disabled Signups',
|
||||
'disable_signups': {
|
||||
"str": 'disabled signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_login_required': {
|
||||
"str": 'disabled Login Required',
|
||||
"str": 'disabled login required',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
|
@ -164,6 +164,11 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-shield',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'disable_under_siege': {
|
||||
"str": 'disabled under siege mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'distinguish_comment': {
|
||||
"str": 'distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
|
@ -189,28 +194,28 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-edit',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'enable_Bots': {
|
||||
"str": 'enabled Bots',
|
||||
'enable_bots': {
|
||||
"str": 'enabled bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Fart mode': {
|
||||
'enable_fart_mode': {
|
||||
"str": 'enabled fart mode',
|
||||
"icon": 'fa-gas-pump',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Read-only mode': {
|
||||
'enable_read_only_mode': {
|
||||
"str": 'enabled read only mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Signups': {
|
||||
"str": 'enabled Signups',
|
||||
'enable_signups': {
|
||||
"str": 'enabled signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_login_required': {
|
||||
"str": 'enabled Login Required',
|
||||
"str": 'enabled login required',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
|
@ -219,6 +224,11 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-shield',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_under_siege': {
|
||||
"str": 'enabled under siege mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-success',
|
||||
},
|
||||
'flair_post': {
|
||||
"str": 'set a flair on {self.target_link}',
|
||||
"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 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
|
||||
|
||||
|
|
|
@ -148,11 +148,10 @@ def logout(v):
|
|||
@app.get("/signup")
|
||||
@auth_desired
|
||||
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.")
|
||||
|
||||
if v: return redirect(SITE_FULL)
|
||||
|
||||
ref = request.values.get("ref")
|
||||
|
||||
if ref:
|
||||
|
@ -198,7 +197,7 @@ def sign_up_get(v:Optional[User]):
|
|||
@limiter.limit("1/second;10/day")
|
||||
@auth_desired
|
||||
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.")
|
||||
|
||||
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),
|
||||
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>")
|
||||
@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"))
|
||||
|
||||
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)
|
||||
|
||||
g.v = v
|
||||
|
|
|
@ -106,34 +106,16 @@
|
|||
</ul>
|
||||
|
||||
{% if v.admin_level >= PERMS['SITE_SETTINGS'] %}
|
||||
<div class="custom-control custom-switch mt-1">
|
||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="signups" {% if site_settings['Signups'] %}checked{% endif %} onchange="postToastSwitch(this,'/admin/site_settings/Signups');">
|
||||
<label class="custom-control-label" for="signups">Signups</label>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
{% for setting in site_settings.keys() %}
|
||||
<div class="custom-control custom-switch{% if loop.index > 1 %} mt-1{% endif %}" id="settings-{{setting}}-container">
|
||||
<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}}');">
|
||||
<label class="custom-control-label" for="settings-{{setting}}-checkbox">{{setting.replace('_', ' ').title()}}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% 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');">
|
||||
<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>
|
||||
{% endif %}
|
||||
<br>
|
||||
|
|
Loading…
Reference in New Issue