fix cert name and show ca wiz on http ip (#2448)

This commit is contained in:
Matt Hill
2023-10-06 16:40:11 -06:00
committed by GitHub
parent 01f0484a0e
commit 23b0674ac0
4 changed files with 14 additions and 18 deletions

View File

@@ -104,5 +104,7 @@
<a
id="install-cert"
href="/eos/local.crt"
[download]="document.location.hostname"
[download]="
config.isLocal() ? document.location.hostname + '.crt' : 'startos.crt'
"
></a>

View File

@@ -1,6 +1,6 @@
<ion-content class="content">
<!-- Local HTTP -->
<ng-container *ngIf="config.isLocalHttp(); else notLanHttp">
<ng-container *ngIf="config.isLanHttp(); else notLanHttp">
<ca-wizard></ca-wizard>
</ng-container>

View File

@@ -57,7 +57,7 @@ export class WifiPage {
}
async presentAlertCountry(): Promise<void> {
if (!this.config.isLan()) {
if (this.config.isTor()) {
const alert = await this.alertCtrl.create({
header: 'Cannot Complete Action',
message:

View File

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