From f2c6d28236abb83739d51e0c4703aacede3ce77c Mon Sep 17 00:00:00 2001 From: llaq Date: Mon, 10 Feb 2025 17:23:49 +0100 Subject: [PATCH 1/2] init json schema --- app/public/schemas/devices.schema.json | 144 +++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 app/public/schemas/devices.schema.json diff --git a/app/public/schemas/devices.schema.json b/app/public/schemas/devices.schema.json new file mode 100644 index 0000000..cb5613d --- /dev/null +++ b/app/public/schemas/devices.schema.json @@ -0,0 +1,144 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://e.foundation/installer/schemas/devices.schema.json", + "title": "Device", + "description": "A device who can be used with /e/ web installer", + "type": "object", + "properties": { + "$schema": { + "type": "string", + "description": "URL of the JSON Schema, if you remove it, autocomplete doens't work" + }, + "description": { + "type": "string", + "description": "Description of the device, you can use this to provide more informations" + }, + "UNUSED___security_patch_level": { + "type": "string", + "description": "[DEPRECATED, USE security_path_level instead] Security Path Level date (AAAA-MM-JJ)", + "deprecated": true + }, + "security_patch_level": { + "type": "string", + "description": "Security Path Level date (AAAA-MM-JJ)" + }, + "android": { + "description": "Android version of /e/ image, use version number, not letter", + "type": "number" + }, + "steps": { + "description": "Each object is a step, called in order", + "type": "array", + "items": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "description": "Alias to reboot in specific mode", + "enum": [ + "fastboot", + "adb", + "bootloader" + ] + }, + "command": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string", + "anyOf": [ + { + "type": "string", + "enum": [ + "connect adb", + "connect bootloader", + "reboot", + "reboot adb", + "reboot fastboot", + "reboot bootloader", + "erase [partitionName]", + "oem unlock [varName?]", + "oem lock [varName?]", + "flashing unlock [varName?]", + "flashing lock [varName?]", + "flash [partitionName] [fileName]", + "sideload [fileName]", + "delay [delayInSeconds]" + ] + }, + { + "type": "string" + } + ] + } + }, + { + "type": "string", + "enum": [ + "connect adb", + "connect bootloader", + "reboot", + "reboot adb", + "reboot fastboot", + "reboot bootloader", + "erase [partitionName]", + "oem unlock [varName?]", + "oem lock [varName?]", + "flashing unlock [varName?]", + "flashing lock [varName?]", + "flash [partitionName] [fileName]", + "sideload [fileName]", + "delay [delayInSeconds]" + ] + }, + { + "type": "string" + } + ] + }, + "id": { + "type": "string", + "description": "Unique id of each step" + }, + "needUserGesture": { + "type": "boolean", + "description": "If this option is set to true, installer display a button, user needs to click on this button to continue installation" + } + }, + "additionalProperties": false + } + }, + "folder": { + "description": "An array describing the files involved in the flash process", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "This name is exposed as fileName in a step command" + }, + "path": { + "type": "string", + "description": "Path used to download the file." + }, + "unzip": { + "type": "boolean", + "description": "Mark true in case we have a zip we want to uncompress." + }, + "mapping": { + "type": "object" + } + }, + "additionalProperties": false + }, + "required": [ + "name", + "path" + ], + "additionalProperties": false + } + }, + "additionalProperties": false +} \ No newline at end of file -- GitLab From 821f01be587ae59e15c4fa25954b1202ddab1f4c Mon Sep 17 00:00:00 2001 From: llaq Date: Mon, 10 Feb 2025 17:25:27 +0100 Subject: [PATCH 2/2] use schema in every device --- app/public/resources/-Nord.json | 3 ++- app/public/resources/FP3.json | 1 + app/public/resources/FP4-safe.json | 1 + app/public/resources/FP4.json | 1 + app/public/resources/GS290.json | 1 + app/public/resources/OnePlus7.json | 1 + app/public/resources/OnePlus7Pro.json | 1 + app/public/resources/OnePlus7T.json | 1 + app/public/resources/OnePlus8.json | 1 + app/public/resources/OnePlus8Pro.json | 1 + app/public/resources/Teracube_2e.json | 2 +- app/public/resources/coral.json | 1 + app/public/resources/emerald-safe.json | 1 + app/public/resources/emerald.json | 1 + app/public/resources/flame.json | 1 + app/public/resources/panther.json | 1 + app/public/resources/redfin.json | 1 + app/public/resources/sunfish.json | 1 + app/public/resources/tetris.json | 1 + 19 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/public/resources/-Nord.json b/app/public/resources/-Nord.json index 8bd275b..43a63e3 100644 --- a/app/public/resources/-Nord.json +++ b/app/public/resources/-Nord.json @@ -1,8 +1,9 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 12, "steps": [ { - "command": "reboot bootloader" + "command": "reboot bootloader" }, { "id": "connect-bootloader", diff --git a/app/public/resources/FP3.json b/app/public/resources/FP3.json index 3e3bda9..269b895 100644 --- a/app/public/resources/FP3.json +++ b/app/public/resources/FP3.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "steps": [ { "mode": "bootloader", diff --git a/app/public/resources/FP4-safe.json b/app/public/resources/FP4-safe.json index 1f267bb..382038f 100644 --- a/app/public/resources/FP4-safe.json +++ b/app/public/resources/FP4-safe.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "steps": [ { "mode": "bootloader", diff --git a/app/public/resources/FP4.json b/app/public/resources/FP4.json index 036fcfb..eee8c2d 100644 --- a/app/public/resources/FP4.json +++ b/app/public/resources/FP4.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "security_patch_level": "2024-06-05", "steps": [ { diff --git a/app/public/resources/GS290.json b/app/public/resources/GS290.json index 281dfe4..c7ca63d 100644 --- a/app/public/resources/GS290.json +++ b/app/public/resources/GS290.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "steps": [ { "mode": "bootloader", diff --git a/app/public/resources/OnePlus7.json b/app/public/resources/OnePlus7.json index d338790..cad8c58 100644 --- a/app/public/resources/OnePlus7.json +++ b/app/public/resources/OnePlus7.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/OnePlus7Pro.json b/app/public/resources/OnePlus7Pro.json index abf2dce..9d0f4d1 100644 --- a/app/public/resources/OnePlus7Pro.json +++ b/app/public/resources/OnePlus7Pro.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/OnePlus7T.json b/app/public/resources/OnePlus7T.json index 9d54693..3c2a324 100644 --- a/app/public/resources/OnePlus7T.json +++ b/app/public/resources/OnePlus7T.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/OnePlus8.json b/app/public/resources/OnePlus8.json index 034d99c..46efdf5 100644 --- a/app/public/resources/OnePlus8.json +++ b/app/public/resources/OnePlus8.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/OnePlus8Pro.json b/app/public/resources/OnePlus8Pro.json index cf7bcc2..fee0f08 100644 --- a/app/public/resources/OnePlus8Pro.json +++ b/app/public/resources/OnePlus8Pro.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 13, "steps": [ { diff --git a/app/public/resources/Teracube_2e.json b/app/public/resources/Teracube_2e.json index be88089..8aab22e 100644 --- a/app/public/resources/Teracube_2e.json +++ b/app/public/resources/Teracube_2e.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "UNUSED___security_patch_level": "2020-04-05", "description": "Teracube 2e (2020)", "steps": [ @@ -16,7 +17,6 @@ "id": "flashing", "command": [ "erase userdata", - "flash preloader preloader_zirconia.bin", "flash lk lk.img", "flash md1img md1img.img", diff --git a/app/public/resources/coral.json b/app/public/resources/coral.json index 98aa67d..839bd93 100644 --- a/app/public/resources/coral.json +++ b/app/public/resources/coral.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/emerald-safe.json b/app/public/resources/emerald-safe.json index 853abb0..7f158f1 100644 --- a/app/public/resources/emerald-safe.json +++ b/app/public/resources/emerald-safe.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "description": "Teracube 2e (2021 emerald) Safe", "steps": [ { diff --git a/app/public/resources/emerald.json b/app/public/resources/emerald.json index 7ca01e0..7f186c1 100644 --- a/app/public/resources/emerald.json +++ b/app/public/resources/emerald.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "UNUSED___security_patch_level": "2020-04-05", "description": "Teracube 2e (2021 emerald)", "steps": [ diff --git a/app/public/resources/flame.json b/app/public/resources/flame.json index c51b111..1712256 100644 --- a/app/public/resources/flame.json +++ b/app/public/resources/flame.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/panther.json b/app/public/resources/panther.json index 92594b3..435e3ee 100644 --- a/app/public/resources/panther.json +++ b/app/public/resources/panther.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 13, "steps": [ { diff --git a/app/public/resources/redfin.json b/app/public/resources/redfin.json index ca9fd8e..66ee681 100644 --- a/app/public/resources/redfin.json +++ b/app/public/resources/redfin.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 13, "steps": [ { diff --git a/app/public/resources/sunfish.json b/app/public/resources/sunfish.json index fcecbc4..6572101 100644 --- a/app/public/resources/sunfish.json +++ b/app/public/resources/sunfish.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { diff --git a/app/public/resources/tetris.json b/app/public/resources/tetris.json index 2d619b2..054c629 100644 --- a/app/public/resources/tetris.json +++ b/app/public/resources/tetris.json @@ -1,4 +1,5 @@ { + "$schema": "https://e.foundation/installer/schemas/devices.schema.json", "android": 14, "steps": [ { -- GitLab