forked from MarseyWorld/MarseyWorld
temporarily disable push notifs to get rid of console spam
parent
e7ce39bd80
commit
58867084af
|
@ -26,8 +26,8 @@ import os
|
||||||
|
|
||||||
d = Dict("en_US")
|
d = Dict("en_US")
|
||||||
|
|
||||||
if PUSHER_ID != 'blahblahblah':
|
# if PUSHER_ID != 'blahblahblah':
|
||||||
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
# beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
||||||
|
|
||||||
WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"}
|
WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"}
|
||||||
|
|
||||||
|
@ -595,9 +595,9 @@ def api_comment(v):
|
||||||
n = Notification(comment_id=c.id, user_id=x)
|
n = Notification(comment_id=c.id, user_id=x)
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
if parent.author.id != v.id and PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
# if parent.author.id != v.id and PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
||||||
try: gevent.spawn(pusher_thread, f'{request.host}{parent.author.id}', c, c.author_name)
|
# try: gevent.spawn(pusher_thread, f'{request.host}{parent.author.id}', c, c.author_name)
|
||||||
except: pass
|
# except: pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import gevent
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
import os
|
import os
|
||||||
|
|
||||||
if PUSHER_ID != 'blahblahblah':
|
# if PUSHER_ID != 'blahblahblah':
|
||||||
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
# beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
||||||
|
|
||||||
def pusher_thread2(interests, notifbody, username):
|
def pusher_thread2(interests, notifbody, username):
|
||||||
beams_client.publish_to_interests(
|
beams_client.publish_to_interests(
|
||||||
|
@ -701,12 +701,12 @@ def message2(v, username):
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
|
|
||||||
if PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
# if PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
||||||
if len(message) > 500: notifbody = message[:500] + '...'
|
# if len(message) > 500: notifbody = message[:500] + '...'
|
||||||
else: notifbody = message
|
# else: notifbody = message
|
||||||
|
|
||||||
try: gevent.spawn(pusher_thread2, f'{request.host}{user.id}', notifbody, v.username)
|
# try: gevent.spawn(pusher_thread2, f'{request.host}{user.id}', notifbody, v.username)
|
||||||
except: pass
|
# except: pass
|
||||||
|
|
||||||
return {"message": "Message sent!"}
|
return {"message": "Message sent!"}
|
||||||
|
|
||||||
|
@ -767,32 +767,32 @@ def messagereply(v):
|
||||||
for n in notifications:
|
for n in notifications:
|
||||||
g.db.delete(n)
|
g.db.delete(n)
|
||||||
|
|
||||||
if PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
# if PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
|
||||||
if len(body) > 500: notifbody = body[:500] + '...'
|
# if len(body) > 500: notifbody = body[:500] + '...'
|
||||||
else: notifbody = body
|
# else: notifbody = body
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
# beams_client.publish_to_interests(
|
||||||
interests=[f'{request.host}{user_id}'],
|
# interests=[f'{request.host}{user_id}'],
|
||||||
publish_body={
|
# publish_body={
|
||||||
'web': {
|
# 'web': {
|
||||||
'notification': {
|
# 'notification': {
|
||||||
'title': f'New message from @{v.username}',
|
# 'title': f'New message from @{v.username}',
|
||||||
'body': notifbody,
|
# 'body': notifbody,
|
||||||
'deep_link': f'{SITE_FULL}/notifications?messages=true',
|
# 'deep_link': f'{SITE_FULL}/notifications?messages=true',
|
||||||
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1015',
|
# 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1015',
|
||||||
}
|
# }
|
||||||
},
|
# },
|
||||||
'fcm': {
|
# 'fcm': {
|
||||||
'notification': {
|
# 'notification': {
|
||||||
'title': f'New message from @{v.username}',
|
# 'title': f'New message from @{v.username}',
|
||||||
'body': notifbody,
|
# 'body': notifbody,
|
||||||
},
|
# },
|
||||||
'data': {
|
# 'data': {
|
||||||
'url': '/notifications?messages=true',
|
# 'url': '/notifications?messages=true',
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
},
|
# },
|
||||||
)
|
# )
|
||||||
|
|
||||||
|
|
||||||
if c.top_comment.sentto == 2:
|
if c.top_comment.sentto == 2:
|
||||||
|
|
|
@ -201,15 +201,17 @@
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if PUSHER_ID != 'blahblahblah' and v %}
|
{% if False %}
|
||||||
<div class="d-none" id="strid">{{request.host}}{{v.id}}</div>
|
{% if PUSHER_ID != 'blahblahblah' and v %}
|
||||||
<div class="d-none" id="pusherid">{{PUSHER_ID}}</div>
|
<div class="d-none" id="strid">{{request.host}}{{v.id}}</div>
|
||||||
<script src="/assets/js/pusher.js?v=244"></script>
|
<div class="d-none" id="pusherid">{{PUSHER_ID}}</div>
|
||||||
<script>
|
<script src="/assets/js/pusher.js?v=244"></script>
|
||||||
if (typeof Android != 'undefined') {
|
<script>
|
||||||
Android.Subscribe('{{request.host}}{{v.id}}');
|
if (typeof Android != 'undefined') {
|
||||||
}
|
Android.Subscribe('{{request.host}}{{v.id}}');
|
||||||
</script>
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if request.path in ('/','/logged_out','/logged_out/') and time.time() > session.get('tooltip_last_dismissed',0)+60*60*24*30 and not g.webview %}
|
{% if request.path in ('/','/logged_out','/logged_out/') and time.time() > session.get('tooltip_last_dismissed',0)+60*60*24*30 and not g.webview %}
|
||||||
|
|
Loading…
Reference in New Issue