From 48f7ad11fd8042f1aa1d28590035f6b03f9e991f Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:44:45 +0400 Subject: [PATCH 1/3] fix: enforce lowecase valid hostname for space domain --- src/schemas/space.json | 4 ++++ src/utils.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/schemas/space.json b/src/schemas/space.json index 542f0c339..489a2bf01 100644 --- a/src/schemas/space.json +++ b/src/schemas/space.json @@ -103,6 +103,10 @@ }, "domain": { "type": "string", + "allOf": [ + { "format": "hostname" }, + { "format": "lowercase" } + ], "title": "domain", "maxLength": 64 }, diff --git a/src/utils.ts b/src/utils.ts index a3115c826..d22352070 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -113,6 +113,10 @@ ajv.addFormat('long', { validate: () => true }); +ajv.addFormat('lowercase', { + validate: (value: string) => value === value.toLowerCase() +}); + ajv.addFormat('ethValue', { validate: (value: string) => { if (!value.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/)) return false; From e1182ff557e20a56799892aa4249f7683a04faa9 Mon Sep 17 00:00:00 2001 From: ChaituVR Date: Tue, 24 Sep 2024 22:19:54 +0530 Subject: [PATCH 2/3] add domain example --- test/examples/space.json | 1 + 1 file changed, 1 insertion(+) diff --git a/test/examples/space.json b/test/examples/space.json index cd62c3d8a..d262eb39f 100644 --- a/test/examples/space.json +++ b/test/examples/space.json @@ -16,6 +16,7 @@ "network": "1", "plugins": {}, "twitter": "lootproject", + "domain": "vote.lootproject.abc", "strategies": [ { "name": "erc721", From 3d56f1499a00028aba643d339138c18b0d33c172 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Tue, 24 Sep 2024 22:21:30 +0530 Subject: [PATCH 3/3] v0.12.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b59a09c5..b32f7dff9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snapshot-labs/snapshot.js", - "version": "0.12.13", + "version": "0.12.14", "repository": "snapshot-labs/snapshot.js", "license": "MIT", "main": "dist/snapshot.cjs.js",