fix: open links in new tab

The addition of external link warning has changed the behavior of
opening links from opening in a new tab to opening in the same tab.
This restores the old behavior and opens all links in a new tab.

Signed-off-by: Tony Chau <90050474+fo5for@users.noreply.github.com>
This commit is contained in:
Tony Chau
2026-08-15 22:27:47 +08:00
committed by Erik Michelson
parent d05cfe4e9f
commit ffcf79ef07
6 changed files with 22 additions and 11 deletions

View File

@@ -1,10 +1,6 @@
module.exports = {
serveLinkWarningPage: function (req, res) {
let targetURL = typeof req.query.url === 'string' ? req.query.url : ''
let noteURL = typeof req.query.note === 'string' ? req.query.note : ''
if (noteURL !== '' && !/^[\w-]+$/.test(noteURL)) {
noteURL = ''
}
let valid = false
try {
targetURL = decodeURIComponent(targetURL)
@@ -20,8 +16,8 @@ module.exports = {
res.render('link.ejs', {
title: 'External link',
valid,
noteURL,
targetURL,
cspNonce: res.locals.nonce,
opengraph: []
})
}