Merge branch 'master' of https://github.com/Aevann1/Drama
This commit is contained in:
commit
e0c2bd9630
9 changed files with 34 additions and 26 deletions
|
@ -28,7 +28,7 @@ def upload_ibb(file, resize=False):
|
|||
|
||||
om = next(frames)
|
||||
om.info = i.info
|
||||
try: om.save(f"image.{om.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
||||
try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return
|
||||
|
@ -63,7 +63,7 @@ def upload_imgur(file, resize=False):
|
|||
|
||||
om = next(frames)
|
||||
om.info = i.info
|
||||
try: om.save(f"image.{om.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
||||
try: om.save(f"image.{i.format}", save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return
|
||||
|
|
|
@ -1052,7 +1052,7 @@ def admin_banned_domains(v):
|
|||
@validate_formkey
|
||||
def admin_toggle_ban_domain(v):
|
||||
|
||||
domain=request.form.get("DOMAIN").strip()
|
||||
domain=request.form.get("domain", "").strip()
|
||||
if not domain: abort(400)
|
||||
|
||||
reason=request.form.get("reason", "").strip()
|
||||
|
|
|
@ -278,9 +278,9 @@ def api_comment(v):
|
|||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
||||
file.save(f"image.{file.format}", optimize=True, quality=30)
|
||||
if 'pcmemes.net' in request.host: url = upload_ibb(f"image.{file.format}")
|
||||
else: url = upload_imgur(f"image.{file.format}")
|
||||
file.save(f"image.{file.filename.split('.')[-1]}")
|
||||
if 'pcmemes.net' in request.host: url = upload_ibb(f"image.{file.filename.split('.')[-1]}")
|
||||
else: url = upload_imgur(f"image.{file.filename.split('.')[-1]}")
|
||||
|
||||
body = request.form.get("body") + f"\n"
|
||||
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||
|
|
|
@ -158,9 +158,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
if lt:
|
||||
posts = posts.filter(Submission.created_utc < lt)
|
||||
|
||||
if not (v and v.shadowbanned):
|
||||
posts=posts.join(Submission.author)
|
||||
posts=posts.filter(User.shadowbanned == False)
|
||||
if v:
|
||||
posts = posts.join(Submission.author).filter(or_(User.shadowbanned==False, Submission.author_id==v.id))
|
||||
else:
|
||||
posts = posts.join(Submission.author).filter(User.shadowbanned == False)
|
||||
|
||||
if sort == "hot":
|
||||
posts = sorted(posts.all(), key=lambda x: x.hotscore, reverse=True)
|
||||
|
@ -182,6 +183,8 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
else:
|
||||
abort(400)
|
||||
|
||||
#print('fartbinn' in [x.author.username for x in posts])
|
||||
|
||||
firstrange = 50 * (page - 1)
|
||||
secondrange = firstrange+51
|
||||
posts = posts[firstrange:secondrange]
|
||||
|
|
|
@ -918,8 +918,8 @@ def submit_post(v):
|
|||
), 400
|
||||
else:
|
||||
if file.content_type.startswith('image/'):
|
||||
file.save(f"image.{file.format}", optimize=True, quality=30)
|
||||
new_post.url = upload_imgur(f"image.{file.format}")
|
||||
file.save(f"image.{file.filename.split('.')[-1]}")
|
||||
new_post.url = upload_imgur(f"image.{file.filename.split('.')[-1]}")
|
||||
else:
|
||||
try:
|
||||
post_url = upload_video(file)
|
||||
|
|
|
@ -52,10 +52,13 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
|
|||
posts = posts.filter(Submission.over_18==True)
|
||||
|
||||
if 'author' in criteria:
|
||||
posts=posts.filter(
|
||||
Submission.author_id==get_user(criteria['author']).id,
|
||||
User.is_private==False,
|
||||
)
|
||||
if v and v.admin_level == 6:
|
||||
posts = posts.filter(Submission.author_id == get_user(criteria['author']).id)
|
||||
else:
|
||||
posts=posts.filter(
|
||||
Submission.author_id==get_user(criteria['author']).id,
|
||||
User.is_private==False,
|
||||
)
|
||||
|
||||
if 'domain' in criteria:
|
||||
domain=criteria['domain']
|
||||
|
|
|
@ -498,14 +498,16 @@ def settings_images_profile(v):
|
|||
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||
|
||||
file = request.files["profile"]
|
||||
file.save(f"image.{file.format}", optimize=True, quality=30)
|
||||
if 'pcmemes.net' in request.host: highres = upload_ibb(f"image.{file.format}")
|
||||
else: highres = upload_imgur(f"image.{file.format}")
|
||||
print(file.filename)
|
||||
print(file.filename.split('.')[-1])
|
||||
file.save(f"image.{file.filename.split('.')[-1]}")
|
||||
if 'pcmemes.net' in request.host: highres = upload_ibb(f"image.{file.filename.split('.')[-1]}")
|
||||
else: highres = upload_imgur(f"image.{file.filename.split('.')[-1]}")
|
||||
|
||||
if not highres: abort(400)
|
||||
|
||||
if 'pcmemes.net' in request.host: imageurl = upload_ibb(f"image.{file.format}", True)
|
||||
else: imageurl = upload_imgur(f"image.{file.format}", True)
|
||||
if 'pcmemes.net' in request.host: imageurl = upload_ibb(f"image.{file.filename.split('.')[-1]}", True)
|
||||
else: imageurl = upload_imgur(f"image.{file.filename.split('.')[-1]}", True)
|
||||
|
||||
if not imageurl: abort(400)
|
||||
|
||||
|
@ -527,10 +529,10 @@ def settings_images_banner(v):
|
|||
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||
|
||||
file = request.files["banner"]
|
||||
file.save(f"image.{file.format}", optimize=True, quality=30)
|
||||
file.save(f"image.{file.filename.split('.')[-1]}")
|
||||
|
||||
if 'pcmemes.net' in request.host: imageurl = upload_ibb(f"image.{file.format}")
|
||||
else: imageurl = upload_imgur(f"image.{file.format}")
|
||||
if 'pcmemes.net' in request.host: imageurl = upload_ibb(f"image.{file.filename.split('.')[-1]}")
|
||||
else: imageurl = upload_imgur(f"image.{file.filename.split('.')[-1]}")
|
||||
|
||||
if imageurl:
|
||||
v.bannerurl = imageurl
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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="body d-lg-flex">
|
||||
<div class="w-lg-100">
|
||||
<form id="profile-settings" action="/admin/rules" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
|
|
|
@ -432,9 +432,9 @@
|
|||
<li class="list-group-item"><a href="/votes?link={{c.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a></li>
|
||||
|
||||
{% if v %}
|
||||
<li id="save2-{{c.id}}" class="{% if c.id not in v.saved_comment_idlist() %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" data-dismiss="modal" onclick="post_toast2('/save_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')"><i class="fas fa-save"></i>Save</a></li>
|
||||
<li id="save2-{{c.id}}" class="{% if c not in v.saved_comment_idlist() %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" data-dismiss="modal" onclick="post_toast2('/save_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')"><i class="fas fa-save"></i>Save</a></li>
|
||||
|
||||
<li id="unsave2-{{c.id}}" class="{% if c.id in v.saved_comment_idlist() %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" onclick="post_toast2('/unsave_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')" data-dismiss="modal"><i class="fas fa-save"></i>Unsave</a></li>
|
||||
<li id="unsave2-{{c.id}}" class="{% if c in v.saved_comment_idlist() %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" onclick="post_toast2('/unsave_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')" data-dismiss="modal"><i class="fas fa-save"></i>Unsave</a></li>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue