Skip to content

Commit 3a09bd9

Browse files
feat(frontend): deprecate custom domains boundary nodes v0 (#2798)
1 parent 98610fd commit 3a09bd9

9 files changed

Lines changed: 4 additions & 151 deletions

File tree

.env.development

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
VITE_BN_REGISTRATIONS_URL=https://icp0.io/registrations
21
VITE_BN_CUSTOM_DOMAINS_URL=https://icp0.io/custom-domains/v1
32
VITE_JUNO_CDN_URL=
43
VITE_CYCLE_EXPRESS_URL=https://cycle.express/

.env.production

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
VITE_BN_REGISTRATIONS_URL=https://icp0.io/registrations
21
VITE_BN_CUSTOM_DOMAINS_URL=https://icp0.io/custom-domains/v1
32
VITE_JUNO_CDN_URL=https://cdn.juno.build
43
VITE_CYCLE_EXPRESS_URL=https://cycle.express/

.env.skylab

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
VITE_BN_REGISTRATIONS_URL=
21
VITE_BN_CUSTOM_DOMAINS_URL=
32
VITE_JUNO_CDN_URL=
43
VITE_CYCLE_EXPRESS_URL=

src/frontend/src/lib/components/satellites/hosting/CustomDomainActions.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
await deleteCustomDomainService({
8787
satelliteId: satellite.satellite_id,
8888
domainName: customDomain[0],
89-
customDomain: customDomain[1],
9089
deleteCustomDomain: !skipDeleteDomain,
9190
identity: $authIdentity
9291
});

src/frontend/src/lib/rest/bn.v0.rest.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/frontend/src/lib/services/satellite/hosting/custom-domain.services.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,33 @@
1-
import type { SatelliteDid } from '$declarations';
21
import {
32
deleteCustomDomain as deleteCustomDomainApi,
43
listCustomDomains as listCustomDomainsApi
54
} from '$lib/api/satellites.api';
6-
import { deleteDomainV0 } from '$lib/rest/bn.v0.rest';
75
import { deleteDomain } from '$lib/rest/bn.v1.rest';
86
import { i18n } from '$lib/stores/app/i18n.store';
97
import { toasts } from '$lib/stores/app/toasts.store';
108
import { authStore } from '$lib/stores/auth.store';
119
import { customDomainsStore } from '$lib/stores/satellite/custom-domains.store';
1210
import type { CustomDomainName } from '$lib/types/custom-domain';
1311
import type { NullishIdentity } from '$lib/types/itentity';
14-
import { assertNonNullish, fromNullable, nonNullish } from '@dfinity/utils';
12+
import { assertNonNullish, nonNullish } from '@dfinity/utils';
1513
import type { Principal } from '@icp-sdk/core/principal';
1614
import { get } from 'svelte/store';
1715

1816
export const deleteCustomDomain = async ({
1917
satelliteId,
20-
customDomain,
2118
domainName,
2219
deleteCustomDomain,
2320
identity
2421
}: {
2522
satelliteId: Principal;
26-
customDomain: SatelliteDid.CustomDomain;
2723
domainName: CustomDomainName;
2824
deleteCustomDomain: boolean;
2925
identity: NullishIdentity;
3026
}) => {
3127
assertNonNullish(identity, get(i18n).core.not_logged_in);
3228

3329
if (deleteCustomDomain) {
34-
// Delete domain name in BN
35-
const unregisterCustomDomain = async () => {
36-
const bnId = fromNullable(customDomain.bn_id);
37-
if (nonNullish(bnId)) {
38-
await deleteDomainV0({
39-
bnId
40-
});
41-
return;
42-
}
43-
44-
await deleteDomain({ domainName });
45-
};
46-
47-
await unregisterCustomDomain();
30+
await deleteDomain({ domainName });
4831
}
4932

5033
// Remove custom domain from satellite

src/frontend/src/lib/types/custom-domain.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,11 @@ export interface CustomDomainDns {
2323
entries: [CustomDomainDnsEntry, ...CustomDomainDnsEntry[]];
2424
}
2525

26-
// BN
27-
2826
export type CustomDomainState = z.infer<typeof CustomDomainStateSchema>;
2927

30-
/**
31-
* @deprecated
32-
*/
33-
type CustomDomainRegistrationV0State =
34-
| 'PendingOrder'
35-
| 'PendingChallengeResponse'
36-
| 'PendingAcmeApproval'
37-
| 'Available'
38-
| 'Failed';
39-
40-
/**
41-
* @deprecated
42-
*/
43-
interface CustomDomainRegistrationV0StateFailed {
44-
Failed: string;
45-
}
46-
47-
/**
48-
* @deprecated
49-
*/
50-
interface CustomDomainRegistrationV0Response {
51-
name: string;
52-
canister: string;
53-
state: CustomDomainRegistrationV0State | CustomDomainRegistrationV0StateFailed;
54-
}
55-
5628
export type GetCustomDomainState = z.infer<typeof GetCustomDomainStateSchema>;
5729

5830
export interface CustomDomainRegistration {
59-
/**
60-
* @deprecated
61-
*/
62-
v0: {
63-
State: CustomDomainRegistrationV0Response;
64-
};
6531
v1: {
6632
State: GetCustomDomainState;
6733
};

src/frontend/src/lib/workers/hosting.worker.ts

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type { SatelliteDid } from '$declarations';
21
import { SYNC_CUSTOM_DOMAIN_TIMER_INTERVAL } from '$lib/constants/app.constants';
3-
import { getCustomDomainRegistrationV0 } from '$lib/rest/bn.v0.rest';
42
import { getCustomDomainRegistration } from '$lib/rest/bn.v1.rest';
53
import type { CustomDomain, CustomDomainName, CustomDomainState } from '$lib/types/custom-domain';
64
import type { PostMessageDataRequest, PostMessageRequest } from '$lib/types/post-message';
7-
import { fromNullable, isNullish, nonNullish } from '@dfinity/utils';
5+
import { isNullish } from '@dfinity/utils';
86

97
export const onHostingMessage = async ({ data: dataMsg }: MessageEvent<PostMessageRequest>) => {
108
const { msg, data } = dataMsg;
@@ -55,12 +53,7 @@ const syncCustomDomainRegistration = async ({ customDomain }: { customDomain: Cu
5553

5654
try {
5755
const sync = async (): Promise<CustomDomainState> => {
58-
const [domainName, custom] = customDomain;
59-
60-
if (nonNullish(fromNullable(custom.bn_id))) {
61-
return await syncCustomDomainRegistrationV0({ customDomain: custom });
62-
}
63-
56+
const [domainName] = customDomain;
6457
return await syncCustomDomainRegistrationV1({ domain: domainName });
6558
};
6659

@@ -100,30 +93,6 @@ const syncCustomDomainRegistrationV1 = async ({
10093
return 'failed';
10194
};
10295

103-
const syncCustomDomainRegistrationV0 = async ({
104-
customDomain
105-
}: {
106-
customDomain: SatelliteDid.CustomDomain;
107-
}): Promise<CustomDomainState> => {
108-
const registration = await getCustomDomainRegistrationV0(customDomain);
109-
const registrationState = nonNullish(registration)
110-
? typeof registration.state !== 'string' && 'Failed' in registration.state
111-
? 'Failed'
112-
: registration.state
113-
: null;
114-
115-
switch (registrationState) {
116-
case 'PendingOrder':
117-
case 'PendingChallengeResponse':
118-
case 'PendingAcmeApproval':
119-
return 'registering';
120-
case 'Available':
121-
return 'registered';
122-
default:
123-
return 'failed';
124-
}
125-
};
126-
12796
// Update ui with registration state
12897
const emit = (registrationState: CustomDomainState | null) =>
12998
postMessage({

src/frontend/src/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ interface ImportMetaEnv {
1313
readonly VITE_JUNO_API_URL: string | undefined;
1414

1515
// .env
16-
readonly VITE_BN_REGISTRATIONS_URL: string | '' | undefined;
1716
readonly VITE_BN_CUSTOM_DOMAINS_URL: string | '' | undefined;
1817
readonly VITE_JUNO_CDN_URL: string | '' | undefined;
1918
readonly VITE_CYCLE_EXPRESS_URL: string | '' | undefined;

0 commit comments

Comments
 (0)