Compare commits

..

2 commits

Author SHA1 Message Date
celestora
cee1b4c8c1
Fix another funny xss thing (not tested sinve since im bisexual 💀) 2023-02-10 08:50:21 +02:00
Vladimir Barinov
cf558d57c5
Fix funny xss thing (not tested sinve since im in hospital 💀) 2023-02-10 08:46:29 +02:00
2 changed files with 15 additions and 0 deletions

View file

@ -428,6 +428,18 @@ function showIncreaseRatingDialog(coinsCount, userUrl, hash) {
}; };
} }
function escapeHtml(text) {
var map = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;'
};
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}
$(document).on("scroll", () => { $(document).on("scroll", () => {
if($(document).scrollTop() > $(".sidebar").height() + 50) { if($(document).scrollTop() > $(".sidebar").height() + 50) {
$(".floating_sidebar")[0].classList.add("show"); $(".floating_sidebar")[0].classList.add("show");

View file

@ -16,6 +16,9 @@ function _bsdnToHumanTime(time) {
} }
function _bsdnTpl(name, author) { function _bsdnTpl(name, author) {
name = escapeHtml(name);
author = escapeHtml(author);
return ` return `
<div class="bsdn_contextMenu" style="display: none;"> <div class="bsdn_contextMenu" style="display: none;">
<span class="bsdn_contextMenuElement bsdn_copyVideoUrl">Copy video link to clipboard</span> <span class="bsdn_contextMenuElement bsdn_copyVideoUrl">Copy video link to clipboard</span>