ui: fix PR comments

This commit is contained in:
Aaron Greenspan
2021-01-18 11:40:13 -07:00
committed by Aiden McClelland
parent 50b887fcb9
commit d5d0ea3ade
4 changed files with 118 additions and 48 deletions

View File

@@ -6,29 +6,35 @@
</ion-button>
</ion-buttons>
<ion-title >
<ion-label style="font-size: 20px;" class="ion-text-wrap">Welcome to EmbassyOS {{ version }}!</ion-label>
<ion-label style="font-size: 20px;" class="ion-text-wrap">Welcome to {{ version }}!</ion-label>
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<h2>Highlights</h2>
<p>
0.2.8 is a small but important update designed to enhance awareness around potential pitfalls of using certain services.
It introduces warnings for installing, uninstalling, backing up, and restoring backups of stateful services such as LND or c-lightning.
0.2.8 introduces automatic checks for updates, a setting that can be enabled or disabled in your Embassy config, and it also draws a distinction between services that are designed to be launched inside the browser and those that are designed to run in the background.
</p>
<div style="display: flex; flex-direction: column; justify-content: space-between; height: 100%">
<div>
<h2>Highlights</h2>
<p>
0.2.8 is a small but important update designed to enhance awareness around potential pitfalls of using certain services.
It introduces warnings for installing, uninstalling, backing up, and restoring backups of stateful services such as LND or c-lightning.
0.2.8 introduces automatic checks for updates, a setting that can be enabled or disabled in your Embassy config, and it also draws a distinction between services that are designed to be launched inside the browser and those that are designed to run in the background.
</p>
<div style="margin-top: 30px">
<h5 style="color: var(--ion-color-danger)">Important</h5>
<p>
If you have LND or c-lightning installed, please update them to the latest versions.
An oversight in Start9s USB backups system has created a situation where <b>restoring</b> a LND or c-lightning backup could potentially result in permanent loss of channel funds.
To be clear, <ion-text style="font-weight: 'bold';">DO NOT</ion-text> attempt to <b>restore</b> a LND or c-lightning backup until you have updated to the latest versions.
</p>
<div style="margin-top: 30px">
<h5 style="color: var(--ion-color-danger)">Important</h5>
<p>
If you have LND or c-lightning installed, please update them to the latest versions.
An oversight in Start9s USB backups system has created a situation where <b>restoring</b> a LND or c-lightning backup could potentially result in permanent loss of channel funds.
To be clear, <ion-text style="font-weight: 'bold';">DO NOT</ion-text> attempt to <b>restore</b> a LND or c-lightning backup until you have updated to the latest versions.
</p>
</div>
</div>
<div class="close-button">
<ion-button fill="outline" (click)="dismiss()">
Close
</ion-button>
</div>
</div>
<ion-button style="text-align: right; margin-top:12px;" fill="outline" (click)="dismiss()">
Close
</ion-button>
</ion-content>

View File

@@ -0,0 +1,8 @@
.close-button {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
min-height: 100px;
}

View File

