From b4c699f391ae15efeced6c40193369921d1ca4fa Mon Sep 17 00:00:00 2001 From: KeesGeerligs <166137421+KeesGeerligs@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:53:14 +0100 Subject: [PATCH 1/2] 256 length check --- scripts/validate.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/validate.js b/scripts/validate.js index 0f0fcb7..9d13453 100644 --- a/scripts/validate.js +++ b/scripts/validate.js @@ -9,6 +9,12 @@ const allIds = new Set(); // Required fields that must be present in info.json const REQUIRED_FIELDS = ['id', 'name', 'description', 'category', 'subcategory']; +const MAX_FIELD_LENGTHS = { + id: 256, + name: 256, + icon: 256 +}; + // Validate a single template directory async function validateTemplate(folder) { const templatePath = path.join('./templates', folder); @@ -82,6 +88,15 @@ async function validateTemplate(folder) { throw new Error(`${folder}: ${error.path} - expected ${error.expected}, but found ${JSON.stringify(error.value)}`); } + // Check field lengths + for (const [field, maxLength] of Object.entries(MAX_FIELD_LENGTHS)) { + if (info[field] && info[field].length > maxLength) { + throw new Error( + `${folder}: Field '${field}' exceeds maximum length of ${maxLength} characters in info.json` + ); + } + } + console.log(`✓ ${folder} template is valid!`); } From c5eb2491e48b53fb65858290746a929da612c2e1 Mon Sep 17 00:00:00 2001 From: KeesGeerligs <166137421+KeesGeerligs@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:58:34 +0100 Subject: [PATCH 2/2] Icon and name fix --- templates/Pytorch-jupyter-notebook/info.json | 6 +++--- templates/Tensorflow-jupyter-notebook/info.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/Pytorch-jupyter-notebook/info.json b/templates/Pytorch-jupyter-notebook/info.json index 9cdad42..2cddec3 100644 --- a/templates/Pytorch-jupyter-notebook/info.json +++ b/templates/Pytorch-jupyter-notebook/info.json @@ -1,9 +1,9 @@ { - "id": "jupyter-notebook-pytorch", - "name": "Jupyter Notebook with pytorch:2.4.0-cuda12.1-cudnn9-runtime", + "id": "pytorch-jupyter-notebook", + "name": "Pytorch:2.4.0-cuda12.1-cudnn9-runtime Jupyter Notebook", "description": "Jupyter Notebook Service", "category": ["Web UI"], "subcategory": ["Other"], - "icon": "https://www.google.com/imgres?q=pytorch%20logo&imgurl=https%3A%2F%2Fwww.clipartmax.com%2Fpng%2Fmiddle%2F476-4769276_pytorch-logo-png.png&imgrefurl=https%3A%2F%2Fwww.clipartmax.com%2Fmiddle%2Fm2H7m2i8H7A0A0G6_pytorch-logo-png%2F&docid=AWv1vZ_1ftQU9M&tbnid=6aaNrsdmoeEDjM&vet=12ahUKEwjT3cHsupCKAxVZgP0HHbcpHagQM3oECH0QAA..i&w=840&h=848&hcb=2&ved=2ahUKEwjT3cHsupCKAxVZgP0HHbcpHagQM3oECH0QAA", + "icon": "https://static-00.iconduck.com/assets.00/pytorch-icon-1694x2048-jgwjy3ne.png", "github_url": "https://github.com/pytorch/pytorch" } \ No newline at end of file diff --git a/templates/Tensorflow-jupyter-notebook/info.json b/templates/Tensorflow-jupyter-notebook/info.json index d899f84..9f2d464 100644 --- a/templates/Tensorflow-jupyter-notebook/info.json +++ b/templates/Tensorflow-jupyter-notebook/info.json @@ -1,6 +1,6 @@ { - "id": "jupyter-notebook-tensorflow", - "name": "Jupyter Notebook with Tensorflow", + "id": "tensorflow-jupyter-notebook", + "name": "Tensorflow Jupyter Notebook", "description": "Jupyter Notebook Service", "category": ["Web UI"], "subcategory": ["Other"],