Activate snort.social NIP-5 service #51
@ -68,10 +68,17 @@ export default function Nip5Service(props: Nip05ServiceProps) {
|
|||||||
}, [props]);
|
}, [props]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (handle.length === 0) {
|
setError(undefined);
|
||||||
setAvailabilityResponse(undefined);
|
setAvailabilityResponse(undefined);
|
||||||
}
|
|
||||||
if (handle && domain) {
|
if (handle && domain) {
|
||||||
|
if(handle.length < (domainConfig?.length[0] ?? 2)) {
|
||||||
|
setAvailabilityResponse({ available: false, why: "TOO_SHORT" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(handle.length > (domainConfig?.length[1] ?? 20)) {
|
||||||
|
setAvailabilityResponse({ available: false, why: "TOO_LONG" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
let rx = new RegExp(domainConfig?.regex[0] ?? "", domainConfig?.regex[1] ?? "");
|
let rx = new RegExp(domainConfig?.regex[0] ?? "", domainConfig?.regex[1] ?? "");
|
||||||
if (!rx.test(handle)) {
|
if (!rx.test(handle)) {
|
||||||
setAvailabilityResponse({ available: false, why: "REGEX" });
|
setAvailabilityResponse({ available: false, why: "REGEX" });
|
||||||
|
Loading…
Reference in New Issue
Block a user