Add Harbor Gateway auto-detection for client routing
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 13s
Build and Deploy Gateway / deploy (push) Successful in 1s

This commit is contained in:
2026-07-11 15:02:33 +03:00
parent 0a1aa8aed3
commit 51312d51cd
17 changed files with 717 additions and 165 deletions

View File

@@ -108,6 +108,7 @@ export function ClientOverviewPage({
onStop,
}) {
const isGateway = state?.mode === 'gateway';
const gatewayDirect = !isGateway && state?.gatewayAuto?.mode === 'gateway-direct';
const connected = Boolean(state?.singboxRunning);
const hasSubscription = Boolean(state?.hasSubscription);
const selectedTag = pendingTag || state?.selectedTag || '';
@@ -411,7 +412,7 @@ export function ClientOverviewPage({
type="button"
role="switch"
aria-checked={connected}
aria-label={connected ? 'Выключить VPN' : 'Включить VPN'}
aria-label={connected ? 'Остановить Harbor Connect' : 'Запустить Harbor Connect'}
disabled={busy || (!connected && !canStart)}
onClick={toggleConnection}
>
@@ -421,7 +422,9 @@ export function ClientOverviewPage({
</button>
<div className="client-state-copy" aria-live="polite">
<h2 key={connected ? 'connected' : 'disconnected'} id="connection-title">
{connected ? 'VPN включён' : 'VPN выключен'}
{connected
? gatewayDirect ? 'Gateway подключён' : 'VPN включён'
: 'Подключение выключено'}
</h2>
<div className="client-state-detail">
{connected ? (
@@ -505,7 +508,13 @@ export function ClientOverviewPage({
</div>
) : (
<div className="client-access-point" role={isGateway ? 'tabpanel' : undefined} key="proxy">
{!isGateway && <span className="client-proxy-label">Адрес</span>}
{!isGateway && (
<span className={`client-proxy-label${gatewayDirect ? ' is-gateway' : ''}`}>
{gatewayDirect
? `Через Harbor Gateway · ${state.gatewayAuto.address}`
: 'Локальный VPN'}
</span>
)}
<strong className="client-proxy-address">
{proxyUrls.http.replace(/^https?:\/\//, '')}
</strong>