From a22bc2f27e07c707f0a8d2cf167e42830d9fa3df Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 8 Sep 2021 22:22:27 +0200 Subject: [PATCH] fd --- files/routes/posts.py | 88 +++++++++++++++++------------------ files/templates/comments.html | 15 +++--- files/templates/default.html | 5 +- files/templates/submit.html | 2 +- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index ac8002b5c..233f6519f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -894,53 +894,53 @@ def submit_post(v): if 'pcm' in request.host: if file.content_type.startswith('image/'): new_post.url = upload_ibb(file) - # else: - # try: - # post_url = upload_video(file) - # if not post_url.endswith('.mp4'): - # post_url += 'mp4' - # new_post.url = post_url - # new_post.processing = True - # gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) - # except UploadException as e: - # if request.headers.get("Authorization"): - # return { - # "error": str(e), - # }, 400 - # else: - # return render_template( - # "submit.html", - # v=v, - # error=str(e), - # title=title, - # body=request.form.get("body", "") - # ), 400 + else: + try: + post_url = upload_video(file) + if not post_url.endswith('.mp4'): + post_url += 'mp4' + new_post.url = post_url + new_post.processing = True + gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) + except UploadException as e: + if request.headers.get("Authorization"): + return { + "error": str(e), + }, 400 + else: + return render_template( + "submit.html", + v=v, + error=str(e), + title=title, + body=request.form.get("body", "") + ), 400 else: if file.content_type.startswith('image/'): new_post.url = upload_imgur(file) - # else: - # try: - # post_url = upload_video(file) - # # shit to make webm work - # if not post_url.endswith('.mp4'): - # post_url += 'mp4' - # # print(post_url) - # new_post.url = post_url - # new_post.processing = True - # gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) - # except UploadException as e: - # if request.headers.get("Authorization"): - # return { - # "error": str(e), - # }, 400 - # else: - # return render_template( - # "submit.html", - # v=v, - # error=str(e), - # title=title, - # body=request.form.get("body", "") - # ), 400 + else: + try: + post_url = upload_video(file) + # shit to make webm work + if not post_url.endswith('.mp4'): + post_url += 'mp4' + # print(post_url) + new_post.url = post_url + new_post.processing = True + gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) + except UploadException as e: + if request.headers.get("Authorization"): + return { + "error": str(e), + }, 400 + else: + return render_template( + "submit.html", + v=v, + error=str(e), + title=title, + body=request.form.get("body", "") + ), 400 g.db.add(new_post) g.db.add(new_post.submission_aux) diff --git a/files/templates/comments.html b/files/templates/comments.html index 320776a0e..71b278abc 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -269,10 +269,9 @@
  • Votes
  • - {% if v and c.id in v.saved_comment_idlist() %} -
  • Unsave
  • - {% else %} -
  • Save
  • + {% if v %} +
  • Save
  • +
  • Unsave
  • {% endif %} {% if v %} @@ -298,11 +297,9 @@
  • Edit
  • - {% if c.deleted_utc > 0 %} -
  • Undelete
  • - {% else %} -
  • Delete
  • - {% endif %} +
  • Delete
  • + +
  • Undelete
  • {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 1f34dd880..c6ee49043 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -247,7 +247,7 @@ // Delete Comment - function delete_commentModal(id) { + function delete_commentModal(id,button1,button2) { // Passed data for modal @@ -263,6 +263,9 @@ ) } + document.getElementById(button1).classList.toggle("d-none"); + document.getElementById(button2).classList.toggle("d-none"); + }; //flagging diff --git a/files/templates/submit.html b/files/templates/submit.html index 01425d08b..419b677d5 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -336,7 +336,7 @@ Optional if you have text.