diff options
| author | 2024-01-12 09:54:14 +0100 | |
|---|---|---|
| committer | 2024-01-12 09:54:14 +0100 | |
| commit | 2af94818377740dad047e1f3c85ce03a3e865ffe (patch) | |
| tree | 0c6717f64f77acae046b85edae379b9e18fb78fc /data.c | |
| parent | Avoid invalid actors in mastoapi_status(). (diff) | |
| download | snac2-2af94818377740dad047e1f3c85ce03a3e865ffe.tar.gz snac2-2af94818377740dad047e1f3c85ce03a3e865ffe.tar.xz snac2-2af94818377740dad047e1f3c85ce03a3e865ffe.zip | |
Added support for ntfy notifications. You can configure either a self-hosted server or use the official ntfy.sh, and you have the option to use a private token to protect access and topics.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 15 |
1 files changed, 15 insertions, 0 deletions
| @@ -2232,6 +2232,21 @@ void enqueue_telegram(const xs_str *msg, const char *bot, const char *chat_id) | |||
| 2232 | srv_debug(1, xs_fmt("enqueue_telegram %s %s", bot, chat_id)); | 2232 | srv_debug(1, xs_fmt("enqueue_telegram %s %s", bot, chat_id)); |
| 2233 | } | 2233 | } |
| 2234 | 2234 | ||
| 2235 | void enqueue_ntfy(const xs_str *msg, const char *ntfy_server, const char *ntfy_token) | ||
| 2236 | /* enqueues a message to be sent via ntfy */ | ||
| 2237 | { | ||
| 2238 | xs *qmsg = _new_qmsg("ntfy", msg, 0); | ||
| 2239 | char *ntid = xs_dict_get(qmsg, "ntid"); | ||
| 2240 | xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); | ||
| 2241 | |||
| 2242 | qmsg = xs_dict_append(qmsg, "ntfy_server", ntfy_server); | ||
| 2243 | qmsg = xs_dict_append(qmsg, "ntfy_token", ntfy_token); | ||
| 2244 | |||
| 2245 | |||
| 2246 | qmsg = _enqueue_put(fn, qmsg); | ||
| 2247 | |||
| 2248 | srv_debug(1, xs_fmt("enqueue_ntfy %s %s", ntfy_server, ntfy_token)); | ||
| 2249 | } | ||
| 2235 | 2250 | ||
| 2236 | void enqueue_message(snac *snac, const xs_dict *msg) | 2251 | void enqueue_message(snac *snac, const xs_dict *msg) |
| 2237 | /* enqueues an output message */ | 2252 | /* enqueues an output message */ |