From 24f12d7b949f946dcbb45427631c712f20de4fe8 Mon Sep 17 00:00:00 2001 From: squidbear <379651+czarly@users.noreply.github.com> Date: Mon, 31 Mar 2025 12:59:11 +0200 Subject: [PATCH] fix foir tron --- latest.sh | 6 +++--- timestamp.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/latest.sh b/latest.sh index 8f89b338..8ef4a6fd 100755 --- a/latest.sh +++ b/latest.sh @@ -29,13 +29,13 @@ for path in $pathlist; do if $include; then RPC_URL="${PROTO:-https}://$DOMAIN$path" - if curl -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then + if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then exit 0 else - if curl -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq; then + if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq; then exit 1 else - curl -vv -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' + curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' fi fi fi diff --git a/timestamp.sh b/timestamp.sh index ffa4272b..fae54879 100755 --- a/timestamp.sh +++ b/timestamp.sh @@ -30,7 +30,7 @@ for path in $pathlist; do RPC_URL="$PROTO://$DOMAIN$path" response_file=$(mktemp) - http_status_code=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' $RPC_URL) + http_status_code=$(curl -L --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' $RPC_URL) if [ $? -eq 0 ]; then