Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Jan 22, 2025
1 parent c18da69 commit 73ec907
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/main/src/lib/cleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { logger } from "~/logger"
import { getMainWindow } from "~/window"

import { t } from "./i18n"
import { store, StoreKey } from "./store"
import { store } from "./store"

const require = createRequire(import.meta.url)
const fastFolderSize = require("fast-folder-size") as any as typeof import("fast-folder-size")
Expand Down Expand Up @@ -101,7 +101,7 @@ export const clearCacheCronJob = () => {
}
timer = setInterval(
async () => {
const hasLimit = store.get(StoreKey.CacheSizeLimit)
const hasLimit = store.get("cacheSizeLimit")

if (!hasLimit) {
return
Expand Down
4 changes: 0 additions & 4 deletions apps/main/src/lib/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ type StoreData = {
} | null
}
export const store = new Store<StoreData>({ name: "db" })

export enum StoreKey {
CacheSizeLimit = "cacheSizeLimit",
}
8 changes: 4 additions & 4 deletions apps/main/src/tipc/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { app, BrowserWindow, clipboard, dialog, shell } from "electron"

import { registerMenuAndContextMenu } from "~/init"
import { clearAllData, getCacheSize } from "~/lib/cleaner"
import { store, StoreKey } from "~/lib/store"
import { store } from "~/lib/store"
import { registerAppTray } from "~/lib/tray"
import { logger, revealLogFile } from "~/logger"
import { cleanupOldRender, loadDynamicRenderEntry } from "~/updater/hot-updater"
Expand Down Expand Up @@ -290,7 +290,7 @@ ${content}
shell.openPath(dir)
}),
getCacheLimit: t.procedure.action(async () => {
return store.get(StoreKey.CacheSizeLimit)
return store.get("cacheSizeLimit")
}),

clearCache: t.procedure.action(async () => {
Expand Down Expand Up @@ -318,9 +318,9 @@ ${content}
limitCacheSize: t.procedure.input<number>().action(async ({ input }) => {
logger.info("set limitCacheSize", input)
if (input === 0) {
store.delete(StoreKey.CacheSizeLimit)
store.delete("cacheSizeLimit")
} else {
store.set(StoreKey.CacheSizeLimit, input)
store.set("cacheSizeLimit", input)
}
}),

Expand Down

0 comments on commit 73ec907

Please sign in to comment.