chore: update
This commit is contained in:
@@ -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")
|
||||
@@ -101,7 +101,7 @@ export const clearCacheCronJob = () => {
|
||||
}
|
||||
timer = setInterval(
|
||||
async () => {
|
||||
const hasLimit = store.get(StoreKey.CacheSizeLimit)
|
||||
const hasLimit = store.get("cacheSizeLimit")
|
||||
|
||||
if (!hasLimit) {
|
||||
return
|
||||
|
||||
@@ -21,7 +21,3 @@ type StoreData = {
|
||||
} | null
|
||||
}
|
||||
export const store = new Store<StoreData>({ name: "db" })
|
||||
|
||||
export enum StoreKey {
|
||||
CacheSizeLimit = "cacheSizeLimit",
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -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 () => {
|
||||
@@ -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)
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user