global-functions: implement notifications via Matrix

Matrix is an open network for secure, decentralized communication - and
it has a web api.

A warning on message type: Using 'm.notice' breaks rendering on Element
for Android (no fixed width font) and does not pop up desktop
notification. Thus we use 'm.text'. Should be safe as we do not send the
messages in response to other messages.

https://matrix.org/
This commit is contained in:
Michael Gisbers 2021-05-28 17:30:37 +02:00 committed by Christian Hesse
parent 7a43bfbc6a
commit 8375673d93
15 changed files with 186 additions and 18 deletions

View file

@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
:global GlobalConfigVersion 52;
:global GlobalConfigVersion 53;
# This is used for DNS and backup file.
:global Domain "example.com";
@ -33,9 +33,19 @@
# This is whether or not to send Telegram messages with fixed-width font.
:global TelegramFixedWidthFont true;
# It is possible to override e-mail and Telegram setting for every script.
# This is done in arrays EmailGeneralToOverride, EmailGeneralCcOverride,
# TelegramTokenIdOverride and TelegramChatIdOverride like this:
# You can send Matrix notifications. Configure these settings and
# install the module:
# $ScriptInstallUpdate global-functions.d/notification-matrix
:global MatrixHomeServer "";
:global MatrixAccessToken "";
:global MatrixRoom "";
#:global MatrixHomeServer "matrix.org";
#:global MatrixAccessToken "123456ABCDEFGHI...";
#:global MatrixRoom "!example:matrix.org";
# It is possible to override e-mail, Telegram and Matrix setting for every
# script. This is done in arrays, where 'Override' is appended to the
# variable name, like this:
#:global EmailGeneralToOverride {
# "check-certificates"="override@example.com";
# "email-backup"="backup@example.com";