Closed
Description
Loading module from “http://localhost:8923/.within.website/x/cmd/anubis/static/js/main.mjs?cacheBuster=1.18.0” was blocked because of a disallowed MIME type (“text/plain”).
main.mjs contents:
/*
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (c) 2025 Xe Iaso <me@xeiaso.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
(()=>{function T(i,l=5,e=null,t=null,n=navigator.hardwareConcurrency||1){return console.debug("fast algo"),new Promise((o,a)=>{let u=URL.createObjectURL(new Blob(["(",C(),")()"],{type:"application/javascript"})),c=[],d=()=>{c.forEach(r=>r.terminate()),e!=null&&(e.removeEventListener("abort",d),e.aborted&&(console.log("PoW aborted"),a(!1)))};e?.addEventListener("abort",d,{once:!0});for(let r=0;r<n;r++){let p=new Worker(u);p.onmessage=g=>{typeof g.data=="number"?t?.(g.data):(d(),o(g.data))},p.onerror=g=>{d(),a(g)},p.postMessage({data:i,difficulty:l,nonce:r,threads:n}),c.push(p)}URL.revokeObjectURL(u)})}function C(){return function(){let i=e=>{let t=new TextEncoder().encode(e);return crypto.subtle.digest("SHA-256",t.buffer)};function l(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}addEventListener("message",async e=>{let t=e.data.data,n=e.data.difficulty,o,a=e.data.nonce,u=e.data.threads,c=a;for(;;){let d=await i(t+a),r=new Uint8Array(d),p=!0;for(let f=0;f<n;f++){let k=Math.floor(f/2),v=f%2;if((r[k]>>(v===0?4:0)&15)!==0){p=!1;break}}if(p){o=l(r),console.log(o);break}let g=a;a+=u,a>g|1023&&(a>>10)%u===c&&postMessage(a)}postMessage({hash:o,data:t,difficulty:n,nonce:a})})}.toString()}function L(i,l=5,e=null,t=null,n=1){return console.debug("slow algo"),new Promise((o,a)=>{let u=URL.createObjectURL(new Blob(["(",I(),")()"],{type:"application/javascript"})),c=new Worker(u),d=()=>{c.terminate(),e!=null&&(e.removeEventListener("abort",d),e.aborted&&(console.log("PoW aborted"),a(!1)))};e?.addEventListener("abort",d,{once:!0}),c.onmessage=r=>{typeof r.data=="number"?t?.(r.data):(d(),o(r.data))},c.onerror=r=>{d(),a(r)},c.postMessage({data:i,difficulty:l}),URL.revokeObjectURL(u)})}function I(){return function(){let i=l=>{let e=new TextEncoder().encode(l);return crypto.subtle.digest("SHA-256",e.buffer).then(t=>Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join(""))};addEventListener("message",async l=>{let e=l.data.data,t=l.data.difficulty,n,o=0;do o&!1&&postMessage(o),n=await i(e+o++);while(n.substring(0,t)!==Array(t+1).join("0"));o-=1,postMessage({hash:n,data:e,difficulty:t,nonce:o})})}.toString()}var H={fast:T,slow:L},M=(i="",l={})=>{let e=new URL(i,window.location.href);return Object.entries(l).forEach(([t,n])=>e.searchParams.set(t,n)),e.toString()},b=(i,l,e)=>M(`${e}/.within.website/x/cmd/anubis/static/img/${i}.webp`,{cacheBuster:l}),R=[{name:"WebCrypto",msg:"Your browser doesn't have a functioning web.crypto element. Are you viewing this over a secure context?",value:window.crypto},{name:"Web Workers",msg:"Your browser doesn't support web workers (Anubis uses this to avoid freezing your browser). Do you have a plugin like JShelter installed?",value:window.Worker},{name:"Cookies",msg:"Your browser doesn't store cookies. Anubis uses cookies to determine which clients have passed challenges by storing a signed token in a cookie. Please enable storing cookies for this domain. The names of the cookies Anubis stores may vary without notice. Cookie names and values are not part of the public API.",value:navigator.cookieEnabled}];(async()=>{let i=document.getElementById("status"),l=document.getElementById("image"),e=document.getElementById("title"),t=document.getElementById("progress"),n=JSON.parse(document.getElementById("anubis_version").textContent),o=JSON.parse(document.getElementById("anubis_base_prefix").textContent),a=document.querySelector("details"),u=!1;a&&a.addEventListener("toggle",()=>{a.open&&(u=!0)});let c=({titleMsg:m,statusMsg:y,imageSrc:h})=>{e.innerHTML=m,i.innerHTML=y,l.src=h,t.style.display="none"};if(!window.isSecureContext){c({titleMsg:"Your context is not secure!",statusMsg:'Try connecting over HTTPS or let the admin know to set up HTTPS. For more information, see <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#when_is_a_context_considered_secure">MDN</a>.',imageSrc:b("reject",n,o)});return}i.innerHTML="Calculating...";for(let{value:m,name:y,msg:h}of R)if(!m){c({titleMsg:`Missing feature ${y}`,statusMsg:h,imageSrc:b("reject",n,o)});return}let{challenge:d,rules:r}=JSON.parse(document.getElementById("anubis_challenge").textContent),p=H[r.algorithm];if(!p){c({titleMsg:"Challenge error!",statusMsg:"Failed to resolve check algorithm. You may want to reload the page.",imageSrc:b("reject",n,o)});return}i.innerHTML=`Calculating...<br/>Difficulty: ${r.report_as}, `,t.style.display="inline-block";let g=document.createTextNode("Speed: 0kH/s");i.appendChild(g);let f=0,k=!1,v=Math.pow(16,-r.report_as);try{let m=Date.now(),{hash:y,nonce:h}=await p(d,r.difficulty,null,s=>{let w=Date.now()-m;w-f>1e3&&(f=w,g.data=`Speed: ${(s/w).toFixed(3)}kH/s`);let x=Math.pow(1-v,s),E=(1-Math.pow(x,2))*100;t["aria-valuenow"]=E,t.firstElementChild.style.width=`${E}%`,x<.1&&!k&&(i.append(document.createElement("br"),document.createTextNode("Verification is taking longer than expected. Please do not refresh the page.")),k=!0)}),S=Date.now();if(console.log({hash:y,nonce:h}),e.innerHTML="Success!",i.innerHTML=`Done! Took ${S-m}ms, ${h} iterations`,l.src=b("happy",n,o),t.style.display="none",u){let w=function(){let x=window.location.href;window.location.replace(M(`${o}/.within.website/x/cmd/anubis/api/pass-challenge`,{response:y,nonce:h,redir:x,elapsedTime:S-m}))},s=document.getElementById("progress");s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.height="2rem",s.style.borderRadius="1rem",s.style.cursor="pointer",s.style.background="#b16286",s.style.color="white",s.style.fontWeight="bold",s.style.outline="4px solid #b16286",s.style.outlineOffset="2px",s.style.width="min(20rem, 90%)",s.style.margin="1rem auto 2rem",s.innerHTML="I've finished reading, continue \u2192",s.onclick=w,setTimeout(w,3e4)}else setTimeout(()=>{let s=window.location.href;window.location.replace(M(`${o}/.within.website/x/cmd/anubis/api/pass-challenge`,{response:y,nonce:h,redir:s,elapsedTime:S-m}))},250)}catch(m){c({titleMsg:"Calculation error!",statusMsg:`Failed to calculate challenge: ${m.message}`,imageSrc:b("reject",n,o)})}})();})();
//# sourceMappingURL=main.mjs.map
Metadata
Metadata
Assignees
Labels
No labels
Activity
Xe commentedon May 28, 2025
Which version of Firefox is this triggering on?
Xe commentedon May 28, 2025
can't reproduce on anubis.techaro.lol
or localhost:
fix(internal): register mime type for .mjs files
fix(internal): register mime type for .mjs files (#577)