Rename product to Harbor and refine connection timer
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user