master
Aevann1 2021-09-08 14:27:29 +02:00
parent db7ecb67ca
commit ebb977cb55
5 changed files with 63 additions and 76 deletions

View File

@ -220,7 +220,7 @@
// Delete Post // Delete Post
function delete_postModal(id) { function delete_postModal(id,button1,button2) {
// Passed data for modal // Passed data for modal
@ -240,6 +240,9 @@
) )
} }
document.getElementById(button1).classList.toggle("d-none");
document.getElementById(button2).classList.toggle("d-none");
}; };
// Delete Comment // Delete Comment

View File

@ -109,7 +109,7 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-dismiss="modal" onclick="togglePostEdit('{{p.id}}')"><i class="far fa-edit text-center text-muted mr-3"></i>Edit</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-dismiss="modal" onclick="togglePostEdit('{{p.id}}')"><i class="far fa-edit text-center text-muted mr-3"></i>Edit</button>
<button class="nobackground btn btn-link btn-block btn-lg text-muted text-left" id="pin-post-{{p.id}}" href="javascript:void(0)" onclick="post('/pin/{{p.id}}',callback=function(){window.location.reload(true);})"><i class="fas fa-thumbtack text-center mr-3"></i>{% if p.is_pinned %}Unpin from your profile{% else %}Pin to your profile{% endif %}</button> <button class="nobackground btn btn-link btn-block btn-lg text-muted text-left" id="pin-post-{{p.id}}" href="javascript:void(0)" onclick="post('/pin/{{p.id}}',callback=function(){window.location.reload(true);})"><i class="fas fa-thumbtack text-center mr-3"></i>{% if p.is_pinned %}Unpin from profile{% else %}Pin to profile{% endif %}</button>
{% if p.deleted_utc > 0 %} {% if p.deleted_utc > 0 %}
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')" data-dismiss="modal"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Undelete</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')" data-dismiss="modal"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Undelete</button>
@ -406,42 +406,37 @@
<li class="list-inline-item"><a href="javascript:void(0);" role="button" class="copy-link" data-clipboard-text="{% if 'rdrama' in request.host %}https://taytay.life{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a></li> <li class="list-inline-item"><a href="javascript:void(0);" role="button" class="copy-link" data-clipboard-text="{% if 'rdrama' in request.host %}https://taytay.life{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a></li>
{% if v and not (v.admin_level == 6 and v.id == p.author_id) %} {% if v %}
{% if p.id in v.subscribed_idlist() %} <li id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/unsubscribe/{{p.id}}')"><i class="fas fa-eye-slash"></i>Unsubscribe</a></li> <li id="unsubscribe-{{p.id}}" class="{% if p.id not in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/unsubscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye-slash"></i>Unsubscribe</a></li>
{% else %}
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/subscribe/{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a></li>
{% endif %}
{% endif %} {% endif %}
{% if v and p.id in v.saved_idlist() %} <li id="save-{{p.id}}" class="{% if v and p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/save_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Save</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/unsave_post/{{p.id}}')"><i class="fas fa-save"></i>Unsave</a></li> <li id="unsave-{{p.id}}" class="{% if v and not p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/unsave_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Unsave</a></li>
{% elif v %}
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/save_post/{{p.id}}')"><i class="fas fa-save"></i>Save</a></li>
{% endif %}
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.id}}', '{{p.author.username}}')"><i class="fas fa-flag"></i>Report</a></li> <li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.id}}', '{{p.author.username}}')"><i class="fas fa-flag"></i>Report</a></li>
{% if v and v.id==p.author_id %} {% if v and v.id==p.author_id %}
<li class="list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast('/pin/{{p.id}}')"><i class="fas fa-thumbtack"></i>{% if p.is_pinned %}Unpin from your profile{% else %}Pin to your profile{% endif %}</a></li> <li id="pin-profile-{{p.id}}" class="{% if p.is_stickied %}d-none{% endif %} list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast2('/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack"></i>Pin to profile</a></li>
{% if p.deleted_utc > 0 %} <li id="unpin-profile-{{p.id}}" class="{% if not p.is_stickied %}d-none{% endif %} list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast2('/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack"></i>Unpin from profile</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')"><i class="fas fa-trash-alt"></i>Undelete</a></li>
{% else %} <li id="delete-{{p.id}}" class="{% if p.deleted_utc %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}','undelete-{{p.id}}','delete-{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li> <li id="undelete-{{p.id}}" class="{% if not p.deleted_utc %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/undelete_post/{{p.id}}','undelete-{{p.id}}','delete-{{p.id}}')"><i class="fas fa-trash-alt"></i>Undelete</a></li>
{% endif %}
{% endif %} {% endif %}
{% if v and v.admin_level>=3 %} {% if v and v.admin_level>=3 %}
<li class="list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast('/sticky/{{p.id}}')"><i class="fas fa-thumbtack"></i>{% if p.stickied %}Unpin{% else %}Pin{% endif %}</a></li> <li id="pin-{{p.id}}" class="{% if p.stickied %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/sticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack"></i>Pin</a></li>
<li id="unpin-{{p.id}}" class="{% if not p.stickied %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/sticky/{{p.id}}','/sticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack"></i>Unpin</a></li>
{% if v==p.author %} {% if v==p.author %}
<li class="list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast('/distinguish/{{p.id}}')"><i class="fas fa-crown"></i>Distinguish</a></li> <li id="distinguish-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Distinguish</a></li>
<li id="undistinguish-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Undistinguish</a></li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if v %} {% if v %}
{% if v.admin_level >=3 %} {% if v.admin_level >=3 %}
<li class="list-inline-item"><a class="text-success" href="javascript:void(0)" onclick="post_toast('/unban_post/{{p.id}}')"><i class="fas fa-check"></i>Approve</a></li> <li id="remove-{{p.id}}" class="{% if p.is_banned %}d-none{% endif %} list-inline-item"><a class="text-danger" href="javascript:void(0)" onclick="post_toast2('/ban_post/{{p.id}}','remove-{{p.id}}','approve-{{p.id}}')"><i class="fas fa-ban"></i>Remove</a></li>
<li class="list-inline-item"><a class="text-danger" href="javascript:void(0)" onclick="post_toast('/ban_post/{{p.id}}')"><i class="fas fa-ban"></i>Remove</a></li> <li id="approve-{{p.id}}" class="{% if not p.is_banned %}d-none{% endif %} list-inline-item"><a class="text-success" href="javascript:void(0)" onclick="post_toast2('/unban_post/{{p.id}}','remove-{{p.id}}','approve-{{p.id}}')"><i class="fas fa-check"></i>Approve</a></li>
{% endif %} {% endif %}
{% if v.id == p.author_id or v.admin_level >= 3 %} {% if v.id == p.author_id or v.admin_level >= 3 %}
@ -453,27 +448,18 @@
{% endif %} {% endif %}
{% if not v.id==p.author_id and v.admin_level == 0 %} {% if not v.id==p.author_id and v.admin_level == 0 %}
<li id="block-user-{{p.id}}" class="list-inline-item {% if p.is_blocking %}d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast('/settings/block?username={{p.author.username}}', callback=function(){document.getElementById('block-user-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-{{p.id}}').classList.toggle('d-none');})" <li id="block-user-{{p.id}}" class="list-inline-item {% if p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast2('/settings/block?username={{p.author.username}}','block-user-{{p.id}}','unblock-user-{{p.id}}')"><i class="fas fa-eye-slash"></i>Block user</a></li>
><i class="fas fa-eye-slash"></i>Block user</a></li> <li id="unblock-user-{{p.id}}" class="list-inline-item {% if not p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast2('/settings/unblock?username={{p.author.username}}','block-user-{{p.id}}','unblock-user-{{p.id}}')"><i class="fas fa-eye"></i>Unblock user</a></li>
<li id="unblock-user-{{p.id}}" class="list-inline-item{% if not p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast('/settings/unblock?username={{p.author.username}}', callback=function(){document.getElementById('block-user-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-{{p.id}}').classList.toggle('d-none');})"
><i class="fas fa-eye"></i>Unblock user</a></li>
{% endif %} {% endif %}
{% if not v.id==p.author_id and v.admin_level == 1 %} {% if not v.id==p.author_id and v.admin_level == 1 %}
<li id="sex-user-{{p.id}}" class="list-inline-item{% if p.is_blocking %} d-none{% endif %}"><a class="text-danger" href="javascript:void(0)" onclick="post_toast('/settings/block?username={{p.author.username}}', callback=function(){document.getElementById('block-user-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-{{p.id}}').classList.toggle('d-none');})" <li id="sex-user-{{p.id}}" class="list-inline-item{% if p.is_blocking %} d-none{% endif %}"><a class="text-danger" href="javascript:void(0)" onclick="post_toast2('/settings/block?username={{p.author.username}}','sex-user-{{p.id}}','unsex-user-{{p.id}}')"><i class="fas fa-user-slash text-danger"></i>Ban user</a></li>
><i class="fas fa-user-slash text-danger"></i>Ban user</a></li> <li id="unsex-user-{{p.id}}" class="list-inline-item{% if not p.is_blocking %} d-none{% endif %}"><a class="text-success" href="javascript:void(0)" onclick="post_toast2('/settings/unblock?username={{p.author.username}}','sex-user-{{p.id}}','unsex-user-{{p.id}}')"><i class="fas fa-user-slash text-success"></i>Unban user</a></li>
<li id="unsex-user-{{p.id}}" class="list-inline-item{% if not p.is_blocking %} d-none{% endif %}"><a class="text-success" href="javascript:void(0)" onclick="post_toast('/settings/unblock?username={{p.author.username}}', callback=function(){document.getElementById('block-user-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-{{p.id}}').classList.toggle('d-none');})"
><i class="fas fa-user-slash text-success"></i>Unban user</a></li>
{% endif %} {% endif %}
{% if v.admin_level >=3 and v.id!=p.author_id %} {% if v.admin_level >=3 and v.id!=p.author_id %}
{% if p.author.is_suspended %} <li id="ban-{{p.id}}" class="{% if p.author.is_suspended %}d-none{% endif %} list-inline-item"><a class="text-danger" id="exile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast2('/ban_user/{{p.author_id}}/?reason={{p.permalink}}','ban-{{p.id}}','unban-{{p.id}}')"><i class="fas fa-user-slash"></i>Ban user</a></li>
<li class="list-inline-item"><a class="text-success" href="javascript:void(0)" onclick="post_toast('/unban_user/{{p.author_id}}')" <li id="unban-{{p.id}}" class="{% if not p.author.is_suspended %}d-none{% endif %} list-inline-item"><a class="text-danger" id="unexile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast2('/unban_user/{{p.author_id}}','ban-{{p.id}}','unban-{{p.id}}')"><i class="fas fa-user-slash"></i>Unban user</a></li>
><i class="fas fa-user-slash text-success"></i>Unban user</a></li>
{% else %}
<li class="list-inline-item "><a class="text-danger" href="javascript:void(0)" onclick="post_toast('/ban_user/{{p.author_id}}/?reason={{p.permalink}}')"
><i class="fas fa-user-slash text-danger"></i>Ban user</a></li>
{% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@ -20,14 +20,14 @@
{% endif %} {% endif %}
<div id="post-{{p.id}}" class="card{% if p.is_banned %} banned{% endif %}{% if p.deleted_utc > 0 %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.over_18 %} nsfw{% endif %}"> <div id="post-{{p.id}}" class="card{% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.over_18 %} nsfw{% endif %}">
<div class="d-flex flex-row-reverse flex-md-row flex-nowrap justify-content-end"> <div class="d-flex flex-row-reverse flex-md-row flex-nowrap justify-content-end">
<!-- Voting on "medium" devices or larger, hidden on smaller devices --> <!-- Voting on "medium" devices or larger, hidden on smaller devices -->
{% if not postembed %} {% if not postembed %}
<div class="voting my-2 d-none d-md-block pr-2"> <div class="voting my-2 d-none d-md-block pr-2">
{% if v and request.path.startswith('/@') and v.admin_level == 0 %} {% if v and request.path.startswith('/@') and not v.admin_level %}
{% if voted==1 %} {% if voted==1 %}
<div class="mx-auto arrow-up post-{{p.id}}-up active"></div> <div class="mx-auto arrow-up post-{{p.id}}-up active"></div>
@ -148,41 +148,39 @@
<li class="list-inline-item"><a href="javascript:void(0);" role="button" class="copy-link" data-clipboard-text="{% if 'rdrama' in request.host %}https://taytay.life{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a></li> <li class="list-inline-item"><a href="javascript:void(0);" role="button" class="copy-link" data-clipboard-text="{% if 'rdrama' in request.host %}https://taytay.life{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a></li>
{% if v and not (v.admin_level == 6 and v.id == p.author_id) %} {% if v %}
<li id="unsubscribe-{{p.id}}" class="{% if p.id not in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/unsubscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye-slash"></i>Unsubscribe</a></li>
<li id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a></li> <li id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a></li>
<li id="unsubscribe-{{p.id}}" class="{% if p.id not in v.subscribed_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/unsubscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye-slash"></i>Unsubscribe</a></li>
{% endif %} {% endif %}
{% if v and p.id in v.saved_idlist() %} <li id="save-{{p.id}}" class="{% if v and p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/save_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Save</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/unsave_post/{{p.id}}')"><i class="fas fa-save"></i>Unsave</a></li> <li id="unsave-{{p.id}}" class="{% if v and not p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/unsave_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Unsave</a></li>
{% elif v %}
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/save_post/{{p.id}}')"><i class="fas fa-save"></i>Save</a></li>
{% endif %}
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.id}}', '{{p.author.username}}')"><i class="fas fa-flag"></i>Report</a></li> <li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.id}}', '{{p.author.username}}')"><i class="fas fa-flag"></i>Report</a></li>
{% if v and v.id==p.author_id %} {% if v and v.id==p.author_id %}
<li class="list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast('/pin/{{p.id}}')"><i class="fas fa-thumbtack"></i>{% if p.is_pinned %}Unpin from your profile{% else %}Pin to your profile{% endif %}</a></li> <li id="pin-profile-{{p.id}}" class="{% if p.is_stickied %}d-none{% endif %} list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast2('/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack"></i>Pin to profile</a></li>
{% if p.deleted_utc > 0 %} <li id="unpin-profile-{{p.id}}" class="{% if not p.is_stickied %}d-none{% endif %} list-inline-item"><a class="text-muted" href="javascript:void(0)" onclick="post_toast2('/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack"></i>Unpin from profile</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')"><i class="fas fa-trash-alt"></i>Undelete</a></li>
{% else %} <li id="delete-{{p.id}}" class="{% if p.deleted_utc %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}','undelete-{{p.id}}','delete-{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li>
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li> <li id="undelete-{{p.id}}" class="{% if not p.deleted_utc %}d-none{% endif %} list-inline-item"><a href="javascript:void(0)" onclick="post_toast2('/undelete_post/{{p.id}}','undelete-{{p.id}}','delete-{{p.id}}')"><i class="fas fa-trash-alt"></i>Undelete</a></li>
{% endif %}
{% endif %} {% endif %}
{% if v and v.admin_level>=3 %} {% if v and v.admin_level>=3 %}
<li class="list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast('/sticky/{{p.id}}')"><i class="fas fa-thumbtack"></i>{% if p.stickied %}Unpin{% else %}Pin{% endif %}</a></li> <li id="pin-{{p.id}}" class="{% if p.stickied %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/sticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack"></i>Pin</a></li>
<li id="unpin-{{p.id}}" class="{% if not p.stickied %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/sticky/{{p.id}}','/sticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack"></i>Unpin</a></li>
{% if v==p.author %} {% if v==p.author %}
<li class="list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast('/distinguish/{{p.id}}')"><i class="fas fa-crown"></i>Distinguish</a></li> <li id="distinguish-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Distinguish</a></li>
<li id="undistinguish-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} list-inline-item"><a class="text-info" href="javascript:void(0)" onclick="post_toast2('/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Undistinguish</a></li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if v %} {% if v %}
{% if v.admin_level >=3 %} {% if v.admin_level >=3 %}
<li class="list-inline-item"><a class="text-success" id="moderate-post-{{p.id}}" href="javascript:void(0)" onclick="post_toast('/unban_post/{{p.id}}')"><i class="fas fa-check"></i>Approve</a></li> <li id="remove-{{p.id}}" class="{% if p.is_banned %}d-none{% endif %} list-inline-item"><a class="text-danger" href="javascript:void(0)" onclick="post_toast2('/ban_post/{{p.id}}','remove-{{p.id}}','approve-{{p.id}}')"><i class="fas fa-ban"></i>Remove</a></li>
<li class="list-inline-item"><a class="text-danger" id="moderate-post-{{p.id}}" href="javascript:void(0)" onclick="post_toast('/ban_post/{{p.id}}')"><i class="fas fa-ban"></i>Remove</a></li> <li id="approve-{{p.id}}" class="{% if not p.is_banned %}d-none{% endif %} list-inline-item"><a class="text-success" href="javascript:void(0)" onclick="post_toast2('/unban_post/{{p.id}}','remove-{{p.id}}','approve-{{p.id}}')"><i class="fas fa-check"></i>Approve</a></li>
{% endif %} {% endif %}
@ -190,9 +188,9 @@
<li class="list-inline-item"><a href="{{p.oauth_app.permalink}}" ><i class="fas fa-code"></i>API App</a></li> <li class="list-inline-item"><a href="{{p.oauth_app.permalink}}" ><i class="fas fa-code"></i>API App</a></li>
{% endif %} {% endif %}
{% if not v.id==p.author_id and v.admin_level == 0 %} {% if not v.id==p.author_id and not v.admin_level %}
<li id="block-user-{{p.id}}" class="list-inline-item {% if p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast('/settings/block?username={{p.author.username}}')"><i class="fas fa-eye-slash"></i>Block user</a></li> <li id="block-user-{{p.id}}" class="list-inline-item {% if p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast2('/settings/block?username={{p.author.username}}','block-user-{{p.id}}','unblock-user-{{p.id}}')"><i class="fas fa-eye-slash"></i>Block user</a></li>
<li id="unblock-user-{{p.id}}" class="list-inline-item {% if not p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast('/settings/unblock?username={{p.author.username}}')"><i class="fas fa-eye"></i>Unblock user</a></li> <li id="unblock-user-{{p.id}}" class="list-inline-item {% if not p.is_blocking %} d-none{% endif %}"><a href="javascript:void(0)" onclick="post_toast2('/settings/unblock?username={{p.author.username}}','block-user-{{p.id}}','unblock-user-{{p.id}}')"><i class="fas fa-eye"></i>Unblock user</a></li>
{% endif %} {% endif %}
{% if v and (v.id==p.author_id or v.admin_level>=3) %} {% if v and (v.id==p.author_id or v.admin_level>=3) %}
@ -202,13 +200,8 @@
{% endif %} {% endif %}
{% if v.admin_level >=3 and v.id!=p.author_id %} {% if v.admin_level >=3 and v.id!=p.author_id %}
{% if p.author.is_suspended %} <li id="ban-{{p.id}}" class="{% if p.author.is_suspended %}d-none{% endif %} list-inline-item"><a class="text-danger" id="exile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast2('/ban_user/{{p.author_id}}/?reason={{p.permalink}}','ban-{{p.id}}','unban-{{p.id}}')"><i class="fas fa-user-slash"></i>Ban user</a></li>
<li class="list-inline-item"><a class="text-danger" id="unexile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast('/unban_user/{{p.author_id}}')" <li id="unban-{{p.id}}" class="{% if not p.author.is_suspended %}d-none{% endif %} list-inline-item"><a class="text-danger" id="unexile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast2('/unban_user/{{p.author_id}}','ban-{{p.id}}','unban-{{p.id}}')"><i class="fas fa-user-slash"></i>Unban user</a></li>
><i class="fas fa-user-slash"></i>Unban user</a></li>
{% else %}
<li class="list-inline-item"><a class="text-danger" id="exile2-user-{{p.id}}" href="javascript:void(0)" onclick="post_toast('/ban_user/{{p.author_id}}/?reason={{p.permalink}}')"
><i class="fas fa-user-slash"></i>Ban user</a></li>
{% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -235,7 +228,7 @@
</li> </li>
{% endif %} {% endif %}
{% if not postembed %} {% if not postembed %}
{% if v and request.path.startswith('/@') and v.admin_level == 0 %} {% if v and request.path.startswith('/@') and not v.admin_level %}
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none"> <li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
{% if voted==1 %} {% if voted==1 %}
@ -299,9 +292,9 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted"><a href="javascript:void(0)" onclick="post_toast('/publish/{{p.id}}')" data-dismiss="modal"><i class="fas fa-globe text-center text-muted mr-3"></i>Publish</a></button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted"><a href="javascript:void(0)" onclick="post_toast('/publish/{{p.id}}')" data-dismiss="modal"><i class="fas fa-globe text-center text-muted mr-3"></i>Publish</a></button>
{% endif %} {% endif %}
<button class="nobackground btn btn-link btn-block btn-lg text-muted text-left" id="pin-post-{{p.id}}" href="javascript:void(0)" onclick="post('/pin/{{p.id}}',callback=function(){window.location.reload(true);})"><i class="fas fa-thumbtack text-center mr-3"></i>{% if p.is_pinned %}Unpin from your profile{% else %}Pin to your profile{% endif %}</button> <button class="nobackground btn btn-link btn-block btn-lg text-muted text-left" id="pin-post-{{p.id}}" href="javascript:void(0)" onclick="post('/pin/{{p.id}}',callback=function(){window.location.reload(true);})"><i class="fas fa-thumbtack text-center mr-3"></i>{% if p.is_pinned %}Unpin from profile{% else %}Pin to profile{% endif %}</button>
{% if p.deleted_utc > 0 %} {% if p.deleted_utc %}
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')" data-dismiss="modal"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Undelete</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" href="javascript:void(0)" onclick="post_toast('/undelete_post/{{p.id}}')" data-dismiss="modal"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Undelete</button>
{% else %} {% else %}
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Delete</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="far fa-trash-alt text-center text-muted mr-3"></i>Delete</button>
@ -343,7 +336,7 @@
{% endif %} {% endif %}
{% if v and v.id != p.author_id and v.admin_level == 0 %} {% if v and v.id != p.author_id and not v.admin_level %}
<button id="block-user-button-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-muted text-left{% if p.is_blocking %} d-none{% endif %}" data-dismiss="modal" onclick="post_toast('/settings/block?username={{p.author.username}}', callback=function(){document.getElementById('block-user-button-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-button-{{p.id}}').classList.toggle('d-none');})" <button id="block-user-button-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-muted text-left{% if p.is_blocking %} d-none{% endif %}" data-dismiss="modal" onclick="post_toast('/settings/block?username={{p.author.username}}', callback=function(){document.getElementById('block-user-button-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-button-{{p.id}}').classList.toggle('d-none');})"
><i class="fas fa-eye-slash mr-3"></i>Block user</button> ><i class="fas fa-eye-slash mr-3"></i>Block user</button>
<button id="unblock-user-button-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-muted text-left{% if not p.is_blocking %} d-none{% endif %}" data-dismiss="modal" onclick="post_toast('/settings/unblock?username={{p.author.username}}', callback=function(){document.getElementById('block-user-button-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-button-{{p.id}}').classList.toggle('d-none');})" <button id="unblock-user-button-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-muted text-left{% if not p.is_blocking %} d-none{% endif %}" data-dismiss="modal" onclick="post_toast('/settings/unblock?username={{p.author.username}}', callback=function(){document.getElementById('block-user-button-{{p.id}}').classList.toggle('d-none');document.getElementById('unblock-user-button-{{p.id}}').classList.toggle('d-none');})"
@ -354,6 +347,11 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast('/toggle_post_nsfw/{{p.id}}')" data-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Toggle +18</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast('/toggle_post_nsfw/{{p.id}}')" data-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Toggle +18</button>
{% endif %} {% endif %}
{% if not v.id==p.author_id and v.admin_level == 1 %}
<li id="sex-user-{{p.id}}" class="list-inline-item{% if p.is_blocking %} d-none{% endif %}"><a class="text-danger" href="javascript:void(0)" onclick="post_toast2('/settings/block?username={{p.author.username}}','sex-user-{{p.id}}','unsex-user-{{p.id}}')"><i class="fas fa-user-slash text-danger"></i>Ban user</a></li>
<li id="unsex-user-{{p.id}}" class="list-inline-item{% if not p.is_blocking %} d-none{% endif %}"><a class="text-success" href="javascript:void(0)" onclick="post_toast2('/settings/unblock?username={{p.author.username}}','sex-user-{{p.id}}','unsex-user-{{p.id}}')"><i class="fas fa-user-slash text-success"></i>Unban user</a></li>
{% endif %}
{% if v and v.admin_level == 6 and v.id!=p.author_id %} {% if v and v.admin_level == 6 and v.id!=p.author_id %}
{% if p.author.is_suspended %} {% if p.author.is_suspended %}
<button class="nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast('/unban_user/{{p.author_id}}')" data-dismiss="modal"><i class="fas fa-user-minus mr-3"></i>Unban user</a></button> <button class="nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast('/unban_user/{{p.author_id}}')" data-dismiss="modal"><i class="fas fa-user-minus mr-3"></i>Unban user</a></button>

View File

@ -1,3 +1,3 @@
source /env source /env
killall gunicorn killall gunicorn
gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --reload-extra-file ./files/templates/

View File

@ -5,7 +5,7 @@ logfile=/tmp/supervisord.log
[program:service] [program:service]
directory=/service directory=/service
command=gunicorn files.__main__:app -k gevent -w 2 --max-requests 10000 --max-requests-jitter 500 --reload --bind 0.0.0.0:80 command=gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --reload-extra-file ./files/templates/
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr