Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
[Cherry Pick] [Head Repo] fix: auto migrate proxy config (#307)
Browse files Browse the repository at this point in the history
Co-authored-by: fred-bf <[email protected]>
  • Loading branch information
H0llyW00dzZ and fred-bf authored Mar 13, 2024
1 parent 5e83b0c commit 8c96b11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/store/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ export const useSyncStore = createPersistStore(
}),
{
name: StoreKey.Sync,
version: 1.2, // golang syncing
version: 1.3, // golang syncing

migrate(persistedState, version) {
const newState = persistedState as typeof DEFAULT_SYNC_STATE;
if (version < 1.1) {
Expand All @@ -247,6 +248,16 @@ export const useSyncStore = createPersistStore(
if (version < 1.2) {
newState.gosync.username = STORAGE_KEY;
}

if (version < 1.3) {
if (
(persistedState as typeof DEFAULT_SYNC_STATE).proxyUrl ===
"/api/cors/"
) {
newState.proxyUrl = "";
}
}

return newState as any;
},
},
Expand Down
3 changes: 3 additions & 0 deletions app/utils/cors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { ApiPath, DEFAULT_API_HOST } from "../constant";
export function corsPath(path: string) {
const baseUrl = getClientConfig()?.isApp ? `${DEFAULT_API_HOST}` : "";

if (baseUrl === "" && path === "") {
return "";
}
if (!path.startsWith("/")) {
path = "/" + path;
}
Expand Down

0 comments on commit 8c96b11

Please sign in to comment.