From bdde1235dc1dfe14edc3bb60d51654e016e9ddfa Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 2 Aug 2024 20:47:17 +0200 Subject: [PATCH] Added some sensible curl flags --- wled | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wled b/wled index 4645bee..32c870a 100755 --- a/wled +++ b/wled @@ -6,6 +6,8 @@ # Author: Shy # License: CC0 +CURL_FLAGS="--silent --show-error --fail --ipv4 --max-filesize 64K" + print_usage() { echo "Usage: $0 f(nordcenter)|w(ohnzimmer) on|off|1-17|list" } @@ -33,17 +35,17 @@ esac # Parse and execute command argument. case "$2" in on) - api_resp=$(curl -s -4 --json '{"on":true}' "http://$wled_host/json") + api_resp=$(curl $CURL_FLAGS --json '{"on":true}' "http://$wled_host/json") ;; off) - api_resp=$(curl -s -4 --json '{"on":false}' "http://$wled_host/json") + api_resp=$(curl $CURL_FLAGS --json '{"on":false}' "http://$wled_host/json") ;; [1-9]|[1-9][0-7]) - api_resp=$(curl -s -4 --json "{'on':true,'ps':$2}" "http://$wled_host/json") + api_resp=$(curl $CURL_FLAGS --json "{'on':true,'ps':$2}" "http://$wled_host/json") ;; l|list) echo "Presets on $wled_host:" - curl -s -4 "http://$wled_host/presets.json" | \ + curl $CURL_FLAGS "http://$wled_host/presets.json" | \ # Split into lines. One line per preset. sed --sandbox -n 's/"\([0-9]\{1,2\}\)"/\n"\1"/gp' | \ # Extract number and name. Append final newline. @@ -51,7 +53,7 @@ case "$2" in exit $? ;; dump) - curl -s -4 -w '\n' "http://$wled_host/json" + curl $CURL_FLAGS -w '\n' "http://$wled_host/json" exit 0 ;; *)