Skip to content

Commit

Permalink
fix d3 url to bypass CORS (#574)
Browse files Browse the repository at this point in the history
* fix d3 url to bypass CORS

* bump agent-js
  • Loading branch information
chenyan-dfinity authored Sep 17, 2024
1 parent 5234523 commit 829343f
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 88 deletions.
163 changes: 83 additions & 80 deletions tools/ui/package-lock.json

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

10 changes: 5 additions & 5 deletions tools/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"build": "webpack"
},
"devDependencies": {
"@dfinity/agent": "1.0.1",
"@dfinity/candid": "1.0.1",
"@dfinity/auth-client": "1.0.1",
"@dfinity/identity": "1.0.1",
"@dfinity/principal": "1.0.1",
"@dfinity/agent": "2.1.0",
"@dfinity/candid": "2.1.0",
"@dfinity/auth-client": "2.1.0",
"@dfinity/identity": "2.1.0",
"@dfinity/principal": "2.1.0",
"buffer": "6.0.3",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.8.1",
Expand Down
2 changes: 1 addition & 1 deletion tools/ui/src/candid.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h1 id="title">Candid UI</h1>
</div>
</div>
</app>
<script type="text/javascript" src="https://d3js.org/d3.v7.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3-flamegraph.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3-flamegraph-tooltip.min.js"></script>
<script>
Expand Down
4 changes: 2 additions & 2 deletions tools/ui/src/candid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const names: Record<number,string> = {};

function isKnownMainnet(agent: HttpAgent) {
// @ts-ignore
const hostname = agent._host.hostname;
const hostname = agent.host.hostname;
return hostname.endsWith('.icp0.io') || hostname.endsWith('.ic0.app');
}

export let authClient: AuthClient | undefined;

const agent = new HttpAgent();
const agent = HttpAgent.createSync();
if (!isKnownMainnet(agent)) {
agent.fetchRootKey();
}
Expand Down

0 comments on commit 829343f

Please sign in to comment.