mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-04 00:42:01 +08:00
Use MikroORM's official Node SQLite dialect with bounded database isolation, preserve legacy schema and data for rollback, and require Node 22.17 or newer. Update Debian runtimes and retain ARMv6 musl compatibility without a SQLite addon. Complete short archive writes, stop orphaned SQL workers after owner death, preserve buffered startup requests, and prestart the archived backend on every platform. Cover real package installation, migration, failure recovery, and legacy database compatibility.
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { AuthInfo } from '../data/system';
|
|
import { App } from '../data/open';
|
|
import Keyv from 'keyv';
|
|
import { CacheStore } from '../data/cacheStore';
|
|
|
|
export enum EKeyv {
|
|
'apps' = 'apps',
|
|
'authInfo' = 'authInfo',
|
|
'lang' = 'lang',
|
|
}
|
|
|
|
export interface IKeyvStore {
|
|
apps: App[];
|
|
authInfo: AuthInfo;
|
|
lang: string;
|
|
}
|
|
|
|
const keyvSqlite = new CacheStore();
|
|
export const keyvStore = new Keyv<IKeyvStore>({ store: keyvSqlite });
|
|
|
|
export const shareStore = {
|
|
getAuthInfo() {
|
|
return keyvStore.get<IKeyvStore['authInfo']>(EKeyv.authInfo);
|
|
},
|
|
updateAuthInfo(value: IKeyvStore['authInfo']) {
|
|
return keyvStore.set<IKeyvStore['authInfo']>(EKeyv.authInfo, value);
|
|
},
|
|
getApps() {
|
|
return keyvStore.get<IKeyvStore['apps']>(EKeyv.apps);
|
|
},
|
|
updateApps(apps: App[]) {
|
|
return keyvStore.set<IKeyvStore['apps']>(EKeyv.apps, apps);
|
|
},
|
|
getLang() {
|
|
return keyvStore.get<IKeyvStore['lang']>(EKeyv.lang);
|
|
},
|
|
setLang(value: IKeyvStore['lang']) {
|
|
return keyvStore.set<IKeyvStore['lang']>(EKeyv.lang, value);
|
|
},
|
|
};
|