remotes/1693045480750635534/spooky-22
Aevann1 2022-05-01 23:44:38 +02:00
parent 0ff7bdc28a
commit bc2a20cd4b
29 changed files with 114 additions and 60 deletions

View File

@ -262,7 +262,7 @@ class User(Base):
return False
@cache.memoize(timeout=86400)
def userpagelisting(self, v=None, page=1, sort="new", t="all"):
def userpagelisting(self, site=None, v=None, page=1, sort="new", t="all"):
if self.shadowbanned and not (v and (v.admin_level > 1 or v.id == self.id)): return []

View File

@ -1228,7 +1228,7 @@ def unban_user(user_id, v):
user = g.db.query(User).filter_by(id=user_id).one_or_none()
if not user: abort(400)
if not user or not user.is_banned: abort(400)
user.is_banned = 0
user.unban_utc = 0
@ -1238,11 +1238,11 @@ def unban_user(user_id, v):
g.db.add(user)
for x in user.alts:
if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} has unbanned you!")
x.is_banned = 0
x.unban_utc = 0
x.ban_evade = 0
x.ban_reason = None
send_repeatable_notification(x.id, f"@{v.username} has unbanned you!")
g.db.add(x)
ma=ModAction(

View File

@ -308,7 +308,10 @@ def api_comment(v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body += f"\n\n{url}"
else: return {"error": "Image/Video files only"}, 400
@ -771,7 +774,10 @@ def edit_comment(cid, v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body += f"\n\n{url}"
else: return {"error": "Image/Video files only"}, 400

View File

@ -48,6 +48,9 @@ def error_405(e):
@app.errorhandler(413)
def error_413(e):
return {"error": "Max file size is 8 MB (16 MB for paypigs)"}, 413
if request.headers.get("Authorization") or request.headers.get("xhr"):
return {"error": "Max image size is 8 MB (16 MB for paypigs)"}, 413
else: return render_template('errors/413.html', err=True), 413
@app.errorhandler(429)
def error_429(e):

View File

@ -346,7 +346,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = posts.join(User, User.id == Submission.author_id).filter(User.shadowbanned == None)
if request.host == 'rdrama.net': num = 5
else: num = 0.1
else: num = 0.5
if sort == "hot":
ti = int(time.time()) + 3600

View File

@ -467,7 +467,10 @@ def edit_post(pid, v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body += f"\n\n{url}"
else: return {"error": "Image/Video files only"}, 400
@ -691,6 +694,11 @@ def thumbnail_thread(pid):
db.close()
return
size = len(image.fp.read())
if size > 8 * 1024 * 1024:
db.close()
return
name = f'/images/{time.time()}'.replace('.','') + '.webp'
with open(name, "wb") as file:
@ -1082,7 +1090,10 @@ def submit_post(v, sub=None):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body += f"\n\n{url}"
else:
@ -1188,7 +1199,10 @@ def submit_post(v, sub=None):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
post.url = url
else:

View File

@ -224,7 +224,10 @@ def settings_profile_post(v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
bio += f"\n\n{url}"
else:

View File

@ -372,7 +372,10 @@ def submit_contact(v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body_html += f"<p>{url}</p>"
else: return {"error": "Image/Video files only"}, 400

View File

@ -686,7 +686,10 @@ def messagereply(v):
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
except:
error = req['error']
if error == 'File exceeds max duration': error += ' (60 seconds)'
return {"error": error}, 400
if url.endswith('.'): url += 'mp4'
body_html += f"<p>{url}</p>"
else: return {"error": "Image/Video files only"}, 400
@ -887,7 +890,7 @@ def u_username(username, v=None):
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
ids = u.userpagelisting(v=v, page=page, sort=sort, t=t)
ids = u.userpagelisting(site=SITE, v=v, page=page, sort=sort, t=t)
next_exists = (len(ids) > 25)
ids = ids[:25]

View File

@ -15,7 +15,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% if v.agendaposter %}
<style>
html {

View File

@ -14,7 +14,7 @@
<title>Chat</title>
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244">
<link rel="stylesheet" href="/assets/css/main.css?v=246">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% if v.css %}
<link rel="stylesheet" href="/@{{v.username}}/css">

View File

@ -847,7 +847,7 @@
{% endif %}
{% if v %}
<script src="/assets/js/marked.js?v=250"></script>
<script src="/assets/js/marked.js?v=251"></script>
<script src="/assets/js/comments_v.js?v=266"></script>
{% endif %}

View File

@ -7,7 +7,7 @@
<script src="/assets/js/bootstrap.js?v=245"></script>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244">
<link rel="stylesheet" href="/assets/css/main.css?v=246">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% if v.agendaposter %}
<style>
@ -32,7 +32,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244">
<link rel="stylesheet" href="/assets/css/main.css?v=246">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
{% endif %}

View File

@ -0,0 +1,20 @@
{% extends "default.html" %}
{% block title %}
<title>Max image size is 8 MB (16 MB for paypigs)</title>
{% endblock %}
{% block pagetype %}error-413{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-10 col-md-5">
<div class="text-center px-3 my-8">
<img alt=":#marseyretard:" loading="lazy" src="/e/marseyretard.webp">
<pre></pre>
<h1 class="h5">Max image size is 8 MB (16 MB for paypigs)</h1>
<div><a href="/" class="btn btn-primary">Go to frontpage</a></div>
</div>
</div>
</div>
{% endblock %}

View File

@ -161,7 +161,7 @@
<div class="px-2">
<a class="dropdown-item" href="/assets/{{config('SITE_NAME')}}_v2.2.apk?v=1"><i class="fab fa-android fa-fw mr-3"></i>Android app</a>
<a class="dropdown-item" href="/changelog"><i class="fas fa-clipboard fa-fw mr-3"></i>Changelog</a>
<a class="dropdown-item" href="https://rdrama.net/changelog"><i class="fas fa-clipboard fa-fw mr-3"></i>Changelog</a>
<a class="dropdown-item" rel="nofollow noopener noreferrer" href="https://github.com/Aevann1/rDrama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a>

View File

@ -6,7 +6,7 @@
{% block content %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% if v.agendaposter %}
<style>
html {
@ -30,7 +30,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
{% endif %}
<div class="row justify-content-around">

View File

@ -18,7 +18,7 @@
{% endblock %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244">
<link rel="stylesheet" href="/assets/css/main.css?v=246">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
</head>

View File

@ -14,7 +14,7 @@
<title>2-Step Login - {{SITE_NAME}}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
</head>

View File

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% if v.agendaposter %}
<style>
html {

View File

@ -39,10 +39,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
{% endif %}
</head>
@ -77,7 +77,7 @@
<a class="nav-link{% if request.path.endswith('/blocks') %} active{% endif %}" href="/blocks"><i class="fas fa-user-slash pr-2"></i>Blocks</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.path.endswith('/changelog') %} active{% endif %}" href="/changelog"><i class="fas fa-clipboard pr-2"></i>Changelog</a>
<a class="nav-link{% if request.path.endswith('/changelog') %} active{% endif %}" href="https://rdrama.net/changelog"><i class="fas fa-clipboard pr-2"></i>Changelog</a>
</li>
</ul>
</div>
@ -108,7 +108,7 @@
<a style="padding: 0.75rem 1rem"class="nav-link{% if request.path.endswith('/blocks') %} active{% endif %}" href="/blocks"><i class="fas fa-eye-slash text-lg mr-0"></i></a>
</li>
<li class="nav-item">
<a style="padding: 0.75rem 1rem"class="nav-link{% if request.path.endswith('/changelog') %} active{% endif %}" href="/changelog"><i class="fas fa-clipboard text-lg mr-0"></i></a>
<a style="padding: 0.75rem 1rem"class="nav-link{% if request.path.endswith('/changelog') %} active{% endif %}" href="https://rdrama.net/changelog"><i class="fas fa-clipboard text-lg mr-0"></i></a>
</li>
</ul>
</div>

View File

@ -14,8 +14,8 @@
{% endif %}
{% if v %}
<div class="d-lg-block d-none btn-block">
<a class="btn btn-primary btn-block mb-3 {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK HOLE</a>
<a class="btn btn-primary btn-block mb-3 {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK HOLE</a>
<a class="btn btn-primary btn-block mb-3 {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">Block /h/{{sub.name}}</a>
<a class="btn btn-primary btn-block mb-3 {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">Unblock /h/{{sub.name}}</a>
</div>
<a class="btn btn-primary btn-block mb-3" href="/create_sub">CREATE HOLE</a>

View File

@ -9,8 +9,8 @@
{% endif %}
{% if v %}
<div class="d-lg-block d-none btn-block">
<a class="btn btn-primary btn-block {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK HOLE</a>
<a class="btn btn-primary btn-block {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK HOLE</a>
<a class="btn btn-primary btn-block {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">Block /h/{{sub.name}}</a>
<a class="btn btn-primary btn-block {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">Unblock /h/{{sub.name}}</a>
</div>
{% endif %}
<a class="btn btn-primary btn-block" href="/h/{{sub.name}}/mods">HOLE MODS</a>

View File

@ -4,7 +4,7 @@
{% set image=sub.sidebar_url %}
{% else %}
{% set path = "assets/images/" + SITE_NAME + "/sidebar" %}
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=41' %}
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=42' %}
{% endif %}
{% if v and (v.is_banned or v.agendaposter) %}
@ -19,8 +19,8 @@
{% endif %}
{% if v %}
<div class="d-lg-block d-none btn-block">
<a class="btn btn-primary btn-block mb-3 {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK HOLE</a>
<a class="btn btn-primary btn-block mb-3 {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK HOLE</a>
<a class="btn btn-primary btn-block mb-3 {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">Block /h/{{sub.name}}</a>
<a class="btn btn-primary btn-block mb-3 {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/h/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">Unblock /h/{{sub.name}}</a>
</div>
{% if v.admin_level > 2 %}

View File

@ -31,7 +31,7 @@
<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>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
</head>

View File

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=244"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
<link rel="stylesheet" href="/assets/css/main.css?v=246"><link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=56">
</head>

View File

@ -113,7 +113,7 @@
<input autocomplete="off" id="file-upload" type="file" name="file" {% if request.headers.get('cf-ipcountry')=="T1" %}disabled{% endif %} accept="image/*, video/*" hidden>
</label>
<small class="form-text text-muted">Optional if you have text.</small>
<small class="form-text text-muted">You can upload images or videos.</small>
<small class="form-text text-muted">You can upload images or videos up to 60 seconds.</small>
</div>
</div>
@ -227,9 +227,9 @@
</script>
{% endif %}
<script src="/assets/js/marked.js?v=250"></script>
<script src="/assets/js/marked.js?v=251"></script>
<script src="/assets/js/formatting.js?v=240"></script>
<script src="/assets/js/submit.js?v=254"></script>
<script src="/assets/js/submit.js?v=255"></script>
{% include "emoji_modal.html" %}
{% include "gif_modal.html" %}

View File

@ -769,7 +769,7 @@
</nav>
{% endif %}
<script src="/assets/js/marked.js?v=250"></script>
<script src="/assets/js/marked.js?v=251"></script>
{% if v and v.id != u.id and '/comments' not in request.path %}

File diff suppressed because one or more lines are too long

View File

@ -3765,4 +3765,6 @@ DUDE i just LOVE the calm relaxation of the Midwest town, it's so PEACEFUL and m
{[para]}
Thats not the point, its about ethics in games journalism.
{[para]}
![](/images/16512452037737622.webp)
![](/images/16512452037737622.webp)
{[para]}
It's too bad @carpathianflorist is dead. He would have loved this