feat: move all frontend projects under the same Angular workspace (#1141)

* feat: move all frontend projects under the same Angular workspace

* Refactor/angular workspace (#1154)

* update frontend build steps

Co-authored-by: waterplea <alexander@inkin.ru>
Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
Co-authored-by: Lucy Cifferello <12953208+elvece@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2022-01-31 14:01:33 -07:00
committed by GitHub
parent 7e6c852ebd
commit 574539faec
504 changed files with 11569 additions and 78972 deletions

View File

@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { IonicModule } from '@ionic/angular'
import { FormsModule } from '@angular/forms'
import { SuccessPage } from './success.page'
import { PasswordPageModule } from '../../modals/password/password.module'
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PasswordPageModule,
],
declarations: [SuccessPage],
exports: [SuccessPage],
})
export class SuccessPageModule { }

View File

@@ -0,0 +1,167 @@
<ion-card color="dark">
<ion-card-header class="ion-text-center" color="success">
<ion-icon style="font-size: 80px;" name="checkmark-circle-outline"></ion-icon>
<ion-card-title>Setup Complete!</ion-card-title>
</ion-card-header>
<ion-card-content>
<br />
<ng-template [ngIf]="stateService.recoverySource && stateService.recoverySource.type === 'disk'">
<h2>You can now safely unplug your backup drive.</h2>
</ng-template>
<!-- Tor Instructions -->
<div (click)="toggleTor()" class="toggle-label">
<h2>Tor Instructions:</h2>
<ion-icon
name="chevron-down-outline"
[ngStyle]="{
'transform': torOpen ? 'rotate(-90deg)' : 'rotate(0deg)',
'transition': 'transform 0.4s ease-out'
}"
></ion-icon>
</div>
<div
[ngStyle]="{
'overflow' : 'hidden',
'max-height': torOpen ? '500px' : '0px',
'transition': 'max-height 0.4s ease-out'
}"
>
<div class="ion-padding ion-text-start">
<p>
To use your Embassy over Tor, visit its unique Tor address from any Tor-enabled browser.
For a list of recommended browsers, click <a href="https://docs.start9.com/user-manual/connecting.html" target="_blank" rel="noreferrer"><b>here</b></a>.
</p>
<br />
<p>Tor Address</p>
<ion-item lines="none" color="dark">
<ion-label class="ion-text-wrap">
<code><ion-text color="light">{{ stateService.torAddress }}</ion-text></code>
</ion-label>
<ion-button color="light" fill="clear" (click)="copy(stateService.torAddress)">
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
</ion-button>
</ion-item>
</div>
<div style="padding-bottom: 24px; border-bottom: solid 1px;"></div>
<br />
</div>
<!-- LAN Instructions -->
<div (click)="toggleLan()" class="toggle-label">
<h2>LAN Instructions (Slightly Advanced):</h2>
<ion-icon
name="chevron-down-outline"
[ngStyle]="{
'transform': lanOpen ? 'rotate(-90deg)' : 'rotate(0deg)',
'transition': 'transform 0.4s ease-out'
}"
></ion-icon>
</div>
<div
[ngStyle]="{
'overflow' : 'hidden',
'max-height': lanOpen ? '500px' : '0px',
'transition': 'max-height 0.4s ease-out'
}"
>
<div class="ion-padding ion-text-start">
<p>To use your Embassy locally, you must:</p>
<ol>
<li>Currently be connected to the same Local Area Network (LAN) as your Embassy.</li>
<li>Download your Embassy's Root Certificate Authority.</li>
<li>Trust your Embassy's Root CA on <i>both</i> your computer/phone and in your browser settings.</li>
</ol>
<p>
For step-by-step instructions, click
<a href="https://docs.start9.com/user-manual/general/lan-setup.html" target="_blank" rel="noreferrer"><b>here</b></a>.
</p>
<p>
<b>Please note, once setup is complete, the embassy.local address will no longer connect to your Embassy.</b>
</p>
<ion-button style="margin-top: 24px; margin-bottom: 24px;" color="light" (click)="installCert()">
Download Root CA
<ion-icon slot="end" name="download-outline"></ion-icon>
</ion-button>
<p>LAN Address</p>
<ion-item lines="none" color="dark">
<ion-label class="ion-text-wrap">
<code><ion-text color="light">{{ stateService.lanAddress }}</ion-text></code>
</ion-label>
<ion-button color="light" fill="clear" (click)="copy(stateService.lanAddress)">
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
</ion-button>
</ion-item>
</div>
<div style="padding-bottom: 24px; border-bottom: solid 1px;"></div>
<br />
</div>
<div class="ion-text-center ion-padding-top">
<ion-button color="light" fill="clear" color="primary" strong (click)="download()">
Download this page
<ion-icon slot="end" name="download-outline"></ion-icon>
</ion-button>
</div>
<br />
</ion-card-content>
</ion-card>
<!-- cert elem -->
<a hidden id="install-cert" download="embassy.crt"></a>
<!-- download elem -->
<div hidden id="downloadable">
<div style="padding: 0 24px; font-family: Courier;">
<h1>Embassy Info</h1>
<section style="padding: 16px; border: solid 1px;">
<h2>Tor Info</h2>
<p>
To use your Embassy over Tor, visit its unique Tor address from any Tor-enabled browser.
</p>
<p>
For a list of recommended browsers, click <a href="https://docs.start9.com/user-manual/connecting.html" target="_blank" rel="noreferrer"><b>here</b></a>.
</p>
<p><b>Tor Address: </b><code id="tor-addr"></code></p>
</section>
<section style="padding: 16px; border: solid 1px; border-top: none;">
<h2>LAN Info</h2>
<p>To use your Embassy locally, you must:</p>
<ol>
<li>Currently be connected to the same Local Area Network (LAN) as your Embassy.</li>
<li>Download your Embassy's Root Certificate Authority.</li>
<li>Trust your Embassy's Root CA on <i>both</i> your computer/phone and in your browser settings.</li>
</ol>
<p>
For step-by-step instructions, click
<a href="https://docs.start9.com/user-manual/general/lan-setup.html" target="_blank" rel="noreferrer"><b>here</b></a>.
</p>
<div style="margin: 42px 0;">
<a
id="cert"
download="embassy.crt"
style="
background: #25272b;
padding: 10px;
text-decoration: none;
text-align: center;
border-radius: 4px;
color: white;
"
>
Download Root CA
</a>
</div>
<p><b>LAN Address: </b><code id="lan-addr"></code></p>
</section>
</div>
</div>

