From eb659d23a6848f8a92619e875cc3e857ae9119a5 Mon Sep 17 00:00:00 2001 From: Alastair Ong Date: Mon, 5 Aug 2024 13:50:52 +0100 Subject: [PATCH] enable ssh and get ssh status --- src/interfaces/HposInterface.ts | 21 ++++++++++----------- src/store/user.ts | 3 ++- ui-common-library | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/interfaces/HposInterface.ts b/src/interfaces/HposInterface.ts index 1a5f2d4..d48f66c 100644 --- a/src/interfaces/HposInterface.ts +++ b/src/interfaces/HposInterface.ts @@ -247,6 +247,7 @@ interface HPosStatus { networkFlavour?: string hposVersion?: string name?: string + ssh_enabled?: boolean } interface CoreAppVersion { @@ -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' }) @@ -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 {} @@ -797,17 +799,14 @@ export function useHposInterface(): HposInterface { async function updateSshSettings(access: boolean): Promise { 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) diff --git a/src/store/user.ts b/src/store/user.ts index 311c6e8..267197f 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -29,7 +29,7 @@ export const useUserStore = defineStore('user', { publicKey: undefined, email: '', networkFlavour: '', - sshAccess: true, + sshAccess: false, deviceName: '', hposVersion: '', holoFuel: { @@ -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 diff --git a/ui-common-library b/ui-common-library index 83f2a11..a0cddfa 160000 --- a/ui-common-library +++ b/ui-common-library @@ -1 +1 @@ -Subproject commit 83f2a11b268b02a25d5d274d73a75da1883eb0f4 +Subproject commit a0cddfa1bf94cbbf03e757168cc1c7263c9c3f0c