Handle rejected subscriptions and add local client compose
This commit is contained in:
@@ -108,8 +108,9 @@ export async function probeGatewayPresence({
|
||||
}) {
|
||||
if (!isIpv4(gateway)) throw new Error('Некорректный адрес default gateway');
|
||||
|
||||
const presenceUrl = `http://${gateway}:${port}/api/gateway-presence?nonce=${nonce}`;
|
||||
const response = await fetchImpl(
|
||||
`http://${gateway}:${port}/api/gateway-presence?nonce=${nonce}`,
|
||||
presenceUrl,
|
||||
{ headers: { accept: 'application/json' }, signal: AbortSignal.timeout(timeoutMs) },
|
||||
);
|
||||
const payload = await response.json().catch(() => ({}));
|
||||
@@ -117,7 +118,11 @@ export async function probeGatewayPresence({
|
||||
throw new Error('Текущий default gateway не является доверенным Harbor Gateway');
|
||||
}
|
||||
|
||||
return { gatewayId: payload.gatewayId };
|
||||
return {
|
||||
gatewayId: payload.gatewayId,
|
||||
uiOrigin: new URL(presenceUrl).origin,
|
||||
verifiedAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeHostNetworkState(value, {
|
||||
@@ -169,6 +174,8 @@ export function createGatewayAutoState() {
|
||||
failures: 0,
|
||||
gateway: null,
|
||||
gatewayId: '',
|
||||
uiOrigin: '',
|
||||
lastVerifiedAt: null,
|
||||
lastError: '',
|
||||
};
|
||||
}
|
||||
@@ -199,6 +206,8 @@ export function nextGatewayAutoState(current, {
|
||||
mode: 'gateway-direct',
|
||||
failures: 0,
|
||||
gatewayId: verifiedGateway.gatewayId,
|
||||
uiOrigin: verifiedGateway.uiOrigin || '',
|
||||
lastVerifiedAt: verifiedGateway.verifiedAt || new Date().toISOString(),
|
||||
lastError: '',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user