From 38062bf06659e3ad9b2427c2049aa3ccce47c24c Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 15:21:52 +0100 Subject: urlwatch: admit dict-based filter lists --- krebs/3modules/urlwatch.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix index 2e336de21..e08289bbc 100644 --- a/krebs/3modules/urlwatch.nix +++ b/krebs/3modules/urlwatch.nix @@ -71,7 +71,7 @@ let description = "URL to watch."; example = [ https://nixos.org/channels/nixos-unstable/git-revision - { url = http://localhost ; filter = "grep:important.*stuff"; } + { url = http://localhost ; filter = [ (grep "important.*stuff") ]; } ]; apply = map (x: getAttr (typeOf x) { set = x; @@ -211,7 +211,9 @@ let }; filter = mkOption { default = null; - type = with types; nullOr str; # TODO nullOr subtypes.filter + type = + with types; + nullOr (either str (listOf (pkgs.formats.json {}).type)); }; ignore_cached = mkOption { default = null; -- cgit v1.2.3 From c2b601d123714f29474a0434555bf90c2ebedbbd Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 16:02:01 +0100 Subject: urlwatch subject: put each url on its own line --- krebs/3modules/urlwatch.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix index e08289bbc..8ebbdd1f8 100644 --- a/krebs/3modules/urlwatch.nix +++ b/krebs/3modules/urlwatch.nix @@ -177,8 +177,8 @@ let echo Date: $(date -R) echo From: ${shell.escape cfg.from} echo Subject: $( - sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \ - | tr '\n' ' ' + sed -nr 's/^(CHANGED|ERROR|NEW): //p' changes | + sed '1!s/^ //' ) echo To: ${shell.escape cfg.mailto} echo -- cgit v1.2.3 From 38d0a0a5be8e472c60c3745df9f34aadc51514dd Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 16:02:31 +0100 Subject: urlwatch content-transfer-encoding: base64 --- krebs/3modules/urlwatch.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix index 8ebbdd1f8..113f6e65d 100644 --- a/krebs/3modules/urlwatch.nix +++ b/krebs/3modules/urlwatch.nix @@ -181,8 +181,11 @@ let sed '1!s/^ //' ) echo To: ${shell.escape cfg.mailto} + echo Mime-Version: 1.0 + echo Content-Type: text/plain\; charset=UTF-8 + echo Content-Transfer-Encoding: base64 echo - cat changes + base64 changes } | /run/wrappers/bin/sendmail -t fi ''} -- cgit v1.2.3