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>
<ion-text color="success">Use Existing Drive</ion-text>
</h2>
<p>
Attach an existing StartOS data drive (
<b>not</b>
a backup)
</p>
<p>Attach an existing StartOS data drive (not a backup)</p>
</ion-label>
</ion-item>

View File

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

View File

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