switch all fe to camelCase

This commit is contained in:
Matt Hill
2024-03-22 12:05:41 -06:00
parent a35baca580
commit 7e9d453a2c
120 changed files with 593 additions and 1739 deletions

View File

@@ -28,27 +28,27 @@ type Encrypted = {
}
export type StatusRes = {
'bytes-transferred': number
'total-bytes': number | null
bytesTransferred: number
totalBytes: number | null
complete: boolean
} | null
export type AttachReq = {
guid: string
'embassy-password': Encrypted
startOsPassword: Encrypted
}
export type ExecuteReq = {
'embassy-logicalname': string
'embassy-password': Encrypted
'recovery-source': RecoverySource | null
'recovery-password': Encrypted | null
startOsLogicalname: string
startOsPassword: Encrypted
recoverySource: RecoverySource | null
recoveryPassword: Encrypted | null
}
export type CompleteRes = {
'tor-address': string
'lan-address': string
'root-ca': string
torAddress: string
lanAddress: string
rootCa: string
}
export type DiskBackupTarget = {
@@ -58,7 +58,7 @@ export type DiskBackupTarget = {
label: string | null
capacity: number
used: number | null
'embassy-os': StartOSDiskInfo | null
startOs: StartOSDiskInfo | null
}
export type CifsBackupTarget = {
@@ -66,7 +66,7 @@ export type CifsBackupTarget = {
path: string
username: string
mountable: boolean
'embassy-os': StartOSDiskInfo | null
startOs: StartOSDiskInfo | null
}
export type DiskRecoverySource = {

View File

@@ -73,11 +73,10 @@ export class LiveApiService extends ApiService {
}
async execute(setupInfo: ExecuteReq) {
if (setupInfo['recovery-source']?.type === 'backup') {
if (isCifsSource(setupInfo['recovery-source'].target)) {
setupInfo['recovery-source'].target.path = setupInfo[
'recovery-source'
].target.path.replace('/\\/g', '/')
if (setupInfo.recoverySource?.type === 'backup') {
if (isCifsSource(setupInfo.recoverySource.target)) {
setupInfo.recoverySource.target.path =
setupInfo.recoverySource.target.path.replace('/\\/g', '/')
}
}
@@ -95,7 +94,7 @@ export class LiveApiService extends ApiService {
return {
...res,
'root-ca': encodeBase64(res['root-ca']),
rootCa: encodeBase64(res.rootCa),
}
}

View File

@@ -30,8 +30,8 @@ export class MockApiService extends ApiService {
const progress = tries > 4 ? (tries - 4) * 268435456 : 0
return {
'bytes-transferred': restoreOrMigrate ? progress : 0,
'total-bytes': restoreOrMigrate ? total : null,
bytesTransferred: restoreOrMigrate ? progress : 0,
totalBytes: restoreOrMigrate ? total : null,
complete: progress === total,
}
}
@@ -65,12 +65,12 @@ export class MockApiService extends ApiService {
label: null,
capacity: 1979120929996,
used: null,
'embassy-os': {
startOs: {
version: '0.2.17',
full: true,
'password-hash':
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null,
wrappedKey: null,
},
guid: null,
},
@@ -88,12 +88,12 @@ export class MockApiService extends ApiService {
label: null,
capacity: 73264762332,
used: null,
'embassy-os': {
startOs: {
version: '0.3.3',
full: true,
'password-hash':
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null,
wrappedKey: null,
},
guid: null,
},
@@ -111,12 +111,12 @@ export class MockApiService extends ApiService {
label: null,
capacity: 73264762332,
used: null,
'embassy-os': {
startOs: {
version: '0.3.2',
full: true,
'password-hash':
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null,
wrappedKey: null,
},
guid: 'guid-guid-guid-guid',
},
@@ -132,9 +132,9 @@ export class MockApiService extends ApiService {
return {
version: '0.3.0',
full: true,
'password-hash':
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '',
wrappedKey: '',
}
}
@@ -149,9 +149,9 @@ export class MockApiService extends ApiService {
async complete(): Promise<CompleteRes> {
await pauseFor(1000)
return {
'tor-address': 'https://asdafsadasdasasdasdfasdfasdf.onion',
'lan-address': 'https://adjective-noun.local',
'root-ca': encodeBase64(rootCA),
torAddress: 'https://asdafsadasdasasdasdfasdfasdf.onion',
lanAddress: 'https://adjective-noun.local',
rootCa: encodeBase64(rootCA),
}
}

View File

@@ -15,7 +15,7 @@ export class StateService {
async importDrive(guid: string, password: string): Promise<void> {
await this.api.attach({
guid,
'embassy-password': await this.api.encrypt(password),
startOsPassword: await this.api.encrypt(password),
})
}
@@ -24,10 +24,10 @@ export class StateService {
password: string,
): Promise<void> {
await this.api.execute({
'embassy-logicalname': storageLogicalname,
'embassy-password': await this.api.encrypt(password),
'recovery-source': this.recoverySource || null,
'recovery-password': this.recoveryPassword
startOsLogicalname: storageLogicalname,
startOsPassword: await this.api.encrypt(password),
recoverySource: this.recoverySource || null,
recoveryPassword: this.recoveryPassword
? await this.api.encrypt(this.recoveryPassword)
: null,
})