-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5cc6ed
commit ca44088
Showing
3 changed files
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
var t,r=Object,n=Proxy,i=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",d="default_info",f="default_security_level",p="sstp_version_table",w="substring",v="length",y="available",b="split",m="entries",x="costom_text_send",S="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",G="get_fmo_infos",R="get_passthrough",j="flat_map",F="RequestHeader",H="check_event",I="from_string",M="",J=M[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[w](0,s),t[w](s+e[v])]},W=(t,e)=>r(t)instanceof e,Y=(t,e,s)=>(t[e]=s,1),z=(e,s,r)=>{return new n(e,i({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=W(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):W(r=e[s],X)?r.bind(e):r}),set:Y},r));var h};class B extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var K=t=>{throw t},L=t=>"http://localhost:"+(t??9801),Q=globalThis.window?location.origin:L(process.env.PORT),Z=/^\w+:\/\/localhost/.test(Q)?"local":"external";class tt{constructor(t){i(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[m](){return r[m](this)}get[v](){return this.keys[v]}[S](t){this[m][S](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return i(et(),this)}[j](t){let e=[];return this[m].map(([s,r])=>e.push(...W(r,tt)?r[j](t.bind(t,s)):[t(s,r)])),e}map(t){return this[m].map(([e,s])=>t(s,e))}push(e){return e[S](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[m].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=M+t,s[v]&&(this.#e=s),i(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[m].map(([t,e])=>t+": "+e),M,M].join(h)}to_string(){return M+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[b](" ").find(t=>(t=+t)==t)}}class rt extends st{constructor(e,s,n={}){return super(e,s,n),z(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[R](s):t})}static[I](t){let e,[s,...r]=t[b](h),n={},i=[];r[v]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?n[e=s]=r:e?n[e]+=h+t:i.push(t)}return new rt(s,n,i)}[R](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class nt extends st{constructor(t){var[t,...s]=t[b](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,n]=V(e,".");(this[r]||=et())[n]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[v]}toString(){return[this.head,M,...this[j]((t,e,s)=>t+"."+e+""+s),M,M].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class it extends B{#r;#n;#i;#h;#u;constructor(t){super((t,e=this[f])=>this[H](t,e)),this.#r=t,this[f]=t[f]}async[H](t,e=this[f]){return this.#i?this.#h[e].includes(t):!!this.#n&&(this.#u[e][t]??=await this.#r[l](t))}get[y](){return this.#n}get fast_query_available(){return this.#i}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#n=await t[l](a),this.#i=this.#n&&await t[l](o),this.#i&&(this.#h=await t[_]()),this}clear(){this.#n=this.#i=!1,this.#u={[e]:{},[s]:{}}}}class ht extends tt{static#o(e,s){return e.every(([,s])=>s===t)?s:new ht(r.fromEntries(e))}constructor(t){let e=et(t);return new n(K,{get:(t,s)=>{if(s!==P)return ht.#o(e.map((t,e)=>[e,t?.[s]]),e[s])},apply:(t,s,r)=>ht.#o(e.map((t,e)=>[e,t(...r)])),set:(t,s,r)=>(e[s]=r,!0)})}}class ut{#a;constructor(e,s){return this[F]={Origin:Q},this[d]={Charset:"UTF-8"},this.host=s,this[k]=e,this[p]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[f]=Z,this[C]=z(this,{i:(e,s)=>W(e[p][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[w](3):t)(s)):t})}get clone(){var t=this;return i(new ut,{[F]:t[F],[d]:t[d],[f]:t[f],[p]:t[p],host:t.host})}by_hwnd(t){return i(this.clone,{ReceiverGhostHWnd:t})}get for_all_ghosts(){let t=new ht;return this.get_fmo_infos().then(e=>{for(var s in e)t[s]=this.by_hwnd(e[s].hwnd);return t})}set host(t){this.#a=t||L()+"/api/sstp/v1"}get host(){return this.#a}set[k](t){this[d].Sender=t||"jsstp-client"}get[k](){return this[d].Sender}async row_send(t){return 200!=(t=await fetch(this.#a,{method:"POST",headers:this[F],body:M+t})).status&&K(t.status),t.text()}[x](t,e){return this.row_send(new rt(t,{...this[d],...e}))}costom_send(t,e){return this[x](t,e)[P](t=>rt[I](t))}[E](t){let e=t+" SSTP/"+this[p][t];return i(t=>this.costom_send(e,t),{get_raw:t=>this[x](e,t)})}#_(t,e,s,r){return new n(s,{get:(s,n)=>n in s?s[n]:this[r](t+"."+n,e)})}[T](t,e=q){return this.#_(t,e,s=>this[C][e](i({Event:t},s)),T)}[c](t,e=q){return this.#_(t,e,(...s)=>{let r=0,n={};return s[S](t=>n["Reference"+r++]=t),this[T](t,e)(n)},c)}get event(){return new n({},{get:(t,e)=>this[c](e)})}[l](t,e=this[f]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||M)[b](","),[s]:(r||M)[b](",")}))}[G](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new nt(t))}[y](){return this[G]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??K)(s))}new_event_queryer(){return new it(this).init()}}i(ut[$],{type:ut,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:nt,ghost_events_queryer_t:it}),u=new ut,i(exports,{base_sstp_info_t:st,default:u,fmo_info_t:nt,ghost_events_queryer_t:it,jsstp:u,jsstp_t:ut,sstp_info_t:rt,__esModule:!0}) | ||
var t,r=Object,n=Proxy,i=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",w="substring",v="length",y="available",m="split",b="entries",x="costom_text_send",S="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",j="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[w](0,s),t[w](s+e[v])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new n(e,i({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?"local":"external";class tt{constructor(t){i(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[v](){return this.keys[v]}[S](t){this[b][S](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return i(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[S](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[v]&&(this.#e=s),i(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>(t=+t)==t)}}class rt extends st{constructor(e,s,n={}){return super(e,s,n),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),n={},i=[];r[v]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?n[e=s]=r:e?n[e]+=h+t:i.push(t)}return new rt(s,n,i)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class nt extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,n]=V(e,".");(this[r]||=et())[n]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[v]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class it extends K{#r;#n;#i;#h;#o;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#i?this.#h[e].includes(t):!!this.#n&&(this.#o[e][t]??=await this.#r[l](t))}get[y](){return this.#n}get fast_query_available(){return this.#i}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#n=await t[l](a),this.#i=this.#n&&await t[l](o),this.#i&&(this.#h=await t[_]()),this}clear(){this.#n=this.#i=!1,this.#o={[e]:{},[s]:{}}}}class ht extends tt{static#u(e,s){return e.every(([,s])=>s===t)?s:new ht(r.fromEntries(e))}constructor(t){let e=et(t);return new n(L,{get:(t,s)=>{if(s!==P)return ht.#u(e.map((t,e)=>[e,t?.[s]]),e[s])},apply:(t,s,r)=>ht.#u(e.map((t,e)=>[e,t(...r)])),set:(t,s,r)=>(e[s]=r,!0)})}}class ut{#a;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[w](3):t)(s)):t})}get clone(){var t=this;return i(new ut,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t){let e=new ht;return this.get_fmo_infos().then(t=>{for(var s in t)e[s]=this.by_fmo_info(t[s]);return e}).then(t||(t=>t))}set host(t){this.#a=t||Q()+"/api/sstp/v1"}get host(){return this.#a}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){return 200!=(t=await fetch(this.#a,{method:"POST",headers:this[I],body:U+t})).status&&L(t.status),t.text()}[x](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[x](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return i(t=>this.costom_send(e,t),{get_raw:t=>this[x](e,t)})}#_(t,e,s,r){return new n(s,{get:(s,n)=>n in s?s[n]:this[r](t+"."+n,e)})}[T](t,e=q){return this.#_(t,e,s=>this[C][e](i({Event:t},s)),T)}[c](t,e=q){return this.#_(t,e,(...s)=>{let r=0,n={};return s[S](t=>n["Reference"+r++]=t),this[T](t,e)(n)},c)}get event(){return new n({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[j](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new nt(t))}[y](){return this[j]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new it(this).init()}}i(ut[$],{type:ut,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:nt,ghost_events_queryer_t:it}),u=new ut,i(exports,{base_sstp_info_t:st,default:u,fmo_info_t:nt,ghost_events_queryer_t:it,jsstp:u,jsstp_t:ut,sstp_info_t:rt,__esModule:!0}) |
Oops, something went wrong.