From ce40a1959d9124fcab5e3b871429e441e8217d55 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Tue, 16 Jan 2024 12:24:15 -0700 Subject: [PATCH] Change root key fetching logic for remote environments --- tools/ui/src/candid.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ui/src/candid.ts b/tools/ui/src/candid.ts index bbba1cda..654fd4fd 100644 --- a/tools/ui/src/candid.ts +++ b/tools/ui/src/candid.ts @@ -12,16 +12,16 @@ declare var d3: any; const names: Record = {}; -function is_local(agent: HttpAgent) { +function isKnownMainnet(agent: HttpAgent) { // @ts-ignore const hostname = agent._host.hostname; - return hostname === '127.0.0.1' || hostname.endsWith('localhost'); + return hostname.endsWith('.icp0.io') || hostname.endsWith('.ic0.app'); } export let authClient: AuthClient | undefined; const agent = new HttpAgent(); -if (is_local(agent)) { +if (!isKnownMainnet(agent)) { agent.fetchRootKey(); }