From 00cde33dbeec2e6ed929595aff7312a29587bb72 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 16 Jan 2022 02:29:08 +0200 Subject: [PATCH] bbb --- files/routes/comments.py | 45 +++++++++++++++++++--------------------- files/routes/users.py | 43 ++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 47 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index e39a89b3e..1d6d64840 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -466,31 +466,28 @@ def api_comment(v): g.db.add(n) if parent.author.id != v.id: - try: - beams_client.publish_to_interests( - interests=[f'{request.host}{parent.author.id}'], - publish_body={ - 'web': { - 'notification': { - 'title': f'New reply by @{v.username}', - 'body': c.body, - 'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context', - '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', - } + beams_client.publish_to_interests( + interests=[f'{request.host}{parent.author.id}'], + publish_body={ + 'web': { + 'notification': { + 'title': f'New reply by @{v.username}', + 'body': c.body, + 'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context', + 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp', } - }, - ) - except Exception as e: - print(e) + }, + 'fcm': { + 'notification': { + 'title': f'New reply by @{v.username}', + 'body': c.body, + }, + 'data': { + 'url': f'comment/{c.id}?context=9&read=true#context', + } + } + }, + ) diff --git a/files/routes/users.py b/files/routes/users.py index b89d2be25..9eb57394c 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -435,31 +435,28 @@ def message2(v, username): g.db.add(notif) - try: - beams_client.publish_to_interests( - interests=[f'{request.host}{parent.author.id}'], - publish_body={ - 'web': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': message, - 'deep_link': f'https://{site}/notifications', - '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', - } + beams_client.publish_to_interests( + interests=[f'{request.host}{parent.author.id}'], + publish_body={ + 'web': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': message, + 'deep_link': f'https://{site}/notifications', + 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp', } }, - ) - except Exception as e: - print(e) + 'fcm': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': message, + }, + 'data': { + 'url': f'notifications', + } + } + }, + ) g.db.commit()