diff --git a/machines/gerd/services/notify/app.py b/machines/gerd/services/notify/app.py index 9c6fb49..cbc0fa1 100644 --- a/machines/gerd/services/notify/app.py +++ b/machines/gerd/services/notify/app.py @@ -9,8 +9,14 @@ import os import jq import json +# TODO(eyJhb): add the following +# - example of bash alias +# - jq filter parameter documentation +# - jq filter example +# - easy way to run it ONLY with curl +# - e.g. curl notify.fricloud.dk/notify//msg + app = Flask(__name__) -app.url_map.strict_slashes = False import logging @@ -169,16 +175,11 @@ def index():
- - + +
-
-
- - -

This notification service has support for both matrix and email. @@ -221,24 +222,9 @@ def index(): default room !yREJWHUMJhGROiHbtu:fricloud.dk or #na-offtopic:rend.al - - token - Authorization Token - empty - enable-trade-decide or enabletradedecide - - - jq - jq filter - . - [.[].commits | .name ] | join("\\n") -


- - bash alias -
notify() {{ curl "{CONFIG_URL}/notify/{token}" -g --data-urlencode "body=${{1:-}}"; }}
curl
curl "{CONFIG_URL}/notify" -H "Authorization: Bearer {token}"
curl w/ specific body/title @@ -254,27 +240,6 @@ def index(): doCheck = false; }} ''{script_example_with_token}''; -
-

Notes

-

- jq is very powerful, and can easily be used to turn webhook data into useful information in a notification. - Just append your `jq=`, to your notification URL, and then watch the magic. - Below is an example for doing it with Forgejo, when new commits are pushed. -

- -
(.total_commits | tostring)
-+ " commits pushed to "
-+ .repository.full_name
-+ "\n\n" +
-  # format commits
-  ([.commits.[]
-  | "- "
-    + (.message | gsub("[\n\t]"; ""))
-    + " (" + .author.name + ")" ]
-  | join("\n"))
-+ "\n\n"
-+ "Changes: " + .compare_url
-