remotes/1693045480750635534/spooky-22
Aevann1 2022-02-04 18:33:50 +02:00
parent d5c65845d4
commit f122f289b9
2 changed files with 67 additions and 61 deletions

View File

@ -552,30 +552,32 @@ def api_comment(v):
if parent.author.id != v.id and PUSHER_ID:
if len(c.body) > 500: notifbody = c.body[:500] + '...'
else: notifbody = c.body or 'no body'
else: notifbody = c.body
beams_client.publish_to_interests(
interests=[f'{request.host}{parent.author.id}'],
publish_body={
'web': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1009',
try:
beams_client.publish_to_interests(
interests=[f'{request.host}{parent.author.id}'],
publish_body={
'web': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1009',
}
},
'fcm': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
},
'data': {
'url': f'/comment/{c.id}?context=8&read=true#context',
}
}
},
'fcm': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
},
'data': {
'url': f'/comment/{c.id}?context=8&read=true#context',
}
}
},
)
)
except: pass
vote = CommentVote(user_id=v.id,

View File

@ -494,28 +494,30 @@ def message2(v, username):
if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message
beams_client.publish_to_interests(
interests=[f'{request.host}{user.id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1009',
try:
beams_client.publish_to_interests(
interests=[f'{request.host}{user.id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1009',
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
)
)
except: pass
g.db.commit()
@ -562,28 +564,30 @@ def messagereply(v):
if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message
beams_client.publish_to_interests(
interests=[f'{request.host}{user_id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1008',
try:
beams_client.publish_to_interests(
interests=[f'{request.host}{user_id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1008',
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
)
)
except: pass
if new_comment.top_comment.sentto == 0: