Feature/group based notifications (#918)

* fix group page

* setup group notification for backend

* update type generators

* script to auto-generate schema exports

* setup frontend CRUD interface

* remove old notifications UI

* drop old events api

* add test functionality

* update naming for fields

* add event dispatcher functionality

* bump to python 3.10

* bump python version

* purge old event code

* use-async apprise

* set mealie logo as image

* unify styles for buttons rows

* add links to banners
This commit is contained in:
Hayden
2022-01-09 21:04:24 -09:00
committed by GitHub
parent 50a341ed3f
commit 190773c5d7
74 changed files with 1992 additions and 1229 deletions

View File

@@ -0,0 +1,29 @@
from typing import Protocol
import apprise
from mealie.services.event_bus_service.event_bus_service import EventBusMessage
class PublisherLike(Protocol):
def publish(self, event: EventBusMessage, notification_urls: list[str]):
...
class ApprisePublisher:
def __init__(self, hard_fail=False) -> None:
asset = apprise.AppriseAsset(
async_mode=True,
image_url_mask="https://raw.githubusercontent.com/hay-kot/mealie/dev/frontend/public/img/icons/android-chrome-maskable-512x512.png",
)
self.apprise = apprise.Apprise(asset=asset)
self.hard_fail = hard_fail
def publish(self, event: EventBusMessage, notification_urls: list[str]):
for dest in notification_urls:
status = self.apprise.add(dest)
if not status and self.hard_fail:
raise Exception("Apprise URL Add Failed")
self.apprise.notify(title=event.title, body=event.body)