<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Le lun. 21 avr. 2025 à 10:12, Paul Gevers <<a href="mailto:elbrus@debian.org">elbrus@debian.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Jérémy,<br>
<br>
Thanks for the reply.<br>
<br>
On 20-04-2025 13:21, Jérémy Lal wrote:<br>
> Good question ! The answer is that it's not needed:<br>
> nodejs 20.19.0 can "require(esm)" [1] so a CJS module is no longer <br>
> locked out using ESM modules.<br>
> The other way around (import a CJS module form an ES module) has always <br>
> been possible.<br>
<br>
<br>
As I understand it, liferea is already ESM and my problem is that the <br>
code apparently assumes that node-dompurify (and handlebars) is ESM too. <br>
So far, I have never needed to fix javascript in a more than trivial <br>
manner, so I don't know where to start here. My fundamental question is <br>
what do I have to do to build liferea with the Debain shipped <br>
node-dompurity (and handlebars) instead of the vendored version? liferea <br>
uses the file during the build and embeds it in the executable, but as <br>
can be seen from my discussion in the upstream bug tracker [1], using <br>
the current versions in Debian doesn't work and upstream suggested that <br>
node-dompurify needs the change. I understand you say it should be <br>
trivial to fix on the liferea side? (The include happens here [2], for <br>
handlebars it's here [3]. I tried commenting them out and adding a <br>
<script> here [4] but that seems to be too simple.)<br></blockquote><div><br></div><div>For handlebars, it should work all right as it is,</div><div>for dompurify, first fix the path you copy it from, use:</div><div>/usr/share/nodejs/dompurify/dist/purify.es.mjs</div><div><br></div><div>Then to fix the version mismatch, you can use this patch:</div><div><br></div><div>diff --git a/js/htmlview.js b/js/htmlview.js<br>index d6f4a9f..d1d4f69 100644<br>--- a/js/htmlview.js<br>+++ b/js/htmlview.js<br>@@ -22,6 +22,8 @@<br> import { render, template } from './helpers/render.js';<br> import DOMPurify from './vendor/purify.min.js';<br><br>+const purify = DOMPurify(window);<br>+<br> window.debugflags = 0;<br><br> function prepare(baseURL, title) {<br>@@ -227,7 +229,7 @@ function contentCleanup() {<br><br> // Run DOMPurify<br> let content = document.getElementById('content').innerHTML;<br>- document.getElementById('content').innerHTML = DOMPurify.sanitize(content);<br>+ document.getElementById('content').innerHTML = purify.sanitize(content);<br><br> // Fix inline SVG sizes<br> const svgMinWidth = 50;<br></div></div></div>