Rename product to Harbor and refine connection timer
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 12s
Build and Deploy Gateway / deploy (push) Successful in 1s

This commit is contained in:
2026-07-11 13:20:32 +03:00
parent 42c15df8c9
commit 84efbe7450
9 changed files with 305 additions and 45 deletions

View File

@@ -2,6 +2,7 @@ import fs from 'node:fs';
import http from 'node:http';
import path from 'node:path';
import { spawn, spawnSync } from 'node:child_process';
import { isDeepStrictEqual } from 'node:util';
import { settings } from './config.js';
import { setGatewayInterception } from './gatewayRouting.js';
import { tcpPing } from './ping.js';
@@ -221,12 +222,18 @@ function refreshSavedSubscription() {
const previousConfig = fs.existsSync(settings.configPath)
? fs.readFileSync(settings.configPath, 'utf8')
: null;
const activeConfigChanged = Boolean(currentState.selectedTag && selectedTag) && (
!previousCache?.config || !isDeepStrictEqual(
buildGatewayConfig(previousCache.config, currentState.selectedTag),
buildGatewayConfig(parsed.config, selectedTag),
)
);
writeJson(settings.subscriptionCachePath, { url: subscriptionUrl, ...parsed });
try {
if (singboxProcess && selectedTag) await applySelectedServer(selectedTag);
if (singboxProcess && activeConfigChanged) await applySelectedServer(selectedTag);
else if (selectedTag) {
writeSingboxConfig(buildGatewayConfig(parsed.config, selectedTag));
if (!singboxProcess) writeSingboxConfig(buildGatewayConfig(parsed.config, selectedTag));
} else {
removeSingboxConfig();
}