diff --git a/src/client/ts/views/dashboard-view.ts b/src/client/ts/views/dashboard-view.ts index 2e4c106..1cf86c0 100644 --- a/src/client/ts/views/dashboard-view.ts +++ b/src/client/ts/views/dashboard-view.ts @@ -371,9 +371,9 @@ export async function renderDashboardView( const wf = entry.workflow; const runStatus = entry.latestRun?.status ?? 'idle'; const badgeClass = - runStatus === 'success' + runStatus === 'succeeded' ? 'badge badge-ok' - : runStatus === 'failed' || runStatus === 'timed-out' + : runStatus === 'failed' || runStatus === 'cancelled' ? 'badge badge-err' : runStatus === 'running' || runStatus === 'queued' ? 'badge badge-warn' diff --git a/src/client/ts/views/systems-view.ts b/src/client/ts/views/systems-view.ts index 7491f6f..33ca44c 100644 --- a/src/client/ts/views/systems-view.ts +++ b/src/client/ts/views/systems-view.ts @@ -577,17 +577,20 @@ export async function renderSystemsView( wf.trigger.type === 'cron' ? `cron: ${wf.trigger.expression ?? ''}${entry.nextRunAt ? ` (next ${new Date(entry.nextRunAt).toISOString().slice(0, 19).replace('T', ' ')})` : ''}` : wf.trigger.type; + const runStatus = entry.latestRun?.status ?? 'idle'; const statusBadge = el( 'span', { class: - entry.latestRun?.status === 'success' + runStatus === 'succeeded' ? 'badge badge-ok' - : entry.latestRun?.status === 'failed' + : runStatus === 'failed' || runStatus === 'cancelled' ? 'badge badge-err' - : 'badge', + : runStatus === 'running' || runStatus === 'queued' + ? 'badge badge-warn' + : 'badge', }, - entry.latestRun?.status ?? 'idle', + runStatus, ); const runTaskBtn = el('button', { type: 'button', class: 'btn btn-sm btn-primary' }, 'Run Task'); runTaskBtn.addEventListener('click', async () => { diff --git a/src/server/automation/transfer-engine.ts b/src/server/automation/transfer-engine.ts index e913f3e..88acdeb 100644 --- a/src/server/automation/transfer-engine.ts +++ b/src/server/automation/transfer-engine.ts @@ -86,6 +86,9 @@ export class TransferEngine { const errBuf: Buffer[] = []; let errLen = 0; + handle.channel.on('data', (chunk: Buffer) => { + opts.onProgress?.(chunk.toString('utf8')); + }); handle.channel.stderr?.on('data', (chunk: Buffer) => { if (errLen < 16_384) { errBuf.push(chunk); diff --git a/src/server/security/vault.ts b/src/server/security/vault.ts index 1a26b91..82794d5 100644 --- a/src/server/security/vault.ts +++ b/src/server/security/vault.ts @@ -91,6 +91,37 @@ export function computeOpenSshFingerprint(publicKeyLine: string): string { return `SHA256:${hash}`; } +/** + * Generates an OpenSSH Ed25519 keypair, retrying around ssh2's BitString + * leading-zero stripping bug when a generated public key starts with 0x00. + */ +export function generateValidEd25519KeyPair(opts: { + comment: string; + passphrase?: string; +}): { privateKey: string; publicKey: string; fingerprint: string } { + let lastErr: unknown; + for (let attempt = 0; attempt < 16; attempt++) { + const kp = opts.passphrase + ? ssh2.utils.generateKeyPairSync('ed25519', { + comment: opts.comment, + passphrase: opts.passphrase, + cipher: 'aes256-ctr', + rounds: 16, + }) + : ssh2.utils.generateKeyPairSync('ed25519', { + comment: opts.comment, + }); + const publicKey = kp.public.trim(); + try { + const fingerprint = computeOpenSshFingerprint(publicKey); + return { privateKey: kp.private, publicKey, fingerprint }; + } catch (err) { + lastErr = err; + } + } + throw lastErr instanceof Error ? lastErr : new Error('Failed to generate valid Ed25519 keypair'); +} + type DistributiveOmit = T extends unknown ? Omit : never; export type VaultCredentialInput = DistributiveOmit< @@ -483,25 +514,16 @@ export class VaultService { this.assertWriteUnlocked(); this.autoInitializedEmpty = false; - const keyPair = options.passphrase - ? ssh2.utils.generateKeyPairSync('ed25519', { - comment: options.comment ?? options.id, - passphrase: options.passphrase, - cipher: 'aes256-ctr', - rounds: 16, - }) - : ssh2.utils.generateKeyPairSync('ed25519', { - comment: options.comment ?? options.id, - }); - - const publicKey = keyPair.public.trim(); - const fingerprint = computeOpenSshFingerprint(publicKey); + const { privateKey, publicKey, fingerprint } = generateValidEd25519KeyPair({ + comment: options.comment ?? options.id, + passphrase: options.passphrase, + }); return this.upsertCredential({ id: options.id, name: options.name, type: 'ssh-key', - privateKey: keyPair.private, + privateKey, publicKey, passphrase: options.passphrase || undefined, fingerprint,