From 28fd2f03140a2a8df3cb057709a6ee38692a56a8 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 16 Mar 2024 13:09:17 -0600 Subject: [PATCH] More 036 Frontend changes (#2572) * update patchDB for futuristic revisions * interfaces display updates * remove zram and move tor to settings --- .../app/app/preloader/preloader.component.ts | 3 +- .../app-interfaces/app-interfaces.page.html | 6 +- .../app-interfaces/app-interfaces.page.ts | 77 ++++--- .../experimental-features.module.ts | 24 -- .../experimental-features.page.html | 36 --- .../experimental-features.page.scss | 0 .../experimental-features.page.ts | 151 ------------- .../server-routes/server-routing.module.ts | 7 - .../server-show/server-show.page.ts | 81 ++++++- .../ui/src/app/services/api/api.fixures.ts | 118 +++++----- .../ui/src/app/services/api/api.types.ts | 5 - .../app/services/api/embassy-api.service.ts | 2 - .../services/api/embassy-live-api.service.ts | 4 - .../services/api/embassy-mock-api.service.ts | 14 -- .../ui/src/app/services/api/mock-patch.ts | 206 +++++++++++++----- .../src/app/services/patch-db/data-model.ts | 1 - 16 files changed, 334 insertions(+), 401 deletions(-) delete mode 100644 web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.module.ts delete mode 100644 web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.html delete mode 100644 web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.scss delete mode 100644 web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.ts diff --git a/web/projects/ui/src/app/app/preloader/preloader.component.ts b/web/projects/ui/src/app/app/preloader/preloader.component.ts index 9823ac981..0b387ac45 100644 --- a/web/projects/ui/src/app/app/preloader/preloader.component.ts +++ b/web/projects/ui/src/app/app/preloader/preloader.component.ts @@ -40,8 +40,6 @@ const ICONS = [ 'file-tray-stacked-outline', 'finger-print-outline', 'flash-outline', - 'flask-outline', - 'flash-off-outline', 'folder-open-outline', 'globe-outline', 'grid-outline', @@ -70,6 +68,7 @@ const ICONS = [ 'receipt-outline', 'refresh', 'reload', + 'reload-circle-outline', 'remove', 'remove-circle-outline', 'remove-outline', diff --git a/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.html b/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.html index ea83aedb1..79b1a1fde 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.html @@ -10,7 +10,7 @@ - User Interfaces (UI) + User Interfaces - Application Program Interfaces (API) + Application Program Interfaces - Peer-To-Peer Interfaces (P2P) + Peer-To-Peer Interfaces { - const addresses: MappedAddress[] = [] + const addresses: MappedAddress[] = [] - let name = '' - let hostname = '' + hostnames.forEach(h => { + let name = '' + let hostname = '' - if (h.kind === 'onion') { - name = 'Tor' - hostname = h.hostname.value + if (h.kind === 'onion') { + name = 'Tor' + hostname = h.hostname.value + } else { + const hostnameKind = h.hostname.kind + + if (hostnameKind === 'domain') { + name = 'Domain' + hostname = `${h.hostname.subdomain}.${h.hostname.domain}` } else { - name = h.hostname.kind - hostname = - h.hostname.kind === 'domain' - ? `${h.hostname.subdomain}.${h.hostname.domain}` - : h.hostname.value + name = + hostnameKind === 'local' + ? 'Local' + : `${h.networkInterfaceId} (${hostnameKind})` + hostname = h.hostname.value } + } - if (h.hostname.sslPort) { - const port = h.hostname.sslPort === 443 ? '' : `:${h.hostname.sslPort}` - const scheme = addressInfo.bindOptions.addSsl?.scheme - ? `${addressInfo.bindOptions.addSsl.scheme}://` - : '' + if (h.hostname.sslPort) { + const port = h.hostname.sslPort === 443 ? '' : `:${h.hostname.sslPort}` + const scheme = addressInfo.bindOptions.addSsl?.scheme + ? `${addressInfo.bindOptions.addSsl.scheme}://` + : '' - addresses.push({ - name, - url: `${scheme}${username}${hostname}${port}${suffix}`, - }) - } + addresses.push({ + name: name === 'Tor' ? 'Tor (HTTPS)' : name, + url: `${scheme}${username}${hostname}${port}${suffix}`, + }) + } - if (h.hostname.port) { - const port = h.hostname.port === 80 ? '' : `:${h.hostname.port}` - const scheme = addressInfo.bindOptions.scheme - ? `${addressInfo.bindOptions.scheme}://` - : '' + if (h.hostname.port) { + const port = h.hostname.port === 80 ? '' : `:${h.hostname.port}` + const scheme = addressInfo.bindOptions.scheme + ? `${addressInfo.bindOptions.scheme}://` + : '' - addresses.push({ - name, - url: `${scheme}${username}${hostname}${port}${suffix}`, - }) - } + addresses.push({ + name: name === 'Tor' ? 'Tor (HTTP)' : name, + url: `${scheme}${username}${hostname}${port}${suffix}`, + }) + } + }) - return addresses - }) - .flat() + return addresses } diff --git a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.module.ts b/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.module.ts deleted file mode 100644 index 86e374b17..000000000 --- a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { Routes, RouterModule } from '@angular/router' -import { IonicModule } from '@ionic/angular' -import { ExperimentalFeaturesPage } from './experimental-features.page' -import { EmverPipesModule } from '@start9labs/shared' - -const routes: Routes = [ - { - path: '', - component: ExperimentalFeaturesPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - EmverPipesModule, - ], - declarations: [ExperimentalFeaturesPage], -}) -export class ExperimentalFeaturesPageModule {} diff --git a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.html b/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.html deleted file mode 100644 index 0ca8c7d8e..000000000 --- a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Experimental Features - - - - - - - - -

Reset Tor

-

- Resetting the Tor daemon on your server may resolve Tor connectivity - issues. -

-
-
- - - -

{{ server.zram ? 'Disable' : 'Enable' }} zram

-

- Zram creates compressed swap in memory, resulting in faster I/O for - low RAM devices -

-
-
-
-
diff --git a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.scss b/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.ts b/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.ts deleted file mode 100644 index bf445250a..000000000 --- a/web/projects/ui/src/app/pages/server-routes/experimental-features/experimental-features.page.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core' -import { - AlertController, - LoadingController, - ToastController, -} from '@ionic/angular' -import { PatchDB } from 'patch-db-client' -import { ApiService } from 'src/app/services/api/embassy-api.service' -import { ConfigService } from 'src/app/services/config.service' -import { DataModel } from 'src/app/services/patch-db/data-model' -import { ErrorToastService } from '@start9labs/shared' - -@Component({ - selector: 'experimental-features', - templateUrl: './experimental-features.page.html', - styleUrls: ['./experimental-features.page.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class ExperimentalFeaturesPage { - readonly server$ = this.patch.watch$('server-info') - - constructor( - private readonly toastCtrl: ToastController, - private readonly patch: PatchDB, - private readonly config: ConfigService, - private readonly alertCtrl: AlertController, - private readonly loadingCtrl: LoadingController, - private readonly api: ApiService, - private readonly errToast: ErrorToastService, - ) {} - - async presentAlertResetTor() { - const isTor = this.config.isTor() - const shared = - 'Optionally wipe state to forcibly acquire new guard nodes. It is recommended to try without wiping state first.' - const alert = await this.alertCtrl.create({ - header: isTor ? 'Warning' : 'Confirm', - message: isTor - ? `You are currently connected over Tor. If you reset the Tor daemon, you will loose connectivity until it comes back online.

${shared}` - : `Reset Tor?

${shared}`, - inputs: [ - { - label: 'Wipe state', - type: 'checkbox', - value: 'wipe', - }, - ], - buttons: [ - { - text: 'Cancel', - role: 'cancel', - }, - { - text: 'Reset', - handler: (value: string[]) => { - this.resetTor(value.some(v => v === 'wipe')) - }, - cssClass: 'enter-click', - }, - ], - cssClass: isTor ? 'alert-warning-message' : '', - }) - await alert.present() - } - - async presentAlertZram(enabled: boolean) { - const alert = await this.alertCtrl.create({ - header: 'Confirm', - message: enabled - ? 'Are you sure you want to disable zram? It provides significant performance benefits on low RAM devices.' - : 'Enable zram? It will only make a difference on lower RAM devices.', - buttons: [ - { - text: 'Cancel', - role: 'cancel', - }, - { - text: enabled ? 'Disable' : 'Enable', - handler: () => { - this.toggleZram(enabled) - }, - cssClass: 'enter-click', - }, - ], - }) - await alert.present() - } - - private async resetTor(wipeState: boolean) { - const loader = await this.loadingCtrl.create({ - message: 'Resetting Tor...', - }) - await loader.present() - - try { - await this.api.resetTor({ - 'wipe-state': wipeState, - reason: 'User triggered', - }) - const toast = await this.toastCtrl.create({ - header: 'Tor reset in progress', - position: 'bottom', - duration: 4000, - buttons: [ - { - side: 'start', - icon: 'close', - handler: () => { - return true - }, - }, - ], - }) - await toast.present() - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } - - private async toggleZram(enabled: boolean) { - const loader = await this.loadingCtrl.create({ - message: enabled ? 'Disabling zram...' : 'Enabling zram...', - }) - await loader.present() - - try { - await this.api.toggleZram({ enable: !enabled }) - const toast = await this.toastCtrl.create({ - header: `Zram ${enabled ? 'disabled' : 'enabled'}`, - position: 'bottom', - duration: 4000, - buttons: [ - { - side: 'start', - icon: 'close', - handler: () => { - return true - }, - }, - ], - }) - await toast.present() - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } -} diff --git a/web/projects/ui/src/app/pages/server-routes/server-routing.module.ts b/web/projects/ui/src/app/pages/server-routes/server-routing.module.ts index 5c728e668..e7eb43aad 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-routing.module.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-routing.module.ts @@ -80,13 +80,6 @@ const routes: Routes = [ loadChildren: () => import('./wifi/wifi.module').then(m => m.WifiPageModule), }, - { - path: 'experimental-features', - loadChildren: () => - import('./experimental-features/experimental-features.module').then( - m => m.ExperimentalFeaturesPageModule, - ), - }, ] @NgModule({ diff --git a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts index 38087b354..ff9cfc775 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -54,6 +54,7 @@ export class ServerShowPage { private readonly ClientStorageService: ClientStorageService, private readonly authService: AuthService, private readonly toastCtrl: ToastController, + private readonly config: ConfigService, @Inject(WINDOW) private readonly windowRef: Window, ) {} @@ -178,6 +179,73 @@ export class ServerShowPage { } } + async presentAlertResetTor() { + const isTor = this.config.isTor() + const shared = + 'Optionally wipe state to forcibly acquire new guard nodes. It is recommended to try without wiping state first.' + const alert = await this.alertCtrl.create({ + header: isTor ? 'Warning' : 'Confirm', + message: isTor + ? `You are currently connected over Tor. If you reset the Tor daemon, you will loose connectivity until it comes back online.

${shared}` + : `Reset Tor?

${shared}`, + inputs: [ + { + label: 'Wipe state', + type: 'checkbox', + value: 'wipe', + }, + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + }, + { + text: 'Reset', + handler: (value: string[]) => { + this.resetTor(value.some(v => v === 'wipe')) + }, + cssClass: 'enter-click', + }, + ], + cssClass: isTor ? 'alert-warning-message' : '', + }) + await alert.present() + } + + private async resetTor(wipeState: boolean) { + const loader = await this.loadingCtrl.create({ + message: 'Resetting Tor...', + }) + await loader.present() + + try { + await this.embassyApi.resetTor({ + 'wipe-state': wipeState, + reason: 'User triggered', + }) + const toast = await this.toastCtrl.create({ + header: 'Tor reset in progress', + position: 'bottom', + duration: 4000, + buttons: [ + { + side: 'start', + icon: 'close', + handler: () => { + return true + }, + }, + ], + }) + await toast.present() + } catch (e: any) { + this.errToast.present(e) + } finally { + loader.dismiss() + } + } + async updateEos(): Promise { const modal = await this.modalCtrl.create({ component: OSUpdatePage, @@ -512,14 +580,11 @@ export class ServerShowPage { disabled$: of(false), }, { - title: 'Experimental Features', - description: 'Try out new and potentially unstable new features', - icon: 'flask-outline', - action: () => - this.navCtrl.navigateForward(['experimental-features'], { - relativeTo: this.route, - }), - detail: true, + title: 'Reset Tor', + description: 'May help resolve Tor connectivity issues.', + icon: 'reload-circle-outline', + action: () => this.presentAlertResetTor(), + detail: false, disabled$: of(false), }, ], diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index 7cf449664..f6986dddd 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1785,7 +1785,7 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: null, + addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', }, @@ -1798,14 +1798,6 @@ export module Mock { id: 'abcdefg', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'bitcoin-ui-address.onion', - port: 80, - sslPort: 443, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -1817,6 +1809,14 @@ export module Mock { sslPort: 1234, }, }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-ui-address.onion', + port: 80, + sslPort: 443, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -1858,7 +1858,7 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: null, + addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', }, @@ -1871,14 +1871,6 @@ export module Mock { id: 'bcdefgh', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'bitcoin-rpc-address.onion', - port: 80, - sslPort: 443, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -1890,6 +1882,14 @@ export module Mock { sslPort: 2345, }, }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-rpc-address.onion', + port: 80, + sslPort: 443, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -1940,14 +1940,6 @@ export module Mock { id: 'cdefghi', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'bitcoin-p2p-address.onion', - port: 8333, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -1959,6 +1951,14 @@ export module Mock { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-p2p-address.onion', + port: 8333, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2034,7 +2034,7 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: null, + addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', }, @@ -2047,14 +2047,6 @@ export module Mock { id: 'hijklmnop', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'proxy-ui-address.onion', - port: 80, - sslPort: 443, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2066,6 +2058,14 @@ export module Mock { sslPort: 4567, }, }, + { + kind: 'onion', + hostname: { + value: 'proxy-ui-address.onion', + port: 80, + sslPort: 443, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2196,14 +2196,6 @@ export module Mock { id: 'qrstuv', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-grpc-address.onion', - port: 10009, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2215,6 +2207,14 @@ export module Mock { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-grpc-address.onion', + port: 10009, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2265,14 +2265,6 @@ export module Mock { id: 'qrstuv', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-grpc-address.onion', - port: 10009, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2284,6 +2276,14 @@ export module Mock { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-grpc-address.onion', + port: 10009, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2334,14 +2334,6 @@ export module Mock { id: 'rstuvw', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-p2p-address.onion', - port: 9735, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -2353,6 +2345,14 @@ export module Mock { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-p2p-address.onion', + port: 9735, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', diff --git a/web/projects/ui/src/app/services/api/api.types.ts b/web/projects/ui/src/app/services/api/api.types.ts index 9d804caf9..c46cee61d 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -77,11 +77,6 @@ export module RR { } // net.tor.reset export type ResetTorRes = null - export type ToggleZramReq = { - enable: boolean - } // server.experimental.zram - export type ToggleZramRes = null - // sessions export type GetSessionsReq = {} // sessions.list diff --git a/web/projects/ui/src/app/services/api/embassy-api.service.ts b/web/projects/ui/src/app/services/api/embassy-api.service.ts index 17ce2d9d6..3f1d9881d 100644 --- a/web/projects/ui/src/app/services/api/embassy-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-api.service.ts @@ -97,8 +97,6 @@ export abstract class ApiService { abstract resetTor(params: RR.ResetTorReq): Promise - abstract toggleZram(params: RR.ToggleZramReq): Promise - // marketplace URLs abstract marketplaceProxy( diff --git a/web/projects/ui/src/app/services/api/embassy-live-api.service.ts b/web/projects/ui/src/app/services/api/embassy-live-api.service.ts index 18d47e2ce..73765b44d 100644 --- a/web/projects/ui/src/app/services/api/embassy-live-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-live-api.service.ts @@ -189,10 +189,6 @@ export class LiveApiService extends ApiService { return this.rpcRequest({ method: 'net.tor.reset', params }) } - async toggleZram(params: RR.ToggleZramReq): Promise { - return this.rpcRequest({ method: 'server.experimental.zram', params }) - } - // marketplace URLs async marketplaceProxy( diff --git a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts index a2e5324a1..73cc71ef8 100644 --- a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -370,20 +370,6 @@ export class MockApiService extends ApiService { return null } - async toggleZram(params: RR.ToggleZramReq): Promise { - await pauseFor(2000) - const patch = [ - { - op: PatchOp.REPLACE, - path: '/server-info/zram', - value: params.enable, - }, - ] - this.mockRevision(patch) - - return null - } - // marketplace URLs async marketplaceProxy( diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index a34a91652..8b163dd2e 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -73,7 +73,6 @@ export const mockPatchData: DataModel = { pubkey: 'npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m', 'ca-fingerprint': 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15', 'ntp-synced': false, - zram: false, platform: 'x86_64-nonfree', }, 'package-data': { @@ -401,36 +400,29 @@ export const mockPatchData: DataModel = { disabled: false, masked: false, name: 'Web UI', - description: 'A launchable web app for Bitcoin Proxy', + description: + 'A launchable web app for you to interact with your Bitcoin node', type: 'ui', addressInfo: { username: null, - hostId: 'hijklmnop', + hostId: 'abcdefg', bindOptions: { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: null, + addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', }, - secure: true, - ssl: true, + secure: false, + ssl: false, }, suffix: '', }, hostInfo: { - id: 'hijklmnop', + id: 'abcdefg', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'proxy-ui-address.onion', - port: 80, - sslPort: 443, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -439,7 +431,15 @@ export const mockPatchData: DataModel = { kind: 'local', value: 'adjective-noun.local', port: null, - sslPort: 4567, + sslPort: 1234, + }, + }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-ui-address.onion', + port: 80, + sslPort: 443, }, }, { @@ -450,7 +450,7 @@ export const mockPatchData: DataModel = { kind: 'ipv4', value: '192.168.1.5', port: null, - sslPort: 4567, + sslPort: 1234, }, }, { @@ -461,40 +461,148 @@ export const mockPatchData: DataModel = { kind: 'ipv6', value: '[2001:db8:85a3:8d3:1319:8a2e:370:7348]', port: null, - sslPort: 4567, + sslPort: 1234, }, }, + ], + }, + }, + rpc: { + id: 'rpc', + hasPrimary: false, + disabled: false, + masked: false, + name: 'RPC', + description: + 'Used by dependent services and client wallets for connecting to your node', + type: 'api', + addressInfo: { + username: null, + hostId: 'bcdefgh', + bindOptions: { + scheme: 'http', + preferredExternalPort: 80, + addSsl: { + preferredExternalPort: 443, + scheme: 'https', + }, + secure: false, + ssl: false, + }, + suffix: '', + }, + hostInfo: { + id: 'bcdefgh', + kind: 'multi', + hostnames: [ { kind: 'ip', - networkInterfaceId: 'wlan0', + networkInterfaceId: 'elan0', public: false, hostname: { kind: 'local', value: 'adjective-noun.local', port: null, - sslPort: 4567, + sslPort: 2345, + }, + }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-rpc-address.onion', + port: 80, + sslPort: 443, }, }, { kind: 'ip', - networkInterfaceId: 'wlan0', + networkInterfaceId: 'elan0', public: false, hostname: { kind: 'ipv4', - value: '192.168.1.7', + value: '192.168.1.5', port: null, - sslPort: 4567, + sslPort: 2345, }, }, { kind: 'ip', - networkInterfaceId: 'wlan0', + networkInterfaceId: 'elan0', public: false, hostname: { kind: 'ipv6', value: '[2001:db8:85a3:8d3:1319:8a2e:370:7348]', port: null, - sslPort: 4567, + sslPort: 2345, + }, + }, + ], + }, + }, + p2p: { + id: 'p2p', + hasPrimary: true, + disabled: false, + masked: false, + name: 'P2P', + description: + 'Used for connecting to other nodes on the Bitcoin network', + type: 'p2p', + addressInfo: { + username: null, + hostId: 'cdefghi', + bindOptions: { + scheme: 'bitcoin', + preferredExternalPort: 8333, + addSsl: null, + secure: true, + ssl: false, + }, + suffix: '', + }, + hostInfo: { + id: 'cdefghi', + kind: 'multi', + hostnames: [ + { + kind: 'ip', + networkInterfaceId: 'elan0', + public: false, + hostname: { + kind: 'local', + value: 'adjective-noun.local', + port: 3456, + sslPort: null, + }, + }, + { + kind: 'onion', + hostname: { + value: 'bitcoin-p2p-address.onion', + port: 8333, + sslPort: null, + }, + }, + { + kind: 'ip', + networkInterfaceId: 'elan0', + public: false, + hostname: { + kind: 'ipv4', + value: '192.168.1.5', + port: 3456, + sslPort: null, + }, + }, + { + kind: 'ip', + networkInterfaceId: 'elan0', + public: false, + hostname: { + kind: 'ipv6', + value: '[2001:db8:85a3:8d3:1319:8a2e:370:7348]', + port: 3456, + sslPort: null, }, }, ], @@ -670,14 +778,6 @@ export const mockPatchData: DataModel = { id: 'qrstuv', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-grpc-address.onion', - port: 10009, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -689,6 +789,14 @@ export const mockPatchData: DataModel = { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-grpc-address.onion', + port: 10009, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -739,14 +847,6 @@ export const mockPatchData: DataModel = { id: 'qrstuv', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-grpc-address.onion', - port: 10009, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -758,6 +858,14 @@ export const mockPatchData: DataModel = { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-grpc-address.onion', + port: 10009, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -808,14 +916,6 @@ export const mockPatchData: DataModel = { id: 'rstuvw', kind: 'multi', hostnames: [ - { - kind: 'onion', - hostname: { - value: 'lnd-p2p-address.onion', - port: 9735, - sslPort: null, - }, - }, { kind: 'ip', networkInterfaceId: 'elan0', @@ -827,6 +927,14 @@ export const mockPatchData: DataModel = { sslPort: null, }, }, + { + kind: 'onion', + hostname: { + value: 'lnd-p2p-address.onion', + port: 9735, + sslPort: null, + }, + }, { kind: 'ip', networkInterfaceId: 'elan0', diff --git a/web/projects/ui/src/app/services/patch-db/data-model.ts b/web/projects/ui/src/app/services/patch-db/data-model.ts index ccea8e076..931b3b949 100644 --- a/web/projects/ui/src/app/services/patch-db/data-model.ts +++ b/web/projects/ui/src/app/services/patch-db/data-model.ts @@ -79,7 +79,6 @@ export interface ServerInfo { pubkey: string 'ca-fingerprint': string 'ntp-synced': boolean - zram: boolean platform: string }