@@ -59,8 +59,8 @@ export class ServerConfigService {
description: 'On launch, EmabssyOS will automatically check for updates of itself and your installed services. Updating still requires user approval and action. No updates will ever be performed automatically.',
default: true,
},
saveFn: (val: string) => {
return this.apiService.patchServerConfig('autoCheckUpdates', val).then(() => this.serverModel.update({ name: val }))
saveFn: (val: boolean) => {
return this.apiService.patchServerConfig('autoCheckUpdates', val).then(() => this.serverModel.update({ autoCheckUpdates: val }))
},
},
// password: {
@@ -121,5 +121,5 @@ export class ServerConfigService {
interface SpecAndSaveFn {
spec: ValueSpec
saveFn: (val: string) => Promise<any>
saveFn: (val: any) => Promise<any>
}

View File

@@ -90,21 +90,31 @@ export class SyncNotifier {
}
private async handleUpdateCheck (server: Readonly<S9Server>) {
debugSync('handleUpdateCheck', server)
if (!server.autoCheckUpdates || this.checkedForUpdates) return
this.checkedForUpdates = true
debugSync('handleUpdateCheck', 'checkedForUpdates=true')
if (server.versionLatest && this.emver.compare(server.versionInstalled, server.versionLatest) === -1) {
return this.presentAlertNewOS(server.versionLatest)
debugSync('handleUpdateCheck', 'OS Update')
// if cancel selected, move on to newApps
const { update } = await this.presentAlertNewOS(server.versionLatest)
debugSync('handleUpdateCheck', 'OS Update', 'response', update)
if (update) {
return this.updateEmbassyOS(server.versionLatest).catch(e => alert(e))
}
}
try {
debugSync('handleUpdateCheck', 'Apps Check')
const availableApps = await this.apiService.getAvailableApps()
if (!!availableApps.find(app => this.emver.compare(app.versionInstalled, app.versionLatest) === -1)) {
debugSync('handleUpdateCheck', 'Apps Check', 'new apps found')
return this.presentAlertNewApps()
}
} catch {
this.checkedForUpdates = false
} catch (e) {
console.error(`Exception checking for new apps: `, e)
}
}
@@ -112,42 +122,44 @@ export class SyncNotifier {
const alert = await this.alertCtrl.create({
backdropDismiss: true,
header: 'Updates Available!',
message: 'New service updates are availbale in the Marketplace.',
message: 'New service updates are available in the Marketplace.',
buttons: [
{
text: 'Cancel',
role: 'cancel'
role: 'cancel',
},
{
text: 'View in Marketplace',
handler: () => {
return this.navCtrl.navigateForward('/services/marketplace')
}
}
]
},
},
],
})
await alert.present()
}
private async presentAlertNewOS (versionLatest: string) {
const alert = await this.alertCtrl.create({
backdropDismiss: true,
header: 'New EmbassyOS Version!',
message: `Update EmbassyOS to version ${versionLatest}?`,
buttons: [
{
text: 'Not now',
role: 'cancel'
},
{
text: 'Update',
handler: () => {
return this.updateEmbassyOS(versionLatest)
}
}
]
private async presentAlertNewOS (versionLatest: string): Promise<{ cancel?: true, update?: true }> {
return new Promise(async resolve => {
const alert = await this.alertCtrl.create({
backdropDismiss: true,
header: 'New EmbassyOS Version!',
message: `Update EmbassyOS to version ${versionLatest}?`,
buttons: [
{
text: 'Not now',
role: 'cancel',
handler: () => resolve({ cancel: true }),
},
{
text: 'Update',
handler: () => resolve({ update: true }),
},
],
})
await alert.present()
})
await alert.present()
}
private async updateEmbassyOS (versionLatest: string) {
@@ -159,3 +171,47 @@ export class SyncNotifier {
.catch(e => alert(e))
}
}
// @TODO: remove
function debugSync (...desc: any[]) {
console.log(`sync: `, ...desc)
}
// return new Promise(async resolve => {
// const confirm = await this.alertController.create({
// cssClass: 'alert-demo',
// header: 'Warning',
// message: `<h6>This is a <i>hosted</i> instance of Burn After Reading.</h6>
// <p>Since you are not the server operator, you can never be 100% certain that your data are private or secure.</p>
// <p>You can run your own, private instance with the click of a button using the Start9 Embassy.</p>`,
// buttons: [
// {
// text: 'Run my Own',
// handler: () => {
// const a = document.createElement('a')
// const site = (this.config.isConsulate || !this.config.isTor) ? 'https://start9labs.com' : 'http://privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion/'
// a.href = site
// a.target = '_blank'
// pauseFor(500).then(() => a.click())
// return resolve()
// },
// },
// {
// text: 'Use Demo',
// role: 'cancel',
// handler: () => resolve(),
// },
// ],
// })
// await confirm.present()
// const alert = document.getElementsByClassName('alert-demo').item(0)
// this.cleanup(
// fromEvent(alert, 'keyup')
// .pipe(filter((k: KeyboardEvent) => isEnter(k)))
// .subscribe(() => confirm.dismiss()),
// )
// })
// }