master
Aevann1 2021-09-08 22:22:27 +02:00
parent 2207a094e7
commit a22bc2f27e
4 changed files with 55 additions and 55 deletions

View File

@ -894,53 +894,53 @@ def submit_post(v):
if 'pcm' in request.host: if 'pcm' in request.host:
if file.content_type.startswith('image/'): if file.content_type.startswith('image/'):
new_post.url = upload_ibb(file) new_post.url = upload_ibb(file)
# else: else:
# try: try:
# post_url = upload_video(file) post_url = upload_video(file)
# if not post_url.endswith('.mp4'): if not post_url.endswith('.mp4'):
# post_url += 'mp4' post_url += 'mp4'
# new_post.url = post_url new_post.url = post_url
# new_post.processing = True new_post.processing = True
# gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db)
# except UploadException as e: except UploadException as e:
# if request.headers.get("Authorization"): if request.headers.get("Authorization"):
# return { return {
# "error": str(e), "error": str(e),
# }, 400 }, 400
# else: else:
# return render_template( return render_template(
# "submit.html", "submit.html",
# v=v, v=v,
# error=str(e), error=str(e),
# title=title, title=title,
# body=request.form.get("body", "") body=request.form.get("body", "")
# ), 400 ), 400
else: else:
if file.content_type.startswith('image/'): if file.content_type.startswith('image/'):
new_post.url = upload_imgur(file) new_post.url = upload_imgur(file)
# else: else:
# try: try:
# post_url = upload_video(file) post_url = upload_video(file)
# # shit to make webm work # shit to make webm work
# if not post_url.endswith('.mp4'): if not post_url.endswith('.mp4'):
# post_url += 'mp4' post_url += 'mp4'
# # print(post_url) # print(post_url)
# new_post.url = post_url new_post.url = post_url
# new_post.processing = True new_post.processing = True
# gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db) gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db)
# except UploadException as e: except UploadException as e:
# if request.headers.get("Authorization"): if request.headers.get("Authorization"):
# return { return {
# "error": str(e), "error": str(e),
# }, 400 }, 400
# else: else:
# return render_template( return render_template(
# "submit.html", "submit.html",
# v=v, v=v,
# error=str(e), error=str(e),
# title=title, title=title,
# body=request.form.get("body", "") body=request.form.get("body", "")
# ), 400 ), 400
g.db.add(new_post) g.db.add(new_post)
g.db.add(new_post.submission_aux) g.db.add(new_post.submission_aux)

View File

@ -269,10 +269,9 @@
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="/votes?link={{c.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a></li> <li class="list-inline-item text-muted d-none d-md-inline-block"><a href="/votes?link={{c.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a></li>
{% if v and c.id in v.saved_comment_idlist() %} {% if v %}
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast('/unsave_comment/{{c.id}}')"><i class="fas fa-save"></i>Unsave</a></li> <li class="{% if c in v.saved_comment_idlist() %}d-none{% endif %} list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast('/save_comment/{{c.id}}')"><i class="fas fa-save"></i>Save</a></li>
{% else %} <li class="{% if not c in v.saved_comment_idlist() %}d-none{% endif %} list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast('/unsave_comment/{{c.id}}')"><i class="fas fa-save"></i>Unsave</a></li>
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast('/save_comment/{{c.id}}')"><i class="fas fa-save"></i>Save</a></li>
{% endif %} {% endif %}
{% if v %} {% if v %}
@ -298,11 +297,9 @@
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</a></li> <li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</a></li>
{% if c.deleted_utc > 0 %} <li id="delete-{{c.id}}" class="{% if c.deleted_utc %}d-none{% endif %} list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" data-toggle="modal" data-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}','delete-{{c.id}}','undelete-{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Delete</a></li>
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast('/undelete/comment/{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Undelete</a></li>
{% else %} <li id="undelete-{{c.id}}" class="{% if not c.deleted_utc %}d-none{% endif %} list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" onclick="post_toast2('/undelete/comment/{{c.id}}','delete-{{c.id}}','undelete-{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Undelete</a></li>
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0)" data-toggle="modal" data-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Delete</a></li>
{% endif %}
{% endif %} {% endif %}

View File

@ -247,7 +247,7 @@
// Delete Comment // Delete Comment
function delete_commentModal(id) { function delete_commentModal(id,button1,button2) {
// Passed data for modal // Passed data for modal
@ -263,6 +263,9 @@
) )
} }
document.getElementById(button1).classList.toggle("d-none");
document.getElementById(button2).classList.toggle("d-none");
}; };
//flagging //flagging

View File

@ -336,7 +336,7 @@
<label class="btn btn-secondary m-0" for="file-upload"> <label class="btn btn-secondary m-0" for="file-upload">
<div id="filename-show">Select File</div> <div id="filename-show">Select File</div>
<input id="file-upload" type="file" name="file" accept="image/*" hidden> <input id="file-upload" type="file" name="file" accept="image/*, video/*" hidden>
</label> </label>
<small class="form-text text-muted">Optional if you have text.</small> <small class="form-text text-muted">Optional if you have text.</small>