forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
da8a3593b0
|
@ -115,3 +115,4 @@ local.txt
|
||||||
*.scssc
|
*.scssc
|
||||||
.idea/*
|
.idea/*
|
||||||
disablesignups
|
disablesignups
|
||||||
|
/rules.md
|
||||||
|
|
|
@ -3,6 +3,7 @@ import calendar
|
||||||
from sqlalchemy.orm import lazyload
|
from sqlalchemy.orm import lazyload
|
||||||
import imagehash
|
import imagehash
|
||||||
from os import remove
|
from os import remove
|
||||||
|
from os.path import exists
|
||||||
from PIL import Image as IMAGE
|
from PIL import Image as IMAGE
|
||||||
|
|
||||||
from files.helpers.wrappers import *
|
from files.helpers.wrappers import *
|
||||||
|
@ -52,6 +53,35 @@ def remove_admin(v, username):
|
||||||
return {"message": "Admin removed!"}
|
return {"message": "Admin removed!"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get('/admin/rules')
|
||||||
|
@admin_level_required(6)
|
||||||
|
def get_rules(v):
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open('./rules.md', 'r') as f:
|
||||||
|
rules = f.read()
|
||||||
|
except Exception:
|
||||||
|
rules = None
|
||||||
|
|
||||||
|
return render_template('admin/rules.html', v=v, rules=rules)
|
||||||
|
|
||||||
|
|
||||||
|
@app.post('/admin/rules')
|
||||||
|
@admin_level_required(6)
|
||||||
|
@validate_formkey
|
||||||
|
def post_rules(v):
|
||||||
|
|
||||||
|
text = request.form.get('rules', '')
|
||||||
|
|
||||||
|
with open('./rules.md', 'w+') as f:
|
||||||
|
f.write(text)
|
||||||
|
|
||||||
|
with open('./rules.md', 'r') as f:
|
||||||
|
rules = f.read()
|
||||||
|
|
||||||
|
return render_template('admin/rules.html', v=v, rules=rules)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/admin/shadowbanned")
|
@app.get("/admin/shadowbanned")
|
||||||
@auth_required
|
@auth_required
|
||||||
def shadowbanned(v):
|
def shadowbanned(v):
|
||||||
|
|
|
@ -3,10 +3,28 @@ from files.__main__ import app, limiter
|
||||||
from files.helpers.alerts import *
|
from files.helpers.alerts import *
|
||||||
from files.classes.award import AWARDS
|
from files.classes.award import AWARDS
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
from os import path
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
site_name = environ.get("SITE_NAME").strip()
|
site_name = environ.get("SITE_NAME").strip()
|
||||||
|
|
||||||
|
|
||||||
|
@app.get('/rules')
|
||||||
|
@auth_desired
|
||||||
|
def static_rules(v):
|
||||||
|
|
||||||
|
if not path.exists('./rules.md'):
|
||||||
|
if v and v.admin_level == 6:
|
||||||
|
return render_template('norules.html', v=v)
|
||||||
|
else:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
|
with open('./rules.md', 'r') as f:
|
||||||
|
rules = f.read()
|
||||||
|
|
||||||
|
return render_template('rules.html', rules=rules, v=v)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/stats")
|
@app.get("/stats")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def participation_stats(v):
|
def participation_stats(v):
|
||||||
|
|
|
@ -8,24 +8,38 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
<h4> Admin Tools</h4>
|
<h3> Admin Tools</h3>
|
||||||
{% filter markdown %}
|
{% filter markdown %}
|
||||||
* [Grant User Award](/admin/user_award)
|
#### Content
|
||||||
* [Advanced Stats](/admin/user_stat_data)
|
|
||||||
* [Banned Domains](/admin/banned_domains)
|
|
||||||
* [Shadowbanned Users](/admin/shadowbanned)
|
|
||||||
* [Users with Agendaposter Theme](/admin/agendaposters)
|
|
||||||
* [Flagged Posts](/admin/flagged/posts)
|
* [Flagged Posts](/admin/flagged/posts)
|
||||||
* [Flagged Comments](/admin/flagged/comments)
|
* [Flagged Comments](/admin/flagged/comments)
|
||||||
* [Image Posts](/admin/image_posts)
|
* [Image Posts](/admin/image_posts)
|
||||||
* [Removed Posts](/admin/removed)
|
* [Removed Posts](/admin/removed)
|
||||||
|
|
||||||
|
#### Users
|
||||||
|
* [Shadowbanned Users](/admin/shadowbanned)
|
||||||
|
* [Users with Agendaposter Theme](/admin/agendaposters)
|
||||||
* [Users Feed](/admin/users)
|
* [Users Feed](/admin/users)
|
||||||
|
|
||||||
|
#### Safety
|
||||||
|
* [Banned Domains](/admin/banned_domains)
|
||||||
* [Remove image from imgur and from cloudflare cache](/admin/image_purge)
|
* [Remove image from imgur and from cloudflare cache](/admin/image_purge)
|
||||||
* [Perceptive Hash Image Ban](/admin/image_ban)
|
* [Perceptive Hash Image Ban](/admin/image_ban)
|
||||||
* [Multi Vote Analysis](/admin/alt_votes)
|
* [Multi Vote Analysis](/admin/alt_votes)
|
||||||
* [Apps](/admin/apps)
|
|
||||||
|
#### Grant
|
||||||
|
* [Give User Award](/admin/user_award)
|
||||||
* [Badges](/admin/badge_grant)
|
* [Badges](/admin/badge_grant)
|
||||||
* [Content Stats](/admin/content_stats)
|
|
||||||
|
#### API Access Control
|
||||||
|
* [Apps](/admin/apps)
|
||||||
|
|
||||||
|
#### Statistics
|
||||||
|
* [Content Stats](/stats)
|
||||||
|
* [Advanced Stats](/admin/user_stat_data)
|
||||||
|
|
||||||
|
#### Configuration
|
||||||
|
* [Site Rules](/admin/rules)
|
||||||
|
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
{% extends "default.html" %}
|
||||||
|
|
||||||
|
{% block pagetitle %}Edit {{'SITE_NAME' | app_config}} rules{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row my-5">
|
||||||
|
<div class="col col-md-8">
|
||||||
|
<div class="settings">
|
||||||
|
<div id="description">
|
||||||
|
<h2>Edit rules</h2>
|
||||||
|
<p>Your rules page will be publicly visible at <a href="/rules">{{'/rules'|full_link}}</a>.</p>
|
||||||
|
<p class="text-small text-muted">Supports <a href="https://www.markdownguide.org/basic-syntax">markdown syntax</a>.</p>
|
||||||
|
</div>
|
||||||
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
<div class="w-lg-100">
|
||||||
|
<form id="profile-settings" action="/admin/rules" method="post">
|
||||||
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
|
<textarea class="form-control rounded" id="bio-text" aria-label="With textarea" placeholder="Site rules" rows="50" name="rules" form="profile-settings">{% if rules %}{{ rules }}{% endif %}</textarea>
|
||||||
|
|
||||||
|
<div class="d-flex mt-2">
|
||||||
|
<input class="btn btn-primary ml-auto" type="submit" value="Save">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -117,8 +117,8 @@
|
||||||
|
|
||||||
{% if "rdrama" in request.host %}
|
{% if "rdrama" in request.host %}
|
||||||
<a class="dropdown-item" href="/post/2510/posting-guidelines-policies-legal-shit"><i class="fas fa-balance-scale fa-fw text-left mr-3"></i>Rules</a>
|
<a class="dropdown-item" href="/post/2510/posting-guidelines-policies-legal-shit"><i class="fas fa-balance-scale fa-fw text-left mr-3"></i>Rules</a>
|
||||||
{% elif "pcm" in request.host %}
|
{% else %}
|
||||||
<a class="dropdown-item" href="/post/94/hi-welcome-to-pcmemesnet-im-your"><i class="fas fa-balance-scale fa-fw text-left mr-3"></i>Rules</a>
|
<a class="dropdown-item" href="/rules"><i class="fas fa-balance-scale fa-fw text-left mr-3"></i>Rules</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a class="dropdown-item" href="/changelog"><i class="fas fa-clipboard fa-fw text-left mr-3"></i>Changelog</a>
|
<a class="dropdown-item" href="/changelog"><i class="fas fa-clipboard fa-fw text-left mr-3"></i>Changelog</a>
|
||||||
|
@ -179,8 +179,8 @@
|
||||||
|
|
||||||
{% if "rdrama" in request.host %}
|
{% if "rdrama" in request.host %}
|
||||||
<li class="nav-item"><a class="nav-link" href="/post/2510/posting-guidelines-policies-legal-shit"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a></li>
|
<li class="nav-item"><a class="nav-link" href="/post/2510/posting-guidelines-policies-legal-shit"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a></li>
|
||||||
{% elif "pcm" in request.host %}
|
{% else %}
|
||||||
<li class="nav-item"><a class="nav-link" href="/post/94/hi-welcome-to-pcmemesnet-im-your"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a></li>
|
<li class="nav-item"><a class="nav-link" href="/rules"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="nav-item"><a class="nav-link" rel="nofollow noopener noreferrer" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a></li>
|
<li class="nav-item"><a class="nav-link" rel="nofollow noopener noreferrer" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a></li>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{% extends "default.html" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
<title>not configured</title>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block pagetype %}message{% endblock %}
|
||||||
|
|
||||||
|
{% block customPadding %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-10 col-md-5">
|
||||||
|
<div class="text-center py-7 py-md-8">
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<i class="fas text-gray-600 fa-exclamation-triangle" style="font-size: 5rem!important;"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1 class="h5">You haven't set up your rules page yet</h1>
|
||||||
|
<div class="text-small text-muted mb-3">Your rules will be publicly available here.</div>
|
||||||
|
<a href="/admin/rules" class="btn btn-primary btn-sm">Set up rules</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends "default.html" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
<title>{{'SITE_NAME' | app_config}} Rules</title>
|
||||||
|
<meta name="description" content="{{'SITE_NAME' | app_config}} Rules">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
<div class="mx-4 mt-2 mb-6">
|
||||||
|
<h5 class="text-muted text-uppercase">{{'SITE_NAME'|app_config}} Rules{% if v and v.admin_level == 6 %} <a href="/admin/rules" class="btn btn-link text-lowercase"><i class="far fa-fw fa-pencil"></i> Edit rules</a>{% endif %}</h5>
|
||||||
|
|
||||||
|
<div id="rules" class="my-3">
|
||||||
|
{{ rules|markdown }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue