diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 64556c0ed..ae0770449 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -5582,16 +5582,16 @@ audio, video { text-transform: uppercase; } -.sidebar--rules-list { +.sidebar--rules ol { margin-left: 0; padding-left: 0; } -.sidebar--rules-list--rdrama li { - margin-bottom: 1rem; +.sidebar--rules--rdrama li > p { + margin-bottom: 0; } -.sidebar--rules-list--wpd { +.sidebar--rules--wpd ol { font-size: 0.95rem; } diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 889c73570..c33124e46 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -183,6 +183,11 @@ ACTIONTYPES = { "icon": 'fa-edit', "color": 'bg-primary' }, + 'edit_rules': { + "str": 'edited the rules', + "icon": 'fa-columns', + "color": 'bg-primary' + }, 'enable_bots': { "str": 'enabled bots', "icon": 'fa-robot', diff --git a/files/helpers/const.py b/files/helpers/const.py index 3a9ce43e0..74a16d5f3 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -221,6 +221,7 @@ PERMS = { # Minimum admin_level to perform action. 'CHAT_BYPASS_MUTE': 2, 'DOMAINS_BAN': 3, 'HOLE_CREATE': 0, + 'EDIT_RULES': 3, 'FLAGS_REMOVE': 2, 'VOTES_VISIBLE': 0, 'USER_BLOCKS_VISIBLE': 0, diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index ef3a0f63d..820abc771 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -238,7 +238,7 @@ def sanitize_settings_text(sanitized:Optional[str], max_length:Optional[int]=Non @with_sigalrm_timeout(5) -def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys=False, torture=False): +def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys=False, torture=False, sidebar=False): sanitized = sanitized.strip() sanitized = utm_regex.sub('', sanitized) @@ -406,7 +406,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys if y.startswith(x.domain): abort(403, description=f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"') - if '
' not in sanitized:
+	if '
' not in sanitized and not sidebar:
 		sanitized = sanitized.replace('\n','')
 
 	if showmore and len(sanitized) > 3500:
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 8fd8d2855..d2e2236ac 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -153,6 +153,40 @@ def merge_all(v, id):
 	return redirect(user.url)
 
 
+
+@app.get('/admin/edit_rules')
+@admin_level_required(PERMS['EDIT_RULES'])
+def edit_rules_get(v):
+
+	try:
+		with open(f'files/templates/rules_{SITE_NAME}.html', 'r', encoding="utf-8") as f:
+			rules = f.read()
+	except:
+		rules = None
+
+	return render_template('admin/edit_rules.html', v=v, rules=rules)
+
+
+@app.post('/admin/edit_rules')
+@limiter.limit("1/second;30/minute;200/hour;1000/day")
+@admin_level_required(PERMS['EDIT_RULES'])
+def edit_rules_post(v):
+	rules = request.values.get('rules', '').strip()
+	rules = sanitize(rules, sidebar=True)
+
+	with open(f'files/templates/rules_{SITE_NAME}.html', 'w+', encoding="utf-8") as f:
+		f.write(rules)
+
+	ma = ModAction(
+		kind="edit_rules",
+		user_id=v.id,
+	)
+	g.db.add(ma)
+
+	return render_template('admin/edit_rules.html', v=v, rules=rules, msg='Rules edited successfully!')
+
+
+
 @app.post("/@/make_admin")
 @admin_level_required(PERMS['ADMIN_ADD'])
 def make_admin(v, username):
diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html
index 9167027d1..6468f608a 100644
--- a/files/templates/admin/admin_home.html
+++ b/files/templates/admin/admin_home.html
@@ -97,6 +97,9 @@
 
 

Configuration

    + {% if v.admin_level >= PERMS['EDIT_RULES'] %} +
  • Edit the Rules
  • + {%- endif %} {% if v.admin_level >= PERMS['HOLE_CREATE'] %}
  • Create {{HOLE_NAME | capitalize}}
  • {% endif %} diff --git a/files/templates/admin/edit_rules.html b/files/templates/admin/edit_rules.html new file mode 100644 index 000000000..bd678cfc5 --- /dev/null +++ b/files/templates/admin/edit_rules.html @@ -0,0 +1,42 @@ +{% extends "default.html" %} + +{% block pagetitle %}Edit {{SITE_NAME}}'s rules{% endblock %} + +{% block content %} + +{% if msg %} + +{% endif %} + +
    +
    +
    +
    +

    Edit the Rules

    +
    +
    +
    +
    +
    + + + +
    + +
    +
    +
    +
    +
    +
    +
    + +{% endblock %} diff --git a/files/templates/rules_PCM.html b/files/templates/rules_PCM.html new file mode 100644 index 000000000..e69de29bb diff --git a/files/templates/rules_WPD.html b/files/templates/rules_WPD.html new file mode 100644 index 000000000..8bdbc32df --- /dev/null +++ b/files/templates/rules_WPD.html @@ -0,0 +1,31 @@ +

    Rules

    +
      +
    1. Do not post anything illegal under US law. +
        +
      • Do not threaten or advocate violence.
      • +
      • Do not sexualize minors.
      • +
      • Do not post animal cruelty/abuse.
      • +
      • Do not request illegal content.
      • +
      +
    2. +
    3. No doxing. No witch hunts.
    4. +
    5. Posts must include videos of people dying. +
        +
      • The Discussion, Social, and Music flairs are intentionally off-topic and do not require people dying.
      • +
      • Videos that only include aftermath of a serious accident/incident or current event may be allowed.
      • +
      • No animal death unless there's also a human dying in the video.
      • +
      +
    6. +
    7. Titles should be as descriptive as possible. +
        +
      • Additional context, images, or sources are always encouraged and appreciated. No joke titles please.
      • +
      • If there is a child hurt or killed, please put "Child Warning" in the title.
      • +
      +
    8. +
    9. No explicit racism or bigotry. +
        +
      • Humor is fine, but comments that are just low effort shock value spam may be removed. Feel free to express your opinions but please try to express them in a reasonable manner.
      • +
      +
    10. +
    11. No reposts within 60 days.
    12. +
    \ No newline at end of file diff --git a/files/templates/rules_rDrama.html b/files/templates/rules_rDrama.html new file mode 100644 index 000000000..4427e2362 --- /dev/null +++ b/files/templates/rules_rDrama.html @@ -0,0 +1,66 @@ +

    Drama: any incident, scene, gaffe, rumor, opinion, or disagreement that is blown entirely out of proportion.

    +

    Do your part to keep our community healthy by blowing everything out of proportion and making literally everything as dramatic as possible.

    +

    rdrama.net caters to drama in all forms such as: Real life, videos, photos, gossip, rumors, news sites, Reddit, and Beyondβ„’. There isn't drama we won't touch, and we want it all.

    +

    What we want:

    +
      +
    • Arguments.

    • +
    • Gossip.

    • +
    • Scandals.

    • +
    • Lolcows.

    • +
    • Assholes.

    • +
    • Trainwrecks.

    • +
    • Meltdowns.

    • +
    • Dramatic news articles.

    • +
    • Dramatic rumours (with context).

    • +
    • Dramatic everything from anywhere

    • +
    +

    A couple things to remember:

    +
      +
    • NO RIGHTWING AGENDAPOSTING.

    • +
    • Don't post anything illegal.

    • +
    • No sexualizing minors.

    • +
    • No doxing.

    • +
    • Using alts to game dramacoin will get you banned.

    • +
    • Supporting free speech is an immediate ban.

    • +
    • Absolutely NO anti-CCP sentiment.

    • +
    • Absolutely NO homophobia, transphobia or furphobia.

    • +
    • Absolutely NO misgendering.

    • +
    • Absolutely NO antisemitism.

    • +
    • Absolutely NO vaccine misinformation.

    • +
    • You are encouraged to post drama you are involved in.

    • +
    • This is a mod playground.

    • +
    • Participation implies enthusiastic consent to being mod abused by unstable alcoholic bullies.

    • +
    +

    Related subreddits:

    + +

    Off-site drama whoring websites:

    + +
    +

    This is an entertainment comedy website. Any and all posts and comments are parody with no basis in reality.

    +

    𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞

    diff --git a/files/templates/sidebar_PCM.html b/files/templates/sidebar_PCM.html index b2baf51e6..1db2080eb 100644 --- a/files/templates/sidebar_PCM.html +++ b/files/templates/sidebar_PCM.html @@ -48,4 +48,9 @@ sidebar image {% endif %} + + diff --git a/files/templates/sidebar_WPD.html b/files/templates/sidebar_WPD.html index e9dc2890f..4b77ab367 100644 --- a/files/templates/sidebar_WPD.html +++ b/files/templates/sidebar_WPD.html @@ -64,37 +64,8 @@ Music - diff --git a/files/templates/sidebar_rDrama.html b/files/templates/sidebar_rDrama.html index 5fe8b8ac5..afa849dcd 100644 --- a/files/templates/sidebar_rDrama.html +++ b/files/templates/sidebar_rDrama.html @@ -53,79 +53,9 @@ CREATE {{HOLE_NAME|upper}} {%- endif %} -