Refine VPN client instructions and subscription refresh flow
This commit is contained in:
@@ -160,13 +160,13 @@ async function requestSubscription(url) {
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function fetchSubscriptionInfo(url) {
|
||||
const response = await requestSubscription(url);
|
||||
await response.body?.cancel();
|
||||
return {
|
||||
userInfo: parseUserInfo(response.headers.get('subscription-userinfo')),
|
||||
fetchedAt: new Date().toISOString(),
|
||||
};
|
||||
export function selectRefreshedServer(currentTag, servers) {
|
||||
const selectedTag = String(currentTag || '').trim();
|
||||
if (!selectedTag) return '';
|
||||
|
||||
return servers.find((server) => String(server.tag || '').trim() === selectedTag)?.tag
|
||||
|| servers[0]?.tag
|
||||
|| '';
|
||||
}
|
||||
|
||||
export async function fetchSubscription(url) {
|
||||
|
||||
Reference in New Issue
Block a user