feat: notifications through Apprise (v2.14.0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
815aff5443
commit
0465ff924b
19 files changed
+659
-17
No files matched your search
@@ -515,6 +515,7 @@ def webmentions():
|
||||
status_filter=status_filter,
|
||||
origin_filter=origin_filter,
|
||||
backfeed=backfeed.status(),
|
||||
notify=_notify_status(),
|
||||
page=page,
|
||||
total_pages=total_pages,
|
||||
user_me=g.me
|
||||
@@ -681,6 +682,34 @@ def revoke_token(token_id):
|
||||
return redirect(url_for("admin.tokens"))
|
||||
|
||||
|
||||
def _notify_status() -> dict:
|
||||
"""Notification settings and last error for the Webmentions page (v2.14.0)"""
|
||||
from starpunk import notifications
|
||||
from starpunk.database import get_db
|
||||
|
||||
return {
|
||||
"enabled": notifications.enabled(current_app.config),
|
||||
"events": sorted(notifications.events(current_app.config)),
|
||||
"priority": current_app.config.get("NOTIFY_PRIORITY") or "normal",
|
||||
"services": [u.split("://", 1)[0] for u in notifications.urls(current_app.config)],
|
||||
"last_error": notifications.last_error(get_db(current_app)),
|
||||
}
|
||||
|
||||
|
||||
@bp.route("/notifications/test", methods=["POST"])
|
||||
@require_auth
|
||||
def notifications_test():
|
||||
"""Send a test notification to every NOTIFY_URLS service (v2.14.0)"""
|
||||
from starpunk import notifications
|
||||
|
||||
ok, error = notifications.send(current_app.config, "StarPunk test notification",
|
||||
"Notifications from StarPunk are working.")
|
||||
notifications._record(current_app.config["DATABASE_PATH"], ok, error)
|
||||
flash("Test notification sent" if ok else f"Test notification failed: {error or 'unknown error'}",
|
||||
"success" if ok else "error")
|
||||
return redirect(url_for("admin.webmentions"))
|
||||
|
||||
|
||||
@bp.route("/backfeed/backfill", methods=["POST"])
|
||||
@require_auth
|
||||
def backfeed_backfill():
|
||||
|
||||
Reference in new issue
Block a user