metronom-login: fix OK/unsuccessful detection

This commit is contained in:
Daniella / Tove 2024-11-12 21:34:26 +01:00
parent c7f5a0b8de
commit 94b4ac3163
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -10,7 +10,7 @@ pkgs.writeShellScriptBin "metronom-login" ''
csrf="$(curl --interface $(cat ~/.direct-netif) "$ip/de/" | grep CSRFToken | sed -E 's/.*value="([0-9a-f]*)".*/\1/')"
echo "csrf is $csrf"
resp="$(curl --interface $(cat ~/.direct-netif) "$ip/de/" -X POST -H "Cookie: csrf=$csrf" --data-raw "login=true&CSRFToken=$csrf" | wc -l)"
if [ $resp = 1 ] ; then
if [ $resp = 0 ] ; then
echo OK
else
echo unsuccessful