vcx
This commit is contained in:
parent
b210e9604d
commit
587e945d6e
13 changed files with 78 additions and 28 deletions
|
@ -3,11 +3,6 @@ from .get import *
|
|||
from os import listdir, environ
|
||||
from .const import *
|
||||
|
||||
@app.template_filter("full_link")
|
||||
def full_link(url):
|
||||
|
||||
return f"{SITE_FULL}{url}"
|
||||
|
||||
@app.template_filter("app_config")
|
||||
def app_config(x):
|
||||
return app.config.get(x)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import html
|
||||
from .front import frontlist
|
||||
from datetime import datetime
|
||||
from files.helpers.jinja2 import full_link
|
||||
from files.helpers.get import *
|
||||
from yattag import Doc
|
||||
from files.helpers.wrappers import *
|
||||
|
@ -55,7 +54,7 @@ def feeds_user(v=None, sort='hot', t='all'):
|
|||
with tag("uri"):
|
||||
text(f'{SITE_FULL}/@{post.author_name}')
|
||||
|
||||
doc.stag("link", href=full_link(post.permalink))
|
||||
doc.stag("link", href=post.permalink)
|
||||
|
||||
image_url = post.thumb_url or post.embed_url or post.url
|
||||
|
||||
|
|
|
@ -660,7 +660,62 @@ def thumbnail_thread(pid):
|
|||
db.add(post)
|
||||
db.commit()
|
||||
|
||||
for i in requests.get('https://api.pushshift.io/reddit/submission/search?html_decode=true&q=rdrama&size=100').json()["data"]:
|
||||
print(i)
|
||||
|
||||
body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
|
||||
|
||||
if existing_comment: break
|
||||
|
||||
print('sex')
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
body_html=body_html,
|
||||
level=1,
|
||||
sentto=0,
|
||||
)
|
||||
db.add(new_comment)
|
||||
db.flush()
|
||||
|
||||
admins = db.query(User).filter(User.admin_level > 0).all()
|
||||
for admin in admins:
|
||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
db.add(notif)
|
||||
break
|
||||
|
||||
for i in requests.get('https://api.pushshift.io/reddit/comment/search?html_decode=true&q=rdrama&size=100').json()["data"]:
|
||||
print(i)
|
||||
|
||||
body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
|
||||
|
||||
if existing_comment: break
|
||||
|
||||
print('ffugq')
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
body_html=body_html,
|
||||
level=1,
|
||||
sentto=0,
|
||||
)
|
||||
db.add(new_comment)
|
||||
db.flush()
|
||||
|
||||
admins = db.query(User).filter(User.admin_level > 0).all()
|
||||
for admin in admins:
|
||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
db.add(notif)
|
||||
break
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
stdout.flush()
|
||||
return
|
||||
|
||||
|
||||
|
|
|
@ -1022,7 +1022,8 @@ def fp(v, fp):
|
|||
new_alt = Alt(user1=v.id, user2=u.id)
|
||||
g.db.add(new_alt)
|
||||
g.db.flush()
|
||||
print('\n\n' + v.username + ' + ' + u.username + '\n\n')
|
||||
if v.email == u.email: print('\n\n' + v.username + ' + ' + u.username + v.email + '\n\n')
|
||||
if v.fp == u.fp: print('\n\n' + v.username + ' + ' + u.username + v.fp + '\n\n')
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return '', 204
|
|
@ -441,7 +441,7 @@
|
|||
|
||||
<a class="btn caction nobackground px-1 text-muted" href="{{c.permalink}}"><i class="fas fa-book-open"></i>Context</a>
|
||||
|
||||
<button class="btn caction py-0 nobackground px-1 text-muted copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{c.permalink}}{% else %}{{c.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
|
||||
<button class="btn caction py-0 nobackground px-1 text-muted copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{c.permalink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
|
||||
|
||||
{% if v %}
|
||||
<button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
|
||||
|
@ -611,7 +611,7 @@
|
|||
|
||||
{% if not c.ghost %}<a href="/votes?link={{c.fullname}}"><li class="list-group-item"><i class="fas fa-arrows-v"></i>Votes</li></a>{% endif %}
|
||||
|
||||
<a role="button" role="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{c.permalink}}{% else %}{{c.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
<a role="button" role="button" class="list-group-item copy-link" data-bs-dismiss="modal" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{c.permalink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
|
||||
<a class="list-group-item" href="{{c.permalink}}"><i class="fas fa-dna"></i>Context</a>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<meta property="og:title" content="{{SITE_NAME}}" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
|
||||
<meta property="og:url" content="{{request.path | full_link}}">
|
||||
<meta property="og:url" content="{{request.url}}">
|
||||
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
|
||||
<meta property="og:author" name="author" content="@{{SITE_FULL}}/" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
|
@ -59,7 +59,7 @@
|
|||
<meta name="twitter:creator" content="@{{SITE_FULL}}/">
|
||||
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
|
||||
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
|
||||
<meta name="twitter:url" content="{{request.path | full_link}}" >
|
||||
<meta name="twitter:url" content="{{request.url}}" >
|
||||
{% endblock %}
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
</div>
|
||||
|
||||
<div class="text-gray-500">{{ma.age_string}} <a href="{{ma.permalink}}"><i class="far fa-link ml-1 text-muted"></i></a>
|
||||
<a role="button" class="copy-link" role="button"data-clipboard-text="{{ma.permalink | full_link}}"><i class="far fa-copy ml-1 text-muted"></i></a>
|
||||
<a role="button" class="copy-link" role="button"data-clipboard-text="{{ma.permalink}}"><i class="far fa-copy ml-1 text-muted"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
Messages
|
||||
</a>
|
||||
</li>
|
||||
{% if v.admin_level > 1 %}
|
||||
{% if v.admin_level > 2 %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link py-3{% if '/notifications?modmail=true' in request.full_path %} active{% endif %}" href="/notifications?modmail=true">
|
||||
Modmail
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<meta property="og:title" content="{{SITE_NAME}}" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
|
||||
<meta property="og:url" content="{{request.path | full_link}}">
|
||||
<meta property="og:url" content="{{request.url}}">
|
||||
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
|
||||
<meta property="og:author" name="author" content="{{SITE_FULL}}/" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
|
@ -30,7 +30,7 @@
|
|||
<meta name="twitter:creator" content="{{SITE_FULL}}/">
|
||||
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
|
||||
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
|
||||
<meta name="twitter:url" content="{{request.path | full_link}}" >
|
||||
<meta name="twitter:url" content="{{request.url}}" >
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
|
||||
<div class="body w-lg-100">
|
||||
|
||||
<input autocomplete="off" type="text" readonly="" class="form-control copy-link" id="rss_feed" value="{{('/rss/hot/all') | full_link}}" data-clipboard-text="{{('/rss/hot/all') | full_link}}">
|
||||
<input autocomplete="off" type="text" readonly="" class="form-control copy-link" id="rss_feed" value="{{SITE_FULL}}/rss/hot/all" data-clipboard-text="{{SITE_FULL}}/rss/hot/all">
|
||||
|
||||
<div class="text-small-extra text-muted mt-3">You can change the feed by replacing "hot" with whatever sorting you want and "all" with whatever time filter you want.</div>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if success %}
|
||||
<script>
|
||||
history.pushState(null, null, '{{p.permalink | full_link}}');
|
||||
history.pushState(null, null, '{{p.permalink}}');
|
||||
localStorage.setItem("post_title", "")
|
||||
localStorage.setItem("post_text", "")
|
||||
</script>
|
||||
|
@ -225,7 +225,7 @@
|
|||
{% if p.is_video %}
|
||||
<meta property="og:video" content="{{p.realurl(v)}}" >
|
||||
{% endif %}
|
||||
<meta property="og:url" content="{{comment_info.permalink | full_link}}" >
|
||||
<meta property="og:url" content="{{comment_info.permalink}}" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
|
||||
<meta name="twitter:card" content="summary" >
|
||||
|
@ -234,7 +234,7 @@
|
|||
<meta name="twitter:creator" content="{{'@'+comment_info.author_name}}">
|
||||
<meta name="twitter:description" content="{{comment_info.plainbody(v)}}" >
|
||||
<meta name="twitter:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp{% endif %}" >
|
||||
<meta name="twitter:url" content="{{p.permalink | full_link}}" >
|
||||
<meta name="twitter:url" content="{{p.permalink}}" >
|
||||
|
||||
{% else %}
|
||||
<title>{{p.plaintitle(v)}} - {{SITE_NAME}}</title>
|
||||
|
@ -250,7 +250,7 @@
|
|||
{% if p.url and p.is_video %}
|
||||
<meta property="og:video" content="{{p.realurl(v)}}" >
|
||||
{% endif %}
|
||||
<meta property="og:url" content="{{p.permalink | full_link}}" >
|
||||
<meta property="og:url" content="{{p.permalink}}" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
@ -259,7 +259,7 @@
|
|||
{% if p.author %}<meta name="twitter:creator" content="{{'@'+p.author_name}}">{% endif %}
|
||||
<meta name="twitter:description" content="{{p.plainbody(v)}}" >
|
||||
<meta name="twitter:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb %}{{p.thumb_url}}{% else %}{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp{% endif %}" >
|
||||
<meta name="twitter:url" content="{{p.permalink | full_link}}" >
|
||||
<meta name="twitter:url" content="{{p.permalink}}" >
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -603,7 +603,7 @@
|
|||
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" onclick="awardModal('/post/{{p.id}}/awards')"><i class="fas fa-gift fa-fw"></i>Give Award</a>
|
||||
{% endif %}
|
||||
|
||||
<a class="list-inline-item copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
<a class="list-inline-item copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
|
||||
{% if v %}
|
||||
<a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2('/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a>
|
||||
|
@ -740,7 +740,7 @@
|
|||
{% endif %}
|
||||
</li>
|
||||
|
||||
<a class="list-inline-item copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-link"></i>Copy link</a>
|
||||
<a class="list-inline-item copy-link" role="button" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-link"></i>Copy link</a>
|
||||
{% if v %}
|
||||
<li class="list-inline-item">
|
||||
<a role="button" data-bs-toggle="modal" data-bs-target="#actionsModal">
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" onclick="awardModal('/post/{{p.id}}/awards')"><i class="fas fa-gift fa-fw"></i>Give Award</a>
|
||||
{% endif %}
|
||||
|
||||
<a class="list-inline-item copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
<a class="list-inline-item copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>
|
||||
|
||||
{% if v %}
|
||||
<a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2('/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a>
|
||||
|
@ -326,7 +326,7 @@
|
|||
|
||||
</li>
|
||||
|
||||
<a class="copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink | full_link}}{% endif %}" style="margin-right: 15px;margin-top:5px;"><i class="fas fa-link"></i></a>
|
||||
<a class="copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://rdrama.com{{p.permalink}}{% else %}{{p.permalink}}{% endif %}" style="margin-right: 15px;margin-top:5px;"><i class="fas fa-link"></i></a>
|
||||
|
||||
{% if p.realbody(v) and request.path != "/changelog"%}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<meta property="og:author" name="author" content="@{{u.username}}" >
|
||||
<meta property="og:title" content="{{u.username}}" >
|
||||
<meta property="og:image" content="{{u.banner_url}}" >
|
||||
<meta property="og:url" content="{{u.url | full_link}}" >
|
||||
<meta property="og:url" content="{{u.url}}" >
|
||||
<meta property="og:site_name" content="{{request.host}}" >
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
@ -26,7 +26,7 @@
|
|||
<meta name="twitter:creator" content="@{{u.username}}">
|
||||
<meta name="twitter:description" content="{{u.coins}} coins - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers -{% endif %} {% if not u.is_private %} {{0 if u.shadowbanned else u.post_count}} Posts - {{0 if u.shadowbanned else u.comment_count}} Comments - {% endif %}{{u.bio}}">
|
||||
<meta name="twitter:image" content="{{u.banner_url}}" >
|
||||
<meta name="twitter:url" content="{{u.url | full_link}}" >
|
||||
<meta name="twitter:url" content="{{u.url}}" >
|
||||
{% endblock %}
|
||||
|
||||
{% block desktopUserBanner %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue