diff --git a/web/projects/ui/src/app/app/menu/menu.component.ts b/web/projects/ui/src/app/app/menu/menu.component.ts index 48a2ee6f7..268a7167d 100644 --- a/web/projects/ui/src/app/app/menu/menu.component.ts +++ b/web/projects/ui/src/app/app/menu/menu.component.ts @@ -11,9 +11,7 @@ import { filter, first, map, - merge, Observable, - of, pairwise, startWith, switchMap, @@ -114,10 +112,9 @@ export class MenuComponent { readonly theme$ = inject(THEME) - readonly warning$ = merge( - of(this.config.isTorHttp()), - this.patch.watch$('server-info', 'ntp-synced').pipe(map(synced => !synced)), - ) + readonly warning$ = this.patch + .watch$('server-info', 'ntp-synced') + .pipe(map(synced => !synced)) constructor( private readonly patch: PatchDB, diff --git a/web/projects/ui/src/app/apps/login/login.module.ts b/web/projects/ui/src/app/apps/login/login.module.ts index 82b683ff7..9d2dcb3b5 100644 --- a/web/projects/ui/src/app/apps/login/login.module.ts +++ b/web/projects/ui/src/app/apps/login/login.module.ts @@ -11,7 +11,6 @@ import { import { TuiInputPasswordModule } from '@taiga-ui/kit' import { CAWizardComponent } from './ca-wizard/ca-wizard.component' import { LoginPage } from './login.page' -import { LoginWarningComponent } from './warning.component' const routes: Routes = [ { @@ -25,7 +24,6 @@ const routes: Routes = [ CommonModule, FormsModule, CAWizardComponent, - LoginWarningComponent, TuiButtonModule, TuiCardModule, TuiSurfaceModule, diff --git a/web/projects/ui/src/app/apps/login/login.page.html b/web/projects/ui/src/app/apps/login/login.page.html index 1343a9316..0cfb4e20e 100644 --- a/web/projects/ui/src/app/apps/login/login.page.html +++ b/web/projects/ui/src/app/apps/login/login.page.html @@ -3,8 +3,6 @@ - -

Login to StartOS

diff --git a/web/projects/ui/src/app/apps/login/warning.component.ts b/web/projects/ui/src/app/apps/login/warning.component.ts deleted file mode 100644 index 9166a3b9a..000000000 --- a/web/projects/ui/src/app/apps/login/warning.component.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { NgIf } from '@angular/common' -import { Component, inject } from '@angular/core' -import { WINDOW } from '@ng-web-apis/common' -import { TuiNotificationModule } from '@taiga-ui/core' -import { TuiButtonModule, TuiIconsModule } from '@taiga-ui/experimental' -import { ConfigService } from 'src/app/services/config.service' - -@Component({ - standalone: true, - selector: 'login-warning', - template: ` - - -

Http detected

-

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

-
- `, - styles: [ - ` - @import '@taiga-ui/core/styles/taiga-ui-local'; - - :host { - @include center-left(); - top: 1rem; - width: max(50%, 20rem); - } - - button { - float: right; - margin: 0.5rem 0 0.5rem 1rem; - } - `, - ], - imports: [NgIf, TuiButtonModule, TuiIconsModule, TuiNotificationModule], -}) -export class LoginWarningComponent { - private readonly windowRef = inject(WINDOW) - readonly config = inject(ConfigService) - - launchHttps() { - this.windowRef.open(`https://${this.config.getHost()}`, '_self') - } -} diff --git a/web/projects/ui/src/app/apps/portal/routes/service/components/status.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/components/status.component.ts index d97e5523c..c5e8aeb22 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/components/status.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/components/status.component.ts @@ -14,7 +14,7 @@ import { InstallProgressPipeModule } from 'src/app/common/install-progress/insta template: ` {{ connected ? rendering.display : 'Unknown' }} - + diff --git a/web/projects/ui/src/app/apps/portal/routes/system/settings/components/http.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/settings/components/http.component.ts deleted file mode 100644 index 515cab2fa..000000000 --- a/web/projects/ui/src/app/apps/portal/routes/system/settings/components/http.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core' -import { TuiNotificationModule } from '@taiga-ui/core' -import { - TuiButtonModule, - TuiCellModule, - TuiTitleModule, -} from '@taiga-ui/experimental' - -@Component({ - selector: 'settings-http', - template: ` - -
-
- Http detected -
-
- Tor is faster over https. - - Download and trust your server's Root CA - - , then switch to https. -
-
-
- -
-
- `, - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: true, - imports: [ - TuiButtonModule, - TuiCellModule, - TuiNotificationModule, - TuiTitleModule, - ], -}) -export class SettingsHttpsComponent {} diff --git a/web/projects/ui/src/app/apps/portal/routes/system/settings/components/menu.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/settings/components/menu.component.ts index d49b9ad1b..66a13c4d5 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/settings/components/menu.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/settings/components/menu.component.ts @@ -3,12 +3,10 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core' import { TuiAlertService, TuiLoaderModule } from '@taiga-ui/core' import { TuiButtonModule } from '@taiga-ui/experimental' import { PatchDB } from 'patch-db-client' -import { ConfigService } from 'src/app/services/config.service' import { DataModel } from 'src/app/services/patch-db/data-model' import { ClientStorageService } from 'src/app/services/client-storage.service' import { SettingsService } from '../settings.service' import { SettingsSyncComponent } from './sync.component' -import { SettingsHttpsComponent } from './http.component' import { SettingsButtonComponent } from './button.component' import { SettingsUpdateComponent } from './update.component' @@ -17,19 +15,7 @@ import { SettingsUpdateComponent } from './update.component' template: ` - - - Open Https - - -
+

{{ cat.key }}

@@ -46,8 +32,8 @@ import { SettingsUpdateComponent } from './update.component' !server.network.outboundProxy ? 'None' : server.network.outboundProxy === 'primary' - ? 'System Primary' - : server.network.outboundProxy.proxyId + ? 'System Primary' + : server.network.outboundProxy.proxyId }}
@@ -82,7 +68,6 @@ import { SettingsUpdateComponent } from './update.component' TuiLoaderModule, TuiButtonModule, SettingsSyncComponent, - SettingsHttpsComponent, SettingsButtonComponent, SettingsUpdateComponent, ], @@ -91,7 +76,6 @@ export class SettingsMenuComponent { private readonly clientStorageService = inject(ClientStorageService) private readonly alerts = inject(TuiAlertService) - readonly isTorHttp = inject(ConfigService).isTorHttp() readonly server$ = inject(PatchDB).watch$('server-info') readonly service = inject(SettingsService) diff --git a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.html b/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.html deleted file mode 100644 index 4301b35b5..000000000 --- a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.html +++ /dev/null @@ -1,15 +0,0 @@ - - - -

You are using unencrypted http

-

- Click the button on the right to switch to https. Your browser may warn - you that the page is insecure. You can safely bypass this warning. It will - go away after you download and trust your Embassy's certificate -

-
- - Open Https - - -
diff --git a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.scss b/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.scss deleted file mode 100644 index dc544f671..000000000 --- a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.warn-label { - h2 { - font-weight: 700; - } - p { - font-weight: 600; - } -} \ No newline at end of file diff --git a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.ts b/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.ts deleted file mode 100644 index 59d5cf9bd..000000000 --- a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { DOCUMENT } from '@angular/common' -import { ChangeDetectionStrategy, Component, Inject } from '@angular/core' - -@Component({ - selector: 'insecure-warning', - templateUrl: './insecure-warning.component.html', - styleUrls: ['./insecure-warning.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class InsecureWarningComponent { - constructor(@Inject(DOCUMENT) private readonly document: Document) {} - - launchHttps() { - this.document.defaultView?.open( - this.document.location.href.replace('http', 'https'), - ) - } -} diff --git a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.module.ts b/web/projects/ui/src/app/common/insecure-warning/insecure-warning.module.ts deleted file mode 100644 index 92429893f..000000000 --- a/web/projects/ui/src/app/common/insecure-warning/insecure-warning.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { InsecureWarningComponent } from './insecure-warning.component' - -@NgModule({ - declarations: [InsecureWarningComponent], - imports: [CommonModule, IonicModule], - exports: [InsecureWarningComponent], -}) -export class InsecureWarningComponentModule {} diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index a55c21d88..7756c0ba4 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -64,10 +64,6 @@ export class ConfigService { ) } - isTorHttp(): boolean { - return this.isTor() && !this.isHttps() - } - isLanHttp(): boolean { return !this.isTor() && !this.isLocalhost() && !this.isHttps() } @@ -80,12 +76,12 @@ export class ConfigService { return this.isTor() ? info.addressInfo.torHostname : this.isLocalhost() - ? `https://${info.addressInfo.lanHostname}` - : this.isLocal() || this.isIpv4() || this.isIpv6() - ? `https://${this.hostname}` - : info.addressInfo.domainInfo?.subdomain - ? `https://${info.addressInfo.domainInfo.subdomain}${info.addressInfo.domainInfo.domain}` - : `https://${info.addressInfo.domainInfo?.domain}` + ? `https://${info.addressInfo.lanHostname}` + : this.isLocal() || this.isIpv4() || this.isIpv6() + ? `https://${this.hostname}` + : info.addressInfo.domainInfo?.subdomain + ? `https://${info.addressInfo.domainInfo.subdomain}${info.addressInfo.domainInfo.domain}` + : `https://${info.addressInfo.domainInfo?.domain}` } getHost(): string {