Refine client setup state and subscription controls

This commit is contained in:
2026-07-11 10:43:28 +03:00
parent 99f7f58fcb
commit e19d33adb9
7 changed files with 266 additions and 13 deletions

View File

@@ -123,11 +123,16 @@ function App() {
const data = await api.subscription.fetch(subscriptionUrl || state?.subscriptionHost || '');
setServers(data.servers || []);
if (data.servers?.length) {
const nextTag = data.servers.some((server) => server.tag === selectedTag)
? selectedTag
: data.servers[0].tag;
setSelectedTag(nextTag);
setPendingTag(nextTag);
if (state?.mode === 'client') {
setSelectedTag('');
setPendingTag('');
} else {
const nextTag = data.servers.some((server) => server.tag === selectedTag)
? selectedTag
: data.servers[0].tag;
setSelectedTag(nextTag);
setPendingTag(nextTag);
}
}
await loadState();
});
@@ -433,6 +438,7 @@ function App() {
setPendingTag={setPendingTag}
onFetchSubscription={fetchSubscription}
onRefreshSubscriptionInfo={refreshSubscriptionInfo}
onForgetSubscription={forgetSubscription}
onApply={applyServer}
onRestart={restartSingbox}
onStop={() => stopSingbox(false)}