feat(db): migrate from lowdb to SQLite with repos pattern

- Add modular DB layer (adapters, migrations, repos, helpers)
- Replace localDb/usageDb/requestDetailsDb monoliths with repos
- Add Tailscale tunnel integration & status check API
- Add /api/cli-tools/all-statuses aggregated endpoint
- Add settingsStore (Zustand) and mitm/dbReader
- Add DB unit tests (benchmark, concurrent, migration, vs-lowdb)
This commit is contained in:
decolua committed 2026-05-09 17:48:20 +07:00
1 parent 145f588cc0
commit bee8dad946
63 files changed
+4223 -2330

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import fs from "node:fs";
import path from "node:path";
let cachedVersion = null;
export function getAppVersion() {
if (cachedVersion) return cachedVersion;
try {
const pkgPath = path.join(process.cwd(), "package.json");
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
cachedVersion = pkg.version || "0.0.0";
} catch {
cachedVersion = "0.0.0";
}
return cachedVersion;
}
export function timestampSlug(date = new Date()) {
const pad = (n) => String(n).padStart(2, "0");
return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}-${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
}