diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts b/frontend/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts index 225aa9184..825d6536d 100644 --- a/frontend/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts +++ b/frontend/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts @@ -1,4 +1,5 @@ -import { Component, Input } from '@angular/core' +import { Component, Inject, Input } from '@angular/core' +import { WINDOW } from '@ng-web-apis/common' import { ActivatedRoute } from '@angular/router' import { ModalController, ToastController } from '@ionic/angular' import { copyToClipboard, getPkgId } from '@start9labs/shared' @@ -91,10 +92,11 @@ export class AppInterfacesItemComponent { constructor( private readonly toastCtrl: ToastController, private readonly modalCtrl: ModalController, + @Inject(WINDOW) private readonly windowRef: Window, ) {} launch(url: string): void { - window.open(url, '_blank', 'noreferrer') + this.windowRef.open(url, '_blank', 'noreferrer') } async showQR(text: string): Promise { 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 52cfc9c26..553bd360a 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 @@ -27,7 +27,13 @@ your device can verify the authenticity of encrypted communications with your server.
- + View Instructions diff --git a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts b/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts index 07b7f30f0..fde1c968f 100644 --- a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts +++ b/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts @@ -31,21 +31,13 @@ export class CAWizardComponent { this.document.getElementById('install-cert')?.click() } - instructions() { - this.windowRef.open( - 'https://docs.start9.com/0.3.5.x/user-manual/getting-started/trust-ca/#trust-root-ca', - '_blank', - 'noreferrer', - ) - } - refresh() { this.document.location.reload() } launchHttps() { const host = this.config.getHost() - this.windowRef.open(`https://${host}`, '_blank', 'noreferrer') + this.windowRef.open(`https://${host}`, '_self') } private async testHttps() { 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 4c1aa64b8..ef04eea67 100644 --- a/frontend/projects/ui/src/app/pages/login/login.page.html +++ b/frontend/projects/ui/src/app/pages/login/login.page.html @@ -11,7 +11,17 @@

Http detected

-

Tor is faster over https.

+

+ Tor is faster over https. Your Root CA must be trusted. + + View instructions + +

Open Https diff --git a/frontend/projects/ui/src/app/pages/login/login.page.ts b/frontend/projects/ui/src/app/pages/login/login.page.ts index 4a61f2adc..15f7d588e 100644 --- a/frontend/projects/ui/src/app/pages/login/login.page.ts +++ b/frontend/projects/ui/src/app/pages/login/login.page.ts @@ -29,7 +29,7 @@ export class LoginPage { launchHttps() { const host = this.config.getHost() - this.windowRef.open(`https://${host}`, '_blank', 'noreferrer') + this.windowRef.open(`https://${host}`, '_self') } async submit() { diff --git a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts index 82e5e3ff1..401dc19c0 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -22,7 +22,7 @@ import { GenericInputOptions, } from 'src/app/modals/generic-input/generic-input.component' import { ConfigService } from 'src/app/services/config.service' -import { DOCUMENT } from '@angular/common' +import { WINDOW } from '@ng-web-apis/common' import { getServerInfo } from 'src/app/util/get-server-info' import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page' import { ConfigSpec } from 'src/app/pkg-config/config-types' @@ -57,7 +57,7 @@ export class ServerShowPage { private readonly authService: AuthService, private readonly toastCtrl: ToastController, private readonly config: ConfigService, - @Inject(DOCUMENT) private readonly document: Document, + @Inject(WINDOW) private readonly windowRef: Window, ) {} async setBrowserTab(): Promise { @@ -307,7 +307,7 @@ export class ServerShowPage { async launchHttps() { const { 'tor-address': torAddress } = await getServerInfo(this.patch) - window.open(torAddress) + this.windowRef.open(torAddress, '_self') } addClick(title: string) { @@ -495,7 +495,7 @@ export class ServerShowPage { }, { title: 'Root CA', - description: `Download and trust your server's root certificate authority`, + description: `Download and trust your server's Root Certificate Authority`, icon: 'ribbon-outline', action: () => this.navCtrl.navigateForward(['root-ca'], { relativeTo: this.route }), @@ -621,7 +621,7 @@ export class ServerShowPage { description: 'Discover what StartOS can do', icon: 'map-outline', action: () => - window.open( + this.windowRef.open( 'https://docs.start9.com/0.3.5.x/user-manual', '_blank', 'noreferrer', @@ -634,7 +634,11 @@ export class ServerShowPage { description: 'Get help from the Start9 team and community', icon: 'chatbubbles-outline', action: () => - window.open('https://start9.com/contact', '_blank', 'noreferrer'), + this.windowRef.open( + 'https://start9.com/contact', + '_blank', + 'noreferrer', + ), detail: true, disabled$: of(false), }, @@ -643,7 +647,7 @@ export class ServerShowPage { description: `Support StartOS development`, icon: 'logo-bitcoin', action: () => - this.document.defaultView?.open( + this.windowRef.open( 'https://donate.start9.com', '_blank', 'noreferrer', diff --git a/frontend/projects/ui/src/app/services/ui-launcher.service.ts b/frontend/projects/ui/src/app/services/ui-launcher.service.ts index d6cb16cf3..55559bcd3 100644 --- a/frontend/projects/ui/src/app/services/ui-launcher.service.ts +++ b/frontend/projects/ui/src/app/services/ui-launcher.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@angular/core' -import { DOCUMENT } from '@angular/common' +import { WINDOW } from '@ng-web-apis/common' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { ConfigService } from './config.service' @@ -8,15 +8,11 @@ import { ConfigService } from './config.service' }) export class UiLauncherService { constructor( - @Inject(DOCUMENT) private readonly document: Document, + @Inject(WINDOW) private readonly windowRef: Window, private readonly config: ConfigService, ) {} launch(pkg: PackageDataEntry): void { - this.document.defaultView?.open( - this.config.launchableURL(pkg), - '_blank', - 'noreferrer', - ) + this.windowRef.open(this.config.launchableURL(pkg), '_blank', 'noreferrer') } }