@dev-anywhere/relay 0.9.1 → 0.9.2
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/assets/web/assets/{fvad-DreiJBJr.js → fvad-oSUTPVOe.js} +1 -1
- package/assets/web/assets/index-BVDmlZok.css +41 -0
- package/assets/web/assets/{index-Buv7a7PI.js → index-BeQpXrcf.js} +184 -184
- package/assets/web/assets/{jmuxer.min-BMedIzGm.js → jmuxer.min-BcaOPF7j.js} +1 -1
- package/assets/web/index.html +2 -2
- package/assets/web/sw.js +1 -1
- package/dist/{chunk-JLLMBFAB.js → chunk-RGMU7VLD.js} +214 -27
- package/dist/chunk-RGMU7VLD.js.map +1 -0
- package/dist/client-registration-admission.d.ts +14 -0
- package/dist/client-registration-admission.d.ts.map +1 -0
- package/dist/handlers/client.d.ts +1 -1
- package/dist/handlers/client.d.ts.map +1 -1
- package/dist/handlers/proxy.d.ts +1 -1
- package/dist/handlers/proxy.d.ts.map +1 -1
- package/dist/health.d.ts.map +1 -1
- package/dist/index.js +551 -51
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +3 -3
- package/assets/web/assets/index-CTJCtPHc.css +0 -41
- package/dist/chunk-JLLMBFAB.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Te,a as _e}from"./index-
|
|
1
|
+
import{g as Te,a as _e}from"./index-BeQpXrcf.js";import{_ as Le}from"./__vite-browser-external-D7Ct-6yo.js";function Ge(R,Y){for(var L=0;L<Y.length;L++){const w=Y[L];if(typeof w!="string"&&!Array.isArray(w)){for(const S in w)if(S!=="default"&&!(S in R)){const g=Object.getOwnPropertyDescriptor(w,S);g&&Object.defineProperty(R,S,g.get?g:{enumerable:!0,get:()=>w[S]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}var K={exports:{}};const Ie=Te(Le);var Re=K.exports,ge;function Oe(){return ge||(ge=1,(function(R,Y){(function(L,w){R.exports=w(Ie)})(Re,function(L){function w(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function S(r,e,t){return e=F(e),(function(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i})(n)})(r,ie()?Reflect.construct(e,t||[],F(r).constructor):e.apply(r,t))}function g(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,se(n.key),n)}}function b(r,e,t){return e&&ne(r.prototype,e),t&&ne(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function C(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=J(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(s){throw s},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var s=t.next();return o=s.done,s},e:function(s){u=!0,i=s},f:function(){try{o||t.return==null||t.return()}finally{if(u)throw i}}}}function k(r,e,t){return(e=se(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function F(r){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(r)}function P(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&$(r,e)}function ie(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ie=function(){return!!r})()}function $(r,e){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$(r,e)}function ae(r,e){return(function(t){if(Array.isArray(t))return t})(r)||(function(t,n){var a=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(a!=null){var i,o,u,s,f=[],l=!0,c=!1;try{if(u=(a=a.call(t)).next,n!==0)for(;!(l=(i=u.call(a)).done)&&(f.push(i.value),f.length!==n);l=!0);}catch(p){c=!0,o=p}finally{try{if(!l&&a.return!=null&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw o}}return f}})(r,e)||J(r,e)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function M(r){return(function(e){if(Array.isArray(e))return w(e)})(r)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(r)||J(r)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function se(r){var e=(function(t,n){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var i=a.call(t,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)})(r,"string");return typeof e=="symbol"?e:e+""}function W(r){return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(r)}function J(r,e){if(r){if(typeof r=="string")return w(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?w(r,e):void 0}}var Z,Q;function v(r){if(Z){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];Z.apply(void 0,[r].concat(t))}}function A(r){if(Q){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];Q.apply(void 0,[r].concat(t))}}var j=(function(){return b(function r(e){g(this,r),this.listener={},this.type=""|e},[{key:"on",value:function(r,e){return this.listener[r]||(this.listener[r]=[]),this.listener[r].push(e),!0}},{key:"off",value:function(r,e){if(this.listener[r]){var t=this.listener[r].indexOf(e);return t>-1&&this.listener[r].splice(t,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return!!this.listener[r]&&(this.listener[r].map(function(a){a.apply(null,t)}),!0)}}])})(),N=(function(){function r(){g(this,r)}return b(r,null,[{key:"init",value:function(){var e;for(e in r.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hev1:[],hvcC:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},r.types)r.types.hasOwnProperty(e)&&(r.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);r.HDLR_TYPES={video:t,audio:n};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);r.STTS=r.STSC=r.STCO=i,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);r.FTYP=r.box(r.types.ftyp,o,s,o,u),r.DINF=r.box(r.types.dinf,r.box(r.types.dref,a))}},{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];for(var i,o=8,u=n.length,s=u;u--;)o+=n[u].byteLength;for((i=new Uint8Array(o))[0]=o>>24&255,i[1]=o>>16&255,i[2]=o>>8&255,i[3]=255&o,i.set(e,4),u=0,o=8;u<s;++u)i.set(n[u],o),o+=n[u].byteLength;return i}},{key:"hdlr",value:function(e){return r.box(r.types.hdlr,r.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return r.box(r.types.mdat,e)}},{key:"mdhd",value:function(e,t){return r.box(r.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"mdia",value:function(e){return r.box(r.types.mdia,r.mdhd(e.timescale,e.duration),r.hdlr(e.type),r.minf(e))}},{key:"mfhd",value:function(e){return r.box(r.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"minf",value:function(e){return e.type==="audio"?r.box(r.types.minf,r.box(r.types.smhd,r.SMHD),r.DINF,r.stbl(e)):r.box(r.types.minf,r.box(r.types.vmhd,r.VMHD),r.DINF,r.stbl(e))}},{key:"moof",value:function(e,t,n){return r.box(r.types.moof,r.mfhd(e),r.traf(n,t))}},{key:"moov",value:function(e,t,n){for(var a=e.length,i=[];a--;)i[a]=r.trak(e[a]);return r.box.apply(null,[r.types.moov,r.mvhd(n,t)].concat(i).concat(r.mvex(e)))}},{key:"mvex",value:function(e){for(var t=e.length,n=[];t--;)n[t]=r.trex(e[t]);return r.box.apply(null,[r.types.mvex].concat(n))}},{key:"mvhd",value:function(e,t){var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,e>>24&255,e>>16&255,e>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,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,255,255,255,255]);return r.box(r.types.mvhd,n)}},{key:"sdtp",value:function(e){var t,n,a=e.samples||[],i=new Uint8Array(4+a.length);for(n=0;n<a.length;n++)t=a[n].flags,i[n+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return r.box(r.types.sdtp,i)}},{key:"stbl",value:function(e){return r.box(r.types.stbl,r.stsd(e),r.box(r.types.stts,r.STTS),r.box(r.types.stsc,r.STSC),r.box(r.types.stsz,r.STSZ),r.box(r.types.stco,r.STCO))}},{key:"avc1",value:function(e){var t,n,a,i=[],o=[];for(t=0;t<e.sps.length;t++)a=(n=e.sps[t]).byteLength,i.push(a>>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(t=0;t<e.pps.length;t++)a=(n=e.pps[t]).byteLength,o.push(a>>>8&255),o.push(255&a),o=o.concat(Array.prototype.slice.call(n));var u=r.box(r.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e.sps.length].concat(i).concat([e.pps.length]).concat(o))),s=e.width,f=e.height;return r.box(r.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,255&s,f>>8&255,255&f,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,r.box(r.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"hev1",value:function(e){for(var t,n,a=[],i=[],o=[],u=0;u<(((s=e.vps)===null||s===void 0?void 0:s.length)||0);u++){var s;n=(t=e.vps[u]).byteLength,a.push(n>>>8&255,255&n),a=a.concat(Array.prototype.slice.call(t))}for(var f=0;f<(((l=e.sps)===null||l===void 0?void 0:l.length)||0);f++){var l;n=(t=e.sps[f]).byteLength,i.push(n>>>8&255,255&n),i=i.concat(Array.prototype.slice.call(t))}for(var c=0;c<(((p=e.pps)===null||p===void 0?void 0:p.length)||0);c++){var p;n=(t=e.pps[c]).byteLength,o.push(n>>>8&255,255&n),o=o.concat(Array.prototype.slice.call(t))}var y=e.hvcC,B=y.profile_space,m=y.tier_flag,U=y.profile_idc,h=y.profile_compatibility_flags,E=y.constraint_indicator_flags,x=y.level_idc,I=y.chroma_format_idc,_=r.box(r.types.hvcC,new Uint8Array([1,B<<6|m<<5|U,h>>24&255,h>>16&255,h>>8&255,255&h].concat(M(E),[x,240,0,252,252|I,248,248,0,0,3,3,32,0,1],M(a),[33,0,1],M(i),[34,0,1],M(o)))),d=e.width,D=e.height;return r.box(r.types.hev1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,255&d,D>>8&255,255&D,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,r.box(r.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,n=new Uint8Array(26+t+3);return n.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),n.set(e.config,26),n.set([6,1,2],26+t),n}},{key:"mp4a",value:function(e){var t=e.audiosamplerate;return r.box(r.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),r.box(r.types.esds,r.esds(e)))}},{key:"stsd",value:function(e){return e.type==="audio"?r.box(r.types.stsd,r.STSD,r.mp4a(e)):e.codec.startsWith("hvc1")?r.box(r.types.stsd,r.STSD,r.hev1(e)):r.box(r.types.stsd,r.STSD,r.avc1(e))}},{key:"tkhd",value:function(e){var t=e.id,n=e.duration,a=e.width,i=e.height,o=e.volume;return r.box(r.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,i>>8&255,255&i,0,0]))}},{key:"traf",value:function(e,t){var n=r.sdtp(e),a=e.id;return r.box(r.types.traf,r.box(r.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),r.box(r.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),r.trun(e,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(e){return e.duration=e.duration||4294967295,r.box(r.types.trak,r.tkhd(e),r.mdia(e))}},{key:"trex",value:function(e){var t=e.id;return r.box(r.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(e,t){var n,a,i,o,u,s,f=e.samples||[],l=f.length,c=12+16*l,p=new Uint8Array(c);for(t+=8+c,p.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),n=0;n<l;n++)i=(a=f[n]).duration,o=a.size,u=a.flags,s=a.cts,p.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,o>>>24&255,o>>>16&255,o>>>8&255,255&o,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12+16*n);return r.box(r.types.trun,p)}},{key:"initSegment",value:function(e,t,n){r.types||r.init();var a,i=r.moov(e,t,n);return(a=new Uint8Array(r.FTYP.byteLength+i.byteLength)).set(r.FTYP),a.set(i,r.FTYP.byteLength),a}}])})(),be=(function(){function r(){g(this,r)}return b(r,null,[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return!(e[0]!==255||240&~e[1]||6&e[1])}},{key:"extractAAC",value:function(e){var t,n,a=0,i=e.byteLength,o=[];if(!r.isAACPattern(e))return A("Invalid ADTS audio format"),{valid:!1};t=r.getHeaderLength(e);for(var u=e.subarray(0,t);a<i;)n=r.getFrameLength(e),o.push(e.subarray(t,n)),e=e.slice(n),a+=n;return{valid:!0,header:u,slices:o}}}])})(),Ue=1,G=(function(r){function e(){return g(this,e),S(this,e,arguments)}return P(e,r),b(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return Ue++}}])})(j),Se=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["AACRemuxer"])).frameDuration=a,i.readyToDecode=!1,i.header=null,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:t,duration:n,samples:[],config:"",codec:""},i.samples=[],i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.header=null,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"feed",value:function(t,n){var a=be.extractAAC(t),i=a.valid,o=a.header,u=a.slices;return this.header||(this.header=o),i&&u.length>0?(this.remux(this.getAudioFrames(u,n)),!0):(A("Failed to extract audio data from:",t),this.dispatch("outOfData"),!1)}},{key:"getAudioFrames",value:function(t,n){var a,i,o=[],u=0,s=C(t);try{for(s.s();!(i=s.n()).done;){var f=i.value;o.push({units:f})}}catch(l){s.e(l)}finally{s.f()}return a=n?n/o.length|0:this.frameDuration,u=n?n-a*o.length:0,o.map(function(l){l.duration=a,u>0&&(l.duration++,u--)}),o}},{key:"remux",value:function(t){if(t.length>0)for(var n=0;n<t.length;n++){var a=t[n],i=a.units,o=i.byteLength;this.samples.push({units:i,size:o,duration:a.duration}),this.mp4track.len+=o,this.readyToDecode||this.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift();u.units,(n=u.duration)<=0?(v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size):(this.nextDts+=n,t={size:u.size,duration:n,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},a.set(u.units,i),i+=u.size,o.push(t))}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"setAACConfig",value:function(){var t,n,a,i=new Uint8Array(2);this.header&&(t=((192&this.header[2])>>>6)+1,n=(60&this.header[2])>>>2,a=(1&this.header[2])<<2,a|=(192&this.header[3])>>>6,i[0]=t<<3,i[0]|=(14&n)>>1,i[1]|=(1&n)<<7,i[1]|=a<<3,this.mp4track.codec="mp4a.40."+t,this.mp4track.channelCount=a,this.mp4track.config=i,this.readyToDecode=!0)}}])})(G),z=(function(){return b(function r(e){g(this,r),this.data=e,this.index=0,this.bitLength=8*e.byteLength},[{key:"setData",value:function(r){this.data=r,this.index=0,this.bitLength=8*r.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(r){if(this.bitsAvailable<r)return!1;this.index+=r}},{key:"readBits",value:function(r){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.getBits(r,this.index,e)}},{key:"getBits",value:function(r,e){var t=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(this.bitsAvailable<r)return 0;var n=e%8,a=this.data[e/8|0]&255>>>n,i=8-n;if(i>=r)return t&&(this.index+=r),a>>i-r;t&&(this.index+=i);var o=r-i;return a<<o|this.getBits(o,e+i,t)}},{key:"skipLZ",value:function(){var r;for(r=0;r<this.bitLength-this.index;++r)if(this.getBits(1,this.index+r,!1)!==0)return this.index+=r,r;return r}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var r=this.skipLZ();return this.readBits(r+1)-1}},{key:"readEG",value:function(){var r=this.readUEG();return 1&r?1+r>>>1:-1*(r>>>1)}},{key:"readBoolean",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.readBits(8*r)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}])})(),oe=(function(){function r(){g(this,r)}return b(r,null,[{key:"extractNALu",value:function(e){for(var t=0,n=e.byteLength,a=[],i=0,o=0;t<n;){var u=e[t++];if(u===0)o++;else if(u===1&&o>=2){var s=o+1;i!==t-s&&a.push(e.subarray(i,t-s)),i=t,o=0}else o=0}var f=null;return i<n&&(f=e.subarray(i,n)),[a,f]}},{key:"skipScalingList",value:function(e,t){for(var n=8,a=8,i=0;i<t;i++)a!==0&&(a=(n+e.readEG()+256)%256),n=a===0?n:a}},{key:"readSPS",value:function(e){var t,n,a,i,o,u,s=new z(e),f=0,l=0,c=0,p=0,y=1,B=0;s.readUByte();for(var m=[],U=e.byteLength,h=1;h<U;h++)h+2<U&&s.readBits(24,!1)===3?(m.push(s.readBits(8)),m.push(s.readBits(8)),h+=2,s.readBits(8)):m.push(s.readBits(8));if(s.setData(new Uint8Array(m)),t=s.readUByte(),s.readBits(5),s.skipBits(3),s.readUByte(),s.skipUEG(),t===100||t===110||t===122||t===244||t===44||t===83||t===86||t===118||t===128){var E=s.readUEG();if(E===3&&s.skipBits(1),s.skipUEG(),s.skipUEG(),s.skipBits(1),s.readBoolean()){u=E!==3?8:12;for(var x=0;x<u;++x)s.readBoolean()&&(x<6?r.skipScalingList(s,16):r.skipScalingList(s,64))}}s.skipUEG();var I=s.readUEG();if(I===0)s.readUEG();else if(I===1){s.skipBits(1),s.skipEG(),s.skipEG(),n=s.readUEG();for(var _=0;_<n;++_)s.skipEG()}if(s.skipUEG(),s.skipBits(1),a=s.readUEG(),i=s.readUEG(),(o=s.readBits(1))===0&&s.skipBits(1),s.skipBits(1),s.readBoolean()&&(f=s.readUEG(),l=s.readUEG(),c=s.readUEG(),p=s.readUEG()),s.readBoolean()){if(s.readBoolean()){var d;switch(s.readUByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[s.readUByte()<<8|s.readUByte(),s.readUByte()<<8|s.readUByte()]}d&&d[0]>0&&d[1]>0&&(y=d[0]/d[1])}if(s.readBoolean()&&s.skipBits(1),s.readBoolean()&&(s.skipBits(4),s.readBoolean()&&s.skipBits(24)),s.readBoolean()&&(s.skipUEG(),s.skipUEG()),s.readBoolean()){var D=s.readUInt(),H=s.readUInt();s.readBoolean(),B=H/(2*D)}}return{fps:B>0?B:void 0,width:Math.ceil((16*(a+1)-2*f-2*l)*y),height:(2-o)*(i+1)*16-(o?2:4)*(c+p)}}}])})(),O=(function(){function r(e){g(this,r),this.payload=e,this.nri=(96&this.payload[0])>>5,this.nalUnitType=31&this.payload[0],this._sliceType=null,this._isFirstSlice=!1}return b(r,[{key:"toString",value:function(){return"".concat(r.TYPES[this.type()]||"UNKNOWN",": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return this.nalUnitType===r.IDR}},{key:"isVCL",get:function(){return this.nalUnitType==r.IDR||this.nalUnitType==r.NDR}},{key:"parseHeader",value:function(){var e=new z(this.getPayload());e.readUByte(),this._isFirstSlice=e.readUEG()===0,this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){return k(k(k(k(k(k({},r.IDR,"IDR"),r.SEI,"SEI"),r.SPS,"SPS"),r.PPS,"PPS"),r.NDR,"NDR"),r.AUD,"AUD")}}])})();function V(r,e){var t=new Uint8Array((0|r.byteLength)+(0|e.byteLength));return t.set(r,0),t.set(e,0|r.byteLength),t}function Be(r){var e,t,n,a="";return e=Math.floor(r),(t=parseInt(e/3600,10)%24)>0&&(a+=(t<10?"0"+t:t)+":"),a+=((n=parseInt(e/60,10)%60)<10?"0"+n:n)+":"+((e=e<0?0:e%60)<10?"0"+e:e)}var we=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["H264Remuxer"])).frameDuration=a,i.readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},i.samples=[],i.remainingData=new Uint8Array,i.kfCounter=0,i.pendingUnits={},i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(t,n,a){var i,o=arguments.length>3&&arguments[3]!==void 0&&arguments[3],u=[];t=V(this.remainingData,t);var s=ae(oe.extractNALu(t),2);return u=s[0],(i=s[1])?o?(u.push(i),this.remainingData=new Uint8Array):this.remainingData=i:this.remainingData=new Uint8Array,u.length>0?(this.remux(this.getVideoFrames(u,n,a)),!0):(v("Failed to extract any NAL units from video data:",i),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(t,n,a){var i,o=this,u=[],s=[],f=0,l=!1,c=!1;this.pendingUnits.units&&(u=this.pendingUnits.units,c=this.pendingUnits.vcl,l=this.pendingUnits.keyFrame,this.pendingUnits={});var p,y=C(t);try{for(y.s();!(p=y.n()).done;){var B=p.value,m=new O(B);this.parseNAL(m)&&(u.length&&c&&(m.isFirstSlice||!m.isVCL)&&(s.push({units:u,keyFrame:l}),u=[],l=!1,c=!1),u.push(m),l=l||m.isKeyframe,c=c||m.isVCL)}}catch(h){y.e(h)}finally{y.f()}if(u.length)if(n)if(c)s.push({units:u,keyFrame:l});else{var U=s.length-1;U>=0&&(s[U].units=s[U].units.concat(u))}else this.pendingUnits={units:u,keyFrame:l,vcl:c};return i=n?n/s.length|0:this.frameDuration,f=n?n-i*s.length:0,s.map(function(h){h.duration=i,h.compositionTimeOffset=a,f>0&&(h.duration++,f--),o.kfCounter++,h.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*i/1e3)}),v("jmuxer: No. of H264 frames of the last chunk: ".concat(s.length)),s}},{key:"remux",value:function(t){var n,a=C(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.units.reduce(function(u,s){return u+s.getSize()},0);i.units.length>0&&this.readyToDecode&&(this.mp4track.len+=o,this.samples.push({units:i.units,size:o,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(u){a.e(u)}finally{a.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),s=u.units;if((n=u.duration)<=0)v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size;else{this.nextDts+=n,t={size:u.size,duration:n,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var f,l=C(s);try{for(l.s();!(f=l.n()).done;){var c=f.value;a.set(c.getData(),i),i+=c.getSize()}}catch(p){l.e(p)}finally{l.f()}o.push(t)}}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(t){var n=oe.readSPS(new Uint8Array(t));this.mp4track.fps=n.fps||this.mp4track.fps,this.mp4track.width=n.width,this.mp4track.height=n.height,this.mp4track.sps=[new Uint8Array(t)],this.mp4track.codec="avc1.";for(var a=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var o=a.getUint8(i).toString(16);o.length<2&&(o="0"+o),this.mp4track.codec+=o}}},{key:"parsePPS",value:function(t){this.mp4track.pps=[new Uint8Array(t)]}},{key:"parseNAL",value:function(t){if(!t)return!1;if(t.isVCL)return!0;var n=!1;switch(t.type()){case O.PPS:this.mp4track.pps||this.parsePPS(t.getPayload()),n=!0;break;case O.SPS:this.mp4track.sps||this.parseSPS(t.getPayload()),n=!0;break;case O.AUD:v("AUD - ignoing");break;case O.SEI:v("SEI - ignoing")}return!this.readyToDecode&&this.mp4track.pps&&this.mp4track.sps&&(this.readyToDecode=!0),n}}])})(G),X=(function(){return b(function r(){g(this,r)},null,[{key:"extractNALu",value:function(r){for(var e=0,t=r.byteLength,n=[],a=0,i=0;e<t;){var o=r[e++];if(o===0)i++;else if(o===1&&i>=2){var u=i+1;a!==e-u&&n.push(r.subarray(a,e-u)),a=e,i=0}else i=0}var s=null;return a<t&&(s=r.subarray(a,t)),[n,s]}},{key:"removeEmulationPreventionBytes",value:function(r){for(var e=[],t=0,n=0;n<r.length;n++){var a=r[n];t!==2||a!==3?(e.push(a),a===0?t++:t=0):t=0}return new Uint8Array(e)}},{key:"readSPS",value:function(r){var e=new z(r);e.readUByte(),e.readUByte(),e.readBits(4);var t=e.readBits(3);e.readBits(1);for(var n=e.readBits(2),a=e.readBits(1),i=e.readBits(5),o=e.readUInt(),u=new Uint8Array(6),s=0;s<6;s++)u[s]=e.readUByte();var f=e.readUByte();e.readUEG();var l=e.readUEG();l===3&&e.readBits(1);var c=e.readUEG(),p=e.readUEG(),y=0,B=0,m=0,U=0;e.readBoolean()&&(y=e.readUEG(),B=e.readUEG(),m=e.readUEG(),U=e.readUEG()),e.readUEG(),e.readUEG(),e.readUEG();for(var h=e.readBits(1)?0:t;h<=t;h++)e.readUEG(),e.readUEG(),e.readUEG();if(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readBits(1)&&e.readBits(1))for(var E=0;E<4;E++)for(var x=0;x<(E===3?2:6);x++)if(e.readBits(1)){var I=Math.min(64,1<<4+(E<<1));E>1&&e.readEG();for(var _=0;_<I;_++)e.readEG()}else e.readUEG();e.readBits(1),e.readBits(1),e.readBits(1)&&(e.readBits(4),e.readBits(4),e.readUEG(),e.readUEG(),e.readBits(1));for(var d=e.readUEG(),D=0;D<d;D++){var H=!1;if(D!==0&&(H=e.readBoolean()),H)e.readUEG(),e.readBits(1),e.readUEG();else{for(var De=e.readUEG(),Ce=e.readUEG(),ue=0;ue<De;ue++)e.readUEG(),e.readBits(1);for(var le=0;le<Ce;le++)e.readUEG(),e.readBits(1)}}if(e.readBits(1))for(var Pe=e.readUEG(),fe=0;fe<Pe;fe++)e.readUEG(),e.readBits(1);e.readBits(1),e.readBits(1);var ce=null;if(e.readBoolean()){if(e.readBoolean()&&e.readUByte()===255&&(e.readUShort(),e.readUShort()),e.readBoolean()&&e.readBoolean(),e.readBoolean()&&(e.readBits(3),e.readBoolean(),e.readBoolean()&&(e.readUByte(),e.readUByte(),e.readUByte())),e.readBoolean()&&(e.readUEG(),e.readUEG()),e.readBoolean(),e.readBoolean(),e.readBoolean(),e.readBoolean()&&(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG()),e.readBoolean()){var de=e.readUInt(),he=e.readUInt();if(e.readBoolean()&&e.readUEG(),e.readBoolean()){var ee=!1,te=!1,q=!1;ee=e.readBoolean(),te=e.readBoolean(),(ee||te)&&((q=e.readBoolean())&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),q&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5));for(var pe=0;pe<=t;pe++){var ye=!1,re=0;if(e.readBoolean()||e.readBoolean()?e.readUEG():ye=e.readBoolean(),ye||(re=e.readUEG()),ee)for(var me=0;me<=re;me++)e.readUEG(),e.readUEG(),q&&(e.readUEG(),e.readUEG()),e.readBits(1);if(te)for(var ve=0;ve<=re;ve++)e.readUEG(),e.readUEG(),q&&(e.readUEG(),e.readUEG()),e.readBits(1)}}de>0&&he>0&&(ce=he/de)}e.readBoolean()&&(e.readBoolean(),e.readBoolean(),e.readBoolean(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG())}return{width:c-(l===1||l===2?2:1)*(B+y),height:p-(l===1?2:1)*(m+U),profile_space:n,tier_flag:a,profile_idc:i,profile_compatibility_flags:o,constraint_indicator_flags:u,level_idc:f,chroma_format_idc:l,fps:ce}}}])})(),T=(function(){function r(e){g(this,r),this.payload=e,this.nalUnitType=(126&e[0])>>1,this.nuhLayerId=(1&e[0])<<5|(248&e[1])>>3,this.nuhTemporalIdPlus1=7&e[1],this._isFirstSlice=null,this._sliceType=null}return b(r,[{key:"toString",value:function(){return"".concat(r.TYPES[this.type()]||"UNKNOWN ("+this.type()+")",": Layer: ").concat(this.nuhLayerId,", Temporal Id: ").concat(this.nuhTemporalIdPlus1)}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return[r.IDR_W_RADL,r.IDR_N_LP,r.CRA].includes(this.nalUnitType)}},{key:"isVCL",get:function(){return this.nalUnitType<=31}},{key:"parseHeader",value:function(){var e=new z(this.getPayload());e.readUByte(),e.readUByte(),this._isFirstSlice=e.readBoolean(),this.isKeyframe&&e.readBits(1),e.readUEG(),this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"TRAIL_N",get:function(){return 0}},{key:"TRAIL_R",get:function(){return 1}},{key:"IDR_W_RADL",get:function(){return 19}},{key:"IDR_N_LP",get:function(){return 20}},{key:"CRA",get:function(){return 21}},{key:"VPS",get:function(){return 32}},{key:"SPS",get:function(){return 33}},{key:"PPS",get:function(){return 34}},{key:"AUD",get:function(){return 35}},{key:"SEI",get:function(){return 39}},{key:"SEI2",get:function(){return 40}},{key:"TYPES",get:function(){var e;return k(k(k(k(k(k(k(k(k(k(e={},r.TRAIL_N,"TRAIL_N"),r.TRAIL_R,"TRAIL_R"),r.IDR_W_RADL,"IDR"),r.IDR_N_LP,"IDR2"),r.CRA,"CRA"),r.VPS,"VPS"),r.SPS,"SPS"),r.PPS,"PPS"),r.AUD,"AUD"),r.SEI,"SEI"),k(e,r.SEI2,"SEI2")}}])})(),Ee=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["H264Remuxer"])).frameDuration=a,i.readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"video",len:0,fragmented:!0,vps:"",sps:"",pps:"",hvcC:{},fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},i.samples=[],i.remainingData=new Uint8Array,i.kfCounter=0,i.pendingUnits={},i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.vps="",this.mp4track.sps="",this.mp4track.pps="",this.mp4track.hvcC={},this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(t,n,a){var i,o=arguments.length>3&&arguments[3]!==void 0&&arguments[3],u=[];t=V(this.remainingData,t);var s=ae(X.extractNALu(t),2);return u=s[0],(i=s[1])?o?(u.push(i),this.remainingData=new Uint8Array):this.remainingData=i:this.remainingData=new Uint8Array,u.length>0?(this.remux(this.getVideoFrames(u,n,a)),!0):(v("Failed to extract any NAL units from video data:",i),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(t,n,a){var i,o=this,u=[],s=[],f=0,l=!1,c=!1;this.pendingUnits.units&&(u=this.pendingUnits.units,c=this.pendingUnits.vcl,l=this.pendingUnits.keyFrame,this.pendingUnits={});var p,y=C(t);try{for(y.s();!(p=y.n()).done;){var B=p.value,m=new T(B);this.parseNAL(m)&&(u.length&&c&&(m.isFirstSlice||!m.isVCL)&&(s.push({units:u,keyFrame:l}),u=[],l=!1,c=!1),u.push(m),l=l||m.isKeyframe,c=c||m.isVCL)}}catch(h){y.e(h)}finally{y.f()}if(u.length)if(n)if(c)s.push({units:u,keyFrame:l});else{var U=s.length-1;U>=0&&(s[U].units=s[U].units.concat(u))}else this.pendingUnits={units:u,keyFrame:l,vcl:c};return i=n?n/s.length|0:this.frameDuration,f=n?n-i*s.length:0,s.map(function(h){h.duration=i,h.compositionTimeOffset=a,f>0&&(h.duration++,f--),o.kfCounter++,h.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*i/1e3)}),v("jmuxer: No. of H265 frames of the last chunk: ".concat(s.length)),s}},{key:"remux",value:function(t){var n,a=C(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.units.reduce(function(u,s){return u+s.getSize()},0);i.units.length>0&&this.readyToDecode&&(this.mp4track.len+=o,this.samples.push({units:i.units,size:o,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(u){a.e(u)}finally{a.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),s=u.units;if((n=u.duration)<=0)v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size;else{this.nextDts+=n,t={size:u.size,duration:n,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var f,l=C(s);try{for(l.s();!(f=l.n()).done;){var c=f.value;a.set(c.getData(),i),i+=c.getSize()}}catch(p){l.e(p)}finally{l.f()}o.push(t)}}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(t){this.mp4track.sps=[new Uint8Array(t)],t=X.removeEmulationPreventionBytes(t);var n=X.readSPS(new Uint8Array(t));this.mp4track.fps=n.fps||this.mp4track.fps,this.mp4track.width=n.width,this.mp4track.height=n.height,this.mp4track.codec="hvc1."+(n.profile_space?String.fromCharCode(64+n.profile_space):"")+n.profile_idc+"."+(function(a){for(var i=0,o=0;o<32;o++)i<<=1,i|=1&a,a>>>=1;return i>>>0})(n.profile_compatibility_flags).toString(16)+"."+(n.tier_flag?"H":"L")+n.level_idc+"."+n.constraint_indicator_flags.map(function(a){return a.toString(16)}).join(".").toUpperCase().replace(/(?:\.0)+$/,""),this.mp4track.hvcC={profile_space:n.profile_space,tier_flag:n.tier_flag,profile_idc:n.profile_idc,profile_compatibility_flags:n.profile_compatibility_flags,constraint_indicator_flags:n.constraint_indicator_flags,level_idc:n.level_idc,chroma_format_idc:n.chroma_format_idc}}},{key:"parsePPS",value:function(t){this.mp4track.pps=[t]}},{key:"parseVPS",value:function(t){this.mp4track.vps=[t]}},{key:"parseNAL",value:function(t){if(!t)return!1;if(t.isVCL)return!0;var n=!1;switch(t.type()){case T.VPS:this.mp4track.vps||this.parseVPS(t.getPayload()),n=!0;break;case T.SPS:this.mp4track.sps||this.parseSPS(t.getPayload()),n=!0;break;case T.PPS:this.mp4track.pps||this.parsePPS(t.getPayload()),n=!0;break;case T.AUD:v("AUD - ignoing");break;case T.SEI:case T.SEI2:v("SEI - ignoing")}return!this.readyToDecode&&this.mp4track.vps&&this.mp4track.sps&&this.mp4track.pps&&(this.readyToDecode=!0),n}}])})(G),Ae=(function(r){function e(t,n,a,i){var o;return g(this,e),(o=S(this,e,["remuxer"])).videoCodec=a,o.frameDuration=i,o.initialized=!1,o.tracks={},o.seq=1,o.env=t,o.timescale=1e3,o.mediaDuration=n?4294967295:0,o}return P(e,r),b(e,[{key:"addTrack",value:function(t){var n=this;if(t!=="video"&&t!=="both"||(this.videoCodec=="H265"?this.tracks.video=new Ee(this.timescale,this.mediaDuration,this.frameDuration):this.tracks.video=new we(this.timescale,this.mediaDuration,this.frameDuration),this.tracks.video.on("outOfData",function(){n.dispatch("missingVideoFrames")}),this.tracks.video.on("keyframePosition",function(i){n.dispatch("keyframePosition",i)})),t==="audio"||t==="both"){var a=new Se(this.timescale,this.mediaDuration,this.frameDuration);this.tracks.audio=a,this.tracks.audio.on("outOfData",function(){n.dispatch("missingAudioFrames")})}}},{key:"reset",value:function(){for(var t in this.tracks)this.tracks[t].resetTrack();this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(!this.initialized){if(!this.isReady())return;this.dispatch("ready"),this.initSegment(),this.initialized=!0}for(var t in this.tracks){var n=this.tracks[t],a=n.getPayload();if(a&&a.byteLength){var i={type:t,payload:V(N.moof(this.seq,n.dts,n.mp4track),N.mdat(a)),dts:n.dts};t==="video"&&(i.fps=n.mp4track.fps),this.dispatch("buffer",i);var o=Be(n.dts/this.timescale);v("put segment (".concat(t,"): dts: ").concat(n.dts," frames: ").concat(n.mp4track.samples.length," second: ").concat(o)),n.flush(),this.seq++}}}},{key:"initSegment",value:function(){var t=[];for(var n in this.tracks){var a=this.tracks[n];if(this.env=="browser"){var i={type:n,payload:N.initSegment([a.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",i)}else t.push(a.mp4track)}if(this.env=="node"){var o={type:"all",payload:N.initSegment(t,this.mediaDuration,this.timescale)};this.dispatch("buffer",o)}v("Initial segment generated.")}},{key:"isReady",value:function(){for(var t in this.tracks)if(!this.tracks[t].readyToDecode||!this.tracks[t].samples.length)return!1;return!0}},{key:"feed",value:function(t){var n=!1;t.video&&this.tracks.video&&(n|=this.tracks.video.feed(t.video,t.duration,t.compositionTimeOffset,t.isLastVideoFrameComplete)),t.audio&&this.tracks.audio&&(n|=this.tracks.audio.feed(t.audio,t.duration)),n?this.flush():A("Input object must have video and/or audio property. Make sure it is a valid typed array")}}])})(j),xe=(function(r){function e(t,n){var a;return g(this,e),(a=S(this,e,["buffer"])).type=n,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=t,a.sourceBuffer.addEventListener("updateend",function(){a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()}),a.sourceBuffer.addEventListener("error",function(){a.dispatch("error",{type:a.type,name:"buffer",error:"buffer error"})}),a}return P(e,r),b(e,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var t=this.cleanRanges.shift();v("".concat(this.type," remove range [").concat(t[0]," - ").concat(t[1],")")),this.cleaning=!0,this.sourceBuffer.remove(t[0],t[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(t){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=t);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var n=0;n<this.sourceBuffer.buffered.length;++n){var a=this.sourceBuffer.buffered.start(n),i=this.sourceBuffer.buffered.end(n);t-a>this.cleanOffset&&a<(i=t-this.cleanOffset)&&this.cleanRanges.push([a,i])}this.doCleanup()}}catch(o){A("Error occured while cleaning ".concat(this.type," buffer - ").concat(o.name,": ").concat(o.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(n){var t="unexpectedError";n.name==="QuotaExceededError"?(v("".concat(this.type," buffer quota full")),t="QuotaExceeded"):(A("Error occured while appending ".concat(this.type," buffer - ").concat(n.name,": ").concat(n.message)),t="InvalidStateError"),this.dispatch("error",{type:this.type,name:t,error:"buffer error"})}}},{key:"feed",value:function(t){this.queue=V(this.queue,t)}}])})(j);return(function(r){function e(t){var n;g(this,e),(n=S(this,e,["jmuxer"])).isReset=!1;var a={node:"",mode:"both",videoCodec:"H264",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onData:function(){},onError:function(){},onUnsupportedCodec:function(){},onMissingVideoFrames:function(){},onMissingAudioFrames:function(){},onKeyframePosition:function(){},onLoggerLog:console.log,onLoggerErr:console.error};return n.options=Object.assign({},a,t),n.env=(typeof process>"u"?"undefined":W(process))==="object"&&typeof window>"u"?"node":"browser",n.options.debug&&(function(i,o){Z=i,Q=o})(n.options.onLoggerLog,n.options.onLoggerErr),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new Ae(n.env,t.live,n.options.videoCodec,n.frameDuration),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(n)),n.env=="browser"&&(n.remuxController.on("ready",n.createBuffer.bind(n)),n.initBrowser()),n.remuxController.on("missingVideoFrames",function(){typeof n.options.onMissingVideoFrames=="function"&&n.options.onMissingVideoFrames.call(null)}),n.remuxController.on("missingAudioFrames",function(){typeof n.options.onMissingAudioFrames=="function"&&n.options.onMissingAudioFrames.call(null)}),n.clearBuffer&&n.remuxController.on("keyframePosition",function(i){n.kfPosition.push(i)}),typeof n.options.onKeyframePosition=="function"&&n.remuxController.on("keyframePosition",function(i){n.options.onKeyframePosition.call(null,i)}),n}return P(e,r),b(e,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){typeof this.options.node=="string"&&this.options.node==""&&A("no video element were found to render, provide a valid video element"),this.node=typeof this.options.node=="string"?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var t=this.feed.bind(this),n=this.destroy.bind(this);return this.stream=new L.Duplex({writableObjectMode:!0,read:function(a){},write:function(a,i,o){t(a),o()},final:function(a){n(),a()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource||window.ManagedMediaSource,!window.MediaSource)throw"Oops! Browser does not support Media Source Extension or Managed Media Source (IOS 17+).";if(this.isMSESupported=!!window.MediaSource,this.mediaSource=new window.MediaSource,this.url=URL.createObjectURL(this.mediaSource),window.MediaSource===window.ManagedMediaSource)try{this.node.removeAttribute("src"),this.node.disableRemotePlayback=!0;var t=document.createElement("source");t.type="video/mp4",t.src=this.url,this.node.appendChild(t),this.node.load()}catch{this.node.src=this.url}else this.node.src=this.url;this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch{A("mediasource is not available to end")}}},{key:"feed",value:function(t){t&&this.remuxController&&(t.duration=t.duration?parseInt(t.duration):0,this.remuxController.feed(t))}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var t in this.bufferControllers)this.bufferControllers[t].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var t in this.bufferControllers)this.bufferControllers[t].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),this.env=="browser"&&this.initBrowser(),v("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var t in this.bufferControllers={},this.remuxController.tracks){var n=this.remuxController.tracks[t];if(!e.isSupported("".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"')))return A("Browser does not support codec: ".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"')),typeof this.options.onUnsupportedCodec=="function"&&this.options.onUnsupportedCodec.call(null,n.mp4track.codec),!1;var a=this.mediaSource.addSourceBuffer("".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"'));this.bufferControllers[t]=new xe(a,t),this.bufferControllers[t].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var t=this;this.interval=setInterval(function(){t.options.flushingTime?t.applyAndClearBuffer():t.bufferControllers&&t.cancelDelay()},this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var t=this.node.buffered.end(0);t-this.node.currentTime>this.options.maxDelay/1e3&&(v("delay"),this.node.paused&&this.node.play().catch(A),this.node.currentTime=t-.001)}}},{key:"releaseBuffer",value:function(){for(var t in this.bufferControllers)this.bufferControllers[t].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(t){for(var n,a=this.options.mode==="audio"&&t||0,i=0;i<this.kfPosition.length&&!(this.kfPosition[i]>=t);i++)n=this.kfPosition[i];return n&&(this.kfPosition=this.kfPosition.filter(function(o){return o<n&&(a=o),o>=n})),a}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var t in this.bufferControllers){var n=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[t].initCleanup(n)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(t){this.options.readFpsFromTrack&&t.fps!==void 0&&this.options.fps!=t.fps&&(this.options.fps=t.fps,this.frameDuration=Math.ceil(1e3/t.fps),v("JMuxer changed FPS to ".concat(t.fps," from track data"))),this.env=="browser"?this.bufferControllers&&this.bufferControllers[t.type]&&this.bufferControllers[t.type].feed(t.payload):this.stream&&this.stream.push(t.payload),this.options.onData&&this.options.onData(t.payload),this.options.flushingTime===0&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),typeof this.options.onReady=="function"&&this.options.onReady.call(null,this.isReset,this.mediaSource)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(t){if(t.name=="QuotaExceeded")return v("JMuxer cleaning ".concat(t.type," buffer due to QuotaExceeded error")),void this.bufferControllers[t.type].initCleanup(this.node.currentTime);t.name=="InvalidStateError"?(v("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),typeof this.options.onError=="function"&&this.options.onError.call(null,t)}}],[{key:"isSupported",value:function(t){return window.MediaSource&&window.MediaSource.isTypeSupported(t)}}])})(j)})})(K)),K.exports}var ke=Oe();const Fe=_e(ke),Ne=Ge({__proto__:null,default:Fe},[ke]);export{Ne as j};
|
package/assets/web/index.html
CHANGED
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
<link rel="icon" type="image/svg+xml" href="/brand-icon.svg" />
|
|
45
45
|
<link rel="icon" type="image/png" sizes="64x64" href="/pwa-64x64.png" />
|
|
46
46
|
<link rel="apple-touch-icon" href="/apple-touch-icon-180x180.png" />
|
|
47
|
-
<script type="module" crossorigin src="/assets/index-
|
|
48
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
47
|
+
<script type="module" crossorigin src="/assets/index-BeQpXrcf.js"></script>
|
|
48
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BVDmlZok.css">
|
|
49
49
|
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
|
50
50
|
<body class="bg-background text-foreground">
|
|
51
51
|
<div id="root"></div>
|
package/assets/web/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const
|
|
1
|
+
if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let t={};const c=e=>i(e,o),f={module:{uri:o},exports:t,require:c};s[o]=Promise.all(n.map(e=>f[e]||c(e))).then(e=>(r(...e),t))}}define(["./workbox-10a3128e"],function(e){"use strict";importScripts("notification-sw.js"),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"notification-sw.js",revision:"ee0be62f4c1f36625b92680b3060becb"},{url:"index.html",revision:"c5496d7a0e4f5881c3a7b84eb4172cf6"},{url:"assets/jmuxer.min-BcaOPF7j.js",revision:null},{url:"assets/index-BeQpXrcf.js",revision:null},{url:"assets/index-BVDmlZok.css",revision:null},{url:"assets/fvad-oSUTPVOe.js",revision:null},{url:"assets/fvad-DYxbW2my.wasm",revision:null},{url:"assets/__vite-browser-external-D7Ct-6yo.js",revision:null},{url:"brand-icon.svg",revision:"efe8505a7b7ef12cbb3a4bcd286254bd"},{url:"maskable-icon-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-192x192.png",revision:"4e4603ce0f22528eded553ba7f2ffbc5"},{url:"pwa-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-64x64.png",revision:"d322160ad1dc08ba9e133cb3d296ae63"},{url:"manifest.webmanifest",revision:"4daa295c44052f4ce59a1fcfd6f06ab8"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/proxy(\/|$|\?)/,/^\/client(\/|$|\?)/,/^\/voice(\/|$|\?)/,/^\/fonts\//,/^\/health/,/^\/status/,/^\/api\//]})),e.registerRoute(/^\/fonts\/.*\.(woff2|woff|ttf|otf|css)$/,new e.CacheFirst({cacheName:"dev-anywhere-fonts",plugins:[new e.ExpirationPlugin({maxEntries:40,maxAgeSeconds:15552e3})]}),"GET")});
|
|
@@ -489,7 +489,7 @@ var ProxyUpgradeBootstrapResponseSchema = z9.object({
|
|
|
489
489
|
bootstrapVersion: z9.literal(PROXY_UPGRADE_BOOTSTRAP_VERSION),
|
|
490
490
|
relayVersion: StableVersionSchema,
|
|
491
491
|
controlProtocolVersion: z9.number().int().positive()
|
|
492
|
-
})
|
|
492
|
+
});
|
|
493
493
|
|
|
494
494
|
// ../../packages/shared/dist/schemas/web-preview.js
|
|
495
495
|
import { z as z10 } from "zod";
|
|
@@ -2109,6 +2109,29 @@ var RelayCloseCode = {
|
|
|
2109
2109
|
DEVICE_STREAM_BINDING_REJECTED: 4404,
|
|
2110
2110
|
PROXY_PROTOCOL_REJECTED: 4405
|
|
2111
2111
|
};
|
|
2112
|
+
var RelayProtocolRejectReason = {
|
|
2113
|
+
PAGE_OUTDATED: "page_outdated",
|
|
2114
|
+
SERVICE_OUTDATED: "service_outdated",
|
|
2115
|
+
PROTOCOL_MISMATCH: "protocol_mismatch"
|
|
2116
|
+
};
|
|
2117
|
+
var ProxyProtocolAdmissionDirection = {
|
|
2118
|
+
COMPATIBLE: "compatible",
|
|
2119
|
+
PROXY_OUTDATED: "proxy_outdated",
|
|
2120
|
+
RELAY_OUTDATED: "relay_outdated",
|
|
2121
|
+
PROTOCOL_MISMATCH: "protocol_mismatch"
|
|
2122
|
+
};
|
|
2123
|
+
function isPositiveSafeProtocolVersion(value) {
|
|
2124
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
2125
|
+
}
|
|
2126
|
+
function compareProxyRelayProtocolVersions(proxyProtocolVersion, relayProtocolVersion) {
|
|
2127
|
+
if (!isPositiveSafeProtocolVersion(proxyProtocolVersion) || !isPositiveSafeProtocolVersion(relayProtocolVersion)) {
|
|
2128
|
+
return ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH;
|
|
2129
|
+
}
|
|
2130
|
+
if (proxyProtocolVersion === relayProtocolVersion) {
|
|
2131
|
+
return ProxyProtocolAdmissionDirection.COMPATIBLE;
|
|
2132
|
+
}
|
|
2133
|
+
return proxyProtocolVersion < relayProtocolVersion ? ProxyProtocolAdmissionDirection.PROXY_OUTDATED : ProxyProtocolAdmissionDirection.RELAY_OUTDATED;
|
|
2134
|
+
}
|
|
2112
2135
|
|
|
2113
2136
|
// ../../packages/shared/dist/constants/wire-limits.js
|
|
2114
2137
|
var RELAY_JSON_MESSAGE_MAX_BYTES = 8 * 1024 * 1024;
|
|
@@ -2628,8 +2651,8 @@ var RelayRegistry = class {
|
|
|
2628
2651
|
}
|
|
2629
2652
|
getAllClientWs() {
|
|
2630
2653
|
const clients = [];
|
|
2631
|
-
for (const ws of this.connectedClients
|
|
2632
|
-
if (ws.readyState === WebSocket.OPEN) {
|
|
2654
|
+
for (const [ws, metadata] of this.connectedClients) {
|
|
2655
|
+
if (metadata.clientId && ws.readyState === WebSocket.OPEN) {
|
|
2633
2656
|
clients.push(ws);
|
|
2634
2657
|
}
|
|
2635
2658
|
}
|
|
@@ -2718,9 +2741,11 @@ function healthRouter(registry, options = {}) {
|
|
|
2718
2741
|
const proxyTokenRequired = options.proxyTokenRequired ?? false;
|
|
2719
2742
|
const clientTokenRequired = options.clientTokenRequired ?? false;
|
|
2720
2743
|
router.get("/health", (_req, res) => {
|
|
2744
|
+
res.setHeader("Cache-Control", "no-store");
|
|
2721
2745
|
res.json({
|
|
2722
2746
|
status: "ok",
|
|
2723
2747
|
version: RELAY_VERSION,
|
|
2748
|
+
controlProtocolVersion: RELAY_CONTROL_PROTOCOL_VERSION,
|
|
2724
2749
|
uptime: process.uptime(),
|
|
2725
2750
|
auth: {
|
|
2726
2751
|
proxyTokenRequired,
|
|
@@ -3223,6 +3248,8 @@ var PREVIEW_PUSH_TYPES = /* @__PURE__ */ new Set([
|
|
|
3223
3248
|
"device_preview_state_push",
|
|
3224
3249
|
"device_preview_removed_push"
|
|
3225
3250
|
]);
|
|
3251
|
+
var DEFAULT_PROXY_ADMISSION_TIMEOUT_MS = 1e4;
|
|
3252
|
+
var RETRYABLE_PROXY_ADMISSION_TIMEOUT_CLOSE_CODE = 1013;
|
|
3226
3253
|
function isPreviewEventMessage(message) {
|
|
3227
3254
|
return PREVIEW_EVENT_TYPES.has(message.type);
|
|
3228
3255
|
}
|
|
@@ -3303,28 +3330,60 @@ function rejectNotRegistered(ws) {
|
|
|
3303
3330
|
})
|
|
3304
3331
|
);
|
|
3305
3332
|
}
|
|
3306
|
-
function closeRejectedProxyProtocol(ws) {
|
|
3307
|
-
ws.
|
|
3333
|
+
function closeRejectedProxyProtocol(ws, direction = ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH) {
|
|
3334
|
+
if (ws.admissionPhase === "rejected") return;
|
|
3335
|
+
ws.admissionPhase = "rejected";
|
|
3336
|
+
ws.close(RelayCloseCode.PROXY_PROTOCOL_REJECTED, direction);
|
|
3337
|
+
}
|
|
3338
|
+
function classifyInitialProxyProtocol(raw) {
|
|
3339
|
+
let value;
|
|
3340
|
+
try {
|
|
3341
|
+
value = JSON.parse(raw);
|
|
3342
|
+
} catch {
|
|
3343
|
+
return ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH;
|
|
3344
|
+
}
|
|
3345
|
+
if (!value || typeof value !== "object" || value.type !== "proxy_register") {
|
|
3346
|
+
return ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH;
|
|
3347
|
+
}
|
|
3348
|
+
const direction = compareProxyRelayProtocolVersions(
|
|
3349
|
+
value.protocolVersion,
|
|
3350
|
+
RELAY_CONTROL_PROTOCOL_VERSION
|
|
3351
|
+
);
|
|
3352
|
+
return direction === ProxyProtocolAdmissionDirection.COMPATIBLE ? null : direction;
|
|
3308
3353
|
}
|
|
3309
3354
|
function isCurrentProxySocket(ws, registry) {
|
|
3310
3355
|
return ws.proxyId !== void 0 && registry.getProxy(ws.proxyId) === ws;
|
|
3311
3356
|
}
|
|
3312
|
-
function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionHistoryRoutes, webPreviewRoutes, devicePreviewBridge, chaos, remoteFileBridge) {
|
|
3357
|
+
function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionHistoryRoutes, webPreviewRoutes, devicePreviewBridge, chaos, remoteFileBridge, proxyAdmissionTimeoutMs = DEFAULT_PROXY_ADMISSION_TIMEOUT_MS) {
|
|
3313
3358
|
const proxyWs = ws;
|
|
3314
3359
|
proxyWs.isAlive = true;
|
|
3360
|
+
proxyWs.admissionPhase = "awaiting";
|
|
3315
3361
|
let registrationCompleted = false;
|
|
3316
|
-
let upgradeBootstrapStarted = false;
|
|
3317
3362
|
let initialFrameReceived = false;
|
|
3363
|
+
const effectiveAdmissionTimeoutMs = Number.isSafeInteger(proxyAdmissionTimeoutMs) && proxyAdmissionTimeoutMs > 0 ? proxyAdmissionTimeoutMs : DEFAULT_PROXY_ADMISSION_TIMEOUT_MS;
|
|
3364
|
+
let admissionTimeout = setTimeout(() => {
|
|
3365
|
+
admissionTimeout = null;
|
|
3366
|
+
if (proxyWs.admissionPhase !== "awaiting" || proxyWs.readyState !== WebSocket4.OPEN) return;
|
|
3367
|
+
proxyWs.admissionPhase = "rejected";
|
|
3368
|
+
logger.warn({ timeoutMs: effectiveAdmissionTimeoutMs }, "Proxy registration timed out");
|
|
3369
|
+
proxyWs.close(RETRYABLE_PROXY_ADMISSION_TIMEOUT_CLOSE_CODE, "proxy registration timeout");
|
|
3370
|
+
}, effectiveAdmissionTimeoutMs);
|
|
3371
|
+
admissionTimeout.unref?.();
|
|
3372
|
+
const clearAdmissionTimeout = () => {
|
|
3373
|
+
if (!admissionTimeout) return;
|
|
3374
|
+
clearTimeout(admissionTimeout);
|
|
3375
|
+
admissionTimeout = null;
|
|
3376
|
+
};
|
|
3318
3377
|
proxyWs.on("pong", () => {
|
|
3319
3378
|
proxyWs.isAlive = true;
|
|
3320
3379
|
});
|
|
3321
3380
|
proxyWs.on("message", (data, isBinary) => {
|
|
3322
|
-
if (
|
|
3381
|
+
if (proxyWs.admissionPhase === "quarantined" || proxyWs.admissionPhase === "rejected") return;
|
|
3323
3382
|
const isInitialFrame = !initialFrameReceived;
|
|
3324
3383
|
initialFrameReceived = true;
|
|
3325
3384
|
if (isBinary) {
|
|
3326
3385
|
if (!proxyWs.proxyId) {
|
|
3327
|
-
closeRejectedProxyProtocol(proxyWs);
|
|
3386
|
+
closeRejectedProxyProtocol(proxyWs, ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH);
|
|
3328
3387
|
return;
|
|
3329
3388
|
}
|
|
3330
3389
|
if (!isCurrentProxySocket(proxyWs, registry)) {
|
|
@@ -3366,13 +3425,16 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3366
3425
|
{ size: data.length, proxyId: proxyWs.proxyId },
|
|
3367
3426
|
"JSON message rejected: exceeds max size"
|
|
3368
3427
|
);
|
|
3369
|
-
if (!proxyWs.proxyId)
|
|
3428
|
+
if (!proxyWs.proxyId) {
|
|
3429
|
+
closeRejectedProxyProtocol(proxyWs, ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH);
|
|
3430
|
+
}
|
|
3370
3431
|
return;
|
|
3371
3432
|
}
|
|
3372
3433
|
const raw = data.toString();
|
|
3373
3434
|
const upgradeBootstrap = isInitialFrame ? parseProxyUpgradeBootstrapRequest(raw, RELAY_VERSION) : null;
|
|
3374
3435
|
if (upgradeBootstrap) {
|
|
3375
|
-
|
|
3436
|
+
proxyWs.admissionPhase = "quarantined";
|
|
3437
|
+
clearAdmissionTimeout();
|
|
3376
3438
|
logger.info(
|
|
3377
3439
|
{
|
|
3378
3440
|
proxyId: upgradeBootstrap.proxyId,
|
|
@@ -3384,6 +3446,14 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3384
3446
|
sendProxyUpgradeBootstrapResponse(proxyWs, RELAY_VERSION);
|
|
3385
3447
|
return;
|
|
3386
3448
|
}
|
|
3449
|
+
if (isInitialFrame) {
|
|
3450
|
+
const rejection = classifyInitialProxyProtocol(raw);
|
|
3451
|
+
if (rejection) {
|
|
3452
|
+
logger.warn({ direction: rejection }, "Proxy control protocol rejected before admission");
|
|
3453
|
+
closeRejectedProxyProtocol(proxyWs, rejection);
|
|
3454
|
+
return;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3387
3457
|
const result = parseMessage(raw);
|
|
3388
3458
|
if (result.kind === "control" && result.message.type === "proxy_register") {
|
|
3389
3459
|
if (registrationCompleted) {
|
|
@@ -3391,10 +3461,12 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3391
3461
|
{ proxyId: proxyWs.proxyId, requestedProxyId: result.message.proxyId },
|
|
3392
3462
|
"Repeated Proxy registration on the same socket rejected"
|
|
3393
3463
|
);
|
|
3394
|
-
closeRejectedProxyProtocol(proxyWs);
|
|
3464
|
+
closeRejectedProxyProtocol(proxyWs, ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH);
|
|
3395
3465
|
return;
|
|
3396
3466
|
}
|
|
3397
3467
|
const { proxyId, name, proxyVersion } = result.message;
|
|
3468
|
+
proxyWs.admissionPhase = "ready";
|
|
3469
|
+
clearAdmissionTimeout();
|
|
3398
3470
|
const status = registry.registerProxy(proxyId, proxyWs, proxyVersion, name);
|
|
3399
3471
|
proxyWs.proxyId = proxyId;
|
|
3400
3472
|
registrationCompleted = true;
|
|
@@ -3421,8 +3493,7 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3421
3493
|
return;
|
|
3422
3494
|
}
|
|
3423
3495
|
if (!proxyWs.proxyId) {
|
|
3424
|
-
|
|
3425
|
-
closeRejectedProxyProtocol(proxyWs);
|
|
3496
|
+
closeRejectedProxyProtocol(proxyWs, ProxyProtocolAdmissionDirection.PROTOCOL_MISMATCH);
|
|
3426
3497
|
return;
|
|
3427
3498
|
}
|
|
3428
3499
|
if (!isCurrentProxySocket(proxyWs, registry)) {
|
|
@@ -3722,6 +3793,7 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3722
3793
|
}
|
|
3723
3794
|
});
|
|
3724
3795
|
proxyWs.on("close", (code, reason) => {
|
|
3796
|
+
clearAdmissionTimeout();
|
|
3725
3797
|
if (!proxyWs.proxyId) return;
|
|
3726
3798
|
const closeMeta = { code, reason: reason.toString() || void 0 };
|
|
3727
3799
|
const current = registry.getProxy(proxyWs.proxyId);
|
|
@@ -4486,15 +4558,45 @@ var DevicePreviewRouteRegistry = class extends PreviewRouteRegistry {
|
|
|
4486
4558
|
}
|
|
4487
4559
|
};
|
|
4488
4560
|
|
|
4489
|
-
// src/
|
|
4490
|
-
function
|
|
4561
|
+
// src/client-registration-admission.ts
|
|
4562
|
+
function inspectClientRegistrationAdmission(raw) {
|
|
4563
|
+
let value;
|
|
4491
4564
|
try {
|
|
4492
|
-
|
|
4493
|
-
return parsed !== null && typeof parsed === "object" && parsed.type === "client_register";
|
|
4565
|
+
value = JSON.parse(raw);
|
|
4494
4566
|
} catch {
|
|
4495
|
-
return
|
|
4567
|
+
return { kind: "not_client_registration" };
|
|
4568
|
+
}
|
|
4569
|
+
if (value === null || typeof value !== "object") {
|
|
4570
|
+
return { kind: "not_client_registration" };
|
|
4571
|
+
}
|
|
4572
|
+
const candidate = value;
|
|
4573
|
+
if (candidate.type !== "client_register") {
|
|
4574
|
+
return { kind: "not_client_registration" };
|
|
4575
|
+
}
|
|
4576
|
+
const clientId = typeof candidate.clientId === "string" ? candidate.clientId : void 0;
|
|
4577
|
+
if (!("protocolVersion" in candidate)) {
|
|
4578
|
+
return {
|
|
4579
|
+
kind: "unversioned_client_registration",
|
|
4580
|
+
...clientId !== void 0 ? { clientId } : {}
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
return {
|
|
4584
|
+
kind: "versioned_client_registration",
|
|
4585
|
+
...clientId !== void 0 ? { clientId } : {},
|
|
4586
|
+
protocolVersion: candidate.protocolVersion
|
|
4587
|
+
};
|
|
4588
|
+
}
|
|
4589
|
+
function classifyClientRegistrationProtocol(clientVersion, relayVersion = RELAY_CONTROL_PROTOCOL_VERSION) {
|
|
4590
|
+
if (typeof clientVersion !== "number" || !Number.isSafeInteger(clientVersion) || clientVersion <= 0) {
|
|
4591
|
+
return RelayProtocolRejectReason.PROTOCOL_MISMATCH;
|
|
4496
4592
|
}
|
|
4593
|
+
if (clientVersion === relayVersion) return null;
|
|
4594
|
+
return clientVersion < relayVersion ? RelayProtocolRejectReason.PAGE_OUTDATED : RelayProtocolRejectReason.SERVICE_OUTDATED;
|
|
4497
4595
|
}
|
|
4596
|
+
|
|
4597
|
+
// src/handlers/client.ts
|
|
4598
|
+
var DEFAULT_CLIENT_ADMISSION_TIMEOUT_MS = 1e4;
|
|
4599
|
+
var RETRYABLE_CLIENT_ADMISSION_TIMEOUT_CLOSE_CODE = 1013;
|
|
4498
4600
|
function handleClientRegister(registration, clientWs, registry, logger, webPreviewRoutes, devicePreviewBridge) {
|
|
4499
4601
|
const { clientId } = registration;
|
|
4500
4602
|
if (clientWs.clientId && clientWs.clientId !== clientId) {
|
|
@@ -4849,8 +4951,36 @@ function validatePreviewScope(ws, registry, requestId, scope) {
|
|
|
4849
4951
|
rejectStaleBinding(ws, requestId);
|
|
4850
4952
|
return false;
|
|
4851
4953
|
}
|
|
4852
|
-
function closeRejectedClientProtocol(ws) {
|
|
4853
|
-
ws
|
|
4954
|
+
function closeRejectedClientProtocol(ws, reason = RelayProtocolRejectReason.PROTOCOL_MISMATCH) {
|
|
4955
|
+
if (!beginClientRejection(ws)) return;
|
|
4956
|
+
ws.close(RelayCloseCode.CLIENT_PROTOCOL_REJECTED, reason);
|
|
4957
|
+
}
|
|
4958
|
+
function beginClientRejection(ws) {
|
|
4959
|
+
if (ws.admissionPhase === "rejected") return false;
|
|
4960
|
+
ws.admissionPhase = "rejected";
|
|
4961
|
+
return ws.readyState !== WebSocket7.CLOSING && ws.readyState !== WebSocket7.CLOSED;
|
|
4962
|
+
}
|
|
4963
|
+
function closeUnversionedClientProtocol(ws) {
|
|
4964
|
+
if (!beginClientRejection(ws)) return;
|
|
4965
|
+
ws.send(
|
|
4966
|
+
JSON.stringify({
|
|
4967
|
+
type: "relay_client_kicked",
|
|
4968
|
+
reason: "\u9875\u9762\u7248\u672C\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u5237\u65B0"
|
|
4969
|
+
})
|
|
4970
|
+
);
|
|
4971
|
+
ws.close(RelayCloseCode.CLIENT_KICKED, "client refresh required");
|
|
4972
|
+
}
|
|
4973
|
+
function rejectVersionedClientProtocol(ws, clientProtocolVersion, reason, clientId, logger) {
|
|
4974
|
+
logger.warn(
|
|
4975
|
+
{
|
|
4976
|
+
...clientId !== void 0 ? { clientId } : {},
|
|
4977
|
+
clientProtocolVersion,
|
|
4978
|
+
relayProtocolVersion: RELAY_CONTROL_PROTOCOL_VERSION,
|
|
4979
|
+
reason
|
|
4980
|
+
},
|
|
4981
|
+
"Client control protocol rejected at admission"
|
|
4982
|
+
);
|
|
4983
|
+
closeRejectedClientProtocol(ws, reason);
|
|
4854
4984
|
}
|
|
4855
4985
|
function rejectProxySelect(ws, requestId, proxyId) {
|
|
4856
4986
|
ws.send(
|
|
@@ -4903,14 +5033,33 @@ function sendRemoteFileUploadUrlFailure(ws, requestId, sessionId, error, errorCo
|
|
|
4903
5033
|
})
|
|
4904
5034
|
);
|
|
4905
5035
|
}
|
|
4906
|
-
function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, sessionHistoryRoutes, webPreviewRoutes, devicePreviewBridge, chaos, voiceConfigStore, voiceProviders, remoteFileBridge, connectionInfo = {}) {
|
|
5036
|
+
function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, sessionHistoryRoutes, webPreviewRoutes, devicePreviewBridge, chaos, voiceConfigStore, voiceProviders, remoteFileBridge, connectionInfo = {}, clientAdmissionTimeoutMs = DEFAULT_CLIENT_ADMISSION_TIMEOUT_MS) {
|
|
4907
5037
|
const clientWs = ws;
|
|
4908
5038
|
clientWs.isAlive = true;
|
|
5039
|
+
clientWs.admissionPhase = "awaiting";
|
|
4909
5040
|
registry.addClientWs(clientWs, connectionInfo);
|
|
5041
|
+
const effectiveAdmissionTimeoutMs = Number.isSafeInteger(clientAdmissionTimeoutMs) && clientAdmissionTimeoutMs > 0 ? clientAdmissionTimeoutMs : DEFAULT_CLIENT_ADMISSION_TIMEOUT_MS;
|
|
5042
|
+
let admissionTimeout = setTimeout(() => {
|
|
5043
|
+
admissionTimeout = null;
|
|
5044
|
+
if (clientWs.admissionPhase !== "awaiting" || clientWs.readyState !== WebSocket7.OPEN) return;
|
|
5045
|
+
if (!beginClientRejection(clientWs)) return;
|
|
5046
|
+
logger.warn(
|
|
5047
|
+
{ timeoutMs: effectiveAdmissionTimeoutMs, remoteAddress: connectionInfo.remoteAddress },
|
|
5048
|
+
"Client registration timed out"
|
|
5049
|
+
);
|
|
5050
|
+
clientWs.close(RETRYABLE_CLIENT_ADMISSION_TIMEOUT_CLOSE_CODE, "client registration timeout");
|
|
5051
|
+
}, effectiveAdmissionTimeoutMs);
|
|
5052
|
+
admissionTimeout.unref?.();
|
|
5053
|
+
const clearAdmissionTimeout = () => {
|
|
5054
|
+
if (!admissionTimeout) return;
|
|
5055
|
+
clearTimeout(admissionTimeout);
|
|
5056
|
+
admissionTimeout = null;
|
|
5057
|
+
};
|
|
4910
5058
|
clientWs.on("pong", () => {
|
|
4911
5059
|
clientWs.isAlive = true;
|
|
4912
5060
|
});
|
|
4913
5061
|
clientWs.on("message", (data, isBinary) => {
|
|
5062
|
+
if (clientWs.admissionPhase === "rejected") return;
|
|
4914
5063
|
if (isBinary) {
|
|
4915
5064
|
if (!clientWs.clientId) closeRejectedClientProtocol(clientWs);
|
|
4916
5065
|
return;
|
|
@@ -4924,6 +5073,32 @@ function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, session
|
|
|
4924
5073
|
return;
|
|
4925
5074
|
}
|
|
4926
5075
|
const raw = data.toString();
|
|
5076
|
+
const registrationAdmission = inspectClientRegistrationAdmission(raw);
|
|
5077
|
+
if (registrationAdmission.kind === "unversioned_client_registration") {
|
|
5078
|
+
logger.warn(
|
|
5079
|
+
{
|
|
5080
|
+
...registrationAdmission.clientId !== void 0 ? { clientId: registrationAdmission.clientId } : {}
|
|
5081
|
+
},
|
|
5082
|
+
"Unversioned client registration rejected"
|
|
5083
|
+
);
|
|
5084
|
+
closeUnversionedClientProtocol(clientWs);
|
|
5085
|
+
return;
|
|
5086
|
+
}
|
|
5087
|
+
if (registrationAdmission.kind === "versioned_client_registration") {
|
|
5088
|
+
const registrationProtocolIssue = classifyClientRegistrationProtocol(
|
|
5089
|
+
registrationAdmission.protocolVersion
|
|
5090
|
+
);
|
|
5091
|
+
if (registrationProtocolIssue) {
|
|
5092
|
+
rejectVersionedClientProtocol(
|
|
5093
|
+
clientWs,
|
|
5094
|
+
registrationAdmission.protocolVersion,
|
|
5095
|
+
registrationProtocolIssue,
|
|
5096
|
+
registrationAdmission.clientId,
|
|
5097
|
+
logger
|
|
5098
|
+
);
|
|
5099
|
+
return;
|
|
5100
|
+
}
|
|
5101
|
+
}
|
|
4927
5102
|
const result = parseMessage(raw);
|
|
4928
5103
|
if (result.kind === "control") {
|
|
4929
5104
|
const msg = result.message;
|
|
@@ -4940,6 +5115,8 @@ function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, session
|
|
|
4940
5115
|
webPreviewRoutes,
|
|
4941
5116
|
devicePreviewBridge
|
|
4942
5117
|
);
|
|
5118
|
+
clientWs.admissionPhase = "ready";
|
|
5119
|
+
clearAdmissionTimeout();
|
|
4943
5120
|
return;
|
|
4944
5121
|
}
|
|
4945
5122
|
if (!clientWs.clientId) {
|
|
@@ -5457,7 +5634,13 @@ function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, session
|
|
|
5457
5634
|
routeClientMessage(raw, clientWs.boundProxyId, clientWs, registry, logger, chaos);
|
|
5458
5635
|
return;
|
|
5459
5636
|
}
|
|
5460
|
-
|
|
5637
|
+
const isRegistrationAttempt = registrationAdmission.kind !== "not_client_registration";
|
|
5638
|
+
const logContext = {
|
|
5639
|
+
error: result.error,
|
|
5640
|
+
raw: raw.slice(0, 200),
|
|
5641
|
+
...registrationAdmission.kind !== "not_client_registration" && registrationAdmission.clientId !== void 0 ? { clientId: registrationAdmission.clientId } : {}
|
|
5642
|
+
};
|
|
5643
|
+
logger.error(logContext, "Invalid message from client");
|
|
5461
5644
|
clientWs.send(
|
|
5462
5645
|
JSON.stringify({
|
|
5463
5646
|
type: "relay_error",
|
|
@@ -5465,11 +5648,13 @@ function handleClientConnection(ws, registry, logger, ptySnapshotRoutes, session
|
|
|
5465
5648
|
message: `${result.error} | raw: ${raw.slice(0, 200)}`
|
|
5466
5649
|
})
|
|
5467
5650
|
);
|
|
5468
|
-
if (
|
|
5651
|
+
if (isRegistrationAttempt || !clientWs.clientId) {
|
|
5469
5652
|
closeRejectedClientProtocol(clientWs);
|
|
5470
5653
|
}
|
|
5471
5654
|
});
|
|
5472
5655
|
clientWs.on("close", (code, reason) => {
|
|
5656
|
+
clearAdmissionTimeout();
|
|
5657
|
+
clientWs.admissionPhase = "rejected";
|
|
5473
5658
|
ptySnapshotRoutes.abandonSocket(clientWs);
|
|
5474
5659
|
sessionHistoryRoutes.abandonSocket(clientWs);
|
|
5475
5660
|
webPreviewRoutes.abandonSocket(clientWs);
|
|
@@ -8568,7 +8753,8 @@ function createRelayServer(options) {
|
|
|
8568
8753
|
webPreviewRoutes,
|
|
8569
8754
|
devicePreviewBridge,
|
|
8570
8755
|
relayChaos,
|
|
8571
|
-
remoteFileBridge
|
|
8756
|
+
remoteFileBridge,
|
|
8757
|
+
options.proxyAdmissionTimeoutMs
|
|
8572
8758
|
);
|
|
8573
8759
|
});
|
|
8574
8760
|
devicePreviewStreamWss.on("connection", (ws) => {
|
|
@@ -8590,7 +8776,8 @@ function createRelayServer(options) {
|
|
|
8590
8776
|
{
|
|
8591
8777
|
userAgent: firstHeaderValue(request.headers["user-agent"]),
|
|
8592
8778
|
remoteAddress: requestRemoteAddress(request)
|
|
8593
|
-
}
|
|
8779
|
+
},
|
|
8780
|
+
options.clientAdmissionTimeoutMs
|
|
8594
8781
|
);
|
|
8595
8782
|
});
|
|
8596
8783
|
voiceAsrWss.on("connection", (ws) => {
|
|
@@ -8697,4 +8884,4 @@ export {
|
|
|
8697
8884
|
parseRelayChaosFromEnv,
|
|
8698
8885
|
createRelayServer
|
|
8699
8886
|
};
|
|
8700
|
-
//# sourceMappingURL=chunk-
|
|
8887
|
+
//# sourceMappingURL=chunk-RGMU7VLD.js.map
|