Skip to content

Commit

Permalink
fix: Allow https in domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Oct 15, 2024
1 parent 97a229d commit 27ba4e0
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 27ba4e0

Please sign in to comment.