fix seed-db, make comments and private messages work without pusher
by catching and printing pusher auth error exception
This commit is contained in:
parent
43a45f76ac
commit
821e697e74
3 changed files with 68 additions and 26 deletions
|
@ -1,3 +1,6 @@
|
|||
import traceback
|
||||
import sys
|
||||
|
||||
from drama.helpers.wrappers import *
|
||||
from drama.helpers.filters import *
|
||||
from drama.helpers.alerts import *
|
||||
|
@ -5,7 +8,7 @@ from drama.helpers.images import *
|
|||
from drama.helpers.session import *
|
||||
from drama.classes import *
|
||||
from drama.routes.front import comment_idlist
|
||||
from pusher_push_notifications import PushNotifications
|
||||
from pusher_push_notifications import PushNotifications, PusherAuthError
|
||||
|
||||
from flask import *
|
||||
from drama.__main__ import app, limiter
|
||||
|
@ -522,6 +525,7 @@ def api_comment(v):
|
|||
except: g.db.rollback()
|
||||
|
||||
if parent.author.id != v.id:
|
||||
try:
|
||||
beams_client.publish_to_interests(
|
||||
interests=[str(parent.author.id)],
|
||||
publish_body={
|
||||
|
@ -534,6 +538,10 @@ def api_comment(v):
|
|||
},
|
||||
},
|
||||
)
|
||||
except PusherAuthError as e:
|
||||
traceback.print_tb(e.__traceback__)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import qrcode
|
||||
import io
|
||||
import time
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
from drama.classes.user import ViewerRelationship
|
||||
from drama.helpers.alerts import *
|
||||
|
@ -9,7 +11,7 @@ from drama.helpers.markdown import *
|
|||
from drama.mail import *
|
||||
from flask import *
|
||||
from drama.__main__ import app, limiter
|
||||
from pusher_push_notifications import PushNotifications
|
||||
from pusher_push_notifications import PushNotifications, PusherAuthError
|
||||
|
||||
site = environ.get("domain").strip()
|
||||
|
||||
|
@ -142,6 +144,8 @@ def message2(v, username):
|
|||
if existing: return redirect('/notifications?all=true')
|
||||
|
||||
send_pm(v.id, user, message)
|
||||
|
||||
try:
|
||||
beams_client.publish_to_interests(
|
||||
interests=[str(user.id)],
|
||||
publish_body={
|
||||
|
@ -154,6 +158,10 @@ def message2(v, username):
|
|||
},
|
||||
},
|
||||
)
|
||||
except PusherAuthError as e:
|
||||
traceback.print_tb(e.__traceback__)
|
||||
sys.stderr.flush()
|
||||
|
||||
return redirect('/notifications?all=true')
|
||||
|
||||
@app.get("/2faqr/<secret>")
|
||||
|
|
28
seed-db.sql
28
seed-db.sql
|
@ -1 +1,27 @@
|
|||
INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined during open beta', 'beta.png', 4, 3, NULL);
|
||||
INSERT INTO public.users
|
||||
(id, username, passhash,
|
||||
created_utc, admin_level, over_18, is_activated, is_banned,
|
||||
is_private, login_nonce, dramacoins, original_username, bio,
|
||||
defaultsorting, defaultsortingcomments, namecolor, titlecolor, theme, themecolor)
|
||||
VALUES
|
||||
-- admin:admin
|
||||
(1, 'admin', 'pbkdf2:sha256:150000$z6kifBOp$1ee4ab0b1d565d541715d128d4d00dee2800f157ac3865546efed28bbb726dac',
|
||||
0, 6, false, true, 0,
|
||||
false, 0, 0, 'admin', '',
|
||||
'hot', 'top', 'ff66ac', 'ff66ac', 'dark', 'ff66ac');
|
||||
|
||||
INSERT INTO public.users
|
||||
(id, username, passhash,
|
||||
created_utc, admin_level, over_18, is_activated, is_banned,
|
||||
is_private, login_nonce, dramacoins, original_username, bio,
|
||||
defaultsorting, defaultsortingcomments, namecolor, titlecolor, theme, themecolor)
|
||||
VALUES
|
||||
-- user:user
|
||||
(2, 'user', 'pbkdf2:sha256:150000$gB7i3Vsj$7e78baba3b3eb8030bef8850f7016369221152488b27b50f48432bd7713a7e31',
|
||||
0, 0, false, true, 0,
|
||||
false, 0, 0, 'user', '',
|
||||
'hot', 'top', 'ff66ac', 'ff66ac', 'dark', 'ff66ac');
|
||||
|
||||
INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined Drama during open beta', 'beta.png', 4, 3, NULL);
|
||||
|
||||
SELECT pg_catalog.setval('public.users_id_seq', 2, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue