about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-06-26 18:02:41 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-06-26 18:02:41 +0300
commit9b3a3d168098f3af024e8d0b98616ed620842668 (patch)
treeee1a0c259ab0819d1c8632f33ce6fb3e16dee48e
parent3ac7050d6cd976d662457b51f57a9e34176b2158 (diff)
downloadthe-epube-9b3a3d168098f3af024e8d0b98616ed620842668.tar.gz
the-epube-9b3a3d168098f3af024e8d0b98616ed620842668.tar.xz
use escapeHtml for remaining unescaped frontend markup generation
-rw-r--r--classes/Handler/DefineHandler.php2
-rw-r--r--src/reader.js8
2 files changed, 5 insertions, 5 deletions
diff --git a/classes/Handler/DefineHandler.php b/classes/Handler/DefineHandler.php
index 3da21da..cedbc8f 100644
--- a/classes/Handler/DefineHandler.php
+++ b/classes/Handler/DefineHandler.php
@@ -46,7 +46,7 @@ class DefineHandler implements RequestHandlerInterface, AuthRequired
                 $retParsed = $this->parseDictReply($dictReply);
 
                 if (count($retParsed) > 0) {
-                    array_push($result, "<strong>" . htmlspecialchars($word, ENT_QUOTES, 'UTF-8') . "</strong>");
+                    array_push($result, htmlspecialchars($word, ENT_QUOTES, 'UTF-8') . ":");
                     $result = array_merge($result, $retParsed);
                     break;
                 } else {
diff --git a/src/reader.js b/src/reader.js
index 1067882..8ff7aab 100644
--- a/src/reader.js
+++ b/src/reader.js
@@ -582,7 +582,7 @@ class ReaderClass extends AppCommon {
                     });
 
                     if (toc_entry && toc_entry.label)
-                        $(".chapter_title").html(toc_entry.label.trim() + " | ");
+                        $(".chapter_title").text(this.escapeHtml(toc_entry.label.trim()) + " | ");
 
                     this.generateTocBar(book, this.flattenToc(book));
                 }
@@ -792,7 +792,7 @@ class ReaderClass extends AppCommon {
 
                     const a = $("<a>")
                         .attr('href', '#')
-                        .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + row.label)
+                        .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + _reader.escapeHtml(row.label))
                         .attr('data-href', row.href)
                         .click(function() {
                             book.rendition.display(a.attr('data-href'));
@@ -821,7 +821,7 @@ class ReaderClass extends AppCommon {
                 try {
                     const a = $("<a>")
                         .attr('href', '#')
-                        .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + row.label)
+                        .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + _reader.escapeHtml(row.label))
                         .attr('data-href', row.href)
                         .click(function() {
                             book.rendition.display(a.attr('data-href'));
@@ -1395,7 +1395,7 @@ class ReaderClass extends AppCommon {
 
             if (data.data) {
 
-                $(".dict_result").html(data.data.result.join("<br/>"));
+                $(".dict_result").html(data.data.result.map((r) => this.escapeHtml(String(r))).join("<br/>"));
                 $(".dict_query").val(word);
 
                 if (callback) callback();