summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-09-03 12:04:51 +0200
committerlassulus <git@lassul.us>2023-09-03 12:04:51 +0200
commit42080b5a394d923f9098da1fdcb353e788dcf122 (patch)
tree8e7d79294bf6a4ecf956d016ef83c14b0bd91776 /lass
parenteb00c6b977986dffbf2063a624a654438a5d354e (diff)
l fysiirc: update code
Diffstat (limited to 'lass')
-rw-r--r--lass/2configs/fysiirc.nix17
1 files changed, 4 insertions, 13 deletions
diff --git a/lass/2configs/fysiirc.nix b/lass/2configs/fysiirc.nix
index 809298df4..b2912d894 100644
--- a/lass/2configs/fysiirc.nix
+++ b/lass/2configs/fysiirc.nix
@@ -1,13 +1,13 @@
{ config, lib, pkgs, ... }: let
format-github-message = pkgs.writeDashBin "format-github-message" ''
- set -xefu
+ set -efu
export PATH=${lib.makeBinPath [
pkgs.jq
]}
INPUT=$(jq -c .)
- if $(echo "$INPUT" | jq 'has("issue") or has("pull_request")'); then
- ${write_to_irc} "$(echo "$INPUT" | jq -r '
+ if $(printf '%s' "$INPUT" | jq 'has("issue") or has("pull_request")'); then
+ ${write_to_irc} "$(printf '%s' "$INPUT" | jq -r '
"\(.action): " +
"[\(.issue.title // .pull_request.title)] " +
"\(.comment.html_url // .issue.html_url // .pull_request.html_url) "
@@ -57,16 +57,7 @@ in {
case "$Method $Request_URI" in
"POST /")
payload=$(head -c "$req_content_length")
- raw=$(printf '%s' "$payload" | ${pkgs.curl}/bin/curl --data-binary @- http://p.krebsco.de | tail -1)
- payload2=$payload
- payload2=$(printf '%s' "$payload" | tr '\n' ' ' | tr -d '\r')
- if [ "$payload" != "$payload2" ]; then
- echo "payload has been mangled" >&2
- else
- echo "payload not mangled" >&2
- fi
- echo "$payload2" | ${format-github-message}/bin/format-github-message
- ${write_to_irc} "$raw"
+ printf '%s' "$payload" | ${format-github-message}/bin/format-github-message
printf 'HTTP/1.1 200 OK\r\n'
printf 'Connection: close\r\n'
printf '\r\n'