The version label now renders 'v0.5.86 (<shortsha>)' when the flake build injects NEXT_PUBLIC_GIT_SHA (git commit identity of the deployed artifact), so any running dashboard traces to its exact source commit. Falls back to semver-only when the env var is absent (local dev). Also fixes the profile page repo link back to asepharyana/9router (MIBP merge target), replacing the mhiqrambg fork label left over from the merge.
114 lines
3.2 KiB
JavaScript
114 lines
3.2 KiB
JavaScript
import pkg from "../../../package.json" with { type: "json" };
|
|
|
|
// App configuration
|
|
export const APP_CONFIG = {
|
|
name: "9Router Proxy",
|
|
description: "AI Infrastructure Management",
|
|
version: pkg.version,
|
|
// Build identity = git short SHA, injected at build time by the Nix flake
|
|
// (NEXT_PUBLIC_GIT_SHA). Falls back to "dirty"/undefined in dev where the
|
|
// env var is absent, so the dashboard shows just the semver.
|
|
gitSha: process.env.NEXT_PUBLIC_GIT_SHA || null,
|
|
};
|
|
|
|
// GitHub configuration
|
|
export const GITHUB_CONFIG = {
|
|
changelogUrl: "https://raw.githubusercontent.com/decolua/9router/refs/heads/master/CHANGELOG.md",
|
|
donateUrl: "https://9router.com/api/donate",
|
|
};
|
|
|
|
// Updater configuration
|
|
export const UPDATER_CONFIG = {
|
|
npmPackageName: "9router",
|
|
installCmd: "npm i -g 9router",
|
|
installCmdLatest: "npm i -g 9router@latest --prefer-online",
|
|
shutdownCountdownSec: 3,
|
|
exitDelayMs: 500,
|
|
statusPort: 20129,
|
|
statusPollIntervalMs: 1000,
|
|
statusLogTailLines: 8,
|
|
installRetries: 3,
|
|
installRetryDelayMs: 5000,
|
|
lingerAfterDoneMs: 30000,
|
|
waitForExitMinMs: 5000,
|
|
waitForExitMaxMs: 20000,
|
|
waitForExitCheckMs: 500,
|
|
appPort: 20128,
|
|
};
|
|
|
|
// Theme configuration
|
|
export const THEME_CONFIG = {
|
|
storageKey: "theme",
|
|
defaultTheme: "system", // "light" | "dark" | "system"
|
|
};
|
|
|
|
// Subscription
|
|
export const SUBSCRIPTION_CONFIG = {
|
|
price: 1.0,
|
|
currency: "USD",
|
|
interval: "month",
|
|
planName: "Pro Plan",
|
|
};
|
|
|
|
// API endpoints
|
|
export const API_ENDPOINTS = {
|
|
users: "/api/users",
|
|
providers: "/api/providers",
|
|
payments: "/api/payments",
|
|
auth: "/api/auth",
|
|
};
|
|
|
|
export const CONSOLE_LOG_CONFIG = {
|
|
maxLines: 200,
|
|
pollIntervalMs: 1000,
|
|
};
|
|
|
|
// Client-side store TTL: how long fetched data stays fresh before re-fetching
|
|
export const CLIENT_STORE_TTL_MS = 60000;
|
|
|
|
// Quota auto-ping: keep 5h windows warm by sending a tiny request right after reset.
|
|
export const QUOTA_AUTOPING_CONFIG = {
|
|
tickIntervalMs: 60000, // scheduler tick
|
|
pingLeadMs: 5000, // fire once reset passes (within tolerance)
|
|
refreshAheadMs: 300000, // refetch usage when within 5min of reset
|
|
failureCooldownMs: 900000, // avoid failed ping spam while upstream/auth is unhealthy
|
|
providers: {
|
|
claude: {
|
|
settingsKey: "claudeAutoPing", // preserve existing settings contract
|
|
quotaKey: "session (5h)", // quota key returned by usage handler
|
|
pingModel: "claude-haiku-4-5-20251001",
|
|
pingText: "hi",
|
|
pingMaxTokens: 1,
|
|
},
|
|
codex: {
|
|
settingsKey: "codexAutoPing",
|
|
quotaKey: "session",
|
|
pingWhenResetAtSlides: true,
|
|
resetAtDriftMs: 30000,
|
|
minPingIntervalMs: 600000,
|
|
skipWhenBlockingQuotaExhausted: true,
|
|
// Free and Plus Codex accounts both expose gpt-5.5; avoid fallback probes that waste requests.
|
|
pingModel: "gpt-5.5",
|
|
pingText: "hi",
|
|
pingInstructions: "Reply with OK.",
|
|
pingReasoningEffort: "none",
|
|
},
|
|
},
|
|
};
|
|
|
|
// Re-export from providers.js for backward compatibility
|
|
export {
|
|
FREE_PROVIDERS,
|
|
OAUTH_PROVIDERS,
|
|
APIKEY_PROVIDERS,
|
|
WEB_COOKIE_PROVIDERS,
|
|
AI_PROVIDERS,
|
|
AUTH_METHODS,
|
|
} from "./providers.js";
|
|
|
|
// Re-export from models.js for backward compatibility
|
|
export {
|
|
PROVIDER_MODELS,
|
|
AI_MODELS,
|
|
} from "./models.js";
|