From 487c15d8b62efad86c6e7a176f0b4b1584b456d3 Mon Sep 17 00:00:00 2001 From: James Chen Date: Sat, 13 Dec 2025 22:26:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E8=AE=A4=E8=AF=81=E5=A4=B1=E8=B4=A5=EF=BC=8C=E8=AF=B7?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E2=80=9D=EF=BC=8C=E5=8D=B4?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E7=99=BB=E5=BD=95=E6=A1=86=20#247?= =?UTF-8?q?=20#255?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stores/settingsStore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stores/settingsStore.ts b/stores/settingsStore.ts index 0a20c37..b2e00b5 100644 --- a/stores/settingsStore.ts +++ b/stores/settingsStore.ts @@ -2,6 +2,7 @@ import { create } from "zustand"; import { SettingsManager } from "@/services/storage"; import { api, ServerConfig } from "@/services/api"; import { storageConfig } from "@/services/storageConfig"; +import AsyncStorage from "@react-native-async-storage/async-storage"; import Logger from "@/utils/Logger"; const logger = Logger.withTag('SettingsStore'); @@ -79,7 +80,8 @@ export const useSettingsStore = create((set, get) => ({ setVideoSource: (config) => set({ videoSource: config }), saveSettings: async () => { const { apiBaseUrl, m3uUrl, remoteInputEnabled, videoSource } = get(); - + const currentSettings = await SettingsManager.get() + const currentApiBaseUrl = currentSettings.apiBaseUrl; let processedApiBaseUrl = apiBaseUrl.trim(); if (processedApiBaseUrl.endsWith("/")) { processedApiBaseUrl = processedApiBaseUrl.slice(0, -1); @@ -105,6 +107,9 @@ export const useSettingsStore = create((set, get) => ({ remoteInputEnabled, videoSource, }); + if ( currentApiBaseUrl !== processedApiBaseUrl) { + await AsyncStorage.setItem('authCookies', ''); + } api.setBaseUrl(processedApiBaseUrl); // Also update the URL in the state so the input field shows the processed URL set({ isModalVisible: false, apiBaseUrl: processedApiBaseUrl });