tor http is secure

This commit is contained in:
Matt Hill
2026-03-25 13:31:53 -06:00
parent 010e439d1d
commit 7e35ad57e7
3 changed files with 13 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
export type AccessType =
| 'tor'
| 'mdns'
| 'localhost'
| 'ipv4'

View File

@@ -1,8 +1,5 @@
@if (config.isLanHttp()) {
<!-- Local HTTP -->
<ca-wizard />
} @else {
<!-- not Local HTTP -->
@if (config.isSecureContext()) {
<!-- Secure context -->
<div tuiCardLarge class="card">
<img alt="StartOS Icon" class="logo" src="assets/img/icon.png" />
<h1 class="header">{{ 'Login to StartOS' | i18n }}</h1>
@@ -23,4 +20,7 @@
<button tuiButton class="button">{{ 'Login' | i18n }}</button>
</form>
</div>
} @else {
<!-- Insecure context -->
<ca-wizard />
}

View File

@@ -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
}
}