View File

@@ -0,0 +1,29 @@
p {
color: var(--ion-color-light);
}
a {
text-decoration: none;
}
.toggle-label {
padding: 24px 0 8px 0;
cursor: pointer;
display: flex;
flex-direction: row;
justify-content: space-between;
* {
display: inline-block;
vertical-align: middle;
}
h2 {
font-weight: bold;
}
ion-icon {
text-align: right;
font-size: 24px;
}
}

View File

@@ -0,0 +1,65 @@
import { Component, EventEmitter, Output } from '@angular/core'
import { ToastController } from '@ionic/angular'
import { StateService } from 'src/app/services/state.service'
@Component({
selector: 'success',
templateUrl: 'success.page.html',
styleUrls: ['success.page.scss'],
})
export class SuccessPage {
@Output() onDownload = new EventEmitter()
torOpen = true
lanOpen = false
constructor (
private readonly toastCtrl: ToastController,
public readonly stateService: StateService,
) { }
ngAfterViewInit () {
document.getElementById('install-cert').setAttribute('href', 'data:application/x-x509-ca-cert;base64,' + encodeURIComponent(this.stateService.cert))
}
async copy (address: string): Promise<void> {
const success = await this.copyToClipboard(address)
const message = success ? 'copied to clipboard!' : 'failed to copy'
const toast = await this.toastCtrl.create({
header: message,
position: 'bottom',
duration: 1000,
})
await toast.present()
}
toggleTor () {
this.torOpen = !this.torOpen
}
toggleLan () {
this.lanOpen = !this.lanOpen
}
installCert () {
document.getElementById('install-cert').click()
}
download () {
this.onDownload.emit()
}
private async copyToClipboard (str: string): Promise<boolean> {
const el = document.createElement('textarea')
el.value = str
el.setAttribute('readonly', '')
el.style.position = 'absolute'
el.style.left = '-9999px'
document.body.appendChild(el)
el.select()
const copy = document.execCommand('copy')
document.body.removeChild(el)
return copy
}
}