Add enabled local routing rules and gateway version reporting
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
||||
import { HarborError, normalizeHarborError } from '../shared/errors.js';
|
||||
import { normalizeRouteRules } from '../shared/routingRules.js';
|
||||
import { createJsonStore, createStateStore } from './services/stateStore.js';
|
||||
import { buildVersionInfo } from './version.js';
|
||||
import { buildGatewayVersionInfo, buildVersionInfo } from './version.js';
|
||||
|
||||
const MAX_BODY_BYTES = 1_000_000;
|
||||
const SUBSCRIPTION_REFRESH_INTERVAL_MS = 15 * 60 * 1000;
|
||||
@@ -90,7 +90,7 @@ let revision = normalizeStoredState(initialStoredState).revision;
|
||||
function updateStoredState(update) {
|
||||
return stateStore.update((stored) => {
|
||||
const current = normalizeStoredState(stored);
|
||||
const next = normalizeStoredState(update(current));
|
||||
const next = normalizeStoredState({ schemaVersion: current.schemaVersion, ...update(current) });
|
||||
revision = Math.max(revision, current.revision) + 1;
|
||||
next.revision = revision;
|
||||
return next;
|
||||
@@ -505,11 +505,7 @@ async function handleApi(req, res) {
|
||||
if (req.method === 'GET' && req.url === '/api/version') {
|
||||
if (!remoteDataplane) return sendJson(res, 200, versionInfo);
|
||||
const runtime = await singboxRuntime.refresh();
|
||||
return sendJson(res, 200, {
|
||||
...versionInfo,
|
||||
components: { gatewayBackend: runtime.gatewayBackendVersion || null },
|
||||
runtime: { singBox: runtime.singBoxVersion || null },
|
||||
});
|
||||
return sendJson(res, 200, buildGatewayVersionInfo(versionInfo, runtime));
|
||||
}
|
||||
|
||||
if (req.method === 'GET' && req.url === '/api/shared-proxy') {
|
||||
|
||||
Reference in New Issue
Block a user