Skip to content

feat(webui): make HTTP/HTTPS URLs clickable in Tracker Status - #3141

Merged
xirvik merged 2 commits into
Novik:masterfrom
jakobbg:master
Aug 1, 2026
Merged

feat(webui): make HTTP/HTTPS URLs clickable in Tracker Status#3141
xirvik merged 2 commits into
Novik:masterfrom
jakobbg:master

Conversation

@jakobbg

@jakobbg jakobbg commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR enables automatic conversion of http:// and https:// URLs in the Tracker status field (under the "General" torrent details tab) into safe, clickable links that open in a new tab.

Key Changes

  • Helper Function (getClickableTrackerStatus):

    • Added a type-hinted JSDoc helper getClickableTrackerStatus(text) in js/common.js.
    • XSS Prevention: Sanitizes raw input with escapeHTML() (escaping &, <, >, ", ') before parsing links.
    • URL Parsing: Matches http:// and https:// links embedded in text (e.g., "New torrent at https://tracker.example.com/torrent.php?id=123. Please update.").
    • Trailing Punctuation: Excludes trailing ., ), and , punctuation from the hyperlink tag so they remain as normal trailing text.
    • Security Attributes: Opens links with target="_blank" and rel="noopener noreferrer".
  • WebUI Details Tab:

    • Updated #ts element rendering in js/webui.js to use getClickableTrackerStatus(d.msg).
  • Automated Tests:

    • Added unit test suite in tests/js/trackerstatus.spec.js testing link generation, text surrounding URLs, trailing punctuation stripping, XSS sanitization, and protocol filtering.

Verification

Run Jest test suite:

cd tests
npm test

@xirvik
xirvik merged commit 2d65295 into Novik:master Aug 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants