Fixed requiem encryption (#1712)

* Fix requiem encryption on some special characters

* Update with k1ngfish3r's suggested

Co-authored-by: K1ngfish3r <trulyihu@gmail.com>

---------

Co-authored-by: K1ngfish3r <trulyihu@gmail.com>
This commit is contained in:
Soopyboo32
2025-06-12 09:21:37 +08:00
committed by GitHub
parent acf75b5f7d
commit 5583844f10
+2 -2
View File
@@ -198,8 +198,8 @@
"options": {
"lang": "English",
"reverseChapters": true,
"customJs": "\n $('div.entry-content script').remove();\n $('div.entry-content > p').each((_,el) => {\n const url = this.site + chapterPath.slice(0, -1);\n const encode = url.length * url.charCodeAt(url.length - 1) * 2 % 3;\n\n const offsets = [[0, 12368, 12462], [1, 6960, 7054], [2, 4176, 4270]];\n const offsetLower = (offsets[encode] ?? offsets[0])[1];\n const offsetCap = (offsets[encode] ?? offsets[0])[2];\n\n $(el).text($(el).text().split('').map(char => {\n let code = char.charCodeAt(0);\n let offset;\n if(code >= offsetLower + 'a'.charCodeAt(0) && code <= offsetLower + 'z'.charCodeAt(0)\n || code >= offsetLower + 'A'.charCodeAt(0) && code <= offsetLower + \"Z\".charCodeAt(0)) {\n offset = offsetLower;\n } else {\n offset = offsetCap;\n }\n return (code < offset || code > offset+255) ? char : String.fromCharCode(code-offset);\n }).join(''));\n });\n",
"versionIncrements": 3
"customJs": "\n $('div.entry-content script').remove();\n\n const url = this.site + chapterPath.slice(0, -1);\n const offsets = [[0, 12368, 12462], [1, 6960, 7054], [2, 4176, 4270]];\n const idx = url.length * url.charCodeAt(url.length - 1) * 2 % 3;\n const [_, offsetLower, offsetCap] = offsets[idx] ?? offsets[0];\n\n const asciiA = 'A'.charCodeAt(0);\n const asciiz = 'z'.charCodeAt(0);\n\n $('div.entry-content > p').text((_, txt) =>\n txt.split('').map(char => {\n const code = char.charCodeAt(0);\n const offset = (code >= offsetLower + asciiA && code <= offsetLower + asciiz)\n ? offsetLower\n : offsetCap;\n const decoded = code - offset;\n return (decoded >= 32 && decoded <= 126) ? String.fromCharCode(decoded) : char;\n }).join('')\n );\n",
"versionIncrements": 4
}
},
{