content: exclude links to ip addresses #53

Merged
offbyn merged 2 commits from content-exclude-iplinks into master 2 years ago
offbyn commented 2 years ago
Owner

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

fixes #44

There is no good reason to link to an ip directly. fixes https://git.qcode.ch/nostr/nostrweb/issues/44
offbyn added 1 commit 2 years ago
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
a59b3a84d2
content: exclude links to ip addresses
There is no good reason to link to an ip directly.
x1ddos approved these changes 2 years ago
src/domutil.js Outdated
@ -35,6 +35,9 @@ function isValidURL(url) {
if (lastDot < 1) {
return false;
}
if (url.hostname.slice(lastDot + 1).match(/^[\d]+$/)) {
x1ddos commented 2 years ago
Owner

would be very nice to check ipv6 too. in that case, i guess you could just check for colon?

if (url.hostname.indexOf(':')) { // possibly an ipv6 addr; certainly an invalid hostname
  return false
}
would be very nice to check ipv6 too. in that case, i guess you could just check for colon? ```js if (url.hostname.indexOf(':')) { // possibly an ipv6 addr; certainly an invalid hostname return false } ```
@ -38,1 +38,4 @@
if (url.hostname.slice(lastDot + 1).match(/^[\d]+$/)) {
return false;
}
if (url.hostname.slice(lastDot) === '.local') {
x1ddos commented 2 years ago
Owner

btw, also refuse localhost?

btw, also refuse localhost?
offbyn marked this conversation as resolved
offbyn force-pushed content-exclude-iplinks from a59b3a84d2 to d7f75f92e0 2 years ago
offbyn merged commit d7f75f92e0 into master 2 years ago
offbyn deleted branch content-exclude-iplinks 2 years ago

Reviewers

x1ddos approved these changes 2 years ago
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
The pull request has been merged as d7f75f92e0.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b content-exclude-iplinks master
git pull origin content-exclude-iplinks

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff content-exclude-iplinks
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/nostrweb#53
Loading…
There is no content yet.