Skip to content

Commit

Permalink
fixup: minor sync fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Sep 10, 2023
1 parent c73a91a commit 415e9dc
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 24 deletions.
3 changes: 2 additions & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Popover,
Select,
showConfirm,
showToast,
} from "./ui-lib";
import { ModelConfigList } from "./model-config";

Expand Down Expand Up @@ -275,7 +276,7 @@ function SyncItems() {
icon={<ResetIcon />}
text={Locale.UI.Sync}
onClick={() => {
syncStore.check().then(console.log);
showToast(Locale.WIP);
}}
/>
</ListItem>
Expand Down
2 changes: 0 additions & 2 deletions app/store/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { LLMModel } from "../client/api";
import { getClientConfig } from "../config/client";
import { DEFAULT_INPUT_TEMPLATE, DEFAULT_MODELS, StoreKey } from "../constant";
Expand Down
2 changes: 0 additions & 2 deletions app/store/mask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export const useMaskStore = createPersistStore(
{ ...DEFAULT_MASK_STATE },

(set, get) => ({
...DEFAULT_MASK_STATE,

create(mask?: Partial<Mask>) {
const masks = get().masks;
const id = nanoid();
Expand Down
20 changes: 1 addition & 19 deletions app/store/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ export interface WebDavConfig {
password: string;
}

export interface SyncStore {
webDavConfig: WebDavConfig;
lastSyncTime: number;

update: Updater<WebDavConfig>;
check: () => Promise<boolean>;

path: (path: string) => string;
headers: () => { Authorization: string };
}

export const useSyncStore = createPersistStore(
{
webDavConfig: {
Expand All @@ -39,18 +28,11 @@ export const useSyncStore = createPersistStore(
lastSyncTime: 0,
},
(set, get) => ({
webDavConfig: {
server: "",
username: "",
password: "",
},

lastSyncTime: 0,

export() {
const state = getLocalAppState();
const fileName = `Backup-${new Date().toLocaleString()}.json`;
downloadAs(JSON.stringify(state), fileName);
set({ lastSyncTime: Date.now() });
},

async import() {
Expand Down

0 comments on commit 415e9dc

Please sign in to comment.