Skip to content

Commit 3feefc1

Browse files
authored
feat: add github.dev and gitpod.io to known hosts (#822)
* Add 'github.dev' and 'gitpod.io' to known hosts * Update comment / tests
1 parent fdcfb45 commit 3feefc1

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

docs/generated/changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ <h2>Version x.x.x</h2>
1818
<li>feat: enhances `.from` methods on public key classes to support unknown types, including PublicKey instances, ArrayBuffer-like objects, DER encoded public keys, and hex strings. Also introduces a new `bufFromBufLike` util</li>
1919
<li>feat: introduces partial identities from public keys for authentication flows</li>
2020
<li>fix: honor disableIdle flag</li>
21+
<li>fix: add `github.dev` and `gitpod.io` to known hosts</li>
2122
</ul>
2223
<h2>Version 0.20.2</h2>
2324
<ul>

packages/agent/src/agent/http/http.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ describe('default host', () => {
733733
expect((agent as any)._host.hostname).toBe('icp-api.io');
734734
});
735735
it('should use the existing host if the agent is used on a known hostname', () => {
736-
const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', '127.0.0.1'];
736+
const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost', 'github.dev', 'gitpod.io'];
737737
for (const host of knownHosts) {
738738
delete (window as any).location;
739739
(window as any).location = {
@@ -745,7 +745,7 @@ describe('default host', () => {
745745
}
746746
});
747747
it('should correctly handle subdomains on known hosts', () => {
748-
const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', '127.0.0.1'];
748+
const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost', 'github.dev', 'gitpod.io'];
749749
for (const host of knownHosts) {
750750
delete (window as any).location;
751751
(window as any).location = {
@@ -757,8 +757,8 @@ describe('default host', () => {
757757
expect((agent as any)._host.hostname).toBe(host);
758758
}
759759
});
760-
it('should handle port numbers for 127.0.0.1', () => {
761-
const knownHosts = ['127.0.0.1', '127.0.0.1'];
760+
it('should handle port numbers for 127.0.0.1 and localhost', () => {
761+
const knownHosts = ['127.0.0.1', 'localhost'];
762762
for (const host of knownHosts) {
763763
delete (window as any).location;
764764
// hostname is different from host when port is specified

packages/agent/src/agent/http/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,15 @@ export class HttpAgent implements Agent {
223223
'Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning.',
224224
);
225225
}
226-
// Mainnet and local will have the api route available
227-
const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost'];
226+
// Mainnet, local, and remote environments will have the api route available
227+
const knownHosts = [
228+
'ic0.app',
229+
'icp0.io',
230+
'127.0.0.1',
231+
'localhost',
232+
'github.dev',
233+
'gitpod.io',
234+
];
228235
const hostname = location?.hostname;
229236
let knownHost;
230237
if (hostname && typeof hostname === 'string') {

0 commit comments

Comments
 (0)