This commit is contained in:
hhftechnologies 2024-11-25 15:52:46 +05:30
parent d04a9f26b2
commit 9f4812f139

View file

@ -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