Revert "chore: update"

This reverts commit 73ec9079cc.
This commit is contained in:
Stephen Zhou
2025-01-22 22:55:03 +08:00
parent 73ec9079cc
commit 8a13db9d6d
3 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ import { logger } from "~/logger"
import { getMainWindow } from "~/window"
import { t } from "./i18n"
import { store } from "./store"
import { store, StoreKey } from "./store"
const require = createRequire(import.meta.url)
const fastFolderSize = require("fast-folder-size") as any as typeof import("fast-folder-size")
@@ -101,7 +101,7 @@ export const clearCacheCronJob = () => {
}
timer = setInterval(
async () => {
const hasLimit = store.get("cacheSizeLimit")
const hasLimit = store.get(StoreKey.CacheSizeLimit)
if (!hasLimit) {
return
+4
View File
@@ -21,3 +21,7 @@ type StoreData = {
} | null
}
export const store = new Store<StoreData>({ name: "db" })
export enum StoreKey {
CacheSizeLimit = "cacheSizeLimit",
}
+4 -4
View File
@@ -9,7 +9,7 @@ import { app, BrowserWindow, clipboard, dialog, shell } from "electron"
import { registerMenuAndContextMenu } from "~/init"
import { clearAllData, getCacheSize } from "~/lib/cleaner"
import { store } from "~/lib/store"
import { store, StoreKey } from "~/lib/store"
import { registerAppTray } from "~/lib/tray"
import { logger, revealLogFile } from "~/logger"
import { cleanupOldRender, loadDynamicRenderEntry } from "~/updater/hot-updater"
@@ -290,7 +290,7 @@ ${content}
shell.openPath(dir)
}),
getCacheLimit: t.procedure.action(async () => {
return store.get("cacheSizeLimit")
return store.get(StoreKey.CacheSizeLimit)
}),
clearCache: t.procedure.action(async () => {
@@ -318,9 +318,9 @@ ${content}
limitCacheSize: t.procedure.input<number>().action(async ({ input }) => {
logger.info("set limitCacheSize", input)
if (input === 0) {
store.delete("cacheSizeLimit")
store.delete(StoreKey.CacheSizeLimit)
} else {
store.set("cacheSizeLimit", input)
store.set(StoreKey.CacheSizeLimit, input)
}
}),