Skip to content

Commit

Permalink
Merge branch 'master' into elias/fix-remote-development-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
fxgst authored Jan 22, 2024
2 parents e68bfc6 + c24644f commit ea37ced
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions tools/ui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions tools/ui/src/candid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ declare var d3: any;

const names: Record<number,string> = {};

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)) {
const agent = new HttpAgent({
host: window.location.host.replace(/^(localhost)(:\d+)?$/, '127.0.0.1$2')
});
if (!isKnownMainnet(agent)) {
agent.fetchRootKey();
}

Expand Down

0 comments on commit ea37ced

Please sign in to comment.