From e8f8f8b0b2a919cff30ed8eeefabecd1dd3c57b5 Mon Sep 17 00:00:00 2001 From: Para Dox Date: Sat, 12 Apr 2025 11:45:19 +0700 Subject: [PATCH] fix --- blocknumber.sh | 4 ++-- endpoint-options.sh | 24 ------------------------ latest.sh | 4 ++-- show-networks.sh | 35 ----------------------------------- success-if-almost-synced.sh | 4 ++-- sync-status.sh | 4 ++-- 6 files changed, 8 insertions(+), 67 deletions(-) delete mode 100755 endpoint-options.sh delete mode 100755 show-networks.sh diff --git a/blocknumber.sh b/blocknumber.sh index 68b94f3c..b8a1e2f6 100755 --- a/blocknumber.sh +++ b/blocknumber.sh @@ -9,7 +9,7 @@ while IFS= read -r line; do blacklist+=("$line") done < "$BASEPATH/path-blacklist.txt" -pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//') +pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+") for path in $pathlist; do include=true @@ -20,7 +20,7 @@ for path in $pathlist; do done if $include; then - RPC_URL="https://$DOMAIN$path" + RPC_URL="https://$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) diff --git a/endpoint-options.sh b/endpoint-options.sh deleted file mode 100755 index aaa809bf..00000000 --- a/endpoint-options.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -BASEPATH="$(dirname "$0")" -source $BASEPATH/.env - -IFS=':' read -ra parts <<< $COMPOSE_FILE - -json=$(cat "$BASEPATH/reference-rpc-endpoint.json") - -default_array=() -for key in $(jq -r 'keys[]' <<< "$json"); do - default_values=$(jq -r ".[\"$key\"].default[]" <<< "$json") - default_array+=($default_values) - - for node in "${default_values[@]}"; do - size_in_gb=$($BASEPATH/restore-volumes.sh "$node" --print-size-only) - - if [ $? -eq 0 ]; then - echo "$key;$node;$size_in_gb" - fi - done - -done - diff --git a/latest.sh b/latest.sh index 8ef4a6fd..a70e992e 100755 --- a/latest.sh +++ b/latest.sh @@ -16,7 +16,7 @@ if [ -n "$NO_SSL" ]; then DOMAIN="${DOMAIN:-0.0.0.0}" fi -pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//') +pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+") for path in $pathlist; do include=true @@ -27,7 +27,7 @@ for path in $pathlist; do done if $include; then - RPC_URL="${PROTO:-https}://$DOMAIN$path" + RPC_URL="${PROTO:-https}://$DOMAIN/$path" 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 diff --git a/show-networks.sh b/show-networks.sh deleted file mode 100755 index 4f58e4de..00000000 --- a/show-networks.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -BASEPATH="$(dirname "$0")" -source $BASEPATH/.env - -IFS=':' read -ra parts <<< $COMPOSE_FILE - -blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml") - -for part in "${parts[@]}"; do - include=true - for word in "${blacklist[@]}"; do - if echo "$part" | grep -qE "$word"; then - #echo "The path $path contains a blacklisted word: $word" - include=false - fi - done - - if $include; then - default=$(jq -r "to_entries[] | select(.value.default[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json) - archive=$(jq -r "to_entries[] | select(.value.archive[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json) - - if [ -n "$archive" ]; then - echo "${archive}_archive" - elif [ -n "$default" ]; then - echo "${default}_default" - else - exit 1 - fi - fi -done - - - - diff --git a/success-if-almost-synced.sh b/success-if-almost-synced.sh index 98e2cf11..23599348 100755 --- a/success-if-almost-synced.sh +++ b/success-if-almost-synced.sh @@ -9,7 +9,7 @@ while IFS= read -r line; do blacklist+=("$line") done < "$BASEPATH/path-blacklist.txt" -pathlist=$(cat "$BASEPATH/$1.yml" | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//') +pathlist=$(cat "$BASEPATH/$1.yml" | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+") for path in $pathlist; do include=true @@ -20,7 +20,7 @@ for path in $pathlist; do done if $include; then - RPC_URL="https://$DOMAIN$path" + RPC_URL="https://$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") diff --git a/sync-status.sh b/sync-status.sh index 87dfeb77..1c26a450 100755 --- a/sync-status.sh +++ b/sync-status.sh @@ -16,7 +16,7 @@ else PROTO="https" fi -pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=PathPrefix).*\"" | cut -d'`' -f2-2) +pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+") for path in $pathlist; do include=true @@ -27,7 +27,7 @@ for path in $pathlist; do done if $include; then - RPC_URL="$PROTO://$DOMAIN$path" + RPC_URL="$PROTO://$DOMAIN/$path" ref='' if [ -n "$2" ]; then