From 9f4812f139edb8814076970bc59e8aaf61abb964 Mon Sep 17 00:00:00 2001 From: hhftechnologies Date: Mon, 25 Nov 2024 15:52:46 +0530 Subject: [PATCH] update --- master.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/master.sh b/master.sh index 4b40745..f460e01 100644 --- a/master.sh +++ b/master.sh @@ -110,22 +110,10 @@ remove_script() { # Modified fetch_scripts function for Forgejo API fetch_scripts() { # Forgejo API endpoint for getting repository contents - api_url="https://$forgejo_instance/api/v1/repos/$forgejo_owner/$forgejo_repo/contents?ref=$BRANCH" + api_url="https://$forgejo_instance/api/v1/repos/$forgejo_owner/$forgejo_repo/git/trees/$BRANCH?recursive=1" # Get all files recursively and filter for .sh files - all_scripts=$(curl -s "$api_url" | jq -r '.[] | select(.type == "file" or .type == "dir") | - if .type == "file" and (.name | endswith(".sh")) then .path - elif .type == "dir" then - "'$api_url'/\(.path)" - else empty end' | - while read -r path; do - if [[ $path == http* ]]; then - # Fetch contents of subdirectories - curl -s "$path" | jq -r '.[] | select(.type == "file" and (.name | endswith(".sh"))) | .path' - else - echo "$path" - fi - done | sort -u) + all_scripts=$(curl -s "$api_url" | jq -r '.tree[] | select(.path | endswith(".sh")) | .path' | sort -u) # Log silently without displaying if [[ "$verbose" == "true" ]]; then