From 23b0674ac081eff38a3307de23eb490340e9cc3f Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 6 Oct 2023 16:40:11 -0600 Subject: [PATCH] fix cert name and show ca wiz on http ip (#2448) --- .../login/ca-wizard/ca-wizard.component.html | 4 +++- .../ui/src/app/pages/login/login.page.html | 2 +- .../app/pages/server-routes/wifi/wifi.page.ts | 2 +- .../ui/src/app/services/config.service.ts | 24 +++++++------------ 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html b/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html index cae7b24d0..22afbcba2 100644 --- a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html +++ b/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html @@ -104,5 +104,7 @@ diff --git a/frontend/projects/ui/src/app/pages/login/login.page.html b/frontend/projects/ui/src/app/pages/login/login.page.html index cfd233caf..7022c5cb7 100644 --- a/frontend/projects/ui/src/app/pages/login/login.page.html +++ b/frontend/projects/ui/src/app/pages/login/login.page.html @@ -1,6 +1,6 @@ - + diff --git a/frontend/projects/ui/src/app/pages/server-routes/wifi/wifi.page.ts b/frontend/projects/ui/src/app/pages/server-routes/wifi/wifi.page.ts index fea8dc48b..bac270613 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/wifi/wifi.page.ts +++ b/frontend/projects/ui/src/app/pages/server-routes/wifi/wifi.page.ts @@ -57,7 +57,7 @@ export class WifiPage { } async presentAlertCountry(): Promise { - if (!this.config.isLan()) { + if (this.config.isTor()) { const alert = await this.alertCtrl.create({ header: 'Cannot Complete Action', message: diff --git a/frontend/projects/ui/src/app/services/config.service.ts b/frontend/projects/ui/src/app/services/config.service.ts index 343e7a059..eb9623068 100644 --- a/frontend/projects/ui/src/app/services/config.service.ts +++ b/frontend/projects/ui/src/app/services/config.service.ts @@ -49,23 +49,12 @@ export class ConfigService { : this.hostname.endsWith('.local') } - isLocalhost(): boolean { - return useMocks - ? mocks.maskAs === 'localhost' - : this.hostname === 'localhost' - } - - isLan(): boolean { - // @TODO will not work once clearnet arrives - return !this.isTor() - } - isTorHttp(): boolean { return this.isTor() && !this.isHttps() } - isLocalHttp(): boolean { - return this.isLocal() && !this.isHttps() + isLanHttp(): boolean { + return !this.isTor() && !this.isLocalhost() && !this.isHttps() } isSecure(): boolean { @@ -85,10 +74,9 @@ export class ConfigService { } launchableURL(pkg: PackageDataEntry): string { - if (this.isLan() && hasLocalUi(pkg.manifest.interfaces)) { + if (!this.isTor() && hasLocalUi(pkg.manifest.interfaces)) { return `https://${lanUiAddress(pkg)}` } else { - // leave http for services return `http://${torUiAddress(pkg)}` } } @@ -97,6 +85,12 @@ export class ConfigService { return this.host } + private isLocalhost(): boolean { + return useMocks + ? mocks.maskAs === 'localhost' + : this.hostname === 'localhost' + } + private isHttps(): boolean { return useMocks ? mocks.maskAsHttps : this.protocol === 'https:' }