forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-01-16 02:29:08 +02:00
parent a010cc8393
commit 00cde33dbe
2 changed files with 41 additions and 47 deletions

View File

@ -466,31 +466,28 @@ def api_comment(v):
g.db.add(n) g.db.add(n)
if parent.author.id != v.id: if parent.author.id != v.id:
try: beams_client.publish_to_interests(
beams_client.publish_to_interests( interests=[f'{request.host}{parent.author.id}'],
interests=[f'{request.host}{parent.author.id}'], publish_body={
publish_body={ 'web': {
'web': { 'notification': {
'notification': { 'title': f'New reply by @{v.username}',
'title': f'New reply by @{v.username}', 'body': c.body,
'body': c.body, 'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context',
'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context', 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
},
'data': {
'url': f'https://{site}/comment/{c.id}?context=9&read=true#context',
}
} }
}, },
) 'fcm': {
except Exception as e: 'notification': {
print(e) 'title': f'New reply by @{v.username}',
'body': c.body,
},
'data': {
'url': f'comment/{c.id}?context=9&read=true#context',
}
}
},
)

View File

@ -435,31 +435,28 @@ def message2(v, username):
g.db.add(notif) g.db.add(notif)
try: beams_client.publish_to_interests(
beams_client.publish_to_interests( interests=[f'{request.host}{parent.author.id}'],
interests=[f'{request.host}{parent.author.id}'], publish_body={
publish_body={ 'web': {
'web': { 'notification': {
'notification': { 'title': f'New message from @{v.username}',
'title': f'New message from @{v.username}', 'body': message,
'body': message, 'deep_link': f'https://{site}/notifications',
'deep_link': f'https://{site}/notifications', 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
},
'data': {
'url': f'https://{site}/notifications',
}
} }
}, },
) 'fcm': {
except Exception as e: 'notification': {
print(e) 'title': f'New message from @{v.username}',
'body': message,
},
'data': {
'url': f'notifications',
}
}
},
)
g.db.commit() g.db.commit()