mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-18 22:36:19 +00:00
d69fb9f1da
Hide the Traffic / Routing, Deployments, Federation and Secrets Fleet tabs by default. They re-appear when the operator opts in by setting SENCHO_EXPERIMENTAL=true. Backend routes and database tables are unchanged; this is a UI discovery gate only. The /api/meta endpoint now returns experimental as a boolean. A new useExperimental hook reads it once per page load and feeds the four tab triggers and tab content panels in FleetView.
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { Router, type Request, type Response } from 'express';
|
|
import { getActiveCapabilities, getSenchoVersion } from '../services/CapabilityRegistry';
|
|
import SelfUpdateService from '../services/SelfUpdateService';
|
|
|
|
// Captured at boot. Exposed via /api/health and /api/meta so the Fleet update
|
|
// overlay can distinguish a brand-new process from the old one still mid-pull.
|
|
const processStartedAt = Date.now();
|
|
|
|
export const metaRouter = Router();
|
|
|
|
// Public health endpoint (no auth). Used by Docker HEALTHCHECK and uptime monitors.
|
|
metaRouter.get('/health', (_req: Request, res: Response): void => {
|
|
res.json({ status: 'ok', uptime: process.uptime(), startedAt: processStartedAt });
|
|
});
|
|
|
|
// Public meta endpoint. Returns this instance's version and supported
|
|
// capabilities. No auth required (like /health). Used by remote nodes during
|
|
// connection tests.
|
|
metaRouter.get('/meta', (_req: Request, res: Response): void => {
|
|
const updateError = SelfUpdateService.getInstance().getLastError();
|
|
res.json({
|
|
version: getSenchoVersion(),
|
|
capabilities: getActiveCapabilities(),
|
|
startedAt: processStartedAt,
|
|
experimental: process.env.SENCHO_EXPERIMENTAL === 'true',
|
|
...(updateError ? { updateError } : {}),
|
|
});
|
|
});
|