From 6128f5fd22f7e9434820a93719c2550304c0b12e Mon Sep 17 00:00:00 2001 From: Marton ILLES Date: Wed, 26 Aug 2026 16:44:20 +0200 Subject: [PATCH] feat: extend upload-firmware with timeout/monitoring/label arguments This way upload timeout, firmware monitoring and labels can be specified on the command line: upload-firmware --label a --label b --timeout 100 --monitoring ... --- onekey_client/cli/firmware_upload.py | 18 +++++++++++++++++- onekey_client/client.py | 1 + onekey_client/models.py | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/onekey_client/cli/firmware_upload.py b/onekey_client/cli/firmware_upload.py index c2b36d1..5e9b27f 100644 --- a/onekey_client/cli/firmware_upload.py +++ b/onekey_client/cli/firmware_upload.py @@ -35,6 +35,14 @@ @click.option( "--sbom", help="Firmware SBOM", type=click.Path(exists=True, path_type=Path) ) +@click.option( + "--timeout", + help="Timeout for HTTP requests", + type=click.IntRange(min=1, max=600), + default=60, +) +@click.option("--monitoring", is_flag=True, default=False, help="Enable monitoring") +@click.option("--label", multiple=True, help="Add a label (repeatable)") @click.argument( "filename", type=click.Path(exists=True, path_type=Path), required=False ) @@ -45,8 +53,11 @@ def upload_firmware( vendor_name: str, product_group_name: str, analysis_configuration_name: str, + timeout: int, + monitoring: bool, version: str | None, name: str | None, + label: tuple[str], sbom: Path | None, filename: Path | None, ): @@ -75,11 +86,16 @@ def upload_firmware( product_group_id=product_group_id, version=version, analysis_configuration_id=analysis_configuration_id, + labels=list(label), ) try: res = client.upload_firmware( - metadata, filename, sbom_path=sbom, enable_monitoring=False + metadata, + filename, + sbom_path=sbom, + enable_monitoring=monitoring, + timeout=timeout, ) click.echo(res["id"]) except QueryError as e: diff --git a/onekey_client/client.py b/onekey_client/client.py index cb95b1d..7b34ec4 100644 --- a/onekey_client/client.py +++ b/onekey_client/client.py @@ -225,6 +225,7 @@ def upload_firmware( "notes": metadata.notes, "enableMonitoring": enable_monitoring, "analysisConfigurationId": str(metadata.analysis_configuration_id), + "labels": metadata.labels, }, "vendorName": metadata.vendor_name, "productName": metadata.product_name, diff --git a/onekey_client/models.py b/onekey_client/models.py index 9342999..ff1352a 100644 --- a/onekey_client/models.py +++ b/onekey_client/models.py @@ -19,3 +19,4 @@ class FirmwareMetadata(BaseModel): product_category: str | None = None product_group_id: UUID analysis_configuration_id: UUID + labels: list[str] | None = None