Skip to content

Commit

Permalink
fix: Allow https in domain (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR authored Oct 16, 2024
1 parent 5957e7d commit b395299
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/schemas/space.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@
},
"domain": {
"type": "string",
"allOf": [
{ "format": "hostname" },
{ "format": "lowercase" }
],
"title": "domain",
"maxLength": 64
"maxLength": 64,
"format": "domain"
},
"strategies": {
"type": "array",
Expand Down
7 changes: 7 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ ajv.addFormat('customUrl', {
}
});

ajv.addFormat('domain', {
validate: (value: string) => {
if (!value) return false;
return !!value.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/);
}
});

export async function call(provider, abi: any[], call: any[], options?) {
const contract = new Contract(call[0], abi, provider);
try {
Expand Down
2 changes: 1 addition & 1 deletion test/examples/space-starknet-delegation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"network": "1",
"plugins": {},
"twitter": "lootproject",
"domain": "vote.lootproject.abc",
"domain": "https://vote.lootproject.abc",
"strategies": [
{
"name": "erc721",
Expand Down

0 comments on commit b395299

Please sign in to comment.