summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-02-02 22:20:44 +0100
committertv <tv@krebsco.de>2021-02-02 22:20:44 +0100
commita78010730930d536e0426429a00851167ba8e05a (patch)
tree48b6d0d961ee8f4e1a6ca72004e21366f1e8443c /krebs
parent0bee76d9092022d6dbb082516e8bdb42f7fcc8c8 (diff)
parenta2ca5f2e214be259fdb0f9ea92b79d74e6216a51 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/1systems/news/config.nix4
-rw-r--r--krebs/2configs/news.nix36
-rw-r--r--krebs/3modules/krebs/default.nix2
3 files changed, 33 insertions, 9 deletions
diff --git a/krebs/1systems/news/config.nix b/krebs/1systems/news/config.nix
index e4059e579..5c4b37aef 100644
--- a/krebs/1systems/news/config.nix
+++ b/krebs/1systems/news/config.nix
@@ -21,14 +21,14 @@
"/var/lib/htgen-go" = {
source = "/var/state/htgen-go";
options = [
- "-M ${toString config.users.users.htgen-go.uid}"
+ "-m ${toString config.users.users.htgen-go.uid}"
];
clearTarget = true;
};
"/var/lib/brockman" = {
source = "/var/state/brockman";
options = [
- "-M ${toString config.users.users.brockman.uid}"
+ "-m ${toString config.users.users.brockman.uid}:${toString config.users.users.nginx.uid}"
];
clearTarget = true;
};
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix
index a492b0782..3bf991433 100644
--- a/krebs/2configs/news.nix
+++ b/krebs/2configs/news.nix
@@ -12,6 +12,9 @@
];
};
"brockman.r" = {
+ serverAliases = [
+ "news.r"
+ ];
locations."/".extraConfig = ''
root /var/lib/brockman;
index brockman.json;
@@ -57,25 +60,46 @@
hooks.PRIVMSG = [
{
activate = "match";
- pattern = "^(?:.*\\s)?\\s*brockman-helper:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
+ pattern = "^brockman-helper:\\s*(\\S*)(?:\\s+(.*\\S))?\\s*$";
command = 1;
arguments = [2];
commands = {
+ add-reddit.filename = pkgs.writeDash "add-reddit" ''
+ set -euf
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: add-reddit $reddit_channel'
+ exit 1
+ fi
+ reddit_channel=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ echo "brockman: add r_$reddit_channel http://rss.r/?action=display&bridge=Telegram&username=$reddit_channel&format=Mrss"
+ '';
add-telegram.filename = pkgs.writeDash "add-telegram" ''
+ set -euf
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: add-telegram $telegram_user'
+ exit 1
+ fi
+ telegram_user=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ echo "brockman: add t_$telegram_user http://rss.r/?action=display&bridge=Telegram&username=$telegram_user&format=Mrss"
+ '';
+ add-youtube.filename = pkgs.writeDash "add-youtube" ''
+ set -euf
if [ "$#" -ne 1 ]; then
- echo 'usage: brockman-helper: add-telegram $telegramname'
- echo "$#"
+ echo 'usage: brockman-helper: add-youtube $nick $channelid'
exit 1
fi
- echo "brockman: add t_$1 http://rss.r/?action=display&bridge=Telegram&username=$1&format=Mrss"
+ youtube_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ youtube_id=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]')
+ echo "brockman: add yt_$youtube_nick http://rss.r/?action=display&bridge=Youtube&context=By+channel+id&c=$youtube_id&duration_min=&duration_max=&format=Mrss"
'';
search.filename = pkgs.writeDash "search" ''
+ set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: brockman-helper: search $searchterm'
- echo "$#"
exit 1
fi
- ${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$1&info=true&favicon=false" |
+ searchterm=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ ${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$searchterm&info=true&favicon=false" |
${pkgs.jq}/bin/jq '.[].url'
'';
};
diff --git a/krebs/3modules/krebs/default.nix b/krebs/3modules/krebs/default.nix
index 4a1b56084..8c164cfe3 100644
--- a/krebs/3modules/krebs/default.nix
+++ b/krebs/3modules/krebs/default.nix
@@ -99,6 +99,7 @@ in {
ip4.addr = "10.243.0.5";
aliases = [
"news.r"
+ "brockman.r"
"go.r"
"rss.r"
];
@@ -159,7 +160,6 @@ in {
ip4.addr = "10.243.77.2";
aliases = [
"puyak.r"
- "brockman.r"
"build.puyak.r"
"cgit.puyak.r"
];