From 8eec3816df024180ca244e4c36bd796c6ee5de7a Mon Sep 17 00:00:00 2001 From: pooneyy <85266337+pooneyy@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:31:00 +0800 Subject: [PATCH] feat(update_local_appstore): optimize repository URL handling and add random sorting for independent repos - restructure repository URL list generation by separating prefix-based and independent repositories - move temporary directory creation and cleanup trap after URL list generation for better logical flow - create local apps directory before processing to prevent runtime errors - implement Fisher-Yates shuffle algorithm to randomize independent repository order - combine all repository URLs into single array for unified processing - update clone failure check to use total URL count instead of prefix count --- update_local_appstore.sh | 55 +++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/update_local_appstore.sh b/update_local_appstore.sh index 7c1f41d09..4a97bb235 100644 --- a/update_local_appstore.sh +++ b/update_local_appstore.sh @@ -136,15 +136,6 @@ else fi fi -TEMP_DIR=$(mktemp -d) - -cleanup_temp_dir() { - rm -rf $TEMP_DIR - printf "$MSG_CLEANUP_TEMP\n" "$TEMP_DIR" - exit 1 -} -trap cleanup_temp_dir INT TERM - repo_prefixs=( 'https://github.com' 'https://gh-proxy.com/https://github.com' @@ -155,20 +146,54 @@ repo_prefixs=( 'https://ghfast.top/https://github.com' 'https://githubfast.com' 'https://ghproxy.net/https://github.com' - 'https://codeberg.org' - 'https://code.forgejo.org' - 'https://gitea.com' +) + +independent_repos=( + 'https://codeberg.org/pooneyy/1Panel-Appstore.git' + 'https://code.forgejo.org/pooneyy/1Panel-Appstore.git' + 'https://gitea.com/pooneyy/1Panel-Appstore.git' ) repo_suffix="/pooneyy/1Panel-Appstore.git" +all_urls=() + +for prefix in "${repo_prefixs[@]}"; do + all_urls+=("${prefix}${repo_suffix}") +done + +indep_len=${#independent_repos[@]} +indices=() +for ((i=0; i /dev/null 2>&1 && break counter=$((counter + 1)) done -if [ $counter -eq ${#repo_prefixs[@]} ]; then + +if [ $counter -eq ${#all_urls[@]} ]; then echo "$MSG_CLONE_FAIL" else printf "$MSG_CLONE_SUCCESS\n" "$full_url"