mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-04 03:36:29 +08:00
@@ -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<SettingsState>((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<SettingsState>((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 });
|
||||
|
||||
Reference in New Issue
Block a user