From 00fc97c57096d4ad8ae4f9841c1dcc12ebb6588e Mon Sep 17 00:00:00 2001 From: arabcoders Date: Thu, 7 Aug 2025 23:03:34 +0300 Subject: [PATCH] working version of custom fields. --- app/library/dl_fields.py | 10 +++++ ui/app/components/DLFields.vue | 75 ++++++++++++++++++++++--------- ui/app/components/NewDownload.vue | 50 ++++++++++++++++----- ui/app/types/dl_fields.d.ts | 6 +++ 4 files changed, 109 insertions(+), 32 deletions(-) diff --git a/app/library/dl_fields.py b/app/library/dl_fields.py index 34281b01..15ee8fdc 100644 --- a/app/library/dl_fields.py +++ b/app/library/dl_fields.py @@ -70,6 +70,12 @@ class DLField: kind: FieldType = FieldType.TEXT """The kind of the field. i.e. string, bool""" + icon: str = "" + """The icon of the field, it can be a font-awesome icon""" + + order: int = 0 + """The order of the field, used to sort the fields in the UI.""" + value: str = "" """The default value of the field, It's currently unused.""" @@ -254,6 +260,10 @@ class DLFields(metaclass=Singleton): msg = "Value must be a string." raise ValueError(msg) + if item.get("order") is not None and not isinstance(item.get("order"), int): + msg = "Order must be an integer." + raise ValueError(msg) + if not isinstance(item.get("extras", {}), dict): msg = "Extras must be a dictionary." raise ValueError(msg) # noqa: TRY004 diff --git a/ui/app/components/DLFields.vue b/ui/app/components/DLFields.vue index b1f50b25..fc012a5b 100644 --- a/ui/app/components/DLFields.vue +++ b/ui/app/components/DLFields.vue @@ -9,6 +9,12 @@