This commit is contained in:
Aevann1 2022-02-21 04:29:06 +02:00
parent 472a6dcca0
commit bea4c446d6

View file

@ -494,30 +494,28 @@ def message2(v, username):
if len(message) > 500: notifbody = message[:500] + '...' if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message else: notifbody = message
try: 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=1011',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1011',
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
} }
}, },
) 'fcm': {
except: pass 'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
)
g.db.commit() g.db.commit()