/** * SPDX-License-Identifier: CC0-1.0 * * Copyright (C) 2026 Woj. Kosior */ /* #+begin_src manifest-jq .matches = [""] #+end_src */ if (false) { /* #+begin_src background-js */ blockJsOnCookie(/^pow_challenge=[0-9]{12}[.]/); } /* #+end_src */ /* * Solve "Varnish PoW" challenges. These are used in some places under * *.debian.org and are derived from haphash PoW challenges. We utilize * `pow-solver.js' for computing the hashes and * `appended-number-counting-schemes.js' for the counting scheme. */ (() => { const target = new URLSearchParams(window.location.search).get('original'); const match = /(?:^|;)\s*pow_challenge=(\S*)/.exec(document.cookie); if (target && match && !window.location.href.startsWith("file://")) { document.documentElement.innerHTML = `\

Simple extension is trying to solve a Varnish PoW challenge on this page…

`; const challenge = match[1]; /* A fixed length of 8 zero bits is required by this challenge. */ genericSolvePow(challenge + ';', 8, appendedNumberCountingSchemes) .then(({suffixArray}) => { const nonce = new TextDecoder().decode(suffixArray); document.cookie = `pow_nonce=${nonce}; Path=/`; window.location.href = target; }); } })();