From 471e5dae50e2c62d055c73fa2618f8823231302c Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 6 Aug 2024 12:04:17 +0200 Subject: [PATCH] Moved --data flag into curl function. --- wled | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wled b/wled index fcb3405..5811985 100755 --- a/wled +++ b/wled @@ -33,13 +33,13 @@ commands: curl_fetch() { curl --silent --show-error --fail --ipv4 --max-filesize 32768 \ - --max-redirs 0 --header 'Accept: application/json' "$@" + --max-redirs 0 --header 'Accept: application/json' "$1" } curl_send() { curl --silent --show-error --fail --ipv4 --max-filesize 1024 \ --max-redirs 0 --header 'Accept: application/json' \ - --header 'Content-Type: application/json' "$@" + --header 'Content-Type: application/json' --data "$1" "$2" } active_preset() { @@ -76,10 +76,10 @@ esac # Parse and execute command argument. case "$2" in on) # Switch on. - api_resp=$(curl_send --data '{"on":true}' "http://$wled_host/json") + api_resp=$(curl_send '{"on":true}' "http://$wled_host/json") ;; off) # Switch off. - api_resp=$(curl_send --data '{"on":false}' "http://$wled_host/json") + api_resp=$(curl_send '{"on":false}' "http://$wled_host/json") ;; -b|--brightness) # Set brightness. if test -z "$3"; then @@ -95,10 +95,10 @@ case "$2" in echo "Error: parameter for brightness is out of range." >&2 exit 1 fi - api_resp=$(curl_send --data "{'bri':$bright}" "http://$wled_host/json") + api_resp=$(curl_send "{'bri':$bright}" "http://$wled_host/json") ;; [1-9]|1[0-7]) # Switch to preset. - api_resp=$(curl_send --data "{'ps':$2}" "http://$wled_host/json") + api_resp=$(curl_send "{'ps':$2}" "http://$wled_host/json") ;; l|list) # List presets. printf "loading ...\r"