l prism.r: add fysiirc github bridge
This commit is contained in:
parent
7666833495
commit
31fc5a95c7
@ -123,6 +123,7 @@ with import <stockholm/lib>;
|
|||||||
<stockholm/lass/2configs/ciko.nix>
|
<stockholm/lass/2configs/ciko.nix>
|
||||||
<stockholm/lass/2configs/container-networking.nix>
|
<stockholm/lass/2configs/container-networking.nix>
|
||||||
<stockholm/lass/2configs/jitsi.nix>
|
<stockholm/lass/2configs/jitsi.nix>
|
||||||
|
<stockholm/lass/2configs/fysiirc.nix>
|
||||||
{
|
{
|
||||||
services.tor = {
|
services.tor = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
51
lass/2configs/fysiirc.nix
Normal file
51
lass/2configs/fysiirc.nix
Normal file
@ -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
|
||||||
|
''}'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user