Merge pull request #9 from atrc445/fix-seed-db

make comments and private messages work without pusher api key
This commit is contained in:
Aevann1 2021-08-06 21:19:31 +02:00 committed by GitHub
commit aa7ab261ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 26 deletions

View file

@ -1,3 +1,6 @@
import traceback
import sys
from files.helpers.wrappers import *
from files.helpers.filters import *
from files.helpers.alerts import *
@ -5,7 +8,7 @@ from files.helpers.images import *
from files.helpers.session import *
from files.classes import *
from files.routes.front import comment_idlist
from pusher_push_notifications import PushNotifications
from pusher_push_notifications import PushNotifications, PusherAuthError
from flask import *
from files.__main__ import app, limiter
@ -530,18 +533,23 @@ def api_comment(v):
except: g.db.rollback()
if parent.author.id != v.id:
beams_client.publish_to_interests(
interests=[str(parent.author.id)],
publish_body={
'web': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
'deep_link': f'https://{site}{c.permalink}?context=5#context',
try:
beams_client.publish_to_interests(
interests=[str(parent.author.id)],
publish_body={
'web': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
'deep_link': f'https://{site}{c.permalink}?context=5#context',
},
},
},
},
},
)
)
except PusherAuthError as e:
sys.stderr.write(traceback.format_exc())
sys.stderr.flush()
@ -866,4 +874,4 @@ def unsave_comment(cid, v):
g.db.delete(save)
return "", 204
return "", 204