Add browser notifications

This commit is contained in:
JonnyWong16 2016-05-04 22:56:04 -07:00
parent ff532a5c6c
commit d09c7b13b3
8 changed files with 236 additions and 22 deletions

View file

@ -1636,6 +1636,22 @@ class WebInterface(object):
logger.debug(u"Unable to send test notification, no notification agent ID received.")
return "No notification agent ID received."
@cherrypy.expose
@requireAuth(member_of("admin"))
def get_browser_notifications(self, **kwargs):
browser = notifiers.Browser()
result = browser.get_notifications()
if result:
notifications = result['notifications']
if notifications:
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps(notifications)
else:
return None
else:
logger.warn('Unable to retrieve browser notifications.')
return None
@cherrypy.expose
@requireAuth(member_of("admin"))