ensure lan address present before getting cert name (#2272)

This commit is contained in:
Matt Hill
2023-05-12 12:18:39 -06:00
committed by GitHub
parent 2e6fc7e4a0
commit 4a00bd4797
3 changed files with 9 additions and 23 deletions

View File

@@ -78,11 +78,7 @@
<h2> <h2>
<ion-text color="success">Use Existing Drive</ion-text> <ion-text color="success">Use Existing Drive</ion-text>
</h2> </h2>
<p> <p>Attach an existing StartOS data drive (not a backup)</p>
Attach an existing StartOS data drive (
<b>not</b>
a backup)
</p>
</ion-label> </ion-label>
</ion-item> </ion-item>

View File

@@ -31,7 +31,7 @@
</ng-container> </ng-container>
<!-- not kiosk --> <!-- not kiosk -->
<ng-template #notKiosk> <ng-template #notKiosk>
<ion-card> <ion-card *ngIf="lanAddress">
<ion-row class="ion-align-items-center"> <ion-row class="ion-align-items-center">
<ion-col responsiveCol sizeXs="12" class="ion-text-center"> <ion-col responsiveCol sizeXs="12" class="ion-text-center">
<div style="margin-bottom: 4rem"> <div style="margin-bottom: 4rem">

View File

@@ -1,13 +1,5 @@
import { DOCUMENT } from '@angular/common' import { DOCUMENT } from '@angular/common'
import { import { Component, ElementRef, Inject, NgZone, ViewChild } from '@angular/core'
Component,
ElementRef,
EventEmitter,
Inject,
NgZone,
Output,
ViewChild,
} from '@angular/core'
import { DownloadHTMLService, ErrorToastService } from '@start9labs/shared' import { DownloadHTMLService, ErrorToastService } from '@start9labs/shared'
import { ApiService } from 'src/app/services/api/api.service' import { ApiService } from 'src/app/services/api/api.service'
import { StateService } from 'src/app/services/state.service' import { StateService } from 'src/app/services/state.service'
@@ -23,11 +15,9 @@ export class SuccessPage {
private canvas: ElementRef<HTMLCanvasElement> = {} as ElementRef<HTMLCanvasElement> private canvas: ElementRef<HTMLCanvasElement> = {} as ElementRef<HTMLCanvasElement>
private ctx: CanvasRenderingContext2D = {} as CanvasRenderingContext2D private ctx: CanvasRenderingContext2D = {} as CanvasRenderingContext2D
@Output() onDownload = new EventEmitter() torAddress?: string
lanAddress?: string
torAddress = '' cert?: string
lanAddress = ''
cert = ''
tileSize = 16 tileSize = 16
// a higher fade factor will make the characters fade quicker // a higher fade factor will make the characters fade quicker
@@ -73,15 +63,15 @@ export class SuccessPage {
const torAddress = this.document.getElementById('tor-addr') const torAddress = this.document.getElementById('tor-addr')
const lanAddress = this.document.getElementById('lan-addr') const lanAddress = this.document.getElementById('lan-addr')
if (torAddress) torAddress.innerHTML = this.torAddress if (torAddress) torAddress.innerHTML = this.torAddress!
if (lanAddress) lanAddress.innerHTML = this.lanAddress if (lanAddress) lanAddress.innerHTML = this.lanAddress!
this.document this.document
.getElementById('cert') .getElementById('cert')
?.setAttribute( ?.setAttribute(
'href', 'href',
'data:application/x-x509-ca-cert;base64,' + 'data:application/x-x509-ca-cert;base64,' +
encodeURIComponent(this.cert), encodeURIComponent(this.cert!),
) )
let html = this.document.getElementById('downloadable')?.innerHTML || '' let html = this.document.getElementById('downloadable')?.innerHTML || ''
this.downloadHtml.download('StartOS-info.html', html).then(_ => { this.downloadHtml.download('StartOS-info.html', html).then(_ => {