Skip to content

Commit

Permalink
enable ssh and get ssh status
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairong1 committed Aug 5, 2024
1 parent 3da97c0 commit eb659d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/interfaces/HposInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ interface HPosStatus {
networkFlavour?: string
hposVersion?: string
name?: string
ssh_enabled?: boolean
}

interface CoreAppVersion {
Expand Down Expand Up @@ -727,7 +728,7 @@ export function useHposInterface(): HposInterface {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { holo_nixpkgs, holoport } = await hposAdminCall({
const { holo_nixpkgs, holoport, ssh } = await hposAdminCall({
method: 'get',
path: '/status'
})
Expand All @@ -738,7 +739,8 @@ export function useHposInterface(): HposInterface {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
hposVersion: formatHposVersion(holo_nixpkgs),
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
name: holoport.name
name: holoport.name,
ssh_enabled: holoport.ssh_enabled
}
} catch (err) {
return {}
Expand Down Expand Up @@ -797,17 +799,14 @@ export function useHposInterface(): HposInterface {

async function updateSshSettings(access: boolean): Promise<void> {
try {
const method = 'put'
const data = {
enable: access,
include_default: access,
pubkeys: []
}

await hposAdminCall({
method,
method: 'put',
path: '/ssh',
params: { data }
params: {
enable: access,
include_default: access,
pubkeys: []
}
})
} catch (error) {
console.error('updateSshSettings failed: ', error)
Expand Down
3 changes: 2 additions & 1 deletion src/store/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useUserStore = defineStore('user', {
publicKey: undefined,
email: '',
networkFlavour: '',
sshAccess: true,
sshAccess: false,
deviceName: '',
hposVersion: '',
holoFuel: {
Expand All @@ -52,6 +52,7 @@ export const useUserStore = defineStore('user', {
this.publicKey = user.hostPubKey
this.email = user.registrationEmail ?? ''
this.networkFlavour = holoport.networkFlavour ?? ''
this.sshAccess = holoport.ssh_enabled ?? false
this.deviceName = holoport.name ?? ''
this.hposVersion = holoport.hposVersion ?? ''
this.holoFuel = holoFuelProfile
Expand Down

0 comments on commit eb659d2

Please sign in to comment.