9router/src/mitm/dbReader.js
decolua 7ad538bcf2 # v0.4.29 (2026-05-10)
## Features
- Add Cline & Kilo Code tool cards
- Tailscale TUN mode for stable Funnel TLS
- Sort APIKEY providers by usage, collapse to top 20

## Improvements
- Local Material Symbols font (no Google Fonts)
- Docker base: Bun → Node 22-alpine
- MITM reads aliases from JSON cache (no native sqlite)
- Stream stall timeout (2 min) in open-sse

## Fixes
- Fal.ai key test: use stable models endpoint
2026-05-10 21:56:40 +07:00

22 lines
689 B
JavaScript

// CJS reader for MITM standalone process. Reads mitmAlias from JSON cache
// at $DATA_DIR/mitm/aliases.json (synced by app from SQLite on startup + writes).
// JSON-only: no SQLite native binding required in MITM bundle.
const fs = require("fs");
const path = require("path");
const { DATA_DIR } = require("./paths");
const CACHE_FILE = path.join(DATA_DIR, "mitm", "aliases.json");
function readCache() {
try {
if (!fs.existsSync(CACHE_FILE)) return null;
return JSON.parse(fs.readFileSync(CACHE_FILE, "utf-8"));
} catch { return null; }
}
function getMitmAlias(toolName) {
const all = readCache();
return all?.[toolName] || null;
}
module.exports = { getMitmAlias };