content: exclude links to ip addresses

There is no good reason to link to an ip directly.

Excluding links that look like ipv4 or ipv6.
pull/53/head
OFF0 1 year ago
parent 9b11459f2d
commit dc664fc318
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -38,6 +38,12 @@ function isValidURL(url) {
if (url.hostname.slice(lastDot) === '.local') {
return false;
}
if (url.hostname.slice(lastDot + 1).match(/^[\d]+$/)) { // there should be no tld with numbers, possible ipv4
return false;
}
if (url.hostname.includes(':')) { // possibly an ipv6 addr; certainly an invalid hostname
return false;
}
return true;
}

Loading…
Cancel
Save