diff --git a/js/README.md b/js/README.md index 2d3dd61..6d4762e 100644 --- a/js/README.md +++ b/js/README.md @@ -1,8 +1,11 @@ - [扩展说明](#扩展说明) + - [uzUtils.js 提供网络、存储 等功能](#uzutilsjs-提供网络存储-等功能) - [uzVideo(视频源) 扩展运行说明](#uzvideo视频源-扩展运行说明) - [uzHome(首页推荐) 扩展运行说明](#uzhome首页推荐-扩展运行说明) +- [panTools(网盘工具)扩展运行说明](#pantools网盘工具扩展运行说明) - [加密说明](#加密说明) - [修改记录](#修改记录) + - [v1.6.00](#v1600) - [v1.5.50](#v1550) - [v1.5.40](#v1540) - [v1.4.00](#v1400) @@ -18,6 +21,8 @@ 6. 集成库可在 `uz3lib.js` 查看,如需添加其他库通用库请联系[机器人](https://t.me/uzVideoAppbot) 7. 成对使用 `// ignore` uz 内部会忽略包裹的内容 +## uzUtils.js 提供网络、存储 等功能 + # uzVideo(视频源) 扩展运行说明 1. 执行每个方法都会为 `webSite` 进行赋值 @@ -99,6 +104,17 @@ graph TD F[结束,点击视频 uz 开始搜索] +``` + +# panTools(网盘工具)扩展运行说明 + +1. 固定实例名称为 `uzPanToolsInstance` +2. uz 运行时仅存在一个网盘工具,请尽量整合所有的解析在 PanTools +3. 流程图 + +```mermaid +graph TD +A[开始] --> B[uz 调用 getShareVideos 获取视频列表] --> C[uz 调用 getPlayInfo 获取播放信息] --> D[结束] ``` @@ -113,6 +129,14 @@ graph TD # 修改记录 +### v1.6.00 + +1. `VideoDetail` 去除 `quarkUrl` 新增 `panUrls` 网盘分享链接列表 + +2. `WebApiBase`、`HomeTabModel` 新增 `uzTag` 字段用于存取环境变量,请勿修改值 +3. 新增 `getEnv(uzTag, key)` 函数用于读取环境变量 +4. 新增 `setEnv(uzTag, key, value, summary)` 用于新增或更新环境变量 + ### v1.5.50 1. 支持使用 uz 加密扩展,加密后请将 `codeID` 填写在 `json` 文件内。 diff --git a/js/core/JSEncrypt.min.js b/js/core/JSEncrypt.min.js index 8f502cf..24de8df 100644 --- a/js/core/JSEncrypt.min.js +++ b/js/core/JSEncrypt.min.js @@ -1,6 +1,2 @@ -// 来自 https://github.com/Yuheng0101/X/blob/main/Utils/ // prettier-ignore -function loadJSEncrypt(){var RSA={};return function(exports){function BigInteger(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function nbi(){return new BigInteger(null)}function am1(t,e,i,n,r,s){for(;0<=--s;){var o=e*this[t++]+i[n]+r;r=Math.floor(o/67108864),i[n++]=67108863&o}return r}function am2(t,e,i,n,r,s){for(var o=32767&e,h=e>>15;0<=--s;){var a=32767&this[t],u=this[t++]>>15,p=h*a+u*o;r=((a=o*a+((32767&p)<<15)+i[n]+(1073741823&r))>>>30)+(p>>>15)+h*u+(r>>>30),i[n++]=1073741823&a}return r}function am3(t,e,i,n,r,s){for(var o=16383&e,h=e>>14;0<=--s;){var a=16383&this[t],u=this[t++]>>14,p=h*a+u*o;r=((a=o*a+((16383&p)<<14)+i[n]+r)>>28)+(p>>14)+h*u,i[n++]=268435455&a}return r}function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){return e=BI_RC[t.charCodeAt(e)],null==e?-1:e}function bnpCopyTo(t){for(var e=this.t-1;0<=e;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=t<0?-1:0,0this.DB?(this[this.t-1]|=(o&(1<>this.DB-s):this[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==i&&0!=(128&t[0])&&(this.s=-1,0>h)&&(r=!0,s=int2char(i));0<=o;)h>(h+=this.DB-e)):(i=this[o]>>(h-=e)&n,h<=0&&(h+=this.DB,--o)),0>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){for(var i=this.t-1;0<=i;--i)e[i+t]=this[i];for(i=t-1;0<=i;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var i=t;i>n|o,o=(this[h]&r)<=this.t)e.t=0;else{var n=t%this.DB,r=this.DB-n,s=(1<>n;for(var o=i+1;o>n;0>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;i>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:0=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}0>this.F2:0);var p=this.FV/r,c=(1<>15,this.um=(1<>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),0<=t.compareTo(this.m)&&t.subTo(this.m,t)}function montSqrTo(t,e){t.squareTo(e),this.reduce(e)}function montMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnpIsEven(){return 0==(0>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||36=i&&(this.dMultiply(n),this.dAddOffset(o,0),o=s=0))}0t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var n=new Array;i=7&t;n.length=1+(t>>3),e.nextBytes(n),0>n)!=(this.s&this.DM)>>n&&(e[r++]=i|this.s<>(n+=this.DB-8)):(i=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(0>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function bnGetLowestSetBit(){for(var t=0;t=this.t?0!=this.s:0!=(this[e]&1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;i>=this.DB;n+=t.s}e.s=n<0?-1:0,0=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,e,i){t.multiplyTo(e,i)}function nSqrTo(t,e){t.squareTo(e)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,e,i){var n,r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;02*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=nbi();return t.copyTo(e),this.reduce(e),e}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);0<=t.compareTo(this.m);)t.subTo(this.m,t)}function barrettSqrTo(t,e){t.squareTo(e),this.reduce(e)}function barrettMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnModPow(t,e){var i,n,r=t.bitLength(),s=nbv(1);if(r<=0)return s;i=r<18?1:r<48?3:r<144?4:r<768?5:6,n=new(r<8?Classic:e.isEven()?Barrett:Montgomery)(e);var o=new Array,h=3,a=i-1,u=(1<>r-a&u:(c=(t[l]&(1<>this.DB+r-a)),h=i;0==(1&c);)c>>=1,--h;if((r-=h)<0&&(r+=this.DB,--l),f)o[c].copyTo(s),f=!1;else{for(;1>1)>lowprimes.length&&(t=lowprimes.length);for(var r=nbi(),s=0;s>6|192):(n[--e]=63&s|128,n[--e]=s>>6&63|128,n[--e]=s>>12|224)}if(n[--e]=0,2==i)for(var o=new SecureRandom,h=new Array;2>3,e),null==e?null:(e=this.doPublic(e),null==e?null:(e=e.toString(16),0==(1&e.length)?e:"0"+e))}function RSAPrivateEncrypt(t,e){return e=pkcs1pad2(t,this.n.bitLength()+7>>3,e),null==e?null:(e=this.doPrivate(e),null==e?null:(e=e.toString(16),0==(1&e.length)?e:"0"+e))}function pkcs1unpad2(t,e,i){var n=t.toByteArray(),r=0;if(0==i)r=-1;else{for(;r=n.length)return null}for(var s="";++r>1;this.e=parseInt(e,16);for(var r=new BigInteger(e,16);;){for(;this.p=new BigInteger(t-n,1,i),0!=this.p.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE)||!this.p.isProbablePrime(10););for(;this.q=new BigInteger(n,1,i),0!=this.q.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE)||!this.q.isProbablePrime(10););this.p.compareTo(this.q)<=0&&(h=this.p,this.p=this.q,this.q=h);var s=this.p.subtract(BigInteger.ONE),o=this.q.subtract(BigInteger.ONE),h=s.multiply(o);if(0==h.gcd(r).compareTo(BigInteger.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(h),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(o),this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)}function RSAPrivateDecrypt(t,e){return t=parseBigInt(t,16),t=this.doPrivate(t),null==t?null:pkcs1unpad2(t,this.n.bitLength()+7>>3,e)}function RSAPublicDecrypt(t,e){return t=parseBigInt(t,16),t=this.doPublic(t),null==t?null:pkcs1unpad2(t,this.n.bitLength()+7>>3,e)}function hex2b64(t){for(var e,i="",n=0;n+3<=t.length;n+=3)e=parseInt(t.substring(n,n+3),16),i+=b64map.charAt(e>>6)+b64map.charAt(63&e);for(n+1==t.length?(e=parseInt(t.substring(n,n+1),16),i+=b64map.charAt(e<<2)):n+2==t.length&&(e=parseInt(t.substring(n,n+2),16),i+=b64map.charAt(e>>2)+b64map.charAt((3&e)<<4));0<(3&i.length);)i+=b64pad;return i}function b64tohex(t){for(var e,i="",n=0,r=0;r>2),e=3&v,1):1==n?(i+=int2char(e<<2|v>>4),e=15&v,2):2==n?(i+=int2char(e),i+=int2char(v>>2),e=3&v,3):(i+=int2char(e<<2|v>>4),i+=int2char(15&v),0));return 1==n&&(i+=int2char(e<<2)),i}function b64toBA(t){for(var e=b64tohex(t),i=new Array,n=0;2*n>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(1>1;this.e=parseInt(e,16);var s=new BigInteger(e,16),o=this,h=function(){function e(){o.p.compareTo(o.q)<=0&&(n=o.p,o.p=o.q,o.q=n);var t=o.p.subtract(BigInteger.ONE),e=o.q.subtract(BigInteger.ONE),n=t.multiply(e);0==n.gcd(s).compareTo(BigInteger.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(e),o.coeff=o.q.modInverse(o.p),setTimeout(function(){i()},0)):setTimeout(h,0)}var a=function(){o.q=nbi(),o.q.fromNumberAsync(r,1,n,function(){o.q.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)})})},u=function(){o.p=nbi(),o.p.fromNumberAsync(t-r,1,n,function(){o.p.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(h,0)},BigInteger.prototype.gcda=function(t,e){var i=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();i.compareTo(n)<0&&(t=i,i=n,n=t);var r,s=i.getLowestSetBit(),o=n.getLowestSetBit();o<0?e(i):(st&&r.subTo(BigInteger.ONE.shiftLeft(t-1),r),r.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(s,0)},setTimeout(s,0)):(o=new Array,i=7&t,o.length=1+(t>>3),e.nextBytes(o),0=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setByDateValue=function(t,e,i,n,r,s){s=new Date(Date.UTC(t,e-1,i,n,r,s,0)),this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},JSX.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},JSX.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},JSX.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){t=new BigInteger(String(t),10),this.setByBigInteger(t)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):void 0!==t.hex&&this.setValueHex(t.hex))},JSX.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7>16,n[n.length]=r>>8&255,n[n.length]=255&r,s=r=0):r<<=6}}switch(s){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:n[n.length]=r>>10;break;case 3:n[n.length]=r>>16,n[n.length]=r>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var i=e.re.exec(t);if(i)if(i[1])t=i[1];else{if(!i[2])throw"RegExp out of sync";t=i[2]}return e.decode(t)}};window.Base64=e}(),function(t){"use strict";function e(t,i){t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=i)}function i(t,e,i,n,r){this.stream=t,this.header=e,this.length=i,this.tag=n,this.sub=r}var n=function(t,e){return t=document.createElement(t),t.className=e,t},r=function(t){return document.createTextNode(t)};e.prototype.get=function(e){if(e===t&&(e=this.pos++),e>=this.enc.length)throw"Requesting byte offset "+e+" on a stream of length "+this.enc.length;return this.enc[e]},e.prototype.hexDigits="0123456789ABCDEF",e.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},e.prototype.hexDump=function(t,e,i){for(var n="",r=t;r>a&1?"1":"0";s=0}}return r},e.prototype.parseOctetString=function(t,e){var i=e-t,n="("+i+" byte) ";100>6,i=(this.tag,31&this.tag);switch(e){case 0:switch(i){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString";default:return"Universal_"+i.toString(16)}case 1:return"Application_"+i.toString(16);case 2:return"["+i+"]";case 3:return"Private_"+i.toString(16)}},i.prototype.reSeemsASCII=/^[ -~]+$/,i.prototype.content=function(){if(this.tag===t)return null;var e=this.tag>>6,i=31&this.tag,n=this.posContent(),r=Math.abs(this.length);if(0!=e)return null!==this.sub?"("+this.sub.length+" elem)":(e=this.stream.parseStringISO(n,n+Math.min(r,100)),this.reSeemsASCII.test(e)?e.substring(0,200)+(200";i+="Length: "+this.header+"+",0<=this.length?i+=this.length:i+=-this.length+" (undefined)",32&this.tag?i+="
(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+="
(encapsulates)"),null!==s&&(i+="
Value:
"+s+"","object"!=typeof oids||6!=this.tag||(s=oids[s])&&(s.d&&(i+="
"+s.d),s.c&&(i+="
"+s.c),s.w&&(i+="
(warning!)"))),o.innerHTML=i,t.appendChild(o);var h=n("div","sub");if(null!==this.sub)for(var a=0,u=this.sub.length;a>6&1)return!1;try{var o=i.decodeLength(s);return s.pos-r.pos+o==n}catch(t){return!1}},i.decode=function(t){t instanceof e||(t=new e(t,0));var n=new e(t),r=t.get(),s=i.decodeLength(t),o=t.pos-n.pos,h=null;if(i.hasContent(r,s,t)){var a=t.pos;if(3==r&&t.get(),h=[],0<=s){for(var u=a+s;t.pos>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){t=k.encrypt_public(t,padding),ct+=t}),output?hex2b64(ct):ct;var t=k.encrypt_public(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.private_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){t=k.decrypt_private(t,padding),ct+=t}),ct}var y=k.decrypt_private(string,padding);return y}catch(t){return!1}},JSEncrypt.prototype.private_encryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){t=k.encrypt_private(t,padding),ct+=t}),output?hex2b64(ct):ct;var t=k.encrypt_private(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.public_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){t=k.decrypt_public(t,padding),ct+=t}),ct}var y=k.decrypt_public(string,padding);return y}catch(t){return!1}},JSEncrypt.version="2.3.0",exports.JSEncrypt=JSEncrypt}(RSA),RSA} - - +function loadJSEncrypt(){var t={155:t=>{var e,i,r=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(i){try{return e.call(null,t,0)}catch(i){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var h,a=[],u=!1,c=-1;function f(){u&&h&&(u=!1,h.length?a=h.concat(a):c=-1,a.length&&l())}function l(){if(!u){var t=o(f);u=!0;for(var e=a.length;e;){for(h=a,a=[];++c1)for(var i=1;i{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};return(()=>{"use strict";i.d(r,{default:()=>ht});var t="0123456789abcdefghijklmnopqrstuvwxyz";function e(e){return t.charAt(e)}function n(t,e){return t&e}function s(t,e){return t|e}function o(t,e){return t^e}function h(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var c,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function l(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=f.charAt(i>>6)+f.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=f.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=f.charAt(i>>2)+f.charAt((3&i)<<4));(3&r.length)>0;)r+="=";return r}function p(t){var i,r="",n=0,s=0;for(i=0;i>2),s=3&o,n=1):1==n?(r+=e(s<<2|o>>4),s=15&o,n=2):2==n?(r+=e(s),r+=e(o>>2),s=3&o,n=3):(r+=e(s<<2|o>>4),r+=e(15&o),n=0))}return 1==n&&(r+=e(s<<2)),r}var g,d={decode:function(t){var e;if(void 0===g){var i="= \f\n\r\t \u2028\u2029";for(g=Object.create(null),e=0;e<64;++e)g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(g["-"]=62,g._=63,e=0;e<9;++e)g[i.charAt(e)]=-1}var r=[],n=0,s=0;for(e=0;e=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,s=0):n<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=d.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return d.decode(t)}},v=1e13,m=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;i0&&(n[i]=e)},t.prototype.sub=function(t){var e,i,r=this.buf,n=r.length;for(e=0;e=0;--r)i+=(v+e[r]).toString().substring(1);return i},t.prototype.valueOf=function(){for(var t=this.buf,e=0,i=t.length-1;i>=0;--i)e=e*v+t[i];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),y=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,b=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function T(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}var S,E=function(){function t(e,i){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=i)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,i){for(var r="",n=t;n176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var i="",r=t;r191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},t.prototype.parseStringBMP=function(t,e){for(var i,r,n="",s=t;s127,s=n?255:0,o="";r==s&&++t4){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(var h=new m(r),a=t+1;a=a;--u)s+=h>>u&1?"1":"0";if(s.length>i)return n+T(s,i)}return n+s},t.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return T(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";r>(i/=2)&&(e=t+i);for(var s=t;si&&(n+="…"),n},t.prototype.parseOID=function(t,e,i){for(var r="",n=new m,s=0,o=t;oi)return T(r,i);n=new m,s=0}}return s>0&&(r+=".incomplete"),r},t}(),w=function(){function t(t,e,i,r,n){if(!(r instanceof D))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+i,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);case 6:return this.stream.parseOID(e,e+i,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return T(this.stream.parseStringUTF(e,e+i),t);case 18:case 19:case 20:case 21:case 22:case 26:return T(this.stream.parseStringISO(e,e+i),t);case 30:return T(this.stream.parseStringBMP(e,e+i),t);case 23:case 24:return this.stream.parseTime(e,e+i,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var i=0,r=this.sub.length;i6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===i)return null;e=0;for(var r=0;r>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var i=new m;do{e=t.get(),i.mulAdd(128,127&e)}while(128&e);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=(1<<26)/x[x.length-1],B=function(){function t(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,n=(1<0)for(a>a)>0&&(s=!0,o=e(r));h>=0;)a>(a+=this.DB-i)):(r=this[h]>>(a-=i)&n,a<=0&&(a+=this.DB,--h)),r>0&&(s=!0),s&&(o+=e(r));return s?o:"0"},t.prototype.negate=function(){var e=N();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+F(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var i=N();return this.abs().divRemTo(e,null,i),this.s<0&&i.compareTo(t.ZERO)>0&&e.subTo(i,i),i},t.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new A(e):new V(e),this.exp(t,i)},t.prototype.clone=function(){var t=N();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(t-- >0)for(r>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this[t]&(1<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=N();return this.bitwiseTo(t,n,e),e},t.prototype.or=function(t){var e=N();return this.bitwiseTo(t,s,e),e},t.prototype.xor=function(t){var e=N();return this.bitwiseTo(t,o,e),e},t.prototype.andNot=function(t){var e=N();return this.bitwiseTo(t,h,e),e},t.prototype.not=function(){for(var t=N(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var c=N();for(r.sqrTo(o[1],c);h<=u;)o[h]=N(),r.mulTo(c,o[h-2],o[h]),h+=2}var f,l,p=t.t-1,g=!0,d=N();for(n=F(t[p])-1;p>=0;){for(n>=a?f=t[p]>>n-a&u:(f=(t[p]&(1<0&&(f|=t[p-1]>>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;h>1;)r.sqrTo(s,d),r.sqrTo(d,s),h-=2;h>0?r.sqrTo(s,d):(l=s,s=d,d=l),r.mulTo(d,o[f],s)}for(;p>=0&&0==(t[p]&1<=0?(r.subTo(n,r),i&&s.subTo(h,s),o.subTo(a,o)):(n.subTo(r,n),i&&h.subTo(s,h),a.subTo(o,a))}return 0!=n.compareTo(t.ONE)?t.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},t.prototype.pow=function(t){return this.exp(t,new O)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),s=i.getLowestSetBit();if(s<0)return e;for(n0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return s>0&&i.lShiftTo(s,i),i},t.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=x[x.length-1]){for(e=0;e=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(e,i);r=2}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var h=8==r?255&+e[n]:H(e,n);h<0?"-"==e.charAt(n)&&(s=!0):(s=!1,0==o?this[this.t++]=h:o+r>this.DB?(this[this.t-1]|=(h&(1<>this.DB-o):this[this.t-1]|=h<=this.DB&&(o-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var i=t;i=0;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<=0;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;r>0&&(e[this.t-i-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},t.prototype.multiplyTo=function(e,i){var r=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,i,r){var n=e.abs();if(!(n.t<=0)){var s=this.abs();if(s.t0?(n.lShiftTo(u,o),s.lShiftTo(u,r)):(n.copyTo(o),s.copyTo(r));var c=o.t,f=o[c-1];if(0!=f){var l=f*(1<1?o[c-2]>>this.F2:0),p=this.FV/l,g=(1<=0&&(r[r.t++]=1,r.subTo(y,r)),t.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t=0;){var b=r[--v]==f?this.DM:Math.floor(r[v]*p+(r[v-1]+d)*g);if((r[v]+=o.am(0,b,r,m,0,c))0&&r.rShiftTo(u,r),h<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,i){if(e>4294967295||e<1)return t.ONE;var r=N(),n=N(),s=i.convert(this),o=F(e)-1;for(s.copyTo(r);--o>=0;)if(i.sqrTo(r,n),(e&1<0)i.mulTo(n,s,r);else{var h=r;r=n,n=h}return i.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),r=C(i),n=N(),s=N(),o="";for(this.divRemTo(r,n,s);n.signum()>0;)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);return s.intValue().toString(t)+o},t.prototype.fromRadix=function(e,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),n=Math.pow(i,r),s=!1,o=0,h=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(h,0),o=0,h=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(h,0)),s&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,i,r){if("number"==typeof i)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),i.nextBytes(n),o>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(var n=i.t-this.t;r=0;)i[r]=0;for(r=Math.max(e-this.t,0);r0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},t.prototype.millerRabin=function(e){var i=this.subtract(t.ONE),r=i.getLowestSetBit();if(r<=0)return!1;var n=i.shiftRight(r);(e=e+1>>1)>x.length&&(e=x.length);for(var s=N(),o=0;o0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout((function(){e(r)}),0))};setTimeout(h,10)}},t.prototype.fromNumberAsync=function(e,i,r,n){if("number"==typeof i)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);var o=this,h=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(i)?setTimeout((function(){n()}),0):setTimeout(h,0)};setTimeout(h,0)}else{var a=[],u=7&e;a.length=1+(e>>3),i.nextBytes(a),u>0?a[0]&=(1<=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),V=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=N();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),I=function(){function t(t){this.m=t,this.r2=N(),this.q3=N(),B.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=N();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function N(){return new B(null)}function P(t,e){return new B(t,e)}var M="undefined"!=typeof navigator;M&&"Microsoft Internet Explorer"==navigator.appName?(B.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;--s>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},S=30):M&&"Netscape"!=navigator.appName?(B.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},S=26):(B.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;--s>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},S=28),B.prototype.DB=S,B.prototype.DM=(1<>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}B.ZERO=C(0),B.ONE=C(1);var U,K,k=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),_=null;if(null==_){_=[],K=0;var z=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var Z=new Uint32Array(256);for(window.crypto.getRandomValues(Z),z=0;z=256||K>=256)window.removeEventListener?window.removeEventListener("mousemove",$,!1):window.detachEvent&&window.detachEvent("onmousemove",$);else try{var e=t.x+t.y;_[K++]=255&e,G+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",$,!1):window.attachEvent&&window.attachEvent("onmousemove",$))}function Y(){if(null==U){for(U=new k;K<256;){var t=Math.floor(65536*Math.random());_[K++]=255&t}for(U.init(_),K=0;K<_.length;++K)_[K]=0;K=0}return U.next()}var J=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e0&&e.length>0?(this.n=P(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,i=function(t,e){if(e=0&&e>0;){var n=t.charCodeAt(r--);n<128?i[--e]=n:n>127&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new J,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);i[--e]=o[0]}return i[--e]=2,i[--e]=0,new B(i)}(t,e);if(null==i)return null;var r=this.doPublic(i);if(null==r)return null;for(var n=r.toString(16),s=n.length,o=0;o<2*e-s;o++)n="0"+n;return n},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=P(t,16),this.e=parseInt(e,16),this.d=P(i,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=P(t,16),this.e=parseInt(e,16),this.d=P(i,16),this.p=P(r,16),this.q=P(n,16),this.dmp1=P(s,16),this.dmq1=P(o,16),this.coeff=P(h,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var i=new J,r=t>>1;this.e=parseInt(e,16);for(var n=new B(e,16);;){for(;this.p=new B(t-r,1,i),0!=this.p.subtract(B.ONE).gcd(n).compareTo(B.ONE)||!this.p.isProbablePrime(10););for(;this.q=new B(r,1,i),0!=this.q.subtract(B.ONE).gcd(n).compareTo(B.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(B.ONE),h=this.q.subtract(B.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(B.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=P(t,16),i=this.doPrivate(e);return null==i?null:function(t,e){for(var i=t.toByteArray(),r=0;r=i.length)return null;for(var n="";++r191&&s<224?(n+=String.fromCharCode((31&s)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,i){var r=new J,n=t>>1;this.e=parseInt(e,16);var s=new B(e,16),o=this,h=function(){var e=function(){if(o.p.compareTo(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(B.ONE),r=o.q.subtract(B.ONE),n=e.multiply(r);0==n.gcd(s).compareTo(B.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout((function(){i()}),0)):setTimeout(h,0)},a=function(){o.q=N(),o.q.fromNumberAsync(n,1,r,(function(){o.q.subtract(B.ONE).gcda(s,(function(t){0==t.compareTo(B.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)}))}))},u=function(){o.p=N(),o.p.fromNumberAsync(t-n,1,r,(function(){o.p.subtract(B.ONE).gcda(s,(function(t){0==t.compareTo(B.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)}))}))};setTimeout(u,0)};setTimeout(h,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},tt.asn1.DERAbstractString=function(t){tt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},W.lang.extend(tt.asn1.DERAbstractString,tt.asn1.ASN1Object),tt.asn1.DERAbstractTime=function(t){tt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,i){var r=this.zeroPadding,n=this.localDateToUTC(t),s=String(n.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=s+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){var h=n.getMilliseconds();if(0!=h){var a=r(String(h),3);o=o+"."+(a=a.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},W.lang.extend(tt.asn1.DERAbstractTime,tt.asn1.ASN1Object),tt.asn1.DERAbstractStructured=function(t){tt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},W.lang.extend(tt.asn1.DERAbstractStructured,tt.asn1.ASN1Object),tt.asn1.DERBoolean=function(){tt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},W.lang.extend(tt.asn1.DERBoolean,tt.asn1.ASN1Object),tt.asn1.DERInteger=function(t){tt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new B(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},W.lang.extend(tt.asn1.DERInteger,tt.asn1.ASN1Object),tt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=tt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}tt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7=2?(n[n.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}(t):d.unarmor(t),n=w.decode(r);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=P(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var s=n.sub[3].getHexStringValue();this.d=P(s,16);var o=n.sub[4].getHexStringValue();this.p=P(o,16);var h=n.sub[5].getHexStringValue();this.q=P(h,16);var a=n.sub[6].getHexStringValue();this.dmp1=P(a,16);var u=n.sub[7].getHexStringValue();this.dmq1=P(u,16);var f=n.sub[8].getHexStringValue();this.coeff=P(f,16)}else{if(2!==n.sub.length)return!1;if(n.sub[0].sub){var l=n.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=P(e,16),i=l.sub[1].getHexStringValue(),this.e=parseInt(i,16)}else e=n.sub[0].getHexStringValue(),this.n=P(e,16),i=n.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new tt.asn1.DERInteger({int:0}),new tt.asn1.DERInteger({bigint:this.n}),new tt.asn1.DERInteger({int:this.e}),new tt.asn1.DERInteger({bigint:this.d}),new tt.asn1.DERInteger({bigint:this.p}),new tt.asn1.DERInteger({bigint:this.q}),new tt.asn1.DERInteger({bigint:this.dmp1}),new tt.asn1.DERInteger({bigint:this.dmq1}),new tt.asn1.DERInteger({bigint:this.coeff})]};return new tt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new tt.asn1.DERSequence({array:[new tt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new tt.asn1.DERNull]}),e=new tt.asn1.DERSequence({array:[new tt.asn1.DERInteger({bigint:this.n}),new tt.asn1.DERInteger({int:this.e})]}),i=new tt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new tt.asn1.DERSequence({array:[t,i]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var i="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(i,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(X),st=i(155),ot=void 0!==st?null===(it=st.env)||void 0===it?void 0:"3.3.2":void 0;const ht=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new nt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(p(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,i){try{return l(this.getKey().sign(t,e,i))}catch(t){return!1}},t.prototype.verify=function(t,e,i){try{return this.getKey().verify(t,p(e),i)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new nt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=ot,t}()})(),r.default} \ No newline at end of file diff --git a/js/core/uzHome.js b/js/core/uzHome.js index a8233ad..762da0c 100644 --- a/js/core/uzHome.js +++ b/js/core/uzHome.js @@ -79,14 +79,25 @@ class RepTabList { class HomeTabModel { constructor() { - // 当前分类的链接 + /** + * 当前分类的链接 + **/ this.id = ""; - // 分类名称 + + /** + * 分类名称 + */ this.name = ""; + /** * 是否是筛选列表 */ this.isFilter = false; + + /** + * 扩展运行标识 ** uzApp 运行时自动赋值,请勿修改 ** + */ + this.uzTag = ""; } } diff --git a/js/core/uzUtils.js b/js/core/uzUtils.js index 58768c2..bd1939b 100644 --- a/js/core/uzUtils.js +++ b/js/core/uzUtils.js @@ -51,6 +51,49 @@ class UZUtils { return str; } + /** + * 计算最长公共子串 + * @param {string} s1 + * @param {string} s2 + * @returns + */ + static lcs(s1, s2) { + const m = s1.length, + n = s2.length; + const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0)); + let maxLength = 0, + endIndex = 0; + + for (let i = 1; i <= m; i++) { + for (let j = 1; j <= n; j++) { + if (s1[i - 1] === s2[j - 1]) { + dp[i][j] = dp[i - 1][j - 1] + 1; + if (dp[i][j] > maxLength) { + maxLength = dp[i][j]; + endIndex = i - 1; + } + } + } + } + + return s1.substring(endIndex - maxLength + 1, endIndex + 1); + } + + /** + * 查找元素在数组中的位置 + * @param {Array} list + * @param {string} element + * @returns + */ + static findIndex(list, element) { + for (let i = 0; i < list.length; i++) { + if (list[i] === element) { + return i; + } + } + return -1; + } + /** * 用于在 uz 扩展调试模式中展示 log 信息 */ @@ -67,14 +110,21 @@ class ProData { constructor() { this.error = ""; this.data; + /** * @type {object} 响应头 */ this.headers; + /** * @type {number} 状态码 */ this.code; + + /** + * @type {boolean} 是否成功 + */ + this.ok = () => this.code === 200; } } @@ -104,25 +154,31 @@ async function req(url, options) { return pro; } -// /** -// * 展示 toast -// */ -// function toast() { -// sendMessage("toast", JSON.stringify([...arguments])); -// } -// -// /** -// * 读取环境变量 -// */ -// async function getEnv(key) { -// let res = await sendMessage("getEnv", JSON.stringify([key])); -// return JSON.parse(res); -// } -// -// /** -// * 写入环境变量 -// */ -// async function setEnv(key, value) { -// let res = await sendMessage("setEnv", JSON.stringify([key, value])); -// return JSON.parse(res); -// } +//MARK: - 环境变量(持久存储) +/** + * 读取环境变量 + * @param {string} uzTag 直接传入扩展的 uzTag ,请勿修改 + * @param {string} key + * @returns {@Promise} + */ +async function getEnv(uzTag, key) { + let res = await sendMessage( + "getEnv", + JSON.stringify({ uzTag: uzTag, key: key }) + ); + return res; +} + +/** + * 写入环境变量 + * @param {string} uzTag 直接传入扩展的 uzTag ,请勿修改 + * @param {string} key + * @param {string} value + * @param {string} summary 描述,新增时建议传入。修改时不必传入 + */ +async function setEnv(uzTag, key, value, summary) { + let res = await sendMessage( + "setEnv", + JSON.stringify({ uzTag: uzTag, key: key, value: value, summary: summary }) + ); +} diff --git a/js/core/uzVideo.js b/js/core/uzVideo.js index e1b1ecd..405195b 100644 --- a/js/core/uzVideo.js +++ b/js/core/uzVideo.js @@ -116,8 +116,11 @@ class VideoDetail { this.vod_content = ""; // 地区 this.vod_area = ""; - // 夸克网盘链接 暂未实现 - this.quarkUrl = ""; + /** + * 网盘分享链接列表 + * @type {string[]} + */ + this.panUrls = []; } } @@ -241,8 +244,18 @@ class UZSubclassVideoListArgs extends UZArgs { * 扩展基类 */ class WebApiBase { - // 网站主页 - webSite = ""; + constructor() { + /** + * 网站主页 + **/ + this.webSite = ""; + + /** + * 扩展运行标识 ** uzApp 运行时自动赋值,请勿修改 ** + */ + this.uzTag = ""; + } + /** * 异步获取分类列表的方法。 * @param {UZArgs} args diff --git a/js/panTools.json b/js/panTools.json new file mode 100644 index 0000000..e491da9 --- /dev/null +++ b/js/panTools.json @@ -0,0 +1,5 @@ +{ + "name": "UC、夸克 网盘解析工具", + "url": "http://192.168.11.225:9527/download/panTools.js", + "env": "UCCookie##用于播放UC网盘视频,请在网页获取UC网盘的Cookie&&夸克Cookie##用于播放Quark网盘视频,请在网页获取Quark网盘的Cookie" +} diff --git a/js/spider/panTools.js b/js/spider/panTools.js new file mode 100644 index 0000000..afaac65 --- /dev/null +++ b/js/spider/panTools.js @@ -0,0 +1,649 @@ +// ignore +import {} from "../core/uzVideo.js"; +import {} from "../core/uzHome.js"; +import {} from "../core/uz3lib.js"; +import {} from "../core/uzUtils.js"; +// ignore + +/** + * 网盘类型 + * 环境变量 key 为 PanType.xx + "Cookie",请在 json 文件中添加 + */ +const PanType = { + /** + * 夸克 + **/ + Quark: "夸克", + + /** + * UC + **/ + UC: "UC", +}; + +/** + * 播放信息 + **/ +class PanPlayInfo { + constructor(url = "", error = "", playHeaders = {}) { + this.url = url; + this.error = error; + this.playHeaders = playHeaders; + } +} + +/** + * 网盘视频项 + */ +class PanVideoItem { + constructor() { + /** + * 展示名称 例如 第一集 + */ + this.name = ""; + + /** + * 分组名称 例如 原画 、 普画 非必须 + */ + this.fromName = ""; + + /** + * 网盘类型 用于获取播放信息时 + * @type {PanType} + **/ + this.panType = PanType.UC; + + /** + * 关键数据 用于获取播放信息时 + * @type {Object} + */ + this.data; + } +} + +/** + * 网盘播放列表 + */ +class PanListDetail { + constructor() { + /** + * @type {PanVideoItem[]} + * 视频列表 + */ + this.videos = []; + this.error = ""; + } +} + +//MARK: - 夸克 UC 相关实现 +// 抄自 https://github.com/jadehh/TVSpider +// prettier-ignore +class QuarkUCVideoItem { constructor() { this.fileId = ""; this.shareId = ""; this.shareToken = ""; this.shareFileToken = ""; this.seriesId = ""; this.name = ""; this.type = ""; this.formatType = ""; this.size = ""; this.parent = ""; this.shareData = null; this.lastUpdateAt = 0; this.subtitle = null; } static objectFrom(itemJson, shareId) { const item = new QuarkUCVideoItem(); item.fileId = itemJson.fid || ""; item.shareId = shareId; item.shareToken = itemJson.stoken || ""; item.shareFileToken = itemJson.share_fid_token || ""; item.seriesId = itemJson.series_id || ""; item.name = itemJson.file_name || ""; item.type = itemJson.obj_category || ""; item.formatType = itemJson.format_type || ""; item.size = (itemJson.size || "").toString(); item.parent = itemJson.pdir_fid || ""; item.lastUpdateAt = itemJson.last_update_at || 0; return item; } } +class QuarkClient { + static apiUrl = "https://drive-pc.quark.cn/1/clouddrive/"; + static pr = "pr=ucpro&fr=pc"; + static httpHeaders = { + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch", + Referer: "https://pan.quark.cn/", + "Content-Type": "application/json", + }; +} +class UCClient { + static apiUrl = "https://pc-api.uc.cn/1/clouddrive/"; + static pr = "pr=UCBrowser&fr=pc"; + static httpHeaders = { + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) uc-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch", + referer: "https://drive.uc.cn", + "Content-Type": "application/json", + }; +} +class QuarkUC { + constructor(isQuark = false) { + this.isQuark = isQuark; + this.cookie = ""; + this.shareTokenCache = {}; + this.saveFileIdCaches = {}; + this.saveDirId = null; + this.saveDirName = "uz影视"; + this.isVip = false; + this.updateCookie = () => {}; + } + get panName() { + if (this.isQuark) { + return PanType.Quark; + } else { + return PanType.UC; + } + } + get apiUrl() { + if (this.isQuark) { + return QuarkClient.apiUrl; + } else { + return UCClient.apiUrl; + } + } + get pr() { + if (this.isQuark) { + return QuarkClient.pr; + } else { + return UCClient.pr; + } + } + get headers() { + const headers = this.isQuark + ? QuarkClient.httpHeaders + : UCClient.httpHeaders; + headers["Cookie"] = this.cookie; + return headers; + } + /** * 获取文件列表 * @param {string} shareUrl * @returns {@Promise} **/ async getFilesByShareUrl( + shareUrl + ) { + const data = new PanListDetail(); + await this.getVip(); + const shareData = this.getShareData(shareUrl); + if (shareData == null) { + data.error = "分享链接无效"; + return data; + } + await this.getShareToken(shareData); + const videos = []; + const subtitles = []; + if (!this.shareTokenCache.hasOwnProperty(shareData.shareId)) { + data.error = "资源获取失败"; + return data; + } + await this.listFile( + shareData, + videos, + subtitles, + shareData.shareId, + shareData.folderId + ); + if (subtitles.length > 0) { + for (const item of videos) { + const matchSubtitle = this.findBestLCS(item, subtitles); + if (matchSubtitle.bestMatch != null) { + item.subtitle = matchSubtitle.bestMatch.target; + } + } + } + const playForm = this.getPlayForm(); + for (let index = 0; index < playForm.length; index++) { + const flag = playForm[index]; + for (let index = 0; index < videos.length; index++) { + const element = videos[index]; + element.flag = flag; + const videoItem = new PanVideoItem(); + videoItem.data = element; + videoItem.panType = this.panName; + videoItem.name = element.name; + videoItem.fromName = flag; + data.videos.push(videoItem); + } + } + return data; + } + /** * 获取播放信息 * @param {{flag:string,shareId:string,shareToken:string,fileId:string,shareFileToken:string }} data * @returns {@Promise} */ async getPlayUrl( + data + ) { + if (this.cookie.length === 0) { + return new PanPlayInfo( + "", + "请在 设置 -> 数据管理 -> 环境变量 中为" + + this.panName + + "Cookie" + + " 添加值" + ); + } + await this.getVip(); + let playData; + try { + const { flag, shareId, shareToken, fileId, shareFileToken } = data; + if (flag.includes("原画")) { + playData = await this.getDownload( + shareId, + shareToken, + fileId, + shareFileToken, + true + ); + } else { + playData = await this.getLiveTranscoding( + shareId, + shareToken, + fileId, + shareFileToken, + flag + ); + } + } catch (error) { + playData = new PanPlayInfo("", error.toString()); + } + playData.playHeaders = { cookie: this.cookie }; + return playData; + } + async api(url, data = null, retry = 3, method = "post") { + let leftRetry = retry; + while (leftRetry > 0) { + try { + const response = await req(this.apiUrl + url, { + method: method, + headers: this.headers, + data: JSON.stringify(data), + }); + if (response.code === 401) { + this.cookie = ""; + return {}; + } + const resp = response.data; + if (response.headers["set-cookie"]) { + const puus = [response.headers["set-cookie"]] + .join(";;;") + .match(/__puus=([^;]+)/); + if (puus) { + if (this.cookie.match(/__puus=([^;]+)/)[1] != puus[1]) { + this.cookie = this.cookie.replace( + /__puus=[^;]+/, + `__puus=${puus[1]}` + ); + this.updateCookie(); + } + } + } + return resp; + } catch (e) {} + leftRetry--; + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + return resp; + } + /** * 根据链接获取分享ID和文件夹ID * @param {string} url * @returns {null|{shareId: string, folderId: string}} */ getShareData( + url + ) { + let regex = /https:\/\/pan\.quark\.cn\/s\/([^\\|#/]+)/; + if (!this.isQuark) { + regex = /https:\/\/drive\.uc\.cn\/s\/([^\\|#/]+)/; + } + const matches = regex.exec(url); + if (matches != null) { + return { shareId: matches[1], folderId: "0" }; + } + return null; + } + /** * 获取分享token * @param {{shareId: string, sharePwd: string}} shareData */ async getShareToken( + shareData + ) { + if (!this.shareTokenCache.hasOwnProperty(shareData.shareId)) { + delete this.shareTokenCache[shareData.shareId]; + const shareToken = await this.api(`share/sharepage/token?${this.pr}`, { + pwd_id: shareData.shareId, + passcode: shareData.sharePwd || "", + }); + if (shareToken.data != null && shareToken.data.stoken != null) { + this.shareTokenCache[shareData.shareId] = shareToken.data; + } + } + } + async getVip() { + if (this.cookie == "") { + this.isVip = false; + return; + } + const listData = await this.api( + `member?${this.pr}&uc_param_str=&fetch_subscribe=true&_ch=home&fetch_identity=true`, + null, + 3, + "get" + ); + this.isVip = listData.data?.member_type === "EXP_SVIP"; + } + getPlayFormatList() { + return this.isVip ? ["4K", "超清", "高清", "普画"] : ["普画"]; + } + getPlayFormtQuarkList() { + return this.isVip + ? ["4k", "2k", "super", "high", "normal", "low"] + : ["low"]; + } + async listFile(shareData, videos, subtitles, shareId, folderId, page = 1) { + const prePage = 200; + const listData = await this.api( + `share/sharepage/detail?${ + this.pr + }&pwd_id=${shareId}&stoken=${encodeURIComponent( + this.shareTokenCache[shareId].stoken + )}&pdir_fid=${folderId}&force=0&_page=${page}&_size=${prePage}&_sort=file_type:asc,file_name:asc`, + null, + 3, + "get" + ); + if (listData.data == null) return []; + const items = listData.data.list || []; + if (items.length === 0) return []; + const subDir = []; + for (const item of items) { + if (item.dir === true) { + subDir.push(item); + } else if (item.file === true && item.obj_category === "video") { + if (parseInt(item.size.toString()) < 1024 * 1024 * 5) continue; + item.stoken = this.shareTokenCache[shareData.shareId].stoken; + videos.push(QuarkUCVideoItem.objectFrom(item, shareData.shareId)); + } else if ( + item.type === "file" && + this.subtitleExts.some((x) => item.file_name.endsWith(x)) + ) { + subtitles.push(QuarkUCVideoItem.objectFrom(item, shareData.shareId)); + } + } + if (page < Math.ceil(listData.metadata._total / prePage)) { + const nextItems = await this.listFile( + shareData, + videos, + subtitles, + shareId, + folderId, + page + 1 + ); + items.push(...nextItems); + } + for (const dir of subDir) { + const subItems = await this.listFile( + shareData, + videos, + subtitles, + shareId, + dir.fid + ); + items.push(...subItems); + } + return items; + } + findBestLCS(mainItem, targetItems) { + const results = []; + let bestMatchIndex = 0; + for (let i = 0; i < targetItems.length; i++) { + const currentLCS = UZUtils.lcs(mainItem.name, targetItems[i].name); + results.push({ target: targetItems[i], lcs: currentLCS }); + if (currentLCS.length > results[bestMatchIndex].lcs.length) { + bestMatchIndex = i; + } + } + const bestMatch = results[bestMatchIndex]; + return { + allLCS: results, + bestMatch: bestMatch, + bestMatchIndex: bestMatchIndex, + }; + } + clean() { + this.saveFileIdCaches = {}; + } + async clearSaveDir() { + const listData = await this.api( + `file/sort?${this.pr}&pdir_fid=${this.saveDirId}&_page=1&_size=200&_sort=file_type:asc,updated_at:desc`, + null, + 3, + "get" + ); + if ( + listData.data != null && + listData.data.list != null && + listData.data.list.length > 0 + ) { + await this.api(`file/delete?${this.pr}`, { + action_type: 2, + filelist: listData.data.list.map((v) => v.fid), + exclude_fids: [], + }); + } + } + async createSaveDir(clean = false) { + await this.clearSaveDir(); + const listData = await this.api( + `file/sort?${this.pr}&pdir_fid=0&_page=1&_size=200&_sort=file_type:asc,updated_at:desc`, + null, + 3, + "get" + ); + if (listData.data != null && listData.data.list != null) { + for (const item of listData.data.list) { + if (item.file_name === this.saveDirName) { + this.saveDirId = item.fid; + await this.clearSaveDir(); + break; + } + } + } + if (this.saveDirId == null) { + const create = await this.api(`file?${this.pr}`, { + pdir_fid: "0", + file_name: this.saveDirName, + dir_path: "", + dir_init_lock: false, + }); + if (create.data != null && create.data.fid != null) { + this.saveDirId = create.data.fid; + } + } + } + async save(shareId, stoken, fileId, fileToken, clean = false) { + await this.createSaveDir(clean); + if (clean) { + this.clean(); + } + if (this.saveDirId == null) return null; + if (stoken == null) { + await this.getShareToken({ shareId }); + if (!this.shareTokenCache.hasOwnProperty(shareId)) return null; + } + const saveResult = await this.api(`share/sharepage/save?${this.pr}`, { + fid_list: [fileId], + fid_token_list: [fileToken], + to_pdir_fid: this.saveDirId, + pwd_id: shareId, + stoken: stoken || this.shareTokenCache[shareId].stoken, + pdir_fid: "0", + scene: "link", + }); + if (saveResult.data != null && saveResult.data.task_id != null) { + let retry = 0; + while (true) { + const taskResult = await this.api( + `task?${this.pr}&task_id=${saveResult.data.task_id}&retry_index=${retry}`, + null, + 3, + "get" + ); + if ( + taskResult.data != null && + taskResult.data.save_as != null && + taskResult.data.save_as.save_as_top_fids != null && + taskResult.data.save_as.save_as_top_fids.length > 0 + ) { + return taskResult.data.save_as.save_as_top_fids[0]; + } + retry++; + if (retry > 2) break; + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + } + return null; + } + async getLiveTranscoding(shareId, stoken, fileId, fileToken, flag) { + if (!this.saveFileIdCaches.hasOwnProperty(fileId)) { + const saveFileId = await this.save( + shareId, + stoken, + fileId, + fileToken, + true + ); + if (saveFileId == null) return new PanPlayInfo("", "Live 转存失败~"); + this.saveFileIdCaches[fileId] = saveFileId; + } + const transcoding = await this.api(`file/v2/play?${this.pr}`, { + fid: this.saveFileIdCaches[fileId], + resolutions: "normal,low,high,super,2k,4k", + supports: "fmp4", + }); + if (transcoding.data != null && transcoding.data.video_list != null) { + const flagId = flag; + const index = UZUtils.findIndex(this.getPlayFormatList(), flagId); + const quarkFormat = this.getPlayFormtQuarkList()[index]; + for (const video of transcoding.data.video_list) { + if (video.resolution === quarkFormat) { + return new PanPlayInfo(video.video_info.url, "", { + Cookie: this.cookie, + }); + } + } + if (transcoding.data.video_list[index].video_info.url != null) { + return new PanPlayInfo( + transcoding.data.video_list[index].video_info.url, + "", + { Cookie: this.cookie } + ); + } + } + return new PanPlayInfo("", "获取播放链接失败~1"); + } + async getDownload(shareId, shareToken, fileId, fileToken, clean = false) { + try { + if (!this.saveFileIdCaches.hasOwnProperty(fileId)) { + const saveFileId = await this.save( + shareId, + shareToken, + fileId, + fileToken, + clean + ); + if (saveFileId == null) { + return new PanPlayInfo("", "Download 转存失败~"); + } + this.saveFileIdCaches[fileId] = saveFileId; + } + const down = await this.api(`file/download?${this.pr}&uc_param_str=`, { + fids: [this.saveFileIdCaches[fileId]], + }); + if ( + down.data != null && + down.data.length > 0 && + down.data[0].download_url != null + ) { + return new PanPlayInfo(down.data[0].download_url, ""); + } + } catch (error) { + return new PanPlayInfo("", error.toString()); + } + return new PanPlayInfo("", "获取播放链接失败~2"); + } + /** * 获取播放格式 * @return {string[]} **/ getPlayForm() { + return this.isVip + ? [`原画`, `4K`] + : [ + `原画`, + ]; /*return this.isVip ? [ `原画`, `4K`, `超清`, `高清`, `普画`, ] : [`原画`, `普画`];*/ + } +} + +//MARK: 网盘扩展统一入口 +/** + * 网盘工具 + */ +class PanTools { + constructor() { + //MARK: 在这里初始化 对应网盘的具体实现对象 + + this.quark = new QuarkUC(true); + this.uc = new QuarkUC(false); + + /** + * 扩展运行标识 ** uzApp 运行时自动赋值,请勿修改 ** + */ + this.uzTag = ""; + } + + /** + * 获取 cookie ** 无法在 PanTools 外部操作** + * 环境变量 key 为 PanType.xx + "Cookie",请在 json 文件中添加 + * @param {PanType} panType + * @returns {@Promise} + */ + async getCookie(panType) { + const cookie = await getEnv(this.uzTag, panType + "Cookie"); + return cookie; + } + + /** + * 更新 cookie ** 无法在 PanTools 外部操作** + * @param {PanType} panType + * @param {string} cookie + */ + async updateCookie(panType, cookie) { + await setEnv(this.uzTag, panType + "Cookie", cookie); + } + + /** + * 获取网盘资源列表 + * @param {string} shareUrl + * @returns {@Promise} + */ + async getShareVideos(shareUrl) { + if (shareUrl.includes("https://pan.quark.cn")) { + /// 如果需要 cookie 请在这里获取 + // this.quark.cookie = await this.getCookie(PanType.Quark); + const data = await this.quark.getFilesByShareUrl(shareUrl); + return data; + } else if (shareUrl.includes("https://drive.uc.cn")) { + shareUrl = shareUrl.split("?")[0]; + /// 如果需要 cookie 请在这里获取 + // this.uc.cookie = await this.getCookie(PanType.UC); + const data = await this.uc.getFilesByShareUrl(shareUrl); + return data; + } + const data = new PanListDetail(); + data.error = "暂不支持该网盘类型"; + return data; + } + + /** + * 获取播放信息 + * @param {PanVideoItem} item + * @returns {@Promise} + */ + async getPlayInfo(item) { + if (item.panType === PanType.Quark) { + /// 如果需要 cookie 请在这里获取 + this.quark.cookie = await this.getCookie(PanType.Quark); + /// 更新 Quark cookie + this.quark.updateCookie = () => { + this.updateCookie(PanType.Quark, this.quark.cookie); + }; + if (this.quark.cookie === "") { + return new PanPlayInfo("", "获取 " + PanType.Quark + " cookie 失败~"); + } + const data = await this.quark.getPlayUrl(item.data); + return data; + } else if (item.panType === PanType.UC) { + /// 如果需要 cookie 请在这里获取 + this.uc.cookie = await this.getCookie(PanType.UC); + /// 更新 UC cookie + this.uc.updateCookie = () => { + this.updateCookie(PanType.UC, this.uc.cookie); + }; + if (this.uc.cookie === "") { + return new PanPlayInfo("", "获取 " + PanType.UC + " cookie 失败~"); + } + const data = await this.uc.getPlayUrl(item.data); + return data; + } + + return new PanPlayInfo("", "暂不支持该网盘类型"); + } +} + +// 固定实例名称 +const uzPanToolsInstance = new PanTools(); diff --git a/uz影视_Android_1.5.40-手机平板.apk b/uz影视_Android_1.5.40-手机平板.apk deleted file mode 100644 index c65cf67..0000000 Binary files a/uz影视_Android_1.5.40-手机平板.apk and /dev/null differ diff --git a/uz影视_Android_1.5.40-电视盒子.apk b/uz影视_Android_1.5.40-电视盒子.apk deleted file mode 100644 index 524cb6e..0000000 Binary files a/uz影视_Android_1.5.40-电视盒子.apk and /dev/null differ diff --git a/uz影视_Android_1.5.40-通用.apk b/uz影视_Android_1.5.40-通用.apk deleted file mode 100644 index df893ff..0000000 Binary files a/uz影视_Android_1.5.40-通用.apk and /dev/null differ diff --git a/uz影视_iOS_1.5.40.ipa b/uz影视_iOS_1.5.40.ipa deleted file mode 100644 index 4f6e806..0000000 Binary files a/uz影视_iOS_1.5.40.ipa and /dev/null differ diff --git a/uz影视_mac_1.5.40.dmg b/uz影视_mac_1.5.40.dmg deleted file mode 100644 index 24d37ea..0000000 Binary files a/uz影视_mac_1.5.40.dmg and /dev/null differ diff --git a/uz影视_win_1.5.30.msix b/uz影视_win_1.5.30.msix deleted file mode 100644 index e142bf2..0000000 Binary files a/uz影视_win_1.5.30.msix and /dev/null differ