feat: set cached config when import, refactor db

This commit is contained in:
shinya
2025-08-15 18:47:51 +08:00
parent 4be9788668
commit 840487acb0
10 changed files with 56 additions and 98 deletions

View File

@@ -29,7 +29,7 @@ function createStorage(): IStorage {
// 单例存储实例
let storageInstance: IStorage | null = null;
export function getStorage(): IStorage {
function getStorage(): IStorage {
if (!storageInstance) {
storageInstance = createStorage();
}
@@ -142,6 +142,14 @@ export class DbManager {
return this.storage.checkUserExist(userName);
}
async changePassword(userName: string, newPassword: string): Promise<void> {
await this.storage.changePassword(userName, newPassword);
}
async deleteUser(userName: string): Promise<void> {
await this.storage.deleteUser(userName);
}
// ---------- 搜索历史 ----------
async getSearchHistory(userName: string): Promise<string[]> {
return this.storage.getSearchHistory(userName);