Skip to content

Commit a9e5842

Browse files
committed
fix: persist install subscription only after successful config generation
1 parent fb3820f commit a9e5842

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ prompt_subscription_if_needed
4141

4242
if [ -n "$(subscription_url 2>/dev/null || true)" ]; then
4343
if generate_config; then
44+
if [ -n "${INSTALL_PENDING_SUBSCRIPTION_URL:-}" ]; then
45+
write_env_value "CLASH_SUBSCRIPTION_URL" "$INSTALL_PENDING_SUBSCRIPTION_URL"
46+
fi
4447
echo "✨ 订阅已生效"
4548
post_install_verify
4649
else

scripts/core/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2816,7 +2816,7 @@ prompt_subscription_if_needed() {
28162816
fi
28172817

28182818
input_fmt="$(detect_subscription_format "$input_url")"
2819-
write_env_value "CLASH_SUBSCRIPTION_URL" "$input_url"
2819+
INSTALL_PENDING_SUBSCRIPTION_URL="$input_url"
28202820
bootstrap_subscription_from_install_input "$input_url" "$input_fmt" "default"
28212821
}
28222822

0 commit comments

Comments
 (0)