summaryrefslogtreecommitdiffstats
path: root/lass/2configs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-01-26 16:41:59 +0100
committerlassulus <lassulus@lassul.us>2022-01-26 16:41:59 +0100
commit31fc5a95c735ab3b9b832d407195e422c07cd4c0 (patch)
treea5c927a78378914bf4388283977eb46b0dc47c96 /lass/2configs
parent76668334958011b69747d5e09691cf21703938cc (diff)
l prism.r: add fysiirc github bridge
Diffstat (limited to 'lass/2configs')
-rw-r--r--lass/2configs/fysiirc.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/lass/2configs/fysiirc.nix b/lass/2configs/fysiirc.nix
new file mode 100644
index 000000000..d2aaa73c5
--- /dev/null
+++ b/lass/2configs/fysiirc.nix
@@ -0,0 +1,51 @@
+{ config, lib, pkgs, ... }:
+{
+ krebs.iptables.tables.filter.INPUT.rules = [
+ { predicate = "-p tcp --dport 44002"; target = "ACCEPT"; }
+ ];
+ krebs.reaktor2.fysiweb-github = {
+ hostname = "irc.libera.chat";
+ port = "6697";
+ useTLS = true;
+ nick = "fysiweb-github";
+ API.listen = "inet://127.0.0.1:44001";
+ plugins = [
+ {
+ plugin = "register";
+ config = {
+ channels = [
+ "#fysi"
+ ];
+ };
+ }
+ ];
+ };
+ krebs.htgen.fysiweb-github = {
+ port = 44002;
+ user = {
+ name = "reaktor2-fysiweb-github";
+ };
+ script = ''. ${pkgs.writeDash "github-irc" ''
+ case "$Method $Request_URI" in
+ "POST /")
+ payload=$(head -c "$req_content_length" \
+ | sed 's/+/ /g;s/%\(..\)/\\x\1/g;' \
+ | xargs -0 echo -e \
+ )
+ ${pkgs.curl}/bin/curl -fsSv http://localhost:44001/ \
+ -H content-type:application/json \
+ -d "$(echo "$payload" | ${pkgs.jq}/bin/jq \
+ '{
+ command:"PRIVMSG",
+ params:["#fysi", "\(.action): \(.comment.html_url // .issue.html_url // .pull_request.html_url)"]
+ }'
+ )"
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ exit
+ ;;
+ esac
+ ''}'';
+ };
+}