fix(utils): use path instead of full url

- enables multiple hosts (e.g. onion, eepsite) to share an instance
This commit is contained in:
Ming Di Leom
2021-12-08 09:53:54 +00:00
parent 37794684d5
commit 655f9f35f7
+2 -2
View File
@@ -119,7 +119,7 @@ module.exports = function(redis) {
href = `${protocol}${config.domain}${href}`
let u = new URL(href)
u.searchParams.append('lang', lang)
href = u.href
href = `${u.pathname}${u.search}`
links[i].setAttribute('href', href)
}
}
@@ -184,7 +184,7 @@ module.exports = function(redis) {
// replace wiki links
const wiki_href_regx = /(href=\"(https:|http:|)\/\/([A-z.-]+\.)?(wikipedia.org|wikimedia.org|wikidata.org|mediawiki.org))/gm
data.html = data.html.replace(wiki_href_regx, `href="${protocol}${config.domain}`)
data.html = data.html.replace(wiki_href_regx, 'href="')
/**
* If we are on DownloadAsPdf page, we have to inject a input which