diff --git a/web/projects/shared/src/types/workspace-config.ts b/web/projects/shared/src/types/workspace-config.ts index a00d66050..ebc678ccd 100644 --- a/web/projects/shared/src/types/workspace-config.ts +++ b/web/projects/shared/src/types/workspace-config.ts @@ -1,4 +1,5 @@ export type AccessType = + | 'tor' | 'mdns' | 'localhost' | 'ipv4' diff --git a/web/projects/ui/src/app/routes/login/login.component.html b/web/projects/ui/src/app/routes/login/login.component.html index 49a5b780a..2223fddc6 100644 --- a/web/projects/ui/src/app/routes/login/login.component.html +++ b/web/projects/ui/src/app/routes/login/login.component.html @@ -1,8 +1,5 @@ -@if (config.isLanHttp()) { - - -} @else { - +@if (config.isSecureContext()) { +

{{ 'Login to StartOS' | i18n }}

@@ -23,4 +20,7 @@
+} @else { + + } diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index 4e56e8e46..1f03046bb 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -32,6 +32,7 @@ export class ConfigService { private getAccessType = utils.once(() => { if (useMocks) return mocks.maskAs if (this.hostname === 'localhost') return 'localhost' + if (this.hostname.endsWith('.onion')) return 'tor' if (this.hostname.endsWith('.local')) return 'mdns' let ip = null try { @@ -49,11 +50,11 @@ export class ConfigService { return this.getAccessType() } - isLanHttp(): boolean { - return !this.isHttps() && this.accessType !== 'localhost' - } - - isHttps(): boolean { - return useMocks ? mocks.maskAsHttps : this.protocol === 'https:' + isSecureContext(): boolean { + return useMocks + ? mocks.maskAsHttps || + mocks.maskAs === 'localhost' || + mocks.maskAs === 'tor' + : window.isSecureContext } }