master
Aevann1 2021-12-10 00:11:19 +02:00
parent afd3126542
commit ed258d4dfc
4 changed files with 24 additions and 78 deletions

View File

@ -125,7 +125,7 @@ def after_request(response):
response.headers.add("Strict-Transport-Security", "max-age=31536000")
response.headers.add("X-Frame-Options", "deny")
response.headers.add("Content-Security-Policy", "script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' tls-use1.fpapi.io api.fpjs.io 02ddcc80-b8db-42be-9022-44c546b4dce6.pushnotifications.pusher.com; object-src 'none';")
response.headers.add("Content-Security-Policy", "script-src 'self'; connect-src 'self' tls-use1.fpapi.io api.fpjs.io 02ddcc80-b8db-42be-9022-44c546b4dce6.pushnotifications.pusher.com; object-src 'none';")
return response
from files.routes import *

View File

@ -198,7 +198,11 @@
{% if c.active_flags %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
{% if v and v.admin_level > 1 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Shadowbanned by @{{c.author.shadowbanned}}"></i>{% endif %}
{% if c.is_pinned %}<i id='pinned-{{c.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned {% if c.is_pinned.startswith('t:') %}until {{c.is_pinned[2:]}}{% else %}by @{{c.is_pinned}}{%endif%}"></i>{% endif %}
{% if c.is_pinned and c.is_pinned.startswith('t:') %}
<i id='pinned-{{c.id}}' onmouseover="pinned_tooltip('pinned-{{c.id}}')" class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-timestamp={{c.is_pinned[2:]}}*1000></i>
{% elif c.is_pinned %}
<i id='pinned-{{c.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned by @{{c.is_pinned}}"></i>
{% endif %}
{% if c.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
{% if c.is_op %}<i class="fas fa-microphone-stand text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="OP"></i>{% endif %}
{% if c.is_bot %}<i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bot"></i>{% endif %}
@ -761,36 +765,7 @@
{% include "expanded_image_modal.html" %}
<script src="/assets/js/popover.js?v=10"></script>
<script src="/assets/js/comments.js?v=9"></script>
<script>
{% if p and (not v or v.highlightcomments) %}
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
lastCount = comments['{{p.id}}']
redhtml = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Unread"></i>'
if (lastCount)
{
{% for c in comments %}
{% if not (v and v.id==c.author_id) %}
if ({{c.created_utc*1000}} > lastCount.t) document.getElementById("reddot-{{c.id}}").innerHTML = redhtml
{% endif %}
{% endfor %}
}
{% endif %}
(() => {
{% for c in comments %}
{% if c.is_pinned %}
const pinned_info = document.getElementById('pinned-{{c.id}}')
{% if c.is_pinned.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{c.is_pinned[2:]}} * 1000).toString()}`)
{% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{c.is_pinned}}")
{%endif%}
{%endif%}
{% endfor %}
})()
</script>
<script src="/assets/js/comments.js?v=10"></script>
{% if offset %}
{% if p %}

View File

@ -14,7 +14,7 @@
{% block title %}
{% if v and (v.id == p.author_id or v.admin_level > 1 and v.admin_level > 2) %}
<script src="/assets/js/submission.js?v=2"></script>
<script src="/assets/js/submission.js?v=3"></script>
{% endif %}
<script src="/assets/js/new_comments_count.js?v=53"></script>
@ -357,7 +357,13 @@
{% endfor %}
{% endif %}
{% if v and v.admin_level > 1 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
{% if p.stickied %}<i id="pinned-{{p.id}}" class="fas fa-thumbtack fa-rotate--45 fa-fw text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned {% if p.stickied.startswith('t:') %}until {{p.stickied[2:]}}{% else %}by @{{p.stickied}}{%endif%}"></i>{% endif %}
{% if p.stickied and p.stickied.startswith('t:') %}
<i id='pinned-{{p.id}}' onmouseover="pinned_tooltip('pinned-{{p.id}}')" class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-timestamp={{p.stickied[2:]}}*1000></i>
{% elif p.stickied %}
<i id='pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned by @{{p.stickied}}"></i>
{% endif %}
{% if p.is_pinned %}<i class="fas fa-thumbtack fa-rotate--45 fa-fw text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned to profile"></i>{% endif %}
{% if p.distinguish_level %} <i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
{% if p.is_bot %} <i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bot"></i>{% endif %}
@ -827,30 +833,6 @@
</div>
<script>
(() => {
{% if (not v or v.highlightcomments) %}
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
{% endif %}
{% if "?context" not in request.full_path %}
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || { c: 0 }).c + 1)
comments['{{p.id}}'] = { c: newTotal, t: Date.now() }
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
{% endif %}
{% if p.stickied %}
const pinned_info = document.getElementById('pinned-{{p.id}}')
{% if p.stickied.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{p.stickied[2:]}} * 1000).toString()}`)
{% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}")
{%endif%}
{%endif%}
})()
</script>
{% if v and v.id==p.author_id %}
{% include "delete_post_modal.html" %}
{% endif %}
@ -873,7 +855,7 @@
{% include "ban_modal.html" %}
{% endif %}
{% endif %}
<script src="/assets/js/comments.js?v=9"></script>
<script src="/assets/js/comments.js?v=10"></script>
{% include "expanded_image_modal.html" %}
{% endif %}

View File

@ -57,23 +57,6 @@
</div>
</div>
<script>
(() => {
{% if (not v or v.highlightcomments) %}
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
{% endif %}
{% if p.stickied %}
const pinned_info = document.getElementById('pinned-{{p.id}}')
{% if p.stickied.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{p.stickied[2:]}} * 1000).toString()}`)
{% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}")
{%endif%}
{%endif%}
})()
</script>
{% set ups=p.upvotes %}
{% set downs=p.downvotes %}
{% set score=ups-downs %}
@ -176,7 +159,13 @@
{% endfor %}
{% endif %}
{% if v and v.admin_level > 1 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
{% if p.stickied %}<i id='pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned {% if p.stickied.startswith('t:') %}until {{p.stickied[2:]}}{% else %}by @{{p.stickied}}{%endif%}"></i>{% endif %}
{% if p.stickied and p.stickied.startswith('t:') %}
<i id='pinned-{{p.id}}' onmouseover="pinned_tooltip('pinned-{{p.id}}')" class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-timestamp={{p.stickied[2:]}}*1000></i>
{% elif p.stickied %}
<i id='pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned by @{{p.stickied}}"></i>
{% endif %}
{% if p.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Pinned to profile"></i>{% endif %}
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
@ -662,4 +651,4 @@
<script src="/assets/js/clipboard.js?v=3"></script>
<script src="/assets/js/popover.js?v=10"></script>
<script src="/assets/js/submission_listing.js?v=5"></script>
<script src="/assets/js/submission_listing.js?v=6"></script>