diff --git a/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domain.const.ts b/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domain.const.ts
index 0074d9030..63ad3777e 100644
--- a/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domain.const.ts
+++ b/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domain.const.ts
@@ -2,7 +2,7 @@ import { Config } from '@start9labs/start-sdk/lib/config/builder/config'
import { Value } from '@start9labs/start-sdk/lib/config/builder/value'
import { Variants } from '@start9labs/start-sdk/lib/config/builder/variants'
-const ddnsOptions = Config.of({
+const auth = Config.of({
username: Value.text({
name: 'Username',
required: { default: null },
@@ -14,7 +14,46 @@ const ddnsOptions = Config.of({
}),
})
-export const domainSpec = Config.of({
+const strategyUnion = Value.union(
+ {
+ name: 'Networking Strategy',
+ required: { default: 'router' },
+ },
+ Variants.of({
+ router: {
+ name: 'Router',
+ spec: Config.of({
+ ip: Value.select({
+ name: 'IP Strategy',
+ description: `
+
IPv6 Only
Pros: Ready for IPv6 Internet. Enhanced privacy, as IPv6 addresses are less correlated with geographic area
+Cons: Your website is only accessible to people who's ISP supports IPv6
+IPv6 and IPv4
Pros: Ready for IPv6 Internet. Anyone can access your website
+Cons: IPv4 addresses are closely correlated with geographic areas
+IPv4 Only
Pros: Anyone can access your website
+Cons: IPv4 addresses are closely correlated with geographic areas
+`,
+ required: { default: 'ipv6' },
+ values: {
+ ipv6: 'IPv6 Only',
+ both: 'IPv6 and IPv4',
+ ipv4: 'IPv4 Only',
+ },
+ }),
+ }),
+ },
+ reverseProxy: {
+ name: 'Reverse Proxy',
+ spec: Config.of({}),
+ },
+ }),
+)
+
+export const start9MeSpec = Config.of({
+ strategy: strategyUnion,
+})
+
+export const customSpec = Config.of({
hostname: Value.text({
name: 'Hostname',
required: { default: null },
@@ -32,30 +71,32 @@ export const domainSpec = Config.of({
},
duckdns: {
name: 'Duck DNS',
- spec: ddnsOptions,
+ spec: auth,
},
dyn: {
name: 'DynDNS',
- spec: ddnsOptions,
+ spec: auth,
},
easydns: {
name: 'easyDNS',
- spec: ddnsOptions,
+ spec: auth,
},
googledomains: {
name: 'Google Domains',
- spec: ddnsOptions,
+ spec: auth,
},
namecheap: {
name: 'Namecheap (IPv4 only)',
- spec: ddnsOptions,
+ spec: auth,
},
zoneedit: {
name: 'Zoneedit',
- spec: ddnsOptions,
+ spec: auth,
},
}),
),
+ strategy: strategyUnion,
})
-export type DomainSpec = typeof domainSpec.validator._TYPE
+export type Start9MeSpec = typeof start9MeSpec.validator._TYPE
+export type CustomSpec = typeof customSpec.validator._TYPE
diff --git a/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domains.page.html b/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domains.page.html
index 2369d135c..3bb2065bb 100644
--- a/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domains.page.html
+++ b/frontend/projects/ui/src/app/apps/ui/pages/system/domains/domains.page.html
@@ -24,7 +24,7 @@
class="ion-padding-start"
strong
size="small"
- (click)="presentAlertClaimStart9MeDomain()"
+ (click)="presentModalClaimStart9Me()"
>
Claim
@@ -34,20 +34,24 @@
- Domain
- Added
- DDNS Provider
- In Use
-
+ Domain
+ Added
+ DDNS Provider
+ Network Strategy
+ IP Strategy
+ In Use
+
- {{ start9Me.value }}
- {{ start9Me.createdAt| date: 'medium' }}
- Start9
-
+ {{ start9Me.value }}
+ {{ start9Me.createdAt| date: 'short' }}
+ Start9
+ {{ start9Me.networkStrategy }}
+ {{ start9Me.ipStrategy || 'N/A' }}
+
N/A
-
+
@@ -85,20 +89,24 @@
- Domain
- Added
- DDNS Provider
- In Use
-
+ Domain
+ Added
+ DDNS Provider
+ Network Strategy
+ IP Strategy
+ In Use
+
- {{ domain.value }}
- {{ domain.createdAt| date: 'medium' }}
- {{ domain.provider.unionSelectKey }}
-
+ {{ domain.value }}
+ {{ domain.createdAt| date: 'short' }}
+ {{ domain.provider }}
+ {{ domain.networkStrategy }}
+ {{ domain.ipStrategy || 'N/A' }}
+
N/A
-
+
combineLatest([this.server$, this.pkgs$]).pipe(
@@ -35,6 +40,8 @@ export class DomainsPage {
value: `${start9MeSubdomain.value}.start9.me`,
createdAt: start9MeSubdomain.createdAt,
provider: 'Start9',
+ networkStrategy: start9MeSubdomain.networkStrategy,
+ ipStrategy: start9MeSubdomain.ipStrategy,
usedBy: usedBy(
start9MeSubdomain.value,
getClearnetAddress('https', ui.domainInfo),
@@ -45,6 +52,8 @@ export class DomainsPage {
value: domain.value,
createdAt: domain.createdAt,
provider: domain.provider,
+ networkStrategy: domain.networkStrategy,
+ ipStrategy: domain.ipStrategy,
usedBy: usedBy(
domain.value,
getClearnetAddress('https', ui.domainInfo),
@@ -69,10 +78,10 @@ export class DomainsPage {
) {}
async presentModalAdd() {
- const options: Partial>> = {
+ const options: Partial>> = {
label: 'Custom Domain',
data: {
- spec: await domainSpec.build({} as any),
+ spec: await customSpec.build({} as any),
buttons: [
{
text: 'Save',
@@ -84,19 +93,20 @@ export class DomainsPage {
this.formDialog.open(FormPage, options)
}
- presentAlertClaimStart9MeDomain() {
- this.dialogs
- .open(TUI_PROMPT, {
- label: 'Confirm',
- size: 's',
- data: {
- content: 'Claim your start9.me domain?',
- yes: 'Claim',
- no: 'Cancel',
- },
- })
- .pipe(filter(Boolean))
- .subscribe(() => this.claimStart9MeDomain())
+ async presentModalClaimStart9Me() {
+ const options: Partial>> = {
+ label: 'start9.me',
+ data: {
+ spec: await start9MeSpec.build({} as any),
+ buttons: [
+ {
+ text: 'Save',
+ handler: async value => this.claimStart9MeDomain(value),
+ },
+ ],
+ },
+ }
+ this.formDialog.open(FormPage, options)
}
presentAlertDelete(hostname: string) {
@@ -143,11 +153,17 @@ export class DomainsPage {
.subscribe()
}
- private async claimStart9MeDomain(): Promise {
+ private async claimStart9MeDomain(value: Start9MeSpec): Promise {
const loader = this.loader.open('Saving...').subscribe()
+ const networkStrategy = value.strategy.unionSelectKey
+
try {
- await this.api.claimStart9MeDomain({})
+ await this.api.claimStart9MeDomain({
+ networkStrategy,
+ ipStrategy:
+ networkStrategy === 'router' ? value.strategy.unionValueKey.ip : null,
+ })
return true
} catch (e: any) {
this.errorService.handleError(e)
@@ -157,11 +173,30 @@ export class DomainsPage {
}
}
- private async save(value: DomainSpec): Promise {
+ private async save(value: CustomSpec): Promise {
const loader = this.loader.open('Saving...').subscribe()
+ const networkStrategy = value.strategy.unionSelectKey
+ const providerName = value.provider.unionSelectKey
+
try {
- await this.api.addDomain(value)
+ await this.api.addDomain({
+ hostname: value.hostname,
+ provider: {
+ name: providerName,
+ username:
+ providerName === 'start9'
+ ? null
+ : value.provider.unionValueKey.username,
+ password:
+ providerName === 'start9'
+ ? null
+ : value.provider.unionValueKey.password,
+ },
+ networkStrategy,
+ ipStrategy:
+ networkStrategy === 'router' ? value.strategy.unionValueKey.ip : null,
+ })
return true
} catch (e: any) {
this.errorService.handleError(e)
diff --git a/frontend/projects/ui/src/app/services/api/api.types.ts b/frontend/projects/ui/src/app/services/api/api.types.ts
index a0a0454ba..595282334 100644
--- a/frontend/projects/ui/src/app/services/api/api.types.ts
+++ b/frontend/projects/ui/src/app/services/api/api.types.ts
@@ -8,7 +8,10 @@ import {
} from 'src/app/services/patch-db/data-model'
import { StartOSDiskInfo, LogsRes, ServerLogsReq } from '@start9labs/shared'
import { customSmtp } from '@start9labs/start-sdk/lib/config/configConstants'
-import { DomainSpec } from 'src/app/apps/ui/pages/system/domains/domain.const'
+import {
+ CustomSpec,
+ Start9MeSpec,
+} from 'src/app/apps/ui/pages/system/domains/domain.const'
export module RR {
// DB
@@ -112,13 +115,25 @@ export module RR {
// domains
- export type ClaimStart9MeReq = {} // net.domain.me.claim
+ export type ClaimStart9MeReq = {
+ networkStrategy: string
+ ipStrategy: string | null
+ } // net.domain.me.claim
export type ClaimStart9MeRes = null
export type DeleteStart9MeReq = {} // net.domain.me.delete
export type DeleteStart9MeRes = null
- export type AddDomainReq = DomainSpec // net.domain.add
+ export type AddDomainReq = {
+ hostname: string
+ provider: {
+ name: string
+ username: string | null
+ password: string | null
+ }
+ networkStrategy: string
+ ipStrategy: string | null
+ } // net.domain.add
export type AddDomainRes = null
export type DeleteDomainReq = { hostname: string } // net.domain.delete
diff --git a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts
index fa305e16a..310ded003 100644
--- a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts
+++ b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts
@@ -452,6 +452,8 @@ export class MockApiService extends ApiService {
value: {
value: 'xyz',
createdAt: new Date(),
+ networkStrategy: params.networkStrategy,
+ ipStrategy: params.ipStrategy,
},
},
]
@@ -482,7 +484,9 @@ export class MockApiService extends ApiService {
value: [
{
value: params.hostname,
- provider: params.provider,
+ provider: params.provider.name,
+ networkStrategy: params.networkStrategy,
+ ipStrategy: params.ipStrategy,
createdAt: new Date(),
},
],
diff --git a/frontend/projects/ui/src/app/services/patch-db/data-model.ts b/frontend/projects/ui/src/app/services/patch-db/data-model.ts
index 6221a773d..64ef1cf98 100644
--- a/frontend/projects/ui/src/app/services/patch-db/data-model.ts
+++ b/frontend/projects/ui/src/app/services/patch-db/data-model.ts
@@ -3,7 +3,7 @@ import { Url } from '@start9labs/shared'
import { Manifest } from '@start9labs/marketplace'
import { BackupJob } from '../api/api.types'
import { customSmtp } from '@start9labs/start-sdk/lib/config/configConstants'
-import { DomainSpec } from 'src/app/apps/ui/pages/system/domains/domain.const'
+import { CustomSpec } from 'src/app/apps/ui/pages/system/domains/domain.const'
export interface DataModel {
'server-info': ServerInfo
@@ -104,7 +104,9 @@ export type WiFiInfo = {
export type Domain = {
value: string
- provider: DomainSpec['provider']
+ provider: string
+ networkStrategy: string
+ ipStrategy: string
createdAt: string
}