The main page and direct photo links open without a prompt. Each photo's pool is sealed with its own key, handed out by POST /k (served by the daemon in serve and export mode). The hold-and-solve card appears only for low-entropy clicks into a collection, too many low-entropy landings from one IP, or more than photo_limit photos per window, with escalating proof-of-work and a 429 cap. Build ids now sort chronologically within the same second. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 lines
3.9 KiB
JavaScript
2 lines
3.9 KiB
JavaScript
"use strict";(()=>{function M(e){let a=e.seed+"|"+e.level+"|"+e.x+"|"+e.y,o=2166136261;for(let n=0;n<a.length;n++)o=Math.imul(o^a.charCodeAt(n),16777619)>>>0;return o}function v(e,a){let o=new Array(e);for(let t=0;t<e;t++)o[t]=t;let n=a|0,r=()=>{n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296};for(let t=e-1;t>0;t--){let c=Math.floor(r()*(t+1)),l=o[t];o[t]=o[c],o[c]=l}return o}function w(e,a,o,n,r){e.drawImage(a,0,0);let t=r.cell,c=Math.floor(o/t),l=Math.floor(n/t);if(c<2||l<2)return;let s=c*l,i=v(s,M(r));for(let f=0;f<s;f++){let b=i[f];if(b===f)continue;let x=f%c*t,m=Math.floor(f/c)*t,h=b%c*t,I=Math.floor(b/c)*t;e.drawImage(a,x,m,t,t,h,I,t,t)}}var C=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),A=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function S(e,a){for(let o=a;o<64;o++){let n=e[o-15],r=e[o-2],t=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,c=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10;e[o]=e[o-16]+t+e[o-7]+c|0}}function k(e,a,o,n){let r=e[0],t=e[1],c=e[2],l=e[3],s=e[4],i=e[5],f=e[6],b=e[7];for(let x=o;x<n;x++){let m=b+((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&i^~s&f)+C[x]+a[x]|0,h=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&t^r&c^t&c)|0;b=f,f=i,i=s,s=l+m|0,l=c,c=t,t=r,r=m+h|0}e[0]=r,e[1]=t,e[2]=c,e[3]=l,e[4]=s,e[5]=i,e[6]=f,e[7]=b}var E=new Int32Array(64),T=new Int32Array(8),j=new Int32Array(8);var p=4294967296,d=class{constructor(a,o){this.w=new Int32Array(64);this.mid=new Int32Array(8);this.s=new Int32Array(8);let n=this.w;for(let r=0;r<8;r++)n[r]=a.charCodeAt(r*4)<<24|a.charCodeAt(r*4+1)<<16|a.charCodeAt(r*4+2)<<8|a.charCodeAt(r*4+3);n[10]=-2147483648,n[15]=320,this.mid.set(A),k(this.mid,n,0,8),this.shift=32-Math.max(1,Math.min(32,o))}run(a,o,n){let r=this.w,t=this.s,c=this.mid,l=this.shift,s=A[0];r[8]=a|0;for(let i=o;i<n;i++)if(r[9]=i|0,S(r,16),t.set(c),k(t,r,8,64),!(s+t[0]>>>l))return i;return-1}};var u=self,y=new Map,U=typeof createImageBitmap=="function",g=self.OffscreenCanvas;u.onmessage=e=>{let a=e.data;if(a.type==="pow"){let o=new d(a.token,a.bits);for(let n=0;n<2097152;n++){let r=o.run(n,0,p);if(r>=0){u.postMessage({pow:n*p+r});return}}u.postMessage({pow:-1});return}if(a.type==="abort"){y.get(a.key)?.abort(),y.delete(a.key);return}O(a)};function B(e,a){if(!g)throw new Error("unsupported-offscreen");let o=new g(e.width,e.height),n=o.getContext("2d");if(!n)throw new Error("unsupported-offscreen");return w(n,e,e.width,e.height,a),e.close(),o.transferToImageBitmap()}async function O(e){if(!U){u.postMessage({key:e.key,ok:!1,bytes:0,ms:0,error:"unsupported-bitmap"});return}if(e.scramble&&!g){u.postMessage({key:e.key,ok:!1,bytes:0,ms:0,error:"unsupported-offscreen"});return}let a=new AbortController;y.set(e.key,a);let o=performance.now();try{let n=await fetch(e.url,{signal:a.signal,credentials:"same-origin"});if(!n.ok)throw new Error("HTTP "+n.status);let r=await n.blob(),t=performance.now()-o,c=await createImageBitmap(r);if(e.scramble&&(c=B(c,e.scramble)),a.signal.aborted)throw c.close(),new Error("aborted");u.postMessage({key:e.key,ok:!0,bitmap:c,bytes:r.size,ms:t},[c])}catch(n){let r=n instanceof Error?n.message:String(n);u.postMessage({key:e.key,ok:!1,bytes:0,ms:0,error:r})}finally{y.delete(e.key)}}})();
|