mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
remove not needed subs
This commit is contained in:
committed by
Aiden McClelland
parent
804786b80b
commit
20cdb47cb0
@@ -8,17 +8,10 @@ import { PatchDbModel } from '../services/patch-db/patch-db.service'
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class MaintenanceGuard implements CanActivate, CanActivateChild {
|
export class MaintenanceGuard implements CanActivate, CanActivateChild {
|
||||||
serverStatus: ServerStatus
|
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly router: Router,
|
private readonly router: Router,
|
||||||
private readonly patch: PatchDbModel,
|
private readonly patch: PatchDbModel,
|
||||||
) {
|
) { }
|
||||||
this.patch.watch$('server-info', 'status')
|
|
||||||
.pipe(
|
|
||||||
tap(status => this.serverStatus = status),
|
|
||||||
).subscribe()
|
|
||||||
}
|
|
||||||
|
|
||||||
canActivate (): boolean {
|
canActivate (): boolean {
|
||||||
return this.runServerStatusCheck()
|
return this.runServerStatusCheck()
|
||||||
@@ -29,7 +22,7 @@ export class MaintenanceGuard implements CanActivate, CanActivateChild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private runServerStatusCheck (): boolean {
|
private runServerStatusCheck (): boolean {
|
||||||
if ([ServerStatus.Updating, ServerStatus.BackingUp].includes(this.serverStatus)) {
|
if ([ServerStatus.Updating, ServerStatus.BackingUp].includes(this.patch.data['server-info']?.status)) {
|
||||||
this.router.navigate(['/maintenance'], { replaceUrl: true })
|
this.router.navigate(['/maintenance'], { replaceUrl: true })
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="ion-padding-top">
|
<ion-content class="ion-padding-top">
|
||||||
<ng-container *ngIf="installed">
|
<ng-container *ngIf="patch.data['server-info'][pkgId]?.installed as installed">
|
||||||
<ion-item-group>
|
<ion-item-group>
|
||||||
<ion-item button *ngFor="let action of installed.manifest.actions | keyvalue: asIsOrder" (click)="handleAction(installed, action)" >
|
<ion-item button *ngFor="let action of installed.manifest.actions | keyvalue: asIsOrder" (click)="handleAction(installed, action)" >
|
||||||
<ion-label class="ion-text-wrap">
|
<ion-label class="ion-text-wrap">
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import { Subscription } from 'rxjs'
|
|||||||
styleUrls: ['./app-actions.page.scss'],
|
styleUrls: ['./app-actions.page.scss'],
|
||||||
})
|
})
|
||||||
export class AppActionsPage {
|
export class AppActionsPage {
|
||||||
installed: InstalledPackageDataEntry
|
|
||||||
|
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
@ViewChild(IonContent) content: IonContent
|
@ViewChild(IonContent) content: IonContent
|
||||||
|
|
||||||
|
pkgId: string
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly route: ActivatedRoute,
|
private readonly route: ActivatedRoute,
|
||||||
private readonly apiService: ApiService,
|
private readonly apiService: ApiService,
|
||||||
@@ -29,18 +29,11 @@ export class AppActionsPage {
|
|||||||
private readonly loaderService: LoaderService,
|
private readonly loaderService: LoaderService,
|
||||||
private readonly wizardBaker: WizardBaker,
|
private readonly wizardBaker: WizardBaker,
|
||||||
private readonly navCtrl: NavController,
|
private readonly navCtrl: NavController,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
const pkgId = this.route.snapshot.paramMap.get('pkgId')
|
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||||
|
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('package-data', pkgId, 'installed')
|
|
||||||
.subscribe(installed => {
|
|
||||||
this.installed = installed
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit () {
|
ngAfterViewInit () {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-grid *ngIf="pkg">
|
<ion-grid *ngIf="patch.data['package-data'][pkgId] as pkg">
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col *ngFor="let interface of pkg.installed.manifest.interfaces | keyvalue: asIsOrder" sizeSm="12" sizeMd="6">
|
<ion-col *ngFor="let interface of pkg.installed.manifest.interfaces | keyvalue: asIsOrder" sizeSm="12" sizeMd="6">
|
||||||
<ion-card>
|
<ion-card>
|
||||||
|
|||||||
@@ -16,30 +16,23 @@ export class AppInterfacesPage {
|
|||||||
pkg: PackageDataEntry
|
pkg: PackageDataEntry
|
||||||
|
|
||||||
@ViewChild(IonContent) content: IonContent
|
@ViewChild(IonContent) content: IonContent
|
||||||
subs: Subscription[] = []
|
pkgId: string
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly route: ActivatedRoute,
|
private readonly route: ActivatedRoute,
|
||||||
private readonly toastCtrl: ToastController,
|
private readonly toastCtrl: ToastController,
|
||||||
private readonly config: ConfigService,
|
private readonly config: ConfigService,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
const pkgId = this.route.snapshot.paramMap.get('pkgId')
|
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('package-data', pkgId).subscribe(pkg => this.pkg = pkg),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit () {
|
ngAfterViewInit () {
|
||||||
this.content.scrollToPoint(undefined, 1)
|
this.content.scrollToPoint(undefined, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async copy (address: string): Promise<void> {
|
async copy (address: string): Promise<void> {
|
||||||
let message = ''
|
let message = ''
|
||||||
await copyToClipboard(address || '')
|
await copyToClipboard(address || '')
|
||||||
|
|||||||
@@ -8,43 +8,44 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content style="position: relative">
|
<ion-content style="position: relative">
|
||||||
|
<div *ngIf="patch.data['package-data'] as pkgs">
|
||||||
<div *ngIf="pkgs | empty; else list" class="ion-text-center ion-padding">
|
<div *ngIf="pkgs | empty; else list" class="ion-text-center ion-padding">
|
||||||
<div style="display: flex; flex-direction: column; justify-content: center; height: 40vh">
|
<div style="display: flex; flex-direction: column; justify-content: center; height: 40vh">
|
||||||
<h2>Welcome to your <span style="font-style: italic; color: var(--ion-color-danger)">Embassy</span></h2>
|
<h2>Welcome to your <span style="font-style: italic; color: var(--ion-color-danger)">Embassy</span></h2>
|
||||||
<p class="ion-text-wrap">Get started by installing your first service.</p>
|
<p class="ion-text-wrap">Get started by installing your first service.</p>
|
||||||
|
</div>
|
||||||
|
<ion-button [routerLink]="['/marketplace']" style="width: 50%;" fill="outline">
|
||||||
|
<ion-icon slot="start" name="storefront-outline"></ion-icon>
|
||||||
|
Marketplace
|
||||||
|
</ion-button>
|
||||||
</div>
|
</div>
|
||||||
<ion-button [routerLink]="['/marketplace']" style="width: 50%;" fill="outline">
|
|
||||||
<ion-icon slot="start" name="storefront-outline"></ion-icon>
|
|
||||||
Marketplace
|
|
||||||
</ion-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ng-template #list>
|
<ng-template #list>
|
||||||
<ion-grid>
|
<ion-grid>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col *ngFor="let pkg of pkgs | keyvalue : asIsOrder" sizeXs="4" sizeSm="3" sizeLg="3" sizeXl="2">
|
<ion-col *ngFor="let pkg of pkgs | keyvalue : asIsOrder" sizeXs="4" sizeSm="3" sizeLg="3" sizeXl="2">
|
||||||
<ion-card class="installed-card" [routerLink]="['/services', (pkg.value | manifest).id]">
|
<ion-card class="installed-card" [routerLink]="['/services', (pkg.value | manifest).id]">
|
||||||
<div class="launch-container" *ngIf="pkg.value | hasUi">
|
<div class="launch-container" *ngIf="pkg.value | hasUi">
|
||||||
<div class="launch-button-triangle" (click)="launchUi(pkg.value, $event)" [class.launch-disabled]="!(pkg.value | isLaunchable)">
|
<div class="launch-button-triangle" (click)="launchUi(pkg.value, $event)" [class.launch-disabled]="!(pkg.value | isLaunchable)">
|
||||||
<ion-icon name="rocket-outline"></ion-icon>
|
<ion-icon name="rocket-outline"></ion-icon>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<img style="position: absolute" class="main-img" [src]="pkg.value['static-files'].icon" alt="icon" />
|
<img style="position: absolute" class="main-img" [src]="pkg.value['static-files'].icon" alt="icon" />
|
||||||
<img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
|
<img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
|
||||||
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'green' : connected) | async" src="assets/img/running-bulb.png"/>
|
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'green' : connected) | async" src="assets/img/running-bulb.png"/>
|
||||||
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'red' : connected) | async" src="assets/img/issue-bulb.png"/>
|
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'red' : connected) | async" src="assets/img/issue-bulb.png"/>
|
||||||
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'yellow' : connected) | async" src="assets/img/warning-bulb.png"/>
|
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'yellow' : connected) | async" src="assets/img/warning-bulb.png"/>
|
||||||
<img class="bulb-off" *ngIf="(pkg.key | displayBulb : 'off' : connected) | async" src="assets/img/off-bulb.png"/>
|
<img class="bulb-off" *ngIf="(pkg.key | displayBulb : 'off' : connected) | async" src="assets/img/off-bulb.png"/>
|
||||||
|
|
||||||
<ion-card-header>
|
<ion-card-header>
|
||||||
<status *ngIf="connected" [pkgId]="pkg.key" size="calc(8px + .4vw)" weight="bold"></status>
|
<status *ngIf="connected" [pkgId]="pkg.key" size="calc(8px + .4vw)" weight="bold"></status>
|
||||||
<ion-card-title>{{ (pkg.value | manifest).title }}</ion-card-title>
|
<ion-card-title>{{ (pkg.value | manifest).title }}</ion-card-title>
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
</ion-grid>
|
</ion-grid>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { Subscription } from 'rxjs'
|
|||||||
styleUrls: ['./app-list.page.scss'],
|
styleUrls: ['./app-list.page.scss'],
|
||||||
})
|
})
|
||||||
export class AppListPage {
|
export class AppListPage {
|
||||||
pkgs: { [id: string]: PackageDataEntry } = { }
|
|
||||||
connected: boolean
|
connected: boolean
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
|
|
||||||
@@ -23,9 +22,6 @@ export class AppListPage {
|
|||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.subs = [
|
this.subs = [
|
||||||
this.patch.watch$('package-data').subscribe(pkgs => {
|
|
||||||
this.pkgs = pkgs
|
|
||||||
}),
|
|
||||||
this.patch.connected$().subscribe(c => this.connected = c),
|
this.patch.connected$().subscribe(c => this.connected = c),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core'
|
|||||||
import { IonContent, LoadingController, ModalController } from '@ionic/angular'
|
import { IonContent, LoadingController, ModalController } from '@ionic/angular'
|
||||||
import { ApiService } from 'src/app/services/api/api.service'
|
import { ApiService } from 'src/app/services/api/api.service'
|
||||||
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
|
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
|
||||||
import { DiskInfo, PartitionInfoEntry } from 'src/app/services/api/api-types'
|
import { DiskInfo } from 'src/app/services/api/api-types'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute } from '@angular/router'
|
||||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
@@ -33,13 +33,7 @@ export class AppRestorePage {
|
|||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||||
|
this.title = this.patch.data['package-data'][this.pkgId].installed.manifest.title
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('package-data', this.pkgId, 'installed', 'manifest', 'title')
|
|
||||||
.subscribe(title => {
|
|
||||||
this.title = title
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
|
|
||||||
this.getExternalDisks()
|
this.getExternalDisks()
|
||||||
}
|
}
|
||||||
@@ -48,10 +42,6 @@ export class AppRestorePage {
|
|||||||
this.content.scrollToPoint(undefined, 1)
|
this.content.scrollToPoint(undefined, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async refresh () {
|
async refresh () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
await this.getExternalDisks()
|
await this.getExternalDisks()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ion-content *ngrxLet="patch.watch$('server-info', 'status') as status">
|
<ion-content *ngIf="patch.data['serverInfo'].status as status">
|
||||||
|
|
||||||
<ion-grid style="height: 100%;">
|
<ion-grid style="height: 100%;">
|
||||||
<ion-row class="ion-align-items-center ion-text-center" style="height: 100%;">
|
<ion-row class="ion-align-items-center ion-text-center" style="height: 100%;">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<ion-label>
|
<ion-label>
|
||||||
<h2 style="font-family: 'Montserrat';">{{ pkg.title }}</h2>
|
<h2 style="font-family: 'Montserrat';">{{ pkg.title }}</h2>
|
||||||
<p>{{ pkg.descriptionShort }}</p>
|
<p>{{ pkg.descriptionShort }}</p>
|
||||||
<ng-container *ngIf="installedPkgs[pkg.id] as pkgI">
|
<ng-container *ngIf="patch.data['package-data'] as pkgI">
|
||||||
<p *ngIf="pkgI.state === PackageState.Installed">
|
<p *ngIf="pkgI.state === PackageState.Installed">
|
||||||
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 0" color="success">Installed</ion-text>
|
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 0" color="success">Installed</ion-text>
|
||||||
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 1" color="warning">Update Available</ion-text>
|
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 1" color="warning">Update Available</ion-text>
|
||||||
@@ -81,45 +81,6 @@
|
|||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
</ion-grid>
|
</ion-grid>
|
||||||
|
|
||||||
<!-- <ion-card *ngFor="let pkg of pkgs" style="margin: 10px 10px;" [routerLink]="['/marketplace', pkg.id]">
|
|
||||||
<ion-item style="--inner-border-width: 0 0 .4px 0; --border-color: #525252;">
|
|
||||||
<ion-avatar style="margin-top: 8px;" slot="start">
|
|
||||||
<img [src]="pkg.icon" />
|
|
||||||
</ion-avatar>
|
|
||||||
<ion-label style="margin-top: 6px; margin-bottom: 3px">
|
|
||||||
<h1 style="font-family: 'Montserrat'; font-size: 20px; margin-bottom: 0px;">
|
|
||||||
{{ pkg.title }}
|
|
||||||
</h1>
|
|
||||||
<p>{{ pkg.version }}</p>
|
|
||||||
<div class="beneath-title" *ngIf="installedPkgs[pkg.id] as pkgI">
|
|
||||||
<ng-container *ngIf="pkgI.state === PackageState.Installed">
|
|
||||||
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 0" style="font-size: 12px;" color="success">Installed</ion-text>
|
|
||||||
<ion-text *ngIf="(pkg.version | compareEmver : pkgI.installed.manifest.version) === 1" style="font-size: 12px;" color="warning">Update Available</ion-text>
|
|
||||||
</ng-container>
|
|
||||||
<div class="beneath-title" *ngIf="pkgI.state === PackageState.Installing" style="display: flex; flex-direction: row; align-items: center;">
|
|
||||||
<ion-text style="font-size: 12px;" color="primary">Installing</ion-text>
|
|
||||||
<ion-spinner name="crescent" style="height: 10px; width: 15px; margin-left: 3px; margin-right: -4px;" color="primary"></ion-spinner>
|
|
||||||
</div>
|
|
||||||
<div class="beneath-title" *ngIf="pkgI.state === PackageState.Updating" style="display: flex; flex-direction: row; align-items: center;">
|
|
||||||
<ion-text style="font-size: 12px;" color="primary">Updating</ion-text>
|
|
||||||
<ion-spinner name="crescent" style="height: 10px; width: 15px; margin-left: 3px; margin-right: -4px;" color="primary"></ion-spinner>
|
|
||||||
</div>
|
|
||||||
<div class="beneath-title" *ngIf="pkgI.state === PackageState.Removing" style="display: flex; flex-direction: row; align-items: center;">
|
|
||||||
<ion-text style="font-size: 12px;" color="danger">Removing</ion-text>
|
|
||||||
<ion-spinner name="crescent" style="height: 10px; width: 15px; margin-left: 3px; margin-right: -4px;" color="danger"></ion-spinner>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ion-label>
|
|
||||||
</ion-item>
|
|
||||||
<ion-card-content style="
|
|
||||||
font-size: small !important;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
padding-top: 6px;
|
|
||||||
">
|
|
||||||
{{ pkg.descriptionShort }}
|
|
||||||
</ion-card-content>
|
|
||||||
</ion-card> -->
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ export class MarketplaceListPage {
|
|||||||
data: MarketplaceData
|
data: MarketplaceData
|
||||||
eos: MarketplaceEOS
|
eos: MarketplaceEOS
|
||||||
pkgs: AvailablePreview[] = []
|
pkgs: AvailablePreview[] = []
|
||||||
installedPkgs: { [id: string]: PackageDataEntry } = { }
|
|
||||||
|
|
||||||
PackageState = PackageState
|
PackageState = PackageState
|
||||||
|
|
||||||
@@ -43,10 +42,6 @@ export class MarketplaceListPage {
|
|||||||
) { }
|
) { }
|
||||||
|
|
||||||
async ngOnInit () {
|
async ngOnInit () {
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('package-data')
|
|
||||||
.subscribe(pkgs => this.installedPkgs = pkgs),
|
|
||||||
]
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [data, eos, pkgs] = await Promise.all([
|
const [data, eos, pkgs] = await Promise.all([
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ export class MarketplaceShowPage {
|
|||||||
this.subs = [
|
this.subs = [
|
||||||
this.patch.watch$('package-data', this.pkgId)
|
this.patch.watch$('package-data', this.pkgId)
|
||||||
.subscribe(pkg => {
|
.subscribe(pkg => {
|
||||||
console.log(pkg)
|
|
||||||
this.installedPkg = pkg
|
this.installedPkg = pkg
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="ion-padding-top">
|
<ion-content class="ion-padding-top" *ngIf="patch.data['server-info] as server">
|
||||||
|
|
||||||
<ion-item-group>
|
<ion-item-group>
|
||||||
<ion-item detail="true" button [routerLink]="['ssh-keys']">
|
<ion-item detail="true" button [routerLink]="['ssh-keys']">
|
||||||
|
|||||||
@@ -10,27 +10,13 @@ import { Subscription } from 'rxjs'
|
|||||||
styleUrls: ['./dev-options.page.scss'],
|
styleUrls: ['./dev-options.page.scss'],
|
||||||
})
|
})
|
||||||
export class DevOptionsPage {
|
export class DevOptionsPage {
|
||||||
server: ServerInfo = { } as any
|
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly serverConfigService: ServerConfigService,
|
private readonly serverConfigService: ServerConfigService,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('server-info')
|
|
||||||
.subscribe(server => {
|
|
||||||
this.server = server
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async presentModalValueEdit (key: string, current?: any): Promise<void> {
|
async presentModalValueEdit (key: string, current?: any): Promise<void> {
|
||||||
await this.serverConfigService.presentModalValueEdit(key, current)
|
await this.serverConfigService.presentModalValueEdit(key, current)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,10 @@
|
|||||||
<ion-content class="ion-padding-top">
|
<ion-content class="ion-padding-top">
|
||||||
|
|
||||||
<ion-item-group>
|
<ion-item-group>
|
||||||
<ion-item button (click)="presentModalValueEdit('autoCheckUpdates', ui['auto-check-updates'])">
|
<ion-item button (click)="presentModalValueEdit('autoCheckUpdates', patch.data.ui['auto-check-updates'])">
|
||||||
<ion-label>Auto Check for Updates</ion-label>
|
<ion-label>Auto Check for Updates</ion-label>
|
||||||
<ion-note slot="end">{{ ui['auto-check-updates'] }}</ion-note>
|
<ion-note slot="end">{{ patch.data.ui['auto-check-updates'] }}</ion-note>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<!-- <ion-item style="word-break: break-all;" button (click)="presentModalValueEdit('password', ui.password)">
|
|
||||||
<ion-label>Change Password</ion-label>
|
|
||||||
<ion-note slot="end">********</ion-note>
|
|
||||||
</ion-item> -->
|
|
||||||
</ion-item-group>
|
</ion-item-group>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { Component } from '@angular/core'
|
|||||||
import { ServerConfigService } from 'src/app/services/server-config.service'
|
import { ServerConfigService } from 'src/app/services/server-config.service'
|
||||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
import { UIData } from 'src/app/services/patch-db/data-model'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'preferences',
|
selector: 'preferences',
|
||||||
@@ -11,26 +10,12 @@ import { UIData } from 'src/app/services/patch-db/data-model'
|
|||||||
})
|
})
|
||||||
export class PreferencesPage {
|
export class PreferencesPage {
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
ui: UIData = { } as any
|
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly serverConfigService: ServerConfigService,
|
private readonly serverConfigService: ServerConfigService,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('ui')
|
|
||||||
.subscribe(ui => {
|
|
||||||
this.ui = ui
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async presentModalValueEdit (key: string, current?: string): Promise<void> {
|
async presentModalValueEdit (key: string, current?: string): Promise<void> {
|
||||||
await this.serverConfigService.presentModalValueEdit(key, current)
|
await this.serverConfigService.presentModalValueEdit(key, current)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ion-item-divider>Basic</ion-item-divider>
|
<ion-item-divider>Basic</ion-item-divider>
|
||||||
|
|
||||||
<ion-item-group *ngIf="server">
|
<ion-item-group *ngIf="patch.data['server-info'] as server">
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>Version</h2>
|
<h2>Version</h2>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { Component } from '@angular/core'
|
|||||||
import { ToastController } from '@ionic/angular'
|
import { ToastController } from '@ionic/angular'
|
||||||
import { copyToClipboard } from 'src/app/util/web.util'
|
import { copyToClipboard } from 'src/app/util/web.util'
|
||||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||||
import { ServerInfo } from 'src/app/services/patch-db/data-model'
|
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,27 +10,13 @@ import { Subscription } from 'rxjs'
|
|||||||
styleUrls: ['./server-specs.page.scss'],
|
styleUrls: ['./server-specs.page.scss'],
|
||||||
})
|
})
|
||||||
export class ServerSpecsPage {
|
export class ServerSpecsPage {
|
||||||
server: ServerInfo
|
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private readonly toastCtrl: ToastController,
|
private readonly toastCtrl: ToastController,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('server-info')
|
|
||||||
.subscribe(server => {
|
|
||||||
this.server = server
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async copy (address: string) {
|
async copy (address: string) {
|
||||||
let message = ''
|
let message = ''
|
||||||
await copyToClipboard(address || '')
|
await copyToClipboard(address || '')
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item-divider>Saved Networks</ion-item-divider>
|
<ion-item-divider>Saved Networks</ion-item-divider>
|
||||||
<ng-container *ngIf="wifi">
|
<ng-container *ngIf="patch.data['server-info']?.wifi as wifi">
|
||||||
<ion-item button detail="false" *ngFor="let ssid of wifi.ssids" (click)="presentAction(ssid, wifi)">
|
<ion-item button detail="false" *ngFor="let ssid of wifi.ssids" (click)="presentAction(ssid, wifi)">
|
||||||
<ion-label>{{ ssid }}</ion-label>
|
<ion-label>{{ ssid }}</ion-label>
|
||||||
<ion-note slot="end" *ngIf="ssid === wifi.connected"><ion-text color="success">Connected</ion-text></ion-note>
|
<ion-note slot="end" *ngIf="ssid === wifi.connected"><ion-text color="success">Connected</ion-text></ion-note>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { Subscription } from 'rxjs'
|
|||||||
})
|
})
|
||||||
export class WifiListPage {
|
export class WifiListPage {
|
||||||
error = ''
|
error = ''
|
||||||
wifi: WiFiInfo
|
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
@@ -23,22 +22,9 @@ export class WifiListPage {
|
|||||||
private readonly loader: LoaderService,
|
private readonly loader: LoaderService,
|
||||||
private readonly actionCtrl: ActionSheetController,
|
private readonly actionCtrl: ActionSheetController,
|
||||||
private readonly wifiService: WifiService,
|
private readonly wifiService: WifiService,
|
||||||
private readonly patch: PatchDbModel,
|
public readonly patch: PatchDbModel,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
|
||||||
this.subs = [
|
|
||||||
this.patch.watch$('server-info', 'wifi')
|
|
||||||
.subscribe(wifi => {
|
|
||||||
this.wifi = wifi
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
this.subs.forEach(sub => sub.unsubscribe())
|
|
||||||
}
|
|
||||||
|
|
||||||
async presentAction (ssid: string, wifi: WiFiInfo) {
|
async presentAction (ssid: string, wifi: WiFiInfo) {
|
||||||
const buttons: ActionSheetButton[] = [
|
const buttons: ActionSheetButton[] = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { BehaviorSubject, combineLatest, fromEvent, merge, Subscription } from 'rxjs'
|
import { BehaviorSubject, combineLatest, fromEvent, merge, Subscription } from 'rxjs'
|
||||||
import { DataModel } from './patch-db/data-model'
|
|
||||||
import { ConnectionStatus, PatchDbModel } from './patch-db/patch-db.service'
|
import { ConnectionStatus, PatchDbModel } from './patch-db/patch-db.service'
|
||||||
import { HttpService, Method } from './http.service'
|
import { HttpService, Method } from './http.service'
|
||||||
import { distinctUntilChanged } from 'rxjs/operators'
|
import { distinctUntilChanged } from 'rxjs/operators'
|
||||||
@@ -9,7 +8,6 @@ import { distinctUntilChanged } from 'rxjs/operators'
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ConnectionService {
|
export class ConnectionService {
|
||||||
private addrs: DataModel['server-info']['connection-addresses']
|
|
||||||
private readonly networkState$ = new BehaviorSubject<boolean>(true)
|
private readonly networkState$ = new BehaviorSubject<boolean>(true)
|
||||||
private readonly connectionFailure$ = new BehaviorSubject<ConnectionFailure>(ConnectionFailure.None)
|
private readonly connectionFailure$ = new BehaviorSubject<ConnectionFailure>(ConnectionFailure.None)
|
||||||
private subs: Subscription[] = []
|
private subs: Subscription[] = []
|
||||||
@@ -25,15 +23,6 @@ export class ConnectionService {
|
|||||||
|
|
||||||
start () {
|
start () {
|
||||||
this.subs = [
|
this.subs = [
|
||||||
this.patch.watch$('server-info')
|
|
||||||
.subscribe(data => {
|
|
||||||
if (!data) return
|
|
||||||
this.addrs = data['connection-addresses'] || {
|
|
||||||
tor: [],
|
|
||||||
clearnet: [],
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
merge(fromEvent(window, 'online'), fromEvent(window, 'offline'))
|
merge(fromEvent(window, 'online'), fromEvent(window, 'offline'))
|
||||||
.subscribe(event => {
|
.subscribe(event => {
|
||||||
this.networkState$.next(event.type === 'online')
|
this.networkState$.next(event.type === 'online')
|
||||||
@@ -42,6 +31,7 @@ export class ConnectionService {
|
|||||||
combineLatest([this.networkState$.pipe(distinctUntilChanged()), this.patch.watchConnection$().pipe(distinctUntilChanged())])
|
combineLatest([this.networkState$.pipe(distinctUntilChanged()), this.patch.watchConnection$().pipe(distinctUntilChanged())])
|
||||||
.subscribe(async ([network, connectionStatus]) => {
|
.subscribe(async ([network, connectionStatus]) => {
|
||||||
console.log('CONNECTION STATUS', connectionStatus)
|
console.log('CONNECTION STATUS', connectionStatus)
|
||||||
|
const addrs = this.patch.data['server-info']?.['connection-addresses']
|
||||||
if (connectionStatus !== ConnectionStatus.Disconnected) {
|
if (connectionStatus !== ConnectionStatus.Disconnected) {
|
||||||
this.connectionFailure$.next(ConnectionFailure.None)
|
this.connectionFailure$.next(ConnectionFailure.None)
|
||||||
} else if (!network) {
|
} else if (!network) {
|
||||||
@@ -49,12 +39,12 @@ export class ConnectionService {
|
|||||||
} else {
|
} else {
|
||||||
console.log('diagnosing')
|
console.log('diagnosing')
|
||||||
this.connectionFailure$.next(ConnectionFailure.Diagnosing)
|
this.connectionFailure$.next(ConnectionFailure.Diagnosing)
|
||||||
const torSuccess = await this.testAddrs(this.addrs.tor)
|
const torSuccess = await this.testAddrs(addrs?.tor || [])
|
||||||
if (torSuccess) {
|
if (torSuccess) {
|
||||||
console.log('TOR SUCCESS, EMBASSY IS PROBLEM')
|
console.log('TOR SUCCESS, EMBASSY IS PROBLEM')
|
||||||
this.connectionFailure$.next(ConnectionFailure.Embassy)
|
this.connectionFailure$.next(ConnectionFailure.Embassy)
|
||||||
} else {
|
} else {
|
||||||
const clearnetSuccess = await this.testAddrs(this.addrs.clearnet)
|
const clearnetSuccess = await this.testAddrs(addrs?.clearnet || [])
|
||||||
if (clearnetSuccess) {
|
if (clearnetSuccess) {
|
||||||
console.log('CLEARNET SUCCESS, TOR IS PROBLEM')
|
console.log('CLEARNET SUCCESS, TOR IS PROBLEM')
|
||||||
this.connectionFailure$.next(ConnectionFailure.Tor)
|
this.connectionFailure$.next(ConnectionFailure.Tor)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export class PatchDbModel {
|
|||||||
|
|
||||||
async init (): Promise<void> {
|
async init (): Promise<void> {
|
||||||
const cache = await this.bootstrapper.init()
|
const cache = await this.bootstrapper.init()
|
||||||
|
console.log('CACHECACHE', cache)
|
||||||
this.patchDb = new PatchDB([this.source, this.http], this.http, cache)
|
this.patchDb = new PatchDB([this.source, this.http], this.http, cache)
|
||||||
|
|
||||||
this.sequence$ = this.patchDb.store.sequence$.asObservable()
|
this.sequence$ = this.patchDb.store.sequence$.asObservable()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"mocks": {
|
"mocks": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"connection": "ws",
|
"connection": "poll",
|
||||||
"rpcPort": "5959",
|
"rpcPort": "5959",
|
||||||
"wsPort": "5960",
|
"wsPort": "5960",
|
||||||
"maskAs": "tor",
|
"maskAs": "tor",
|
||||||
|
|||||||
Reference in New Issue
Block a user