hfs 0.56.0 → 0.57.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/assets/{index-DlA4sSmp.js → index-Cl7PJ7_4.js} +263 -263
- package/admin/assets/{sha512--f9T-TYW.js → sha512-DwXzavpM.js} +1 -1
- package/admin/index.html +14 -2
- package/frontend/assets/index-legacy-0ZDBWQI9.js +50 -0
- package/frontend/assets/{sha512-legacy-CX3vTVvC.js → sha512-legacy-slBG5k4n.js} +1 -1
- package/frontend/index.html +1 -1
- package/package.json +2 -2
- package/plugins/antibrute/plugin.js +25 -27
- package/src/SendList.js +2 -2
- package/src/acme.js +1 -2
- package/src/adminApis.js +1 -0
- package/src/api.accounts.js +3 -0
- package/src/api.auth.js +27 -4
- package/src/api.get_file_list.js +2 -6
- package/src/api.log.js +9 -4
- package/src/api.monitor.js +1 -1
- package/src/api.plugins.js +13 -0
- package/src/apiMiddleware.js +1 -1
- package/src/auth.js +17 -1
- package/src/comments.js +31 -8
- package/src/config.js +2 -0
- package/src/connections.js +16 -5
- package/src/const.js +4 -4
- package/src/cross-const.js +2 -1
- package/src/cross.js +13 -3
- package/src/customHtml.js +4 -2
- package/src/events.js +7 -5
- package/src/fileAttr.js +10 -5
- package/src/frontEndApis.js +0 -12
- package/src/geo.js +1 -0
- package/src/langs/hfs-lang-ar.json +4 -1
- package/src/langs/hfs-lang-de.json +4 -1
- package/src/langs/hfs-lang-el.json +4 -1
- package/src/langs/hfs-lang-es.json +4 -1
- package/src/langs/hfs-lang-fi.json +4 -1
- package/src/langs/hfs-lang-fr.json +4 -1
- package/src/langs/hfs-lang-hu.json +4 -1
- package/src/langs/hfs-lang-it.json +4 -1
- package/src/langs/hfs-lang-ja.json +4 -1
- package/src/langs/hfs-lang-ko.json +4 -1
- package/src/langs/hfs-lang-ms.json +4 -1
- package/src/langs/hfs-lang-nl.json +4 -1
- package/src/langs/hfs-lang-pt-br.json +4 -1
- package/src/langs/hfs-lang-ro.json +4 -1
- package/src/langs/hfs-lang-ru.json +16 -13
- package/src/langs/hfs-lang-sr.json +4 -1
- package/src/langs/hfs-lang-th.json +4 -1
- package/src/langs/hfs-lang-tr.json +7 -1
- package/src/langs/hfs-lang-uk.json +4 -1
- package/src/langs/hfs-lang-vi.json +8 -5
- package/src/langs/hfs-lang-zh-tw.json +4 -1
- package/src/langs/hfs-lang-zh.json +4 -1
- package/src/listen.js +3 -2
- package/src/log.js +10 -3
- package/src/middlewares.js +7 -23
- package/src/misc.js +6 -35
- package/src/perm.js +5 -3
- package/src/plugins.js +44 -4
- package/src/roots.js +1 -3
- package/src/serveGuiAndSharedFiles.js +18 -10
- package/src/serveGuiFiles.js +2 -4
- package/src/throttler.js +3 -2
- package/src/update.js +1 -1
- package/src/upload.js +1 -1
- package/src/vfs.js +1 -1
- package/README.md +0 -177
- package/frontend/assets/index-legacy-3T51dA5w.js +0 -50
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
System.register(["./index-legacy-3T51dA5w.js"],(function(h,t){"use strict";var i,s;return{setters:[function(h){i=h.c,s=h.g}],execute:function(){function t(h,t){for(var i=function(){var i=t[s];if("string"!=typeof i&&!Array.isArray(i)){var r=function(t){if("default"!==t&&!(t in h)){var s=Object.getOwnPropertyDescriptor(i,t);s&&Object.defineProperty(h,t,s.get?s:{enumerable:!0,get:function(){return i[t]}})}};for(var e in i)r(e)}},s=0;s<t.length;s++)i();return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}var r,e={exports:{}},n=(r||(r=1,function(h){!function(){var t="input is invalid type",s="object"==typeof window,r=s?window:{};r.JS_SHA512_NO_WINDOW&&(s=!1);var e=!s&&"object"==typeof self;!r.JS_SHA512_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=i:e&&(r=self);var n=!r.JS_SHA512_NO_COMMON_JS&&h.exports,o=!r.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,a="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],f=[24,16,8,0],c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],u=["hex","array","digest","arrayBuffer"],y=[];!r.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(h){return"[object Array]"===Object.prototype.toString.call(h)}),!o||!r.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(h){return"object"==typeof h&&h.buffer&&h.buffer.constructor===ArrayBuffer});var p=function(h,t){return function(i){return new _(t,!0).update(i)[h]()}},d=function(h){var t=p("hex",h);t.create=function(){return new _(h)},t.update=function(h){return t.create().update(h)};for(var i=0;i<u.length;++i){var s=u[i];t[s]=p(s,h)}return t},b=function(h,t){return function(i,s){return new w(i,t,!0).update(s)[h]()}},v=function(h){var t=b("hex",h);t.create=function(t){return new w(t,h)},t.update=function(h,i){return t.create(h).update(i)};for(var i=0;i<u.length;++i){var s=u[i];t[s]=b(s,h)}return t};function _(h,t){t?(y[0]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=y[16]=y[17]=y[18]=y[19]=y[20]=y[21]=y[22]=y[23]=y[24]=y[25]=y[26]=y[27]=y[28]=y[29]=y[30]=y[31]=y[32]=0,this.blocks=y):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],384==h?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):256==h?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):224==h?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=h,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}function w(h,i,s){var r,e=typeof h;if("string"!==e){if("object"!==e)throw new Error(t);if(null===h)throw new Error(t);if(o&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!(Array.isArray(h)||o&&ArrayBuffer.isView(h)))throw new Error(t);r=!0}var n=h.length;if(!r){for(var a,l=[],f=(n=h.length,0),c=0;c<n;++c)(a=h.charCodeAt(c))<128?l[f++]=a:a<2048?(l[f++]=192|a>>6,l[f++]=128|63&a):a<55296||a>=57344?(l[f++]=224|a>>12,l[f++]=128|a>>6&63,l[f++]=128|63&a):(a=65536+((1023&a)<<10|1023&h.charCodeAt(++c)),l[f++]=240|a>>18,l[f++]=128|a>>12&63,l[f++]=128|a>>6&63,l[f++]=128|63&a);h=l}h.length>128&&(h=new _(i,!0).update(h).array());var u=[],y=[];for(c=0;c<128;++c){var p=h[c]||0;u[c]=92^p,y[c]=54^p}_.call(this,i,s),this.update(y),this.oKeyPad=u,this.inner=!0,this.sharedMemory=s}_.prototype.update=function(h){if(this.finalized)throw new Error("finalize already called");var i,s=typeof h;if("string"!==s){if("object"!==s)throw new Error(t);if(null===h)throw new Error(t);if(o&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!(Array.isArray(h)||o&&ArrayBuffer.isView(h)))throw new Error(t);i=!0}for(var r,e,n=0,a=h.length,l=this.blocks;n<a;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=l[16]=l[17]=l[18]=l[19]=l[20]=l[21]=l[22]=l[23]=l[24]=l[25]=l[26]=l[27]=l[28]=l[29]=l[30]=l[31]=l[32]=0),i)for(e=this.start;n<a&&e<128;++n)l[e>>2]|=h[n]<<f[3&e++];else for(e=this.start;n<a&&e<128;++n)(r=h.charCodeAt(n))<128?l[e>>2]|=r<<f[3&e++]:r<2048?(l[e>>2]|=(192|r>>6)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]):r<55296||r>=57344?(l[e>>2]|=(224|r>>12)<<f[3&e++],l[e>>2]|=(128|r>>6&63)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]):(r=65536+((1023&r)<<10|1023&h.charCodeAt(++n)),l[e>>2]|=(240|r>>18)<<f[3&e++],l[e>>2]|=(128|r>>12&63)<<f[3&e++],l[e>>2]|=(128|r>>6&63)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,e>=128?(this.block=l[32],this.start=e-128,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var h=this.blocks,t=this.lastByteIndex;h[32]=this.block,h[t>>2]|=l[3&t],this.block=h[32],t>=112&&(this.hashed||this.hash(),h[0]=this.block,h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7]=h[8]=h[9]=h[10]=h[11]=h[12]=h[13]=h[14]=h[15]=h[16]=h[17]=h[18]=h[19]=h[20]=h[21]=h[22]=h[23]=h[24]=h[25]=h[26]=h[27]=h[28]=h[29]=h[30]=h[31]=h[32]=0),h[30]=this.hBytes<<3|this.bytes>>>29,h[31]=this.bytes<<3,this.hash()}},_.prototype.hash=function(){var h,t,i,s,r,e,n,o,a,l,f,u,y,p,d,b,v,_,w,A,g,S,B,U,O,k=this.h0h,x=this.h0l,z=this.h1h,j=this.h1l,E=this.h2h,N=this.h2l,m=this.h3h,J=this.h3l,P=this.h4h,H=this.h4l,I=this.h5h,R=this.h5l,V=this.h6h,C=this.h6l,D=this.h7h,K=this.h7l,M=this.blocks;for(h=32;h<160;h+=2)t=((A=M[h-30])>>>1|(g=M[h-29])<<31)^(A>>>8|g<<24)^A>>>7,i=(g>>>1|A<<31)^(g>>>8|A<<24)^(g>>>7|A<<25),s=((A=M[h-4])>>>19|(g=M[h-3])<<13)^(g>>>29|A<<3)^A>>>6,r=(g>>>19|A<<13)^(A>>>29|g<<3)^(g>>>6|A<<26),A=M[h-32],g=M[h-31],a=((S=M[h-14])>>>16)+(A>>>16)+(t>>>16)+(s>>>16)+((o=(65535&S)+(65535&A)+(65535&t)+(65535&s)+((n=((B=M[h-13])>>>16)+(g>>>16)+(i>>>16)+(r>>>16)+((e=(65535&B)+(65535&g)+(65535&i)+(65535&r))>>>16))>>>16))>>>16),M[h]=a<<16|65535&o,M[h+1]=n<<16|65535&e;var F=k,T=x,W=z,Y=j,q=E,G=N,L=m,Q=J,X=P,Z=H,$=I,hh=R,th=V,ih=C,sh=D,rh=K;for(b=W&q,v=Y&G,h=0;h<160;h+=8)t=(F>>>28|T<<4)^(T>>>2|F<<30)^(T>>>7|F<<25),i=(T>>>28|F<<4)^(F>>>2|T<<30)^(F>>>7|T<<25),s=(X>>>14|Z<<18)^(X>>>18|Z<<14)^(Z>>>9|X<<23),r=(Z>>>14|X<<18)^(Z>>>18|X<<14)^(X>>>9|Z<<23),_=(l=F&W)^F&q^b,w=(f=T&Y)^T&G^v,U=X&$^~X&th,O=Z&hh^~Z&ih,A=M[h],g=M[h+1],A=(a=((S=c[h])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(sh>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&sh)+((n=((B=c[h+1])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(rh>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&rh))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,sh=(a=(L>>>16)+(A>>>16)+((o=(65535&L)+(65535&A)+((n=(Q>>>16)+(g>>>16)+((e=(65535&Q)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,rh=n<<16|65535&e,t=((L=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(Q=n<<16|65535&e)<<4)^(Q>>>2|L<<30)^(Q>>>7|L<<25),i=(Q>>>28|L<<4)^(L>>>2|Q<<30)^(L>>>7|Q<<25),s=(sh>>>14|rh<<18)^(sh>>>18|rh<<14)^(rh>>>9|sh<<23),r=(rh>>>14|sh<<18)^(rh>>>18|sh<<14)^(sh>>>9|rh<<23),_=(u=L&F)^L&W^l,w=(y=Q&T)^Q&Y^f,U=sh&X^~sh&$,O=rh&Z^~rh&hh,A=M[h+2],g=M[h+3],A=(a=((S=c[h+2])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(th>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&th)+((n=((B=c[h+3])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(ih>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&ih))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,th=(a=(q>>>16)+(A>>>16)+((o=(65535&q)+(65535&A)+((n=(G>>>16)+(g>>>16)+((e=(65535&G)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,ih=n<<16|65535&e,t=((q=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(G=n<<16|65535&e)<<4)^(G>>>2|q<<30)^(G>>>7|q<<25),i=(G>>>28|q<<4)^(q>>>2|G<<30)^(q>>>7|G<<25),s=(th>>>14|ih<<18)^(th>>>18|ih<<14)^(ih>>>9|th<<23),r=(ih>>>14|th<<18)^(ih>>>18|th<<14)^(th>>>9|ih<<23),_=(p=q&L)^q&F^u,w=(d=G&Q)^G&T^y,U=th&sh^~th&X,O=ih&rh^~ih&Z,A=M[h+4],g=M[h+5],A=(a=((S=c[h+4])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+($>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&$)+((n=((B=c[h+5])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(hh>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&hh))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,$=(a=(W>>>16)+(A>>>16)+((o=(65535&W)+(65535&A)+((n=(Y>>>16)+(g>>>16)+((e=(65535&Y)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,hh=n<<16|65535&e,t=((W=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(Y=n<<16|65535&e)<<4)^(Y>>>2|W<<30)^(Y>>>7|W<<25),i=(Y>>>28|W<<4)^(W>>>2|Y<<30)^(W>>>7|Y<<25),s=($>>>14|hh<<18)^($>>>18|hh<<14)^(hh>>>9|$<<23),r=(hh>>>14|$<<18)^(hh>>>18|$<<14)^($>>>9|hh<<23),_=(b=W&q)^W&L^p,w=(v=Y&G)^Y&Q^d,U=$&th^~$&sh,O=hh&ih^~hh&rh,A=M[h+6],g=M[h+7],A=(a=((S=c[h+6])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(X>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&X)+((n=((B=c[h+7])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(Z>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&Z))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,X=(a=(F>>>16)+(A>>>16)+((o=(65535&F)+(65535&A)+((n=(T>>>16)+(g>>>16)+((e=(65535&T)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,Z=n<<16|65535&e,F=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,T=n<<16|65535&e;a=(k>>>16)+(F>>>16)+((o=(65535&k)+(65535&F)+((n=(x>>>16)+(T>>>16)+((e=(65535&x)+(65535&T))>>>16))>>>16))>>>16),this.h0h=a<<16|65535&o,this.h0l=n<<16|65535&e,a=(z>>>16)+(W>>>16)+((o=(65535&z)+(65535&W)+((n=(j>>>16)+(Y>>>16)+((e=(65535&j)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=a<<16|65535&o,this.h1l=n<<16|65535&e,a=(E>>>16)+(q>>>16)+((o=(65535&E)+(65535&q)+((n=(N>>>16)+(G>>>16)+((e=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h2h=a<<16|65535&o,this.h2l=n<<16|65535&e,a=(m>>>16)+(L>>>16)+((o=(65535&m)+(65535&L)+((n=(J>>>16)+(Q>>>16)+((e=(65535&J)+(65535&Q))>>>16))>>>16))>>>16),this.h3h=a<<16|65535&o,this.h3l=n<<16|65535&e,a=(P>>>16)+(X>>>16)+((o=(65535&P)+(65535&X)+((n=(H>>>16)+(Z>>>16)+((e=(65535&H)+(65535&Z))>>>16))>>>16))>>>16),this.h4h=a<<16|65535&o,this.h4l=n<<16|65535&e,a=(I>>>16)+($>>>16)+((o=(65535&I)+(65535&$)+((n=(R>>>16)+(hh>>>16)+((e=(65535&R)+(65535&hh))>>>16))>>>16))>>>16),this.h5h=a<<16|65535&o,this.h5l=n<<16|65535&e,a=(V>>>16)+(th>>>16)+((o=(65535&V)+(65535&th)+((n=(C>>>16)+(ih>>>16)+((e=(65535&C)+(65535&ih))>>>16))>>>16))>>>16),this.h6h=a<<16|65535&o,this.h6l=n<<16|65535&e,a=(D>>>16)+(sh>>>16)+((o=(65535&D)+(65535&sh)+((n=(K>>>16)+(rh>>>16)+((e=(65535&K)+(65535&rh))>>>16))>>>16))>>>16),this.h7h=a<<16|65535&o,this.h7l=n<<16|65535&e},_.prototype.hex=function(){this.finalize();var h=this.h0h,t=this.h0l,i=this.h1h,s=this.h1l,r=this.h2h,e=this.h2l,n=this.h3h,o=this.h3l,l=this.h4h,f=this.h4l,c=this.h5h,u=this.h5l,y=this.h6h,p=this.h6l,d=this.h7h,b=this.h7l,v=this.bits,_=a[h>>28&15]+a[h>>24&15]+a[h>>20&15]+a[h>>16&15]+a[h>>12&15]+a[h>>8&15]+a[h>>4&15]+a[15&h]+a[t>>28&15]+a[t>>24&15]+a[t>>20&15]+a[t>>16&15]+a[t>>12&15]+a[t>>8&15]+a[t>>4&15]+a[15&t]+a[i>>28&15]+a[i>>24&15]+a[i>>20&15]+a[i>>16&15]+a[i>>12&15]+a[i>>8&15]+a[i>>4&15]+a[15&i]+a[s>>28&15]+a[s>>24&15]+a[s>>20&15]+a[s>>16&15]+a[s>>12&15]+a[s>>8&15]+a[s>>4&15]+a[15&s]+a[r>>28&15]+a[r>>24&15]+a[r>>20&15]+a[r>>16&15]+a[r>>12&15]+a[r>>8&15]+a[r>>4&15]+a[15&r]+a[e>>28&15]+a[e>>24&15]+a[e>>20&15]+a[e>>16&15]+a[e>>12&15]+a[e>>8&15]+a[e>>4&15]+a[15&e]+a[n>>28&15]+a[n>>24&15]+a[n>>20&15]+a[n>>16&15]+a[n>>12&15]+a[n>>8&15]+a[n>>4&15]+a[15&n];return v>=256&&(_+=a[o>>28&15]+a[o>>24&15]+a[o>>20&15]+a[o>>16&15]+a[o>>12&15]+a[o>>8&15]+a[o>>4&15]+a[15&o]),v>=384&&(_+=a[l>>28&15]+a[l>>24&15]+a[l>>20&15]+a[l>>16&15]+a[l>>12&15]+a[l>>8&15]+a[l>>4&15]+a[15&l]+a[f>>28&15]+a[f>>24&15]+a[f>>20&15]+a[f>>16&15]+a[f>>12&15]+a[f>>8&15]+a[f>>4&15]+a[15&f]+a[c>>28&15]+a[c>>24&15]+a[c>>20&15]+a[c>>16&15]+a[c>>12&15]+a[c>>8&15]+a[c>>4&15]+a[15&c]+a[u>>28&15]+a[u>>24&15]+a[u>>20&15]+a[u>>16&15]+a[u>>12&15]+a[u>>8&15]+a[u>>4&15]+a[15&u]),512==v&&(_+=a[y>>28&15]+a[y>>24&15]+a[y>>20&15]+a[y>>16&15]+a[y>>12&15]+a[y>>8&15]+a[y>>4&15]+a[15&y]+a[p>>28&15]+a[p>>24&15]+a[p>>20&15]+a[p>>16&15]+a[p>>12&15]+a[p>>8&15]+a[p>>4&15]+a[15&p]+a[d>>28&15]+a[d>>24&15]+a[d>>20&15]+a[d>>16&15]+a[d>>12&15]+a[d>>8&15]+a[d>>4&15]+a[15&d]+a[b>>28&15]+a[b>>24&15]+a[b>>20&15]+a[b>>16&15]+a[b>>12&15]+a[b>>8&15]+a[b>>4&15]+a[15&b]),_},_.prototype.toString=_.prototype.hex,_.prototype.digest=function(){this.finalize();var h=this.h0h,t=this.h0l,i=this.h1h,s=this.h1l,r=this.h2h,e=this.h2l,n=this.h3h,o=this.h3l,a=this.h4h,l=this.h4l,f=this.h5h,c=this.h5l,u=this.h6h,y=this.h6l,p=this.h7h,d=this.h7l,b=this.bits,v=[h>>24&255,h>>16&255,h>>8&255,255&h,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24&255,i>>16&255,i>>8&255,255&i,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24&255,n>>16&255,n>>8&255,255&n];return b>=256&&v.push(o>>24&255,o>>16&255,o>>8&255,255&o),b>=384&&v.push(a>>24&255,a>>16&255,a>>8&255,255&a,l>>24&255,l>>16&255,l>>8&255,255&l,f>>24&255,f>>16&255,f>>8&255,255&f,c>>24&255,c>>16&255,c>>8&255,255&c),512==b&&v.push(u>>24&255,u>>16&255,u>>8&255,255&u,y>>24&255,y>>16&255,y>>8&255,255&y,p>>24&255,p>>16&255,p>>8&255,255&p,d>>24&255,d>>16&255,d>>8&255,255&d),v},_.prototype.array=_.prototype.digest,_.prototype.arrayBuffer=function(){this.finalize();var h=this.bits,t=new ArrayBuffer(h/8),i=new DataView(t);return i.setUint32(0,this.h0h),i.setUint32(4,this.h0l),i.setUint32(8,this.h1h),i.setUint32(12,this.h1l),i.setUint32(16,this.h2h),i.setUint32(20,this.h2l),i.setUint32(24,this.h3h),h>=256&&i.setUint32(28,this.h3l),h>=384&&(i.setUint32(32,this.h4h),i.setUint32(36,this.h4l),i.setUint32(40,this.h5h),i.setUint32(44,this.h5l)),512==h&&(i.setUint32(48,this.h6h),i.setUint32(52,this.h6l),i.setUint32(56,this.h7h),i.setUint32(60,this.h7l)),t},_.prototype.clone=function(){var h=new _(this.bits,!1);return this.copyTo(h),h},_.prototype.copyTo=function(h){var t=0,i=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(t=0;t<i.length;++t)h[i[t]]=this[i[t]];for(t=0;t<this.blocks.length;++t)h.blocks[t]=this.blocks[t]},w.prototype=new _,w.prototype.finalize=function(){if(_.prototype.finalize.call(this),this.inner){this.inner=!1;var h=this.array();_.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(h),_.prototype.finalize.call(this)}},w.prototype.clone=function(){var h=new w([],this.bits,!1);this.copyTo(h),h.inner=this.inner;for(var t=0;t<this.oKeyPad.length;++t)h.oKeyPad[t]=this.oKeyPad[t];return h};var A=d(512);A.sha512=A,A.sha384=d(384),A.sha512_256=d(256),A.sha512_224=d(224),A.sha512.hmac=v(512),A.sha384.hmac=v(384),A.sha512_256.hmac=v(256),A.sha512_224.hmac=v(224),n?h.exports=A:(r.sha512=A.sha512,r.sha384=A.sha384,r.sha512_256=A.sha512_256,r.sha512_224=A.sha512_224)}()}(e)),e.exports);
|
|
1
|
+
System.register(["./index-legacy-0ZDBWQI9.js"],(function(h,t){"use strict";var i,s;return{setters:[function(h){i=h.c,s=h.g}],execute:function(){function t(h,t){for(var i=function(){var i=t[s];if("string"!=typeof i&&!Array.isArray(i)){var r=function(t){if("default"!==t&&!(t in h)){var s=Object.getOwnPropertyDescriptor(i,t);s&&Object.defineProperty(h,t,s.get?s:{enumerable:!0,get:function(){return i[t]}})}};for(var e in i)r(e)}},s=0;s<t.length;s++)i();return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}var r,e={exports:{}},n=(r||(r=1,function(h){!function(){var t="input is invalid type",s="object"==typeof window,r=s?window:{};r.JS_SHA512_NO_WINDOW&&(s=!1);var e=!s&&"object"==typeof self;!r.JS_SHA512_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=i:e&&(r=self);var n=!r.JS_SHA512_NO_COMMON_JS&&h.exports,o=!r.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,a="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],f=[24,16,8,0],c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],u=["hex","array","digest","arrayBuffer"],y=[];!r.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(h){return"[object Array]"===Object.prototype.toString.call(h)}),!o||!r.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(h){return"object"==typeof h&&h.buffer&&h.buffer.constructor===ArrayBuffer});var p=function(h,t){return function(i){return new _(t,!0).update(i)[h]()}},d=function(h){var t=p("hex",h);t.create=function(){return new _(h)},t.update=function(h){return t.create().update(h)};for(var i=0;i<u.length;++i){var s=u[i];t[s]=p(s,h)}return t},b=function(h,t){return function(i,s){return new w(i,t,!0).update(s)[h]()}},v=function(h){var t=b("hex",h);t.create=function(t){return new w(t,h)},t.update=function(h,i){return t.create(h).update(i)};for(var i=0;i<u.length;++i){var s=u[i];t[s]=b(s,h)}return t};function _(h,t){t?(y[0]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=y[16]=y[17]=y[18]=y[19]=y[20]=y[21]=y[22]=y[23]=y[24]=y[25]=y[26]=y[27]=y[28]=y[29]=y[30]=y[31]=y[32]=0,this.blocks=y):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],384==h?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):256==h?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):224==h?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=h,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}function w(h,i,s){var r,e=typeof h;if("string"!==e){if("object"!==e)throw new Error(t);if(null===h)throw new Error(t);if(o&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!(Array.isArray(h)||o&&ArrayBuffer.isView(h)))throw new Error(t);r=!0}var n=h.length;if(!r){for(var a,l=[],f=(n=h.length,0),c=0;c<n;++c)(a=h.charCodeAt(c))<128?l[f++]=a:a<2048?(l[f++]=192|a>>6,l[f++]=128|63&a):a<55296||a>=57344?(l[f++]=224|a>>12,l[f++]=128|a>>6&63,l[f++]=128|63&a):(a=65536+((1023&a)<<10|1023&h.charCodeAt(++c)),l[f++]=240|a>>18,l[f++]=128|a>>12&63,l[f++]=128|a>>6&63,l[f++]=128|63&a);h=l}h.length>128&&(h=new _(i,!0).update(h).array());var u=[],y=[];for(c=0;c<128;++c){var p=h[c]||0;u[c]=92^p,y[c]=54^p}_.call(this,i,s),this.update(y),this.oKeyPad=u,this.inner=!0,this.sharedMemory=s}_.prototype.update=function(h){if(this.finalized)throw new Error("finalize already called");var i,s=typeof h;if("string"!==s){if("object"!==s)throw new Error(t);if(null===h)throw new Error(t);if(o&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!(Array.isArray(h)||o&&ArrayBuffer.isView(h)))throw new Error(t);i=!0}for(var r,e,n=0,a=h.length,l=this.blocks;n<a;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=l[16]=l[17]=l[18]=l[19]=l[20]=l[21]=l[22]=l[23]=l[24]=l[25]=l[26]=l[27]=l[28]=l[29]=l[30]=l[31]=l[32]=0),i)for(e=this.start;n<a&&e<128;++n)l[e>>2]|=h[n]<<f[3&e++];else for(e=this.start;n<a&&e<128;++n)(r=h.charCodeAt(n))<128?l[e>>2]|=r<<f[3&e++]:r<2048?(l[e>>2]|=(192|r>>6)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]):r<55296||r>=57344?(l[e>>2]|=(224|r>>12)<<f[3&e++],l[e>>2]|=(128|r>>6&63)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]):(r=65536+((1023&r)<<10|1023&h.charCodeAt(++n)),l[e>>2]|=(240|r>>18)<<f[3&e++],l[e>>2]|=(128|r>>12&63)<<f[3&e++],l[e>>2]|=(128|r>>6&63)<<f[3&e++],l[e>>2]|=(128|63&r)<<f[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,e>=128?(this.block=l[32],this.start=e-128,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var h=this.blocks,t=this.lastByteIndex;h[32]=this.block,h[t>>2]|=l[3&t],this.block=h[32],t>=112&&(this.hashed||this.hash(),h[0]=this.block,h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7]=h[8]=h[9]=h[10]=h[11]=h[12]=h[13]=h[14]=h[15]=h[16]=h[17]=h[18]=h[19]=h[20]=h[21]=h[22]=h[23]=h[24]=h[25]=h[26]=h[27]=h[28]=h[29]=h[30]=h[31]=h[32]=0),h[30]=this.hBytes<<3|this.bytes>>>29,h[31]=this.bytes<<3,this.hash()}},_.prototype.hash=function(){var h,t,i,s,r,e,n,o,a,l,f,u,y,p,d,b,v,_,w,A,g,S,B,U,O,k=this.h0h,x=this.h0l,z=this.h1h,j=this.h1l,E=this.h2h,N=this.h2l,m=this.h3h,J=this.h3l,P=this.h4h,H=this.h4l,I=this.h5h,R=this.h5l,V=this.h6h,C=this.h6l,D=this.h7h,K=this.h7l,M=this.blocks;for(h=32;h<160;h+=2)t=((A=M[h-30])>>>1|(g=M[h-29])<<31)^(A>>>8|g<<24)^A>>>7,i=(g>>>1|A<<31)^(g>>>8|A<<24)^(g>>>7|A<<25),s=((A=M[h-4])>>>19|(g=M[h-3])<<13)^(g>>>29|A<<3)^A>>>6,r=(g>>>19|A<<13)^(A>>>29|g<<3)^(g>>>6|A<<26),A=M[h-32],g=M[h-31],a=((S=M[h-14])>>>16)+(A>>>16)+(t>>>16)+(s>>>16)+((o=(65535&S)+(65535&A)+(65535&t)+(65535&s)+((n=((B=M[h-13])>>>16)+(g>>>16)+(i>>>16)+(r>>>16)+((e=(65535&B)+(65535&g)+(65535&i)+(65535&r))>>>16))>>>16))>>>16),M[h]=a<<16|65535&o,M[h+1]=n<<16|65535&e;var F=k,T=x,W=z,Y=j,q=E,G=N,L=m,Q=J,X=P,Z=H,$=I,hh=R,th=V,ih=C,sh=D,rh=K;for(b=W&q,v=Y&G,h=0;h<160;h+=8)t=(F>>>28|T<<4)^(T>>>2|F<<30)^(T>>>7|F<<25),i=(T>>>28|F<<4)^(F>>>2|T<<30)^(F>>>7|T<<25),s=(X>>>14|Z<<18)^(X>>>18|Z<<14)^(Z>>>9|X<<23),r=(Z>>>14|X<<18)^(Z>>>18|X<<14)^(X>>>9|Z<<23),_=(l=F&W)^F&q^b,w=(f=T&Y)^T&G^v,U=X&$^~X&th,O=Z&hh^~Z&ih,A=M[h],g=M[h+1],A=(a=((S=c[h])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(sh>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&sh)+((n=((B=c[h+1])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(rh>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&rh))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,sh=(a=(L>>>16)+(A>>>16)+((o=(65535&L)+(65535&A)+((n=(Q>>>16)+(g>>>16)+((e=(65535&Q)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,rh=n<<16|65535&e,t=((L=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(Q=n<<16|65535&e)<<4)^(Q>>>2|L<<30)^(Q>>>7|L<<25),i=(Q>>>28|L<<4)^(L>>>2|Q<<30)^(L>>>7|Q<<25),s=(sh>>>14|rh<<18)^(sh>>>18|rh<<14)^(rh>>>9|sh<<23),r=(rh>>>14|sh<<18)^(rh>>>18|sh<<14)^(sh>>>9|rh<<23),_=(u=L&F)^L&W^l,w=(y=Q&T)^Q&Y^f,U=sh&X^~sh&$,O=rh&Z^~rh&hh,A=M[h+2],g=M[h+3],A=(a=((S=c[h+2])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(th>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&th)+((n=((B=c[h+3])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(ih>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&ih))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,th=(a=(q>>>16)+(A>>>16)+((o=(65535&q)+(65535&A)+((n=(G>>>16)+(g>>>16)+((e=(65535&G)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,ih=n<<16|65535&e,t=((q=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(G=n<<16|65535&e)<<4)^(G>>>2|q<<30)^(G>>>7|q<<25),i=(G>>>28|q<<4)^(q>>>2|G<<30)^(q>>>7|G<<25),s=(th>>>14|ih<<18)^(th>>>18|ih<<14)^(ih>>>9|th<<23),r=(ih>>>14|th<<18)^(ih>>>18|th<<14)^(th>>>9|ih<<23),_=(p=q&L)^q&F^u,w=(d=G&Q)^G&T^y,U=th&sh^~th&X,O=ih&rh^~ih&Z,A=M[h+4],g=M[h+5],A=(a=((S=c[h+4])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+($>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&$)+((n=((B=c[h+5])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(hh>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&hh))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,$=(a=(W>>>16)+(A>>>16)+((o=(65535&W)+(65535&A)+((n=(Y>>>16)+(g>>>16)+((e=(65535&Y)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,hh=n<<16|65535&e,t=((W=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o)>>>28|(Y=n<<16|65535&e)<<4)^(Y>>>2|W<<30)^(Y>>>7|W<<25),i=(Y>>>28|W<<4)^(W>>>2|Y<<30)^(W>>>7|Y<<25),s=($>>>14|hh<<18)^($>>>18|hh<<14)^(hh>>>9|$<<23),r=(hh>>>14|$<<18)^(hh>>>18|$<<14)^($>>>9|hh<<23),_=(b=W&q)^W&L^p,w=(v=Y&G)^Y&Q^d,U=$&th^~$&sh,O=hh&ih^~hh&rh,A=M[h+6],g=M[h+7],A=(a=((S=c[h+6])>>>16)+(A>>>16)+(U>>>16)+(s>>>16)+(X>>>16)+((o=(65535&S)+(65535&A)+(65535&U)+(65535&s)+(65535&X)+((n=((B=c[h+7])>>>16)+(g>>>16)+(O>>>16)+(r>>>16)+(Z>>>16)+((e=(65535&B)+(65535&g)+(65535&O)+(65535&r)+(65535&Z))>>>16))>>>16))>>>16))<<16|65535&o,g=n<<16|65535&e,S=(a=(_>>>16)+(t>>>16)+((o=(65535&_)+(65535&t)+((n=(w>>>16)+(i>>>16)+((e=(65535&w)+(65535&i))>>>16))>>>16))>>>16))<<16|65535&o,B=n<<16|65535&e,X=(a=(F>>>16)+(A>>>16)+((o=(65535&F)+(65535&A)+((n=(T>>>16)+(g>>>16)+((e=(65535&T)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,Z=n<<16|65535&e,F=(a=(S>>>16)+(A>>>16)+((o=(65535&S)+(65535&A)+((n=(B>>>16)+(g>>>16)+((e=(65535&B)+(65535&g))>>>16))>>>16))>>>16))<<16|65535&o,T=n<<16|65535&e;a=(k>>>16)+(F>>>16)+((o=(65535&k)+(65535&F)+((n=(x>>>16)+(T>>>16)+((e=(65535&x)+(65535&T))>>>16))>>>16))>>>16),this.h0h=a<<16|65535&o,this.h0l=n<<16|65535&e,a=(z>>>16)+(W>>>16)+((o=(65535&z)+(65535&W)+((n=(j>>>16)+(Y>>>16)+((e=(65535&j)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=a<<16|65535&o,this.h1l=n<<16|65535&e,a=(E>>>16)+(q>>>16)+((o=(65535&E)+(65535&q)+((n=(N>>>16)+(G>>>16)+((e=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h2h=a<<16|65535&o,this.h2l=n<<16|65535&e,a=(m>>>16)+(L>>>16)+((o=(65535&m)+(65535&L)+((n=(J>>>16)+(Q>>>16)+((e=(65535&J)+(65535&Q))>>>16))>>>16))>>>16),this.h3h=a<<16|65535&o,this.h3l=n<<16|65535&e,a=(P>>>16)+(X>>>16)+((o=(65535&P)+(65535&X)+((n=(H>>>16)+(Z>>>16)+((e=(65535&H)+(65535&Z))>>>16))>>>16))>>>16),this.h4h=a<<16|65535&o,this.h4l=n<<16|65535&e,a=(I>>>16)+($>>>16)+((o=(65535&I)+(65535&$)+((n=(R>>>16)+(hh>>>16)+((e=(65535&R)+(65535&hh))>>>16))>>>16))>>>16),this.h5h=a<<16|65535&o,this.h5l=n<<16|65535&e,a=(V>>>16)+(th>>>16)+((o=(65535&V)+(65535&th)+((n=(C>>>16)+(ih>>>16)+((e=(65535&C)+(65535&ih))>>>16))>>>16))>>>16),this.h6h=a<<16|65535&o,this.h6l=n<<16|65535&e,a=(D>>>16)+(sh>>>16)+((o=(65535&D)+(65535&sh)+((n=(K>>>16)+(rh>>>16)+((e=(65535&K)+(65535&rh))>>>16))>>>16))>>>16),this.h7h=a<<16|65535&o,this.h7l=n<<16|65535&e},_.prototype.hex=function(){this.finalize();var h=this.h0h,t=this.h0l,i=this.h1h,s=this.h1l,r=this.h2h,e=this.h2l,n=this.h3h,o=this.h3l,l=this.h4h,f=this.h4l,c=this.h5h,u=this.h5l,y=this.h6h,p=this.h6l,d=this.h7h,b=this.h7l,v=this.bits,_=a[h>>28&15]+a[h>>24&15]+a[h>>20&15]+a[h>>16&15]+a[h>>12&15]+a[h>>8&15]+a[h>>4&15]+a[15&h]+a[t>>28&15]+a[t>>24&15]+a[t>>20&15]+a[t>>16&15]+a[t>>12&15]+a[t>>8&15]+a[t>>4&15]+a[15&t]+a[i>>28&15]+a[i>>24&15]+a[i>>20&15]+a[i>>16&15]+a[i>>12&15]+a[i>>8&15]+a[i>>4&15]+a[15&i]+a[s>>28&15]+a[s>>24&15]+a[s>>20&15]+a[s>>16&15]+a[s>>12&15]+a[s>>8&15]+a[s>>4&15]+a[15&s]+a[r>>28&15]+a[r>>24&15]+a[r>>20&15]+a[r>>16&15]+a[r>>12&15]+a[r>>8&15]+a[r>>4&15]+a[15&r]+a[e>>28&15]+a[e>>24&15]+a[e>>20&15]+a[e>>16&15]+a[e>>12&15]+a[e>>8&15]+a[e>>4&15]+a[15&e]+a[n>>28&15]+a[n>>24&15]+a[n>>20&15]+a[n>>16&15]+a[n>>12&15]+a[n>>8&15]+a[n>>4&15]+a[15&n];return v>=256&&(_+=a[o>>28&15]+a[o>>24&15]+a[o>>20&15]+a[o>>16&15]+a[o>>12&15]+a[o>>8&15]+a[o>>4&15]+a[15&o]),v>=384&&(_+=a[l>>28&15]+a[l>>24&15]+a[l>>20&15]+a[l>>16&15]+a[l>>12&15]+a[l>>8&15]+a[l>>4&15]+a[15&l]+a[f>>28&15]+a[f>>24&15]+a[f>>20&15]+a[f>>16&15]+a[f>>12&15]+a[f>>8&15]+a[f>>4&15]+a[15&f]+a[c>>28&15]+a[c>>24&15]+a[c>>20&15]+a[c>>16&15]+a[c>>12&15]+a[c>>8&15]+a[c>>4&15]+a[15&c]+a[u>>28&15]+a[u>>24&15]+a[u>>20&15]+a[u>>16&15]+a[u>>12&15]+a[u>>8&15]+a[u>>4&15]+a[15&u]),512==v&&(_+=a[y>>28&15]+a[y>>24&15]+a[y>>20&15]+a[y>>16&15]+a[y>>12&15]+a[y>>8&15]+a[y>>4&15]+a[15&y]+a[p>>28&15]+a[p>>24&15]+a[p>>20&15]+a[p>>16&15]+a[p>>12&15]+a[p>>8&15]+a[p>>4&15]+a[15&p]+a[d>>28&15]+a[d>>24&15]+a[d>>20&15]+a[d>>16&15]+a[d>>12&15]+a[d>>8&15]+a[d>>4&15]+a[15&d]+a[b>>28&15]+a[b>>24&15]+a[b>>20&15]+a[b>>16&15]+a[b>>12&15]+a[b>>8&15]+a[b>>4&15]+a[15&b]),_},_.prototype.toString=_.prototype.hex,_.prototype.digest=function(){this.finalize();var h=this.h0h,t=this.h0l,i=this.h1h,s=this.h1l,r=this.h2h,e=this.h2l,n=this.h3h,o=this.h3l,a=this.h4h,l=this.h4l,f=this.h5h,c=this.h5l,u=this.h6h,y=this.h6l,p=this.h7h,d=this.h7l,b=this.bits,v=[h>>24&255,h>>16&255,h>>8&255,255&h,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24&255,i>>16&255,i>>8&255,255&i,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24&255,n>>16&255,n>>8&255,255&n];return b>=256&&v.push(o>>24&255,o>>16&255,o>>8&255,255&o),b>=384&&v.push(a>>24&255,a>>16&255,a>>8&255,255&a,l>>24&255,l>>16&255,l>>8&255,255&l,f>>24&255,f>>16&255,f>>8&255,255&f,c>>24&255,c>>16&255,c>>8&255,255&c),512==b&&v.push(u>>24&255,u>>16&255,u>>8&255,255&u,y>>24&255,y>>16&255,y>>8&255,255&y,p>>24&255,p>>16&255,p>>8&255,255&p,d>>24&255,d>>16&255,d>>8&255,255&d),v},_.prototype.array=_.prototype.digest,_.prototype.arrayBuffer=function(){this.finalize();var h=this.bits,t=new ArrayBuffer(h/8),i=new DataView(t);return i.setUint32(0,this.h0h),i.setUint32(4,this.h0l),i.setUint32(8,this.h1h),i.setUint32(12,this.h1l),i.setUint32(16,this.h2h),i.setUint32(20,this.h2l),i.setUint32(24,this.h3h),h>=256&&i.setUint32(28,this.h3l),h>=384&&(i.setUint32(32,this.h4h),i.setUint32(36,this.h4l),i.setUint32(40,this.h5h),i.setUint32(44,this.h5l)),512==h&&(i.setUint32(48,this.h6h),i.setUint32(52,this.h6l),i.setUint32(56,this.h7h),i.setUint32(60,this.h7l)),t},_.prototype.clone=function(){var h=new _(this.bits,!1);return this.copyTo(h),h},_.prototype.copyTo=function(h){var t=0,i=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(t=0;t<i.length;++t)h[i[t]]=this[i[t]];for(t=0;t<this.blocks.length;++t)h.blocks[t]=this.blocks[t]},w.prototype=new _,w.prototype.finalize=function(){if(_.prototype.finalize.call(this),this.inner){this.inner=!1;var h=this.array();_.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(h),_.prototype.finalize.call(this)}},w.prototype.clone=function(){var h=new w([],this.bits,!1);this.copyTo(h),h.inner=this.inner;for(var t=0;t<this.oKeyPad.length;++t)h.oKeyPad[t]=this.oKeyPad[t];return h};var A=d(512);A.sha512=A,A.sha384=d(384),A.sha512_256=d(256),A.sha512_224=d(224),A.sha512.hmac=v(512),A.sha384.hmac=v(384),A.sha512_256.hmac=v(256),A.sha512_224.hmac=v(224),n?h.exports=A:(r.sha512=A.sha512,r.sha384=A.sha384,r.sha512_256=A.sha512_256,r.sha512_224=A.sha512_224)}()}(e)),e.exports);
|
|
2
2
|
/*
|
|
3
3
|
* [js-sha512]{@link https://github.com/emn178/js-sha512}
|
|
4
4
|
*
|
package/frontend/index.html
CHANGED
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
document.getElementById('root').innerHTML = 'Loading...'
|
|
23
23
|
</script>
|
|
24
24
|
<script crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-Ca1TOBqp.js"></script>
|
|
25
|
-
<script crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-
|
|
25
|
+
<script crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-0ZDBWQI9.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
|
26
26
|
</body>
|
|
27
27
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hfs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0-beta2",
|
|
4
4
|
"description": "HTTP File Server",
|
|
5
5
|
"keywords": ["file server", "http server"],
|
|
6
6
|
"homepage": "https://rejetto.com/hfs",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@gregoranders/csv": "^0.0.13",
|
|
72
72
|
"@koa/router": "^13.0.1",
|
|
73
73
|
"@node-rs/crc32": "^1.10.6",
|
|
74
|
-
"@rejetto/kvstorage": "^0.13.
|
|
74
|
+
"@rejetto/kvstorage": "^0.13.2",
|
|
75
75
|
"acme-client": "^5.4.0",
|
|
76
76
|
"buffer-crc32": "^1.0.0",
|
|
77
77
|
"fast-glob": "^3.2.7",
|
|
@@ -15,33 +15,31 @@ exports.configDialog = {
|
|
|
15
15
|
const byIp = {}
|
|
16
16
|
|
|
17
17
|
exports.init = api => {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
api.addBlock({ ip, comment: "From antibrute plugin", expire: hours ? new Date(now.getTime() + hours * HOUR) : undefined })
|
|
32
|
-
}
|
|
33
|
-
clearTimeout(rec.timer)
|
|
34
|
-
if (wait > 0) {
|
|
35
|
-
api.log('delaying', ip, 'for', Math.round(wait / 1000))
|
|
36
|
-
ctx.set('x-anti-brute-force', wait)
|
|
37
|
-
await new Promise(resolve => setTimeout(resolve, wait))
|
|
38
|
-
}
|
|
39
|
-
rec.timer = setTimeout(() => delete byIp[ip], 24 * HOUR) // no memory leak
|
|
40
|
-
},
|
|
41
|
-
login: ctx => {
|
|
42
|
-
if (ctx.state.account)
|
|
43
|
-
delete byIp[ctx.ip] // reset if login was successful
|
|
18
|
+
const { isLocalHost, HOUR } = api.misc
|
|
19
|
+
api.events.multi({
|
|
20
|
+
async attemptingLogin({ ctx }) {
|
|
21
|
+
const { ip } = ctx
|
|
22
|
+
const now = new Date
|
|
23
|
+
const rec = byIp[ip] ||= { attempts: 0, next: now }
|
|
24
|
+
const max = api.getConfig('max') * 1000
|
|
25
|
+
const delay = Math.min(max, 1000 * api.getConfig('increment') * ++rec.attempts)
|
|
26
|
+
const wait = rec.next - now
|
|
27
|
+
rec.next = new Date(+rec.next + delay)
|
|
28
|
+
if (rec.attempts > api.getConfig('blockAfter') && !isLocalHost(ctx)) {
|
|
29
|
+
const hours = api.getConfig('blockForHours')
|
|
30
|
+
api.addBlock({ ip, comment: "From antibrute plugin", expire: hours ? new Date(now.getTime() + hours * HOUR) : undefined })
|
|
44
31
|
}
|
|
32
|
+
clearTimeout(rec.timer)
|
|
33
|
+
if (wait > 0) {
|
|
34
|
+
api.log('delaying', ip, 'for', Math.round(wait / 1000))
|
|
35
|
+
ctx.set('x-anti-brute-force', wait)
|
|
36
|
+
await new Promise(resolve => setTimeout(resolve, wait))
|
|
37
|
+
}
|
|
38
|
+
rec.timer = setTimeout(() => delete byIp[ip], 24 * HOUR) // no memory leak
|
|
39
|
+
},
|
|
40
|
+
login(ctx) {
|
|
41
|
+
if (ctx.state.account)
|
|
42
|
+
delete byIp[ctx.ip] // reset if login was successful
|
|
43
|
+
}
|
|
45
44
|
})
|
|
46
|
-
}
|
|
47
45
|
}
|
package/src/SendList.js
CHANGED
|
@@ -76,7 +76,7 @@ class SendListReadable extends stream_1.Readable {
|
|
|
76
76
|
if (found) {
|
|
77
77
|
this.buffer.splice(idx, 1);
|
|
78
78
|
if (op === cross_1.LIST.add)
|
|
79
|
-
return;
|
|
79
|
+
return; // assuming this never reached the client
|
|
80
80
|
}
|
|
81
81
|
this._push([cross_1.LIST.remove, search]);
|
|
82
82
|
}
|
|
@@ -90,7 +90,7 @@ class SendListReadable extends stream_1.Readable {
|
|
|
90
90
|
return;
|
|
91
91
|
if (op === cross_1.LIST.add || op === cross_1.LIST.update)
|
|
92
92
|
return Object.assign(found[op === cross_1.LIST.add ? 1 : 2], change);
|
|
93
|
-
|
|
93
|
+
this._push([cross_1.LIST.update, search, change]);
|
|
94
94
|
}
|
|
95
95
|
ready() {
|
|
96
96
|
this._push([cross_1.LIST.ready]);
|
package/src/acme.js
CHANGED
|
@@ -117,7 +117,6 @@ exports.makeCert = (0, debounceAsync_1.debounceAsync)(async (domain, email, altN
|
|
|
117
117
|
});
|
|
118
118
|
exports.acmeRenewError = '';
|
|
119
119
|
const acmeDomain = (0, config_1.defineConfig)('acme_domain', '');
|
|
120
|
-
const acmeEmail = (0, config_1.defineConfig)('acme_email', '');
|
|
121
120
|
const acmeRenew = (0, config_1.defineConfig)('acme_renew', false); // handle config changes
|
|
122
121
|
events_1.default.once('httpsReady', () => (0, misc_1.repeat)(misc_1.HOUR, renewCert));
|
|
123
122
|
// checks if the cert is near expiration date, and if so renews it
|
|
@@ -133,6 +132,6 @@ const renewCert = (0, debounceAsync_1.debounceAsync)(async () => {
|
|
|
133
132
|
// not expiring in a month
|
|
134
133
|
if (now > new Date(cert.validFrom) && now < validTo && validTo.getTime() - now.getTime() >= 30 * misc_1.DAY)
|
|
135
134
|
return console.log("certificate still good");
|
|
136
|
-
await (0, exports.makeCert)(domain,
|
|
135
|
+
await (0, exports.makeCert)(domain, undefined, altNames)
|
|
137
136
|
.catch(e => console.log(exports.acmeRenewError = `Error renewing certificate, expiring ${validTo.toLocaleDateString()}: ${String(e.message || e)}`));
|
|
138
137
|
}, { retain: misc_1.DAY, retainFailure: misc_1.HOUR });
|
package/src/adminApis.js
CHANGED
|
@@ -100,6 +100,7 @@ exports.adminApis = {
|
|
|
100
100
|
},
|
|
101
101
|
get_custom_html() {
|
|
102
102
|
return {
|
|
103
|
+
enabled: !customHtml_1.disableCustomHtml.get(),
|
|
103
104
|
sections: Object.fromEntries([
|
|
104
105
|
...customHtml_1.customHtmlSections.concat((0, errorPages_1.getErrorSections)()).map(k => [k, '']),
|
|
105
106
|
...customHtml_1.customHtml.sections // override entries above
|
package/src/api.accounts.js
CHANGED
|
@@ -11,13 +11,16 @@ const const_1 = require("./const");
|
|
|
11
11
|
const auth_1 = require("./auth");
|
|
12
12
|
const misc_1 = require("./misc");
|
|
13
13
|
function prepareAccount(ac) {
|
|
14
|
+
var _a;
|
|
14
15
|
return ac && {
|
|
15
16
|
...lodash_1.default.omit(ac, ['password', 'hashed_password', 'srp']),
|
|
16
17
|
username: ac.username,
|
|
17
18
|
hasPassword: (0, perm_1.accountHasPassword)(ac),
|
|
19
|
+
isGroup: !((_a = ac.plugin) === null || _a === void 0 ? void 0 : _a.auth) && !(0, perm_1.accountHasPassword)(ac),
|
|
18
20
|
adminActualAccess: (0, perm_1.accountCanLoginAdmin)(ac),
|
|
19
21
|
canLogin: (0, perm_1.accountHasPassword)(ac) ? (0, perm_1.accountCanLogin)(ac) : undefined,
|
|
20
22
|
invalidated: auth_1.invalidateSessionBefore.get(ac.username),
|
|
23
|
+
directMembers: Object.values(perm_1.accountsConfig.get()).filter(a => { var _a; return (_a = a.belongs) === null || _a === void 0 ? void 0 : _a.includes(ac.username); }).map(x => x.username),
|
|
21
24
|
members: (0, misc_1.with_)(Object.values(perm_1.accountsConfig.get()), accounts => {
|
|
22
25
|
const ret = [];
|
|
23
26
|
let news = [ac.username];
|
package/src/api.auth.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.change_my_srp = exports.refresh_session = exports.logout = exports.loginSrp2 = exports.loginSrp1 = void 0;
|
|
7
|
+
exports.change_my_srp = exports.refresh_session = exports.logout = exports.loginSrp2 = exports.loginSrp1 = exports.login = void 0;
|
|
8
8
|
const perm_1 = require("./perm");
|
|
9
9
|
const apiMiddleware_1 = require("./apiMiddleware");
|
|
10
10
|
const const_1 = require("./const");
|
|
@@ -15,14 +15,36 @@ const config_1 = require("./config");
|
|
|
15
15
|
const events_1 = __importDefault(require("./events"));
|
|
16
16
|
const ongoingLogins = {}; // store data that doesn't fit session object
|
|
17
17
|
const keepSessionAlive = (0, config_1.defineConfig)('keep_session_alive', true);
|
|
18
|
-
const
|
|
18
|
+
const login = async ({ username, password }, ctx) => {
|
|
19
19
|
var _a;
|
|
20
|
+
if (!username)
|
|
21
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_BAD_REQUEST);
|
|
22
|
+
if (!ctx.session)
|
|
23
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_SERVER_ERROR);
|
|
24
|
+
try {
|
|
25
|
+
const account = await (0, auth_1.clearTextLogin)(ctx, username, password, 'api');
|
|
26
|
+
if (!account)
|
|
27
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_UNAUTHORIZED, 'wrong');
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_UNAUTHORIZED, String(e));
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
redirect: (_a = ctx.state.account) === null || _a === void 0 ? void 0 : _a.redirect,
|
|
34
|
+
...await (0, exports.refresh_session)({}, ctx)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.login = login;
|
|
38
|
+
const loginSrp1 = async ({ username }, ctx) => {
|
|
39
|
+
var _a, _b;
|
|
20
40
|
if (!username)
|
|
21
41
|
return new apiMiddleware_1.ApiError(const_1.HTTP_BAD_REQUEST);
|
|
22
42
|
const account = (0, perm_1.getAccount)(username);
|
|
23
43
|
if (!ctx.session)
|
|
24
44
|
return new apiMiddleware_1.ApiError(const_1.HTTP_SERVER_ERROR);
|
|
25
|
-
if ((_a =
|
|
45
|
+
if ((_a = account === null || account === void 0 ? void 0 : account.plugin) === null || _a === void 0 ? void 0 : _a.auth) // tell client to do clear-text login, before firing attemptingLogin, before triggering anti-brute
|
|
46
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_METHOD_NOT_ALLOWED);
|
|
47
|
+
if ((_b = (await events_1.default.emitAsync('attemptingLogin', { ctx, username }))) === null || _b === void 0 ? void 0 : _b.isDefaultPrevented())
|
|
26
48
|
return;
|
|
27
49
|
if (!account || !(0, perm_1.accountCanLogin)(account)) { // TODO simulate fake account to prevent knowing valid usernames
|
|
28
50
|
ctx.logExtra({ u: username });
|
|
@@ -56,7 +78,8 @@ const loginSrp2 = async ({ pubKey, proof }, ctx) => {
|
|
|
56
78
|
if (!step1)
|
|
57
79
|
return new apiMiddleware_1.ApiError(const_1.HTTP_NOT_FOUND);
|
|
58
80
|
try {
|
|
59
|
-
const M2 = await step1.step2(BigInt(pubKey), BigInt(proof))
|
|
81
|
+
const M2 = await step1.step2(BigInt(pubKey), BigInt(proof))
|
|
82
|
+
.catch(() => { throw 'wrong'; });
|
|
60
83
|
await (0, auth_1.setLoggedIn)(ctx, username);
|
|
61
84
|
return {
|
|
62
85
|
proof: String(M2),
|
package/src/api.get_file_list.js
CHANGED
|
@@ -90,12 +90,8 @@ const get_file_list = async ({ uri = '/', offset, limit, c, onlyFolders, onlyFil
|
|
|
90
90
|
--offset;
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
-
if (c === 'no')
|
|
94
|
-
|
|
95
|
-
entry.m = entry.c;
|
|
96
|
-
if (entry.c)
|
|
97
|
-
entry.c = undefined;
|
|
98
|
-
}
|
|
93
|
+
if (c === 'no' && entry.c) // allow excluding c for smaller payload
|
|
94
|
+
entry.c = undefined;
|
|
99
95
|
yield entry;
|
|
100
96
|
if (limit && !--limit)
|
|
101
97
|
break;
|
package/src/api.log.js
CHANGED
|
@@ -12,6 +12,7 @@ const log_1 = require("./log");
|
|
|
12
12
|
const SendList_1 = require("./SendList");
|
|
13
13
|
const serveFile_1 = require("./serveFile");
|
|
14
14
|
const ips_1 = require("./ips");
|
|
15
|
+
const connections_1 = require("./connections");
|
|
15
16
|
exports.default = {
|
|
16
17
|
async get_log_file({ file = 'log', range = '' }, ctx) {
|
|
17
18
|
const log = lodash_1.default.find(log_1.loggers, { name: file });
|
|
@@ -32,11 +33,16 @@ exports.default = {
|
|
|
32
33
|
return new SendList_1.SendListReadable({
|
|
33
34
|
bufferTime: 10,
|
|
34
35
|
async doAtStart(list) {
|
|
36
|
+
if (file === 'disconnections') {
|
|
37
|
+
for (const x of connections_1.disconnectionsLog)
|
|
38
|
+
list.add(x);
|
|
39
|
+
ctx.res.once('close', events_1.default.on('disconnection', x => list.add(x)));
|
|
40
|
+
return list.ready();
|
|
41
|
+
}
|
|
35
42
|
if (file === 'ips') {
|
|
36
43
|
for await (const [k, v] of ips_1.ips.iterator())
|
|
37
44
|
list.add({ ip: k, ...v });
|
|
38
|
-
list.ready();
|
|
39
|
-
return;
|
|
45
|
+
return list.ready();
|
|
40
46
|
}
|
|
41
47
|
if (file === 'console') {
|
|
42
48
|
for (const chunk of lodash_1.default.chunk(consoleLog_1.consoleLog, 1000)) { // avoid occupying the thread too long
|
|
@@ -44,9 +50,8 @@ exports.default = {
|
|
|
44
50
|
list.add(x);
|
|
45
51
|
await (0, cross_1.wait)(0);
|
|
46
52
|
}
|
|
47
|
-
list.ready();
|
|
48
53
|
ctx.res.once('close', events_1.default.on('console', x => list.add(x)));
|
|
49
|
-
return;
|
|
54
|
+
return list.ready();
|
|
50
55
|
}
|
|
51
56
|
// for other logs we only provide updates. Use get_log_file to download past content
|
|
52
57
|
if (lodash_1.default.some(files, x => !lodash_1.default.find(log_1.loggers, { name: x })))
|
package/src/api.monitor.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.default = {
|
|
|
17
17
|
: lodash_1.default.matches({ ip, port });
|
|
18
18
|
const found = (0, connections_1.getConnections)().filter(c => match(getConnAddress(c)));
|
|
19
19
|
for (const c of found)
|
|
20
|
-
c.socket
|
|
20
|
+
(0, connections_1.disconnect)(c.socket, "manual disconnection");
|
|
21
21
|
return { result: found.length };
|
|
22
22
|
},
|
|
23
23
|
get_connections({}, ctx) {
|
package/src/api.plugins.js
CHANGED
|
@@ -25,6 +25,7 @@ const apis = {
|
|
|
25
25
|
list.update({ id }, rest);
|
|
26
26
|
},
|
|
27
27
|
pluginUninstalled: id => list.remove({ id }),
|
|
28
|
+
pluginLog: id => list.update({ id }, { log: true }) // SendList is already capping frequency
|
|
28
29
|
});
|
|
29
30
|
},
|
|
30
31
|
async get_plugin_updates({}, ctx) {
|
|
@@ -54,6 +55,7 @@ const apis = {
|
|
|
54
55
|
return; // different, not just newer ones, in case a version was retired
|
|
55
56
|
list.add(Object.assign(online, {
|
|
56
57
|
id: disk.id,
|
|
58
|
+
installedVersion: disk.version,
|
|
57
59
|
repo: serialize(disk).repo,
|
|
58
60
|
downgrade: online.version < disk.version,
|
|
59
61
|
downloading: lodash_1.default.isString(online.repo) && github_1.downloading[online.repo],
|
|
@@ -166,13 +168,24 @@ const apis = {
|
|
|
166
168
|
(0, plugins_1.setPluginConfig)(id, null);
|
|
167
169
|
return {};
|
|
168
170
|
},
|
|
171
|
+
get_plugin_log({ id }, ctx) {
|
|
172
|
+
const p = (0, plugins_1.getPluginInfo)(id);
|
|
173
|
+
if (!p)
|
|
174
|
+
return new apiMiddleware_1.ApiError(const_1.HTTP_NOT_FOUND);
|
|
175
|
+
const list = new SendList_1.SendListReadable({ addAtStart: p.log });
|
|
176
|
+
return list.events(ctx, {
|
|
177
|
+
['pluginLog:' + id]: x => list.add(x)
|
|
178
|
+
});
|
|
179
|
+
},
|
|
169
180
|
};
|
|
170
181
|
exports.default = apis;
|
|
171
182
|
function serialize(p) {
|
|
183
|
+
var _a;
|
|
172
184
|
let o = 'getData' in p ? Object.assign(lodash_1.default.pick(p, ['id', 'started']), p.getData())
|
|
173
185
|
: { ...p }; // _.defaults mutates object, and we don't want that
|
|
174
186
|
if (typeof o.repo === 'object') // custom repo
|
|
175
187
|
o.repo = o.repo.web;
|
|
188
|
+
o.log = 'log' in p && ((_a = p.log) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
176
189
|
o = (0, immer_1.default)(o, (o) => {
|
|
177
190
|
lodash_1.default.each(o.config, x => x.showIf && (x.showIf = String(x.showIf)));
|
|
178
191
|
});
|
package/src/apiMiddleware.js
CHANGED
|
@@ -37,7 +37,7 @@ function apiMiddleware(apis) {
|
|
|
37
37
|
const apiFun = customApiRest && (0, plugins_1.firstPlugin)(pl => { var _a; return (_a = pl.getData().customRest) === null || _a === void 0 ? void 0 : _a[customApiRest]; })
|
|
38
38
|
|| apis.hasOwnProperty(apiName) && apis[apiName];
|
|
39
39
|
if (!apiFun)
|
|
40
|
-
return send(const_1.
|
|
40
|
+
return send(const_1.HTTP_BAD_REQUEST, 'invalid api');
|
|
41
41
|
// we don't rely on SameSite cookie option because it's https-only
|
|
42
42
|
let res;
|
|
43
43
|
try {
|
package/src/auth.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.invalidateSessionBefore = exports.setLoggedIn = exports.getCurrentUsername = exports.srpCheck = exports.srpServerStep1 = void 0;
|
|
6
|
+
exports.invalidateSessionBefore = exports.setLoggedIn = exports.clearTextLogin = exports.getCurrentUsername = exports.srpCheck = exports.srpServerStep1 = void 0;
|
|
7
7
|
const perm_1 = require("./perm");
|
|
8
8
|
const cross_const_1 = require("./cross-const");
|
|
9
9
|
const tssrp6a_1 = require("tssrp6a");
|
|
@@ -43,6 +43,21 @@ function getCurrentUsername(ctx) {
|
|
|
43
43
|
return ((_a = ctx.state.account) === null || _a === void 0 ? void 0 : _a.username) || '';
|
|
44
44
|
}
|
|
45
45
|
exports.getCurrentUsername = getCurrentUsername;
|
|
46
|
+
async function clearTextLogin(ctx, u, p, via) {
|
|
47
|
+
var _a;
|
|
48
|
+
if ((_a = (await events_1.default.emitAsync('attemptingLogin', { ctx, username: u, via }))) === null || _a === void 0 ? void 0 : _a.isDefaultPrevented())
|
|
49
|
+
return;
|
|
50
|
+
const plugins = await events_1.default.emitAsync('clearTextLogin', { ctx, username: u, password: p, via }); // provide clear password to plugins
|
|
51
|
+
const a = (plugins === null || plugins === void 0 ? void 0 : plugins.some(x => x === true)) ? (0, perm_1.getAccount)(u) : await srpCheck(u, p);
|
|
52
|
+
if (a) {
|
|
53
|
+
await setLoggedIn(ctx, a.username);
|
|
54
|
+
ctx.headers['x-username'] = a.username; // give an easier way to determine if the login was successful
|
|
55
|
+
}
|
|
56
|
+
else if (u)
|
|
57
|
+
events_1.default.emit('failedLogin', ctx, { username: u, via });
|
|
58
|
+
return a;
|
|
59
|
+
}
|
|
60
|
+
exports.clearTextLogin = clearTextLogin;
|
|
46
61
|
// centralized log-in state
|
|
47
62
|
async function setLoggedIn(ctx, username) {
|
|
48
63
|
var _a;
|
|
@@ -58,6 +73,7 @@ async function setLoggedIn(ctx, username) {
|
|
|
58
73
|
const a = ctx.state.account = (0, perm_1.getAccount)(username);
|
|
59
74
|
if (!a)
|
|
60
75
|
return;
|
|
76
|
+
await events_1.default.emitAsync('finalizingLogin', { ctx, username, inputs: { ...ctx.state.params, ...ctx.query } });
|
|
61
77
|
s.username = (0, perm_1.normalizeUsername)(username);
|
|
62
78
|
s.ts = Date.now();
|
|
63
79
|
const k = cross_1.CFG.allow_session_ip_change;
|
package/src/comments.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.areCommentsEnabled = exports.setCommentFor = exports.getCommentFor = exports.
|
|
6
|
+
exports.areCommentsEnabled = exports.setCommentFor = exports.getCommentFor = exports.usingDescriptIon = exports.DESCRIPT_ION = void 0;
|
|
7
7
|
const config_1 = require("./config");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const cross_1 = require("./cross");
|
|
@@ -14,17 +14,40 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
14
14
|
const iconv_lite_1 = __importDefault(require("iconv-lite"));
|
|
15
15
|
const promises_1 = require("node:fs/promises");
|
|
16
16
|
exports.DESCRIPT_ION = 'descript.ion';
|
|
17
|
-
|
|
17
|
+
const commentsStorage = (0, config_1.defineConfig)(cross_1.CFG.comments_storage, '');
|
|
18
|
+
(0, config_1.defineConfig)('descript_ion', true, (v, more) => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (!v && ((_a = more.version) === null || _a === void 0 ? void 0 : _a.olderThan('0.57.0-alpha1')))
|
|
21
|
+
commentsStorage.set('attr');
|
|
22
|
+
});
|
|
18
23
|
const descriptIonEncoding = (0, config_1.defineConfig)('descript_ion_encoding', 'utf8');
|
|
24
|
+
function readFromDescriptIon(path) {
|
|
25
|
+
return usingDescriptIon() && readDescriptIon((0, path_1.dirname)(path)).then(x => x.get((0, cross_1.basename)(path)), () => undefined);
|
|
26
|
+
}
|
|
27
|
+
function usingDescriptIon() {
|
|
28
|
+
return ['', 'attr+ion'].includes(commentsStorage.get());
|
|
29
|
+
}
|
|
30
|
+
exports.usingDescriptIon = usingDescriptIon;
|
|
31
|
+
const COMMENT_ATTR = 'comment';
|
|
19
32
|
async function getCommentFor(path) {
|
|
20
|
-
return !path
|
|
21
|
-
|
|
33
|
+
return !path ? undefined : Promise.all([
|
|
34
|
+
commentsStorage.get() ? (0, misc_1.loadFileAttr)(path, COMMENT_ATTR) : undefined,
|
|
35
|
+
readFromDescriptIon(path)
|
|
36
|
+
]).then(([fromAttr, fromIon]) => fromAttr || fromIon);
|
|
22
37
|
}
|
|
23
38
|
exports.getCommentFor = getCommentFor;
|
|
24
|
-
|
|
39
|
+
async function setCommentFor(path, comment) {
|
|
40
|
+
if (commentsStorage.get()) {
|
|
41
|
+
await (0, misc_1.storeFileAttr)(path, COMMENT_ATTR, comment || undefined);
|
|
42
|
+
return setCommentDescriptIon(path, '');
|
|
43
|
+
}
|
|
44
|
+
return setCommentDescriptIon(path, comment); // should we also remove from file-attr? not sure, but for the time we won't because #1 storeFileAttr is not really deleting, and we would store a lot of empty attributes, #2 more people will switch from descript.ion to attr (because introduced later) than the opposite
|
|
45
|
+
}
|
|
46
|
+
exports.setCommentFor = setCommentFor;
|
|
47
|
+
const setCommentDescriptIon = (0, misc_1.singleWorkerFromBatchWorker)(async (jobs) => {
|
|
25
48
|
const byFolder = lodash_1.default.groupBy(jobs, job => (0, path_1.dirname)(job[0]));
|
|
26
49
|
return Promise.allSettled(lodash_1.default.map(byFolder, async (jobs, folder) => {
|
|
27
|
-
const comments = await
|
|
50
|
+
const comments = await readDescriptIon(folder).catch(() => new Map());
|
|
28
51
|
for (const [path, comment] of jobs) {
|
|
29
52
|
const file = path.slice(folder.length + 1);
|
|
30
53
|
if (!comment)
|
|
@@ -49,11 +72,11 @@ exports.setCommentFor = (0, misc_1.singleWorkerFromBatchWorker)(async (jobs) =>
|
|
|
49
72
|
}));
|
|
50
73
|
});
|
|
51
74
|
function areCommentsEnabled() {
|
|
52
|
-
return
|
|
75
|
+
return true; // true since we introduced comments in file-attr
|
|
53
76
|
}
|
|
54
77
|
exports.areCommentsEnabled = areCommentsEnabled;
|
|
55
78
|
const MULTILINE_SUFFIX = Buffer.from([4, 0xC2]);
|
|
56
|
-
function
|
|
79
|
+
function readDescriptIon(path) {
|
|
57
80
|
// decoding could also be done with native TextDecoder.decode, but we need iconv for the encoding anyway
|
|
58
81
|
return (0, util_files_1.parseFileContent)((0, path_1.join)(path, exports.DESCRIPT_ION), raw => {
|
|
59
82
|
// for simplicity we "remove" the sequence MULTILINE_SUFFIX before iconv.decode messes it up
|
package/src/config.js
CHANGED
package/src/connections.js
CHANGED
|
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.disconnect = exports.updateConnection = exports.updateConnectionForCtx = exports.getConnection = exports.socket2connection = exports.getConnections = exports.newConnection = exports.normalizeIp = exports.Connection = void 0;
|
|
7
|
+
exports.disconnect = exports.disconnectionsLog = exports.updateConnection = exports.updateConnectionForCtx = exports.getConnection = exports.socket2connection = exports.getConnections = exports.newConnection = exports.normalizeIp = exports.Connection = void 0;
|
|
8
8
|
const events_1 = __importDefault(require("./events"));
|
|
9
|
+
const geo_1 = require("./geo");
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
11
|
class Connection {
|
|
10
12
|
constructor(socket) {
|
|
11
13
|
this.socket = socket;
|
|
@@ -34,10 +36,11 @@ function normalizeIp(ip) {
|
|
|
34
36
|
exports.normalizeIp = normalizeIp;
|
|
35
37
|
const all = [];
|
|
36
38
|
function newConnection(socket) {
|
|
37
|
-
var _a;
|
|
38
39
|
const ip = normalizeIp(socket.remoteAddress || '');
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const res = events_1.default.emit('newSocket', { socket, ip });
|
|
41
|
+
const msg = (res === null || res === void 0 ? void 0 : res.isDefaultPrevented()) ? 'plugin (newSocket)' : res === null || res === void 0 ? void 0 : res.find(lodash_1.default.isString);
|
|
42
|
+
if (msg)
|
|
43
|
+
return disconnect(socket, msg);
|
|
41
44
|
new Connection(socket);
|
|
42
45
|
}
|
|
43
46
|
exports.newConnection = newConnection;
|
|
@@ -72,11 +75,19 @@ function updateConnection(conn, change, changeState) {
|
|
|
72
75
|
events_1.default.emit('connectionUpdated', conn, change);
|
|
73
76
|
}
|
|
74
77
|
exports.updateConnection = updateConnection;
|
|
78
|
+
exports.disconnectionsLog = [];
|
|
75
79
|
function disconnect(what, debugLog = '') {
|
|
76
80
|
if ('socket' in what)
|
|
77
81
|
what = what.socket;
|
|
82
|
+
const ip = normalizeIp(what.remoteAddress || '');
|
|
78
83
|
if (debugLog)
|
|
79
|
-
console.debug("disconnection:", debugLog,
|
|
84
|
+
console.debug("disconnection:", debugLog, ip);
|
|
85
|
+
(0, geo_1.ip2country)(ip).then(res => {
|
|
86
|
+
const rec = { ip, country: res || undefined, ts: new Date, msg: debugLog || undefined };
|
|
87
|
+
exports.disconnectionsLog.unshift(rec);
|
|
88
|
+
exports.disconnectionsLog.length = Math.min(1000, exports.disconnectionsLog.length);
|
|
89
|
+
events_1.default.emit('disconnection', rec);
|
|
90
|
+
});
|
|
80
91
|
return what.destroy();
|
|
81
92
|
}
|
|
82
93
|
exports.disconnect = disconnect;
|