forked from rDrama/rDrama
master
parent
2207a094e7
commit
a22bc2f27e
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
||||
{% if v and c.id in v.saved_comment_idlist() %}
|
||||
<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>
|
||||
{% else %}
|
||||
<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>
|
||||
{% if v %}
|
||||
<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>
|
||||
<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>
|
||||
{% endif %}
|
||||
|
||||
{% 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>
|
||||
|
||||
{% if c.deleted_utc > 0 %}
|
||||
<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 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 %}
|
||||
<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 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>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -336,7 +336,7 @@
|
|||
|
||||
<label class="btn btn-secondary m-0" for="file-upload">
|
||||
<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>
|
||||
|
||||
<small class="form-text text-muted">Optional if you have text.</small>
|
||||
|
|
Loading…
Reference in New Issue