diff --git a/setup-wizard/src/app/pages/embassy/embassy.page.ts b/setup-wizard/src/app/pages/embassy/embassy.page.ts
index 2c40111e3..c58f5ce6e 100644
--- a/setup-wizard/src/app/pages/embassy/embassy.page.ts
+++ b/setup-wizard/src/app/pages/embassy/embassy.page.ts
@@ -39,8 +39,22 @@ export class EmbassyPage {
async getDrives () {
try {
- const drives = await this.apiService.getDrives()
- this.storageDrives = drives.filter(d => !d.partitions.map(p => p.logicalname).includes((this.stateService.recoverySource as DiskRecoverySource)?.logicalname))
+ const { disks, reconnect } = await this.apiService.getDrives()
+ this.storageDrives = disks.filter(d => !d.partitions.map(p => p.logicalname).includes((this.stateService.recoverySource as DiskRecoverySource)?.logicalname))
+ if (!this.storageDrives.length && reconnect.length) {
+ const list = `
${reconnect.map(recon => `- ${recon}
`)}
`
+ const alert = await this.alertCtrl.create({
+ header: 'Warning',
+ message: `One or more devices you connected had to be reconfigured to support the current hardware platform. Please unplug and replug in the following device(s):
${list}`,
+ buttons: [
+ {
+ role: 'cancel',
+ text: 'OK',
+ },
+ ],
+ })
+ await alert.present()
+ }
} catch (e) {
this.errorToastService.present(e.message)
} finally {
diff --git a/setup-wizard/src/app/pages/recover/recover.page.ts b/setup-wizard/src/app/pages/recover/recover.page.ts
index bd322da09..6951caf49 100644
--- a/setup-wizard/src/app/pages/recover/recover.page.ts
+++ b/setup-wizard/src/app/pages/recover/recover.page.ts
@@ -44,8 +44,8 @@ export class RecoverPage {
async getDrives () {
this.mappedDrives = []
try {
- const drives = await this.apiService.getDrives()
- drives.filter(d => d.partitions.length).forEach(d => {
+ const { disks, reconnect } = await this.apiService.getDrives()
+ disks.filter(d => d.partitions.length).forEach(d => {
d.partitions.forEach(p => {
const drive: DiskBackupTarget = {
vendor: d.vendor,
@@ -66,7 +66,22 @@ export class RecoverPage {
})
})
- const importableDrive = drives.find(d => !!d.guid)
+ if (!this.mappedDrives.length && reconnect.length) {
+ const list = `${reconnect.map(recon => `- ${recon}
`)}
`
+ const alert = await this.alertCtrl.create({
+ header: 'Warning',
+ message: `One or more devices you connected had to be reconfigured to support the current hardware platform. Please unplug and replug in the following device(s):
${list}`,
+ buttons: [
+ {
+ role: 'cancel',
+ text: 'OK',
+ },
+ ],
+ })
+ await alert.present()
+ }
+
+ const importableDrive = disks.find(d => !!d.guid)
if (!!importableDrive && !this.hasShownGuidAlert) {
const alert = await this.alertCtrl.create({
header: 'Embassy Drive Detected',
diff --git a/setup-wizard/src/app/services/api/api.service.ts b/setup-wizard/src/app/services/api/api.service.ts
index cb6f5b7eb..bd1e3f8ff 100644
--- a/setup-wizard/src/app/services/api/api.service.ts
+++ b/setup-wizard/src/app/services/api/api.service.ts
@@ -1,7 +1,7 @@
export abstract class ApiService {
// unencrypted
abstract getStatus (): Promise // setup.status
- abstract getDrives (): Promise // setup.disk.list
+ abstract getDrives (): Promise // setup.disk.list
abstract set02XDrive (logicalname: string): Promise // setup.recovery.v2.set
abstract getRecoveryStatus (): Promise // setup.recovery.status
@@ -38,6 +38,11 @@ export interface EmbassyOSRecoveryInfo {
'wrapped-key': string | null
}
+export interface DiskListResponse {
+ disks: DiskInfo[]
+ reconnect: string[]
+}
+
export interface DiskBackupTarget {
vendor: string | null
model: string | null
diff --git a/setup-wizard/src/app/services/api/live-api.service.ts b/setup-wizard/src/app/services/api/live-api.service.ts
index 5cda53ff0..015c9c5a5 100644
--- a/setup-wizard/src/app/services/api/live-api.service.ts
+++ b/setup-wizard/src/app/services/api/live-api.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
-import { ApiService, CifsRecoverySource, DiskInfo, DiskRecoverySource, EmbassyOSRecoveryInfo, GetStatusRes, RecoveryStatusRes, SetupEmbassyReq, SetupEmbassyRes } from './api.service'
+import { ApiService, CifsRecoverySource, DiskInfo, DiskListResponse, DiskRecoverySource, EmbassyOSRecoveryInfo, GetStatusRes, RecoveryStatusRes, SetupEmbassyReq, SetupEmbassyRes } from './api.service'
import { HttpService } from './http.service'
@Injectable({
@@ -21,7 +21,7 @@ export class LiveApiService extends ApiService {
}
async getDrives () {
- return this.http.rpcRequest({
+ return this.http.rpcRequest({
method: 'setup.disk.list',
params: { },
}, false)
diff --git a/setup-wizard/src/app/services/api/mock-api.service.ts b/setup-wizard/src/app/services/api/mock-api.service.ts
index f9b609763..106c06ceb 100644
--- a/setup-wizard/src/app/services/api/mock-api.service.ts
+++ b/setup-wizard/src/app/services/api/mock-api.service.ts
@@ -25,106 +25,10 @@ export class MockApiService extends ApiService {
async getDrives () {
await pauseFor(1000)
- return [
- {
- vendor: 'Samsung',
- model: 'SATA',
- logicalname: '/dev/sda',
- guid: 'theguid',
- partitions: [
- {
- logicalname: 'sda1',
- label: 'label 1',
- capacity: 100000,
- used: 200.1255312,
- 'embassy-os': null,
- },
- {
- logicalname: 'sda2',
- label: 'label 2',
- capacity: 50000,
- used: 200.1255312,
- 'embassy-os': null,
- },
- ],
- capacity: 150000,
- },
- {
- vendor: 'Samsung',
- model: null,
- logicalname: 'dev/sdb',
- partitions: [],
- capacity: 34359738369,
- guid: null,
- },
- {
- vendor: 'Crucial',
- model: 'MX500',
- logicalname: 'dev/sdc',
- guid: null,
- partitions: [
- {
- logicalname: 'sdc1',
- label: 'label 1',
- capacity: 0,
- used: null,
- 'embassy-os': {
- version: '0.3.3',
- full: true,
- 'password-hash': 'asdfasdfasdf',
- 'wrapped-key': '',
- },
- },
- {
- logicalname: 'sdc1MOCKTESTER',
- label: 'label 1',
- capacity: 0,
- used: null,
- 'embassy-os': {
- version: '0.3.6',
- full: true,
- // password is 'asdfasdf'
- 'password-hash': '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
- 'wrapped-key': '',
- },
- },
- {
- logicalname: 'sdc1',
- label: 'label 1',
- capacity: 0,
- used: null,
- 'embassy-os': {
- version: '0.3.3',
- full: false,
- 'password-hash': 'asdfasdfasdf',
- 'wrapped-key': '',
- },
- },
- ],
- capacity: 100000,
- },
- {
- vendor: 'Sandisk',
- model: null,
- logicalname: '/dev/sdd',
- guid: null,
- partitions: [
- {
- logicalname: 'sdd1',
- label: null,
- capacity: 10000,
- used: null,
- 'embassy-os': {
- version: '0.2.7',
- full: true,
- 'password-hash': 'asdfasdfasdf',
- 'wrapped-key': '',
- },
- },
- ],
- capacity: 10000,
- },
- ]
+ return {
+ disks: [],
+ reconnect: ['yolo'],
+ }
}
async set02XDrive () {
@@ -202,3 +106,104 @@ const setupRes = {
'lan-address': 'https://embassy-abcdefgh.local',
'root-ca': btoa(rootCA),
}
+
+const disks = [
+ {
+ vendor: 'Samsung',
+ model: 'SATA',
+ logicalname: '/dev/sda',
+ guid: 'theguid',
+ partitions: [
+ {
+ logicalname: 'sda1',
+ label: 'label 1',
+ capacity: 100000,
+ used: 200.1255312,
+ 'embassy-os': null,
+ },
+ {
+ logicalname: 'sda2',
+ label: 'label 2',
+ capacity: 50000,
+ used: 200.1255312,
+ 'embassy-os': null,
+ },
+ ],
+ capacity: 150000,
+ },
+ {
+ vendor: 'Samsung',
+ model: null,
+ logicalname: 'dev/sdb',
+ partitions: [],
+ capacity: 34359738369,
+ guid: null,
+ },
+ {
+ vendor: 'Crucial',
+ model: 'MX500',
+ logicalname: 'dev/sdc',
+ guid: null,
+ partitions: [
+ {
+ logicalname: 'sdc1',
+ label: 'label 1',
+ capacity: 0,
+ used: null,
+ 'embassy-os': {
+ version: '0.3.3',
+ full: true,
+ 'password-hash': 'asdfasdfasdf',
+ 'wrapped-key': '',
+ },
+ },
+ {
+ logicalname: 'sdc1MOCKTESTER',
+ label: 'label 1',
+ capacity: 0,
+ used: null,
+ 'embassy-os': {
+ version: '0.3.6',
+ full: true,
+ // password is 'asdfasdf'
+ 'password-hash': '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
+ 'wrapped-key': '',
+ },
+ },
+ {
+ logicalname: 'sdc1',
+ label: 'label 1',
+ capacity: 0,
+ used: null,
+ 'embassy-os': {
+ version: '0.3.3',
+ full: false,
+ 'password-hash': 'asdfasdfasdf',
+ 'wrapped-key': '',
+ },
+ },
+ ],
+ capacity: 100000,
+ },
+ {
+ vendor: 'Sandisk',
+ model: null,
+ logicalname: '/dev/sdd',
+ guid: null,
+ partitions: [
+ {
+ logicalname: 'sdd1',
+ label: null,
+ capacity: 10000,
+ used: null,
+ 'embassy-os': {
+ version: '0.2.7',
+ full: true,
+ 'password-hash': 'asdfasdfasdf',
+ 'wrapped-key': '',
+ },
+ },
+ ],
+ capacity: 10000,
+ },
+]