Skip to content

Commit b395299

Browse files
authored
fix: Allow https in domain (#1074)
1 parent 5957e7d commit b395299

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/schemas/space.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@
103103
},
104104
"domain": {
105105
"type": "string",
106-
"allOf": [
107-
{ "format": "hostname" },
108-
{ "format": "lowercase" }
109-
],
110106
"title": "domain",
111-
"maxLength": 64
107+
"maxLength": 64,
108+
"format": "domain"
112109
},
113110
"strategies": {
114111
"type": "array",

src/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ ajv.addFormat('customUrl', {
252252
}
253253
});
254254

255+
ajv.addFormat('domain', {
256+
validate: (value: string) => {
257+
if (!value) return false;
258+
return !!value.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/);
259+
}
260+
});
261+
255262
export async function call(provider, abi: any[], call: any[], options?) {
256263
const contract = new Contract(call[0], abi, provider);
257264
try {

test/examples/space-starknet-delegation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"network": "1",
1717
"plugins": {},
1818
"twitter": "lootproject",
19-
"domain": "vote.lootproject.abc",
19+
"domain": "https://vote.lootproject.abc",
2020
"strategies": [
2121
{
2222
"name": "erc721",

0 commit comments

Comments
 (0)