From d5a4494f7678f71eb17d3c387e7ce0fda82b4931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiss=20R=C3=B3bert?= Date: Sun, 1 Feb 2026 19:49:48 +0100 Subject: [PATCH 1/2] feat: make the firmware update also accept a CI-generated zip file --- .../src/util/save-extract-firmware.ts | 23 +++++++++++++++++++ .../firmware-file-upload.component.html | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/uhk-agent/src/util/save-extract-firmware.ts b/packages/uhk-agent/src/util/save-extract-firmware.ts index 331f51e3719..8b8e1fc5287 100644 --- a/packages/uhk-agent/src/util/save-extract-firmware.ts +++ b/packages/uhk-agent/src/util/save-extract-firmware.ts @@ -4,6 +4,7 @@ import { dirSync } from 'tmp'; import decompress from 'decompress'; import decompressTarbz from 'decompress-tarbz2'; import decompressTargz from 'decompress-targz'; +import decompressUnzip from 'decompress-unzip'; import { UploadFileData } from 'uhk-common'; import { TmpFirmware } from 'uhk-usb'; @@ -26,6 +27,28 @@ export async function saveTmpFirmware(fileData: UploadFileData): Promise { + const fileName = path.basename(file.path); + + return fileName.startsWith('uhk-firmware-') && fileName.endsWith('.tar.gz'); + }, + plugins: [decompressUnzip()] + } + + const unzippedFiles = await decompress(zipFilePath, tmpDirectory.name, unzipOptions); + if (unzippedFiles.length === 0) { + throw new Error('Zip file does not contain uhk-firmware-*.tar.gz file.'); + } + + return saveTmpFirmware({ + data: unzippedFiles[0].data as any, + filename: path.basename(unzippedFiles[0].path), + saveInHistory: fileData.saveInHistory, + }) + } + default: throw new Error(`Unsupported firmware file extension: ${extension}`); } diff --git a/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html b/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html index 29f316dcef8..7bfb87242ed 100644 --- a/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html +++ b/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html @@ -18,6 +18,6 @@ From 06e2b0c09f78306a37931485438d34c9b1604ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiss=20R=C3=B3bert?= Date: Mon, 2 Feb 2026 19:08:30 +0100 Subject: [PATCH 2/2] fix: add firmware*.zip text to firmware-file-upload component --- .../firmware-file-upload/firmware-file-upload.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html b/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html index 7bfb87242ed..7fc5bea1c27 100644 --- a/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html +++ b/packages/uhk-web/src/app/components/device/firmware-file-upload/firmware-file-upload.component.html @@ -13,7 +13,7 @@ (confirm)="onForceClick()" (isOpenChange)="onOpenChange($event)" > - Flash firmware from file (uhk-firmware-*.tar.gz) + Flash firmware from file (uhk-firmware-*.tar.gz, firmware*.zip)