fix: add pylon relay fallback to dashboard status endpoint

The dashboard uses /api/v1/services/status (not /api/health/services)
for live status cards. This endpoint was missing pylon relay fallback,
so services unreachable from the Docker container showed as OFF even
when the pylon was running. Also adds Windows VBS startup wrapper for
pylon persistence across reboots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 16:50:24 -07:00
parent fc6275a96b
commit e5cd8678b0
2 changed files with 37 additions and 0 deletions

View File

@@ -65,6 +65,25 @@ module.exports = function(ctx) {
});
}
async function probeViaPylon(targetUrl) {
const pylonConfig = ctx.siteConfig?.pylon;
if (!pylonConfig?.url) return null;
try {
const probeUrl = `${pylonConfig.url}/probe?url=${encodeURIComponent(targetUrl)}`;
const headers = {};
if (pylonConfig.key) headers['x-pylon-key'] = pylonConfig.key;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 12000);
const response = await ctx.fetchT(probeUrl, { method: 'GET', signal: controller.signal, headers });
clearTimeout(timeout);
if (!response.ok) return null;
const data = await response.json();
return data;
} catch (_) {
return null;
}
}
async function probeServiceStatus(id, service) {
const startedAt = process.hrtime.bigint();
let url = resolveProbeUrl(id, service);
@@ -92,6 +111,22 @@ module.exports = function(ctx) {
}
}
// Pylon relay fallback — if direct probes failed, try through the pylon
if (error && ctx.siteConfig?.pylon) {
const pylonResult = await probeViaPylon(url);
if (pylonResult && pylonResult.status) {
const responseTime = Number((process.hrtime.bigint() - startedAt) / 1000000n);
return {
id,
isUp: pylonResult.status === 'healthy',
statusCode: pylonResult.statusCode || 0,
responseTime,
url,
via: 'pylon'
};
}
}
const responseTime = Number((process.hrtime.bigint() - startedAt) / 1000000n);
if (error) {
return {