Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,7 @@ <h2>Go To Login</h2>
<a
id="install-cert"
href="/eos/local.crt"
[download]="document.location.hostname"
[download]="
config.isLocal() ? document.location.hostname + '.crt' : 'startos.crt'
"
></a>
2 changes: 1 addition & 1 deletion frontend/projects/ui/src/app/pages/login/login.page.html
Original file line number Diff line number Diff line change
@@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 9 additions & 15 deletions frontend/projects/ui/src/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)}`
}
}
Expand All @@ -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:'
}
Expand Down