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 2026-05-09 17:48:20 +07:00
parent 145f588cc0
commit bee8dad946
63 changed files with 4223 additions and 2330 deletions

View file

@ -114,7 +114,7 @@ export default function RequestLogger() {
</div>
</Card>
<div className="text-[10px] text-text-muted italic">
Logs are saved to log.txt in the application data directory.
Logs are loaded from the request history database.
</div>
</div>
);

View file

@ -51,7 +51,7 @@ export default function Sidebar({ onClose }) {
const { copied, copy } = useCopyToClipboard(2000);
const INSTALL_CMD = UPDATER_CONFIG.installCmd;
const STATUS_URL = `http://localhost:${UPDATER_CONFIG.statusPort}/update/status`;
const STATUS_URL = `http://127.0.0.1:${UPDATER_CONFIG.statusPort}/update/status`;
useEffect(() => {
fetch("/api/settings")

View file

@ -2,7 +2,7 @@ import pkg from "../../../package.json" with { type: "json" };
// App configuration
export const APP_CONFIG = {
name: "9Router proxy",
name: "9Router Proxy",
description: "AI Infrastructure Management",
version: pkg.version,
};
@ -56,6 +56,9 @@ export const CONSOLE_LOG_CONFIG = {
pollIntervalMs: 1000,
};
// Client-side store TTL: how long fetched data stays fresh before re-fetching
export const CLIENT_STORE_TTL_MS = 60000;
// Provider API endpoints (for display only)
export const PROVIDER_ENDPOINTS = {
openrouter: "https://openrouter.ai/api/v1/chat/completions",

View file

@ -4,7 +4,7 @@ import { isCloudEnabled } from "@/lib/localDb";
const INTERNAL_BASE_URL =
process.env.BASE_URL ||
process.env.NEXT_PUBLIC_BASE_URL ||
"http://localhost:20128";
"http://127.0.0.1:20128";
/**
* Cloud sync scheduler