master
Aevann1 2022-02-21 04:35:02 +02:00
parent 915d36d319
commit 2b69077960
2 changed files with 40 additions and 44 deletions

View File

@ -586,30 +586,28 @@ def api_comment(v):
if len(c.body) > 500: notifbody = c.body[:500] + '...'
else: notifbody = c.body
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=1011',
}
},
'fcm': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
},
'data': {
'url': f'/comment/{c.id}?context=8&read=true#context',
}
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=1011',
}
},
)
except: pass
'fcm': {
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
},
'data': {
'url': f'/comment/{c.id}?context=8&read=true#context',
}
}
},
)
vote = CommentVote(user_id=v.id,

View File

@ -562,30 +562,28 @@ def messagereply(v):
if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message
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=1010',
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
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=1010',
}
},
)
except: pass
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
)
if new_comment.top_comment.sentto == 2: