minor cosmetics

This commit is contained in:
Matt Hill
2021-08-17 21:44:16 -06:00
committed by Aiden McClelland
parent 62b523ebde
commit 3ee06a556e
7 changed files with 21 additions and 62 deletions

View File

@@ -1 +1 @@
<qr-code [value]="text"></qr-code> <qr-code [value]="text" size="400"></qr-code>

View File

@@ -6,7 +6,8 @@
<ion-title>Logs</ion-title> <ion-title>Logs</ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button (click)="getLogs()"> <ion-button (click)="getLogs()">
<ion-icon slot="icon-only" name="refresh-outline"></ion-icon> <ion-icon slot="start" name="refresh-outline"></ion-icon>
Refresh
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>

View File

@@ -50,7 +50,7 @@
<ion-label> <ion-label>
<ion-skeleton-text animated style="width: 150px; height: 18px; margin-bottom: 8px;"></ion-skeleton-text> <ion-skeleton-text animated style="width: 150px; height: 18px; margin-bottom: 8px;"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 400px;"></ion-skeleton-text> <ion-skeleton-text animated style="width: 400px;"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 400px;"></ion-skeleton-text> <ion-skeleton-text animated style="width: 100px;"></ion-skeleton-text>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-col> </ion-col>

View File

@@ -14,9 +14,13 @@
<ion-item class="ion-padding-bottom"> <ion-item class="ion-padding-bottom">
<ion-label> <ion-label>
<h2> <h2>
Connecting to your Embassy over the Local Area Network (LAN) is great for achieving a faster experience, as well as a fallback in case Tor is experiencing issues. Connecting to your Embassy over LAN is fast and a great fallback in case the Tor network is experiencing issues.
<a [href]="docsUrl" target="_blank">View instructions</a> <a href="https://docs.start9.com/user-manual/general/lan-setup" target="_blank">View instructions</a>
</h2> </h2>
<ng-container *ngIf="lanDisabled">
<br />
<ion-text color="warning" [innerHtml]="lanDisabled"></ion-text>
</ng-container>
</ion-label> </ion-label>
</ion-item> </ion-item>
@@ -24,20 +28,10 @@
<ion-icon slot="start" name="download-outline" size="large"></ion-icon> <ion-icon slot="start" name="download-outline" size="large"></ion-icon>
<ion-label> <ion-label>
<h1>Download Root CA</h1> <h1>Download Root CA</h1>
<p>Download and trust your Embassy's Root Certificate Authority to achieve a secure connection on the LAN.</p> <p>Download and trust your Embassy's Root Certificate Authority to establish a secure connection on the LAN.</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
<ng-container *ngIf="lanDisabled">
<ion-item-divider></ion-item-divider>
<ion-item>
<ion-label>
<p class="ion-padding-bottom">Setup</p>
<ion-text color="warning" [innerHtml]="lanDisabledExplanation[lanDisabled]"></ion-text>
</ion-label>
</ion-item>
</ng-container>
<!-- Refresh Network --> <!-- Refresh Network -->
<ion-item button (click)="refreshLAN()" detail="false"> <ion-item button (click)="refreshLAN()" detail="false">
<ion-icon slot="start" name="refresh-outline" size="large"></ion-icon> <ion-icon slot="start" name="refresh-outline" size="large"></ion-icon>

View File

@@ -1,10 +1,7 @@
import { Component } from '@angular/core' import { Component } from '@angular/core'
import { isPlatform, LoadingController, ToastController } from '@ionic/angular' import { LoadingController, ToastController } from '@ionic/angular'
import { copyToClipboard } from 'src/app/util/web.util'
import { ConfigService } from 'src/app/services/config.service' import { ConfigService } from 'src/app/services/config.service'
import { ApiService } from 'src/app/services/api/embassy-api.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { Subscription } from 'rxjs'
import { ErrorToastService } from 'src/app/services/error-toast.service' import { ErrorToastService } from 'src/app/services/error-toast.service'
@Component({ @Component({
@@ -14,13 +11,7 @@ import { ErrorToastService } from 'src/app/services/error-toast.service'
}) })
export class LANPage { export class LANPage {
lanAddress: string lanAddress: string
lanDisabled: LanSetupIssue lanDisabled: string
readonly lanDisabledExplanation: { [k in LanSetupIssue]: string } = {
NotDesktop: `You are using a mobile device. To setup LAN on a mobile device, please use the Start9 Setup App.`,
NotTor: `For security reasons, you must setup LAN over a Tor connection. Please navigate to your Embassy Tor Address and try again.`,
}
readonly docsUrl = 'https://docs.start9.com/user-manual/general/lan-setup'
subs: Subscription[] = []
constructor ( constructor (
private readonly toastCtrl: ToastController, private readonly toastCtrl: ToastController,
@@ -28,25 +19,16 @@ export class LANPage {
private readonly loadingCtrl: LoadingController, private readonly loadingCtrl: LoadingController,
private readonly errToast: ErrorToastService, private readonly errToast: ErrorToastService,
private readonly embassyApi: ApiService, private readonly embassyApi: ApiService,
private readonly patch: PatchDbService,
) { } ) { }
ngOnInit () { ngOnInit () {
if (isPlatform('ios') || isPlatform('android')) { if (!this.config.isTor()) {
this.lanDisabled = LanSetupIssue.NOT_DESKTOP this.lanDisabled = 'For security reasons, you must setup LAN over a Tor connection. Please navigate to your Embassy Tor Address and try again.'
} else if (!this.config.isTor()) {
this.lanDisabled = LanSetupIssue.NOT_TOR
} }
this.subs = [
this.patch.watch$('server-info', 'lan-address')
.subscribe(addr => {
this.lanAddress = `https://${addr}`
}),
]
} }
ngOnDestroy () { installCert (): void {
this.subs.forEach(sub => sub.unsubscribe()) document.getElementById('install-cert').click()
} }
async refreshLAN (): Promise<void> { async refreshLAN (): Promise<void> {
@@ -67,21 +49,6 @@ export class LANPage {
} }
} }
async copyLAN (): Promise <void> {
const message = await copyToClipboard(this.lanAddress).then(success => success ? 'copied to clipboard!' : 'failed to copy')
const toast = await this.toastCtrl.create({
header: message,
position: 'bottom',
duration: 1000,
})
await toast.present()
}
installCert (): void {
document.getElementById('install-cert').click()
}
private async presentToastSuccess (): Promise<void> { private async presentToastSuccess (): Promise<void> {
const toast = await this.toastCtrl.create({ const toast = await this.toastCtrl.create({
header: 'Success', header: 'Success',
@@ -103,8 +70,3 @@ export class LANPage {
await toast.present() await toast.present()
} }
} }
enum LanSetupIssue {
NOT_TOR = 'NotTor',
NOT_DESKTOP = 'NotDesktop',
}

View File

@@ -6,7 +6,8 @@
<ion-title>Logs</ion-title> <ion-title>Logs</ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button (click)="getLogs()"> <ion-button (click)="getLogs()">
<ion-icon slot="icon-only" name="refresh-outline"></ion-icon> <ion-icon slot="start" name="refresh-outline"></ion-icon>
Refresh
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>

View File

@@ -14,7 +14,8 @@
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2> <h2>
Embassy will automatically connect to saved WiFi networks when they are available, allowing you to remove the Ethernet cable. Adding WiFi credentials to your Embassy allows you to remove the Ethernet cable and move the device anywhere you want. Embassy will automatically connect to available networks.
<a href="https://docs.start9.com/user-manual/general/wifi.html" target="_blank">View instructions</a>
</h2> </h2>
</ion-label> </ion-label>
</ion-item> </ion-item>