mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
lan address added
This commit is contained in:
committed by
Aiden McClelland
parent
55bf7c71da
commit
cc2e937216
@@ -91,7 +91,7 @@ export class EmbassyPage {
|
||||
this.stateService.embassyPassword = ret.data.password
|
||||
|
||||
try {
|
||||
this.stateService.torAddress = (await this.stateService.setupEmbassy()).torAddress
|
||||
await this.stateService.setupEmbassy()
|
||||
} catch (e) {
|
||||
this.errorToastService.present(`${e.message}: ${e.details}`)
|
||||
console.error(e.message)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<p>{{ stateService.torAddress }}</p>
|
||||
</ion-label>
|
||||
<ion-buttons>
|
||||
<ion-button fill="clear" (click)="copy()">
|
||||
<ion-button fill="clear" (click)="copy(stateService.torAddress)">
|
||||
<ion-icon size="small" slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
@@ -41,7 +41,7 @@
|
||||
<div
|
||||
[ngStyle]="{
|
||||
'overflow' : 'hidden',
|
||||
'max-height': lanInstructionsOpen ? '355px' : '0px',
|
||||
'max-height': lanInstructionsOpen ? '455px' : '0px',
|
||||
'transition': 'max-height 0.4s ease-out'
|
||||
}"
|
||||
>
|
||||
@@ -65,6 +65,19 @@
|
||||
<p>Download and trust your Embassy's Root Cert</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<p style="padding-top: 10px;" class="addr-label">LAN Address:</p>
|
||||
|
||||
<ion-item style="--border-radius: 8px !important;" color="medium">
|
||||
<ion-label>
|
||||
<p>{{ stateService.lanAddress }}</p>
|
||||
</ion-label>
|
||||
<ion-buttons>
|
||||
<ion-button fill="clear" (click)="copy(stateService.lanAddress)">
|
||||
<ion-icon size="small" slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
</div>
|
||||
</ion-card-content>
|
||||
|
||||
@@ -16,9 +16,9 @@ export class SuccessPage {
|
||||
window = window
|
||||
lanInstructionsOpen = false
|
||||
|
||||
async copy (): Promise<void> {
|
||||
async copy (address: string): Promise<void> {
|
||||
let message = ''
|
||||
await this.copyToClipboard(this.stateService.torAddress)
|
||||
await this.copyToClipboard(address)
|
||||
.then(success => message = success ? 'copied to clipboard!' : 'failed to copy')
|
||||
|
||||
const toast = await this.toastCtrl.create({
|
||||
|
||||
@@ -8,7 +8,7 @@ export abstract class ApiService {
|
||||
// encrypted
|
||||
abstract verifyProductKey (): Promise<void> // echo - throws error if invalid
|
||||
abstract verify03XPassword (logicalname: string, password: string): Promise<boolean> // setup.recovery.test-password
|
||||
abstract setupEmbassy (setupInfo: SetupEmbassyReq): Promise<string> // setup.execute
|
||||
abstract setupEmbassy (setupInfo: SetupEmbassyReq): Promise<SetupEmbassyRes> // setup.execute
|
||||
}
|
||||
|
||||
export interface GetStatusRes {
|
||||
@@ -23,6 +23,11 @@ export interface SetupEmbassyReq {
|
||||
'recovery-password'?: string
|
||||
}
|
||||
|
||||
export interface SetupEmbassyRes {
|
||||
'tor-address': string
|
||||
'lan-address': string
|
||||
}
|
||||
|
||||
export interface DiskInfo {
|
||||
logicalname: string,
|
||||
vendor: string | null,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ApiService, DiskInfo, GetStatusRes, RecoveryStatusRes, SetupEmbassyReq } from './api.service'
|
||||
import { ApiService, DiskInfo, GetStatusRes, RecoveryStatusRes, SetupEmbassyReq, SetupEmbassyRes } from './api.service'
|
||||
import { HttpService } from './http.service'
|
||||
|
||||
@Injectable({
|
||||
@@ -46,7 +46,7 @@ export class LiveApiService extends ApiService {
|
||||
async verifyProductKey () {
|
||||
return this.http.rpcRequest<void>({
|
||||
method: 'echo',
|
||||
params: { "message": "hello" },
|
||||
params: { 'message': 'hello' },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
async setupEmbassy (setupInfo: SetupEmbassyReq) {
|
||||
return this.http.rpcRequest<string>({
|
||||
return this.http.rpcRequest<SetupEmbassyRes>({
|
||||
method: 'setup.execute',
|
||||
params: setupInfo as any,
|
||||
})
|
||||
|
||||
@@ -126,7 +126,10 @@ export class MockApiService extends ApiService {
|
||||
|
||||
async setupEmbassy (setupInfo: SetupEmbassyReq) {
|
||||
await pauseFor(3000)
|
||||
return 'asdfasdfasdf.onion'
|
||||
return {
|
||||
'tor-address': 'asdfasdfasdf.onion',
|
||||
'lan-address': 'embassy-dfasdf.local',
|
||||
}
|
||||
}
|
||||
|
||||
async getRecoveryDrives () {
|
||||
|
||||
@@ -21,6 +21,7 @@ export class StateService {
|
||||
dataProgSubject = new BehaviorSubject(this.dataProgress)
|
||||
|
||||
torAddress: string
|
||||
lanAddress: string
|
||||
|
||||
constructor (
|
||||
private readonly apiService: ApiService,
|
||||
@@ -56,14 +57,15 @@ export class StateService {
|
||||
this.pollDataTransferProgress(callback)
|
||||
}
|
||||
|
||||
async setupEmbassy () : Promise<{ torAddress: string }> {
|
||||
async setupEmbassy () : Promise<void> {
|
||||
const ret = await this.apiService.setupEmbassy({
|
||||
'embassy-logicalname': this.storageDrive.logicalname,
|
||||
'embassy-password': this.embassyPassword,
|
||||
'recovery-drive': this.recoveryDrive,
|
||||
'recovery-password': this.recoveryPassword,
|
||||
})
|
||||
return { torAddress: ret }
|
||||
this.torAddress = ret['tor-address']
|
||||
this.lanAddress = ret['lan-address']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user