From 062509d50b4b0806c0026b77df7b3e59be18fa04 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 30 Aug 2026 22:52:48 +0000 Subject: [PATCH 1/5] feat: add roll SFTP credentials button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a confirmation-gated control to regenerate SFTP username and password, plus API client and sync support for the new roll endpoint. Co-authored-by: François-Xavier Talbot --- .../src/modules/archon/servers/v1.ts | 15 ++ .../api-client/src/modules/archon/types.ts | 11 ++ .../ui/src/composables/server-panel-sync.ts | 19 +++ .../shared/server-settings/pages/advanced.vue | 132 ++++++++++++++++-- 4 files changed, 163 insertions(+), 14 deletions(-) diff --git a/packages/api-client/src/modules/archon/servers/v1.ts b/packages/api-client/src/modules/archon/servers/v1.ts index 9435bf11c7..0aad12eb07 100644 --- a/packages/api-client/src/modules/archon/servers/v1.ts +++ b/packages/api-client/src/modules/archon/servers/v1.ts @@ -66,4 +66,19 @@ export class ArchonServersV1Module extends AbstractModule { method: 'POST', }) } + + /** + * Roll SFTP credentials for a server + * POST /v1/servers/:server_id/sftp/roll + */ + public async rollSftp(serverId: string): Promise { + return this.client.request( + `/servers/${serverId}/sftp/roll`, + { + api: 'archon', + version: 1, + method: 'POST', + }, + ) + } } diff --git a/packages/api-client/src/modules/archon/types.ts b/packages/api-client/src/modules/archon/types.ts index 00fb3c7da4..beea64e832 100644 --- a/packages/api-client/src/modules/archon/types.ts +++ b/packages/api-client/src/modules/archon/types.ts @@ -746,6 +746,11 @@ export namespace Archon { worlds: WorldFull[] } + export type SftpCredentials = { + sftp_username: string + sftp_password: string + } + export type ServerResources = { cpu: number memory_mb: number @@ -981,6 +986,11 @@ export namespace Archon { type: 'server.network.patch' ports: ServerNetworkPort[] } + export type ServerSftpPatchEvent = { + type: 'server.sftp.patch' + sftp_username: string + sftp_password: string + } export type ServerTransferEvent = { type: 'server.transfer.start' | 'server.transfer.done' target_node: string @@ -1094,6 +1104,7 @@ export namespace Archon { | BackupOperationDoneEvent | ServerPatchEvent | ServerNetworkPatchEvent + | ServerSftpPatchEvent | ServerTransferEvent | UsersPatchEvent | WorldPatchEvent diff --git a/packages/ui/src/composables/server-panel-sync.ts b/packages/ui/src/composables/server-panel-sync.ts index cd4101b096..1b68a6a539 100644 --- a/packages/ui/src/composables/server-panel-sync.ts +++ b/packages/ui/src/composables/server-panel-sync.ts @@ -96,6 +96,9 @@ export function useServerPanelSync(options: UseServerPanelSyncOptions) { case 'server.network.patch': handleServerNetworkPatch(serverId, event) break + case 'server.sftp.patch': + handleServerSftpPatch(serverId, event) + break case 'server.transfer.start': case 'server.transfer.done': void invalidateServerDetails(serverId) @@ -149,6 +152,22 @@ export function useServerPanelSync(options: UseServerPanelSyncOptions) { ) } + function handleServerSftpPatch(serverId: string, event: Archon.Sync.v1.ServerSftpPatchEvent) { + applySftpCredentials(serverId, { + sftp_username: event.sftp_username, + sftp_password: event.sftp_password, + }) + } + + function applySftpCredentials(serverId: string, credentials: Archon.Servers.v1.SftpCredentials) { + queryClient.setQueryData(legacyServerDetailKey(serverId), (current) => + current ? { ...current, ...credentials } : current, + ) + queryClient.setQueryData(serverV1DetailKey(serverId), (current) => + current ? { ...current, ...credentials } : current, + ) + } + function handleServerNetworkPatch( serverId: string, event: Archon.Sync.v1.ServerNetworkPatchEvent, diff --git a/packages/ui/src/layouts/shared/server-settings/pages/advanced.vue b/packages/ui/src/layouts/shared/server-settings/pages/advanced.vue index 9a610883f6..e1833e1d42 100644 --- a/packages/ui/src/layouts/shared/server-settings/pages/advanced.vue +++ b/packages/ui/src/layouts/shared/server-settings/pages/advanced.vue @@ -1,23 +1,49 @@