Improve the regex and the replacement string

This commit is contained in:
Dorian Niemiec 2024-06-07 22:00:40 +02:00
parent 3237afa541
commit 7c25eac748

View file

@ -92,7 +92,7 @@ https.get("https://blog.svrjs.org/atom.xml", function (res) {
var imageURL = "https://blog.svrjs.org/images/covers/" + (qim ? qim[1] : "missing") + ".png";
formatTemplate("index.html", {
"title": antiXSS(ent[_qid].title),
"summary": ent[_qid].summary.replace(/(src|href)="\/(?!\/)/,"$1=\"https://blog.svrjs.org/"),
"summary": ent[_qid].summary.replace(/ (src|href)="\/(?!\/)/," $1=\"https://blog.svrjs.org/"),
"image": antiXSS(imageURL),
"link": antiXSS(ent[_qid].id),
"unsubscribe": antiXSS("https://newsletter.svrjs.org/unsubscribe.svr?id=" + encodeURIComponent(emails[_id].unsubscribeId))