forked from rDrama/rDrama
push notifications: fix pusher causing errors on large unicode msgs
parent
f4f03f6582
commit
bf98444ead
|
@ -106,6 +106,8 @@ if PUSHER_ID != 'blahblahblah':
|
||||||
def pusher_thread(interests, title, notifbody, url):
|
def pusher_thread(interests, title, notifbody, url):
|
||||||
title = censor_slurs(title, None)
|
title = censor_slurs(title, None)
|
||||||
notifbody = censor_slurs(notifbody, None)
|
notifbody = censor_slurs(notifbody, None)
|
||||||
|
if len(notifbody) > PUSHER_LIMIT:
|
||||||
|
notifbody = notifbody[:PUSHER_LIMIT] + "..."
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
beams_client.publish_to_interests(
|
||||||
interests=[interests],
|
interests=[interests],
|
||||||
|
|
|
@ -57,6 +57,8 @@ DEFAULT_RATELIMIT = "3/second;30/minute;200/hour;1000/day"
|
||||||
DEFAULT_RATELIMIT_SLOWER = "1/second;30/minute;200/hour;1000/day"
|
DEFAULT_RATELIMIT_SLOWER = "1/second;30/minute;200/hour;1000/day"
|
||||||
DEFAULT_RATELIMIT_USER = DEFAULT_RATELIMIT_SLOWER
|
DEFAULT_RATELIMIT_USER = DEFAULT_RATELIMIT_SLOWER
|
||||||
|
|
||||||
|
PUSHER_LIMIT = 1000 # API allows 10 KB but better safe than sorry
|
||||||
|
|
||||||
if SITE == "localhost": SITE_FULL = 'http://' + SITE
|
if SITE == "localhost": SITE_FULL = 'http://' + SITE
|
||||||
else: SITE_FULL = 'https://' + SITE
|
else: SITE_FULL = 'https://' + SITE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue