mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-18 06:53:41 +08:00
Merge 7c1a7653ac into 6ded4e96e7
This commit is contained in:
@@ -27,18 +27,22 @@ const DEFAULT_SYNC_STATE = {
|
||||
useProxy: true,
|
||||
proxyUrl: ApiPath.Cors as string,
|
||||
|
||||
webdav: {
|
||||
[ProviderType.WebDAV]: {
|
||||
endpoint: "",
|
||||
username: "",
|
||||
password: "",
|
||||
},
|
||||
|
||||
upstash: {
|
||||
[ProviderType.UpStash]: {
|
||||
endpoint: "",
|
||||
username: STORAGE_KEY,
|
||||
apiKey: "",
|
||||
},
|
||||
|
||||
autoSync: {
|
||||
onStart: false,
|
||||
},
|
||||
|
||||
lastSyncTime: 0,
|
||||
lastProvider: "",
|
||||
};
|
||||
@@ -46,9 +50,14 @@ const DEFAULT_SYNC_STATE = {
|
||||
export const useSyncStore = createPersistStore(
|
||||
DEFAULT_SYNC_STATE,
|
||||
(set, get) => ({
|
||||
cloudSync() {
|
||||
cloudSync(): boolean {
|
||||
const config = get()[get().provider];
|
||||
return Object.values(config).every((c) => c.toString().length > 0);
|
||||
if (!config) {
|
||||
return false;
|
||||
}
|
||||
return Object.values(config).every(
|
||||
(c) => c != null && c.toString().length > 0,
|
||||
);
|
||||
},
|
||||
|
||||
markSyncTime() {
|
||||
@@ -126,7 +135,7 @@ export const useSyncStore = createPersistStore(
|
||||
}),
|
||||
{
|
||||
name: StoreKey.Sync,
|
||||
version: 1.2,
|
||||
version: 1.3,
|
||||
|
||||
migrate(persistedState, version) {
|
||||
const newState = persistedState as typeof DEFAULT_SYNC_STATE;
|
||||
@@ -144,6 +153,10 @@ export const useSyncStore = createPersistStore(
|
||||
}
|
||||
}
|
||||
|
||||
if (version < 1.3) {
|
||||
newState.autoSync = { ...DEFAULT_SYNC_STATE.autoSync };
|
||||
}
|
||||
|
||||
return newState as any;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user