@titaniumnetwork-dev/ultraviolet
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";const e=self.Ultraviolet,t=self.UVClient,a=self.__uv$config,r=self.__uv$bareData,o=self.__uv$bareURL,n=self.__uv$cookies;if("object"!=typeof r||"string"!=typeof o||"string"!=typeof n)throw new TypeError("Unable to load global UV data");function i(s){if("__uv"in s&&s.__uv instanceof e)return!1;s.document&&s.window&&s.document.querySelectorAll("script[__uv-script]").forEach((e=>e.remove()));const l=!s.window,d="__uv",c="__uv$",u=new e(a),h=new t(s),{HTMLMediaElement:m,HTMLScriptElement:v,HTMLAudioElement:p,HTMLVideoElement:g,HTMLInputElement:b,HTMLEmbedElement:f,HTMLTrackElement:y,HTMLAnchorElement:_,HTMLIFrameElement:w,HTMLAreaElement:S,HTMLLinkElement:k,HTMLBaseElement:P,HTMLFormElement:U,HTMLImageElement:M,HTMLSourceElement:x}=s;h.nativeMethods.defineProperty(s,"__uv",{value:u,enumerable:!1}),u.meta.origin=location.origin,u.location=h.location.emulate((e=>"about:srcdoc"===e?new URL(e):(e.startsWith("blob:")&&(e=e.slice("blob:".length)),new URL(u.sourceUrl(e)))),(e=>u.rewriteUrl(e)));let E=n;u.meta.url=u.location,u.domain=u.meta.url.host,u.blobUrls=new s.Map,u.referrer="",u.cookies=[],u.localStorageObj={},u.sessionStorageObj={};const j=new e.BareClient(o,r);if("about:srcdoc"===u.location.href&&(u.meta=s.parent.__uv.meta),s.EventTarget&&(u.addEventListener=s.EventTarget.prototype.addEventListener,u.removeListener=s.EventTarget.prototype.removeListener,u.dispatchEvent=s.EventTarget.prototype.dispatchEvent),h.nativeMethods.defineProperty(h.storage.storeProto,"__uv$storageObj",{get(){return this===h.storage.sessionStorage?u.sessionStorageObj:this===h.storage.localStorage?u.localStorageObj:void 0},enumerable:!1}),s.localStorage){for(const e in s.localStorage)e.startsWith(c+u.location.origin+"@")&&(u.localStorageObj[e.slice((c+u.location.origin+"@").length)]=s.localStorage.getItem(e));u.lsWrap=h.storage.emulate(h.storage.localStorage,u.localStorageObj)}if(s.sessionStorage){for(const e in s.sessionStorage)e.startsWith(c+u.location.origin+"@")&&(u.sessionStorageObj[e.slice((c+u.location.origin+"@").length)]=s.sessionStorage.getItem(e));u.ssWrap=h.storage.emulate(h.storage.sessionStorage,u.sessionStorageObj)}let O=s.document?h.node.baseURI.get.call(s.document):s.location.href,T=u.sourceUrl(O);h.nativeMethods.defineProperty(u.meta,"base",{get:()=>s.document?(h.node.baseURI.get.call(s.document)!==O&&(O=h.node.baseURI.get.call(s.document),T=u.sourceUrl(O)),T):u.meta.url.href}),u.methods={setSource:"__uv$setSource",source:"__uv$source",location:"__uv$location",function:"__uv$function",string:"__uv$string",eval:"__uv$eval",parent:"__uv$parent",top:"__uv$top"},u.filterKeys=[d,u.methods.setSource,u.methods.source,u.methods.location,u.methods.function,u.methods.string,u.methods.eval,u.methods.parent,u.methods.top,"__uv$protocol","__uv$storageObj","__uv$url","__uv$modifiedStyle","__uv$config","__uv$dispatched","Ultraviolet","__uvHook"],h.on("wrap",((e,t)=>{h.nativeMethods.defineProperty(t,"name",h.nativeMethods.getOwnPropertyDescriptor(e,"name")),h.nativeMethods.defineProperty(t,"length",h.nativeMethods.getOwnPropertyDescriptor(e,"length")),h.nativeMethods.defineProperty(t,u.methods.string,{enumerable:!1,value:h.nativeMethods.fnToString.call(e)}),h.nativeMethods.defineProperty(t,u.methods.function,{enumerable:!1,value:e})})),h.fetch.on("request",(e=>{e.data.input=u.rewriteUrl(e.data.input)})),h.fetch.on("requestUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.fetch.on("responseUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.xhr.on("open",(e=>{e.data.input=u.rewriteUrl(e.data.input)})),h.xhr.on("responseUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.workers.on("worker",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.workers.on("addModule",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.workers.on("importScripts",(e=>{for(const t in e.data.scripts)e.data.scripts[t]=u.rewriteUrl(e.data.scripts[t])})),h.workers.on("postMessage",(e=>{let t=e.data.origin;e.data.origin="*",e.data.message={__data:e.data.message,__origin:u.meta.url.origin,__to:t}})),h.navigator.on("sendBeacon",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.document.on("getCookie",(e=>{e.data.value=E})),h.document.on("setCookie",(e=>{Promise.resolve(u.cookie.setCookies(e.data.value,u.db,u.meta)).then((()=>{u.cookie.db().then((e=>{u.cookie.getCookies(e).then((e=>{E=u.cookie.serialize(e,u.meta,!0)}))}))}));const t=u.cookie.setCookie(e.data.value)[0];t.path||(t.path="/"),t.domain||(t.domain=u.meta.url.hostname),u.cookie.validateCookie(t,u.meta,!0)&&(E.length&&(E+="; "),E+=`${t.name}=${t.value}`),e.respondWith(e.data.value)})),h.element.on("setInnerHTML",(e=>{switch(e.that.tagName){case"SCRIPT":e.data.value=u.js.rewrite(e.data.value);break;case"STYLE":e.data.value=u.rewriteCSS(e.data.value);break;default:e.data.value=u.rewriteHtml(e.data.value)}})),h.element.on("getInnerHTML",(e=>{if("SCRIPT"===e.that.tagName)e.data.value=u.js.source(e.data.value);else e.data.value=u.sourceHtml(e.data.value)})),h.element.on("setOuterHTML",(e=>{e.data.value=u.rewriteHtml(e.data.value,{document:"HTML"===e.that.tagName})})),h.element.on("getOuterHTML",(e=>{switch(e.that.tagName){case"HEAD":e.data.value=u.sourceHtml(e.data.value.replace(/<head(.*)>(.*)<\/head>/s,"<op-head$1>$2</op-head>")).replace(/<op-head(.*)>(.*)<\/op-head>/s,"<head$1>$2</head>");break;case"BODY":e.data.value=u.sourceHtml(e.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:e.data.value=u.sourceHtml(e.data.value,{document:"HTML"===e.that.tagName})}})),h.document.on("write",(e=>{if(!e.data.html.length)return!1;e.data.html=[u.rewriteHtml(e.data.html.join(""))]})),h.document.on("writeln",(e=>{if(!e.data.html.length)return!1;e.data.html=[u.rewriteHtml(e.data.html.join(""))]})),h.element.on("insertAdjacentHTML",(e=>{e.data.html=u.rewriteHtml(e.data.html)})),h.eventSource.on("construct",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.eventSource.on("url",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.history.on("replaceState",(e=>{e.data.url&&(e.data.url=u.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:u.meta))})),h.history.on("pushState",(e=>{e.data.url&&(e.data.url=u.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:u.meta))})),h.element.on("getAttribute",(e=>{h.element.hasAttribute.call(e.that,u.attributePrefix+"-attr-"+e.data.name)&&e.respondWith(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name))})),h.message.on("postMessage",(e=>{let t=e.data.origin,a=u.call;e.that&&(a=e.that.__uv$source.call),e.data.origin="*",e.data.message={__data:e.data.message,__origin:(e.that||e.target).__uv$source.location.origin,__to:t},e.respondWith(a(e.target,l?[e.data.message,e.data.transfer]:[e.data.message,e.data.origin,e.data.transfer],e.that))})),h.message.on("data",(e=>{const{value:t}=e.data;"object"==typeof t&&"__data"in t&&"__origin"in t&&e.respondWith(t.__data)})),h.message.on("origin",(e=>{const t=h.message.messageData.get.call(e.that);"object"==typeof t&&t.__data&&t.__origin&&e.respondWith(t.__origin)})),h.overrideDescriptor(s,"origin",{get:()=>u.location.origin}),h.node.on("baseURI",(e=>{e.data.value.startsWith(s.location.origin)&&(e.data.value=u.sourceUrl(e.data.value))})),h.element.on("setAttribute",(e=>{if(e.that instanceof m&&"src"===e.data.name&&e.data.value.startsWith("blob:"))return e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),void(e.data.value=u.blobUrls.get(e.data.value));u.attrs.isUrl(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteUrl(e.data.value)),u.attrs.isStyle(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList"})),u.attrs.isHtml(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteHtml(e.data.value,{...u.meta,document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,E,s.location.href)})),u.attrs.isSrcset(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.html.wrapSrcset(e.data.value.toString())),u.attrs.isForbidden(e.data.name)&&(e.data.name=u.attributePrefix+"-attr-"+e.data.name)})),h.element.on("audio",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.element.hookProperty([_,S,k,P],"href",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-href",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([v,p,g,m,M,b,f,w,y,x],"src",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{if(new String(a).toString().trim().startsWith("blob:")&&t instanceof m)return h.element.setAttribute.call(t,u.attributePrefix+"-attr-src",a),e.call(t,u.blobUrls.get(a)||a);h.element.setAttribute.call(t,u.attributePrefix+"-attr-src",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([U],"action",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-action",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([M],"srcset",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-srcset")||e.call(t),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-srcset",a),e.call(t,u.html.wrapSrcset(a.toString()))}}),h.element.hookProperty(v,"integrity",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-integrity"),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-integrity",a)}}),h.element.hookProperty(w,"sandbox",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-sandbox")||e.call(t),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-sandbox",a)}});const $=w&&Object.getOwnPropertyDescriptor(w.prototype,"contentWindow").get;function L(e){const t=$.call(e);if(!t.__uv)try{i(t)}catch(e){console.error("catastrophic failure"),console.error(e)}}function H(e,t){const a=`on${t}`,r=new WeakMap;Reflect.defineProperty(e,a,{enumerable:!0,configurable:!0,get(){return r.has(this)?r.get(this):null},set(e){"function"==typeof e&&(r.has(this)&&this.removeEventListener(t,r.get(this)),r.set(this,e),this.addEventListener(t,e))}})}h.element.hookProperty(w,"contentWindow",{get:(e,t)=>(L(t),e.call(t))}),h.element.hookProperty(w,"contentDocument",{get:(e,t)=>(L(t),e.call(t))}),h.element.hookProperty(w,"srcdoc",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-srcdoc")||e.call(t),set:(e,t,[a])=>{e.call(t,u.rewriteHtml(a,{document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,E,s.location.href)}))}}),h.node.on("getTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=u.js.source(e.data.value))})),h.node.on("setTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=u.js.rewrite(e.data.value))})),"serviceWorker"in s.navigator&&delete s.Navigator.prototype.serviceWorker,h.document.on("getDomain",(e=>{e.data.value=u.domain})),h.document.on("setDomain",(e=>{if(!e.data.value.toString().endsWith(u.meta.url.hostname.split(".").slice(-2).join(".")))return e.respondWith("");e.respondWith(u.domain=e.data.value)})),h.document.on("url",(e=>{e.data.value=u.location.href})),h.document.on("documentURI",(e=>{e.data.value=u.location.href})),h.document.on("referrer",(e=>{e.data.value=u.referrer||u.sourceUrl(e.data.value)})),h.document.on("parseFromString",(e=>{if("text/html"!==e.data.type)return!1;e.data.string=u.rewriteHtml(e.data.string,{...u.meta,document:!0})})),h.attribute.on("getValue",(e=>{h.element.hasAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name)&&(e.data.value=h.element.getAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name))})),h.attribute.on("setValue",(e=>{u.attrs.isUrl(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteUrl(e.data.value)),u.attrs.isStyle(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList"})),u.attrs.isHtml(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteHtml(e.data.value,{...u.meta,document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,E,s.location.href)})),u.attrs.isSrcset(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.html.wrapSrcset(e.data.value.toString()))})),h.url.on("createObjectURL",(e=>{let t=e.target.call(e.that,e.data.object);if(t.startsWith("blob:"+location.origin)){let a="blob:"+("about:blank"!==u.meta.url.href?u.meta.url.origin:s.parent.__uv.meta.url.origin)+t.slice("blob:".length+location.origin.length);u.blobUrls.set(a,t),e.respondWith(a)}else e.respondWith(t)})),h.url.on("revokeObjectURL",(e=>{if(u.blobUrls.has(e.data.url)){const t=e.data.url;e.data.url=u.blobUrls.get(e.data.url),u.blobUrls.delete(t)}})),h.storage.on("get",(e=>{e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("set",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("delete",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("getItem",(e=>{e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("setItem",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("removeItem",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=c+u.meta.url.origin+"@"+e.data.name})),h.storage.on("clear",(e=>{if(e.that.__uv$storageObj)for(const t of h.nativeMethods.keys.call(null,e.that.__uv$storageObj))delete e.that.__uv$storageObj[t],h.storage.removeItem.call(e.that,c+u.meta.url.origin+"@"+t),e.respondWith()})),h.storage.on("length",(e=>{e.that.__uv$storageObj&&e.respondWith(h.nativeMethods.keys.call(null,e.that.__uv$storageObj).length)})),h.storage.on("key",(e=>{e.that.__uv$storageObj&&e.respondWith(h.nativeMethods.keys.call(null,e.that.__uv$storageObj)[e.data.index]||null)}));const W=["ws:","wss:"];class C extends EventTarget{#e;#t;#a="blob";#r="";#o="";#n="";async#i(e,t){const a={};Reflect.setPrototypeOf(a,null),a.Origin=u.meta.url.origin,a["User-Agent"]=navigator.userAgent,""!==E&&(a.Cookie=E.toString()),this.#e=await j.createWebSocket(e,a,t),this.#e.binaryType=this.#a,this.#e.addEventListener("message",(e=>{this.dispatchEvent(new MessageEvent("message",e))})),this.#e.addEventListener("open",(async e=>{this.dispatchEvent(new Event("open",e))})),this.#e.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",e))})),this.#e.addEventListener("close",(e=>{this.dispatchEvent(new Event("close",e))}));const r=await this.#e.meta;r.headers.has("sec-websocket-protocol")&&(this.#r=r.headers.get("sec-websocket-protocol")),r.headers.has("sec-websocket-extensions")&&(this.#o=r.headers.get("sec-websocket-extensions"));let o=r.rawHeaders["set-cookie"]||[];Array.isArray(o)||(o=[]);for(const e of o)document.cookie=e}get url(){return this.#n}constructor(...e){if(super(),!e.length)throw new DOMException("Failed to construct 'WebSocket': 1 argument required, but only 0 present.");const[t,a]=e;let r;try{r=new URL(t)}catch(e){throw new DOMException(`Faiiled to construct 'WebSocket': The URL '${t}' is invalid.`)}if(!W.includes(r.protocol))throw new DOMException(`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${r.protocol}' is not allowed.`);this.#t=this.#i(r,a)}get protocol(){return this.#r}get extensions(){return this.#o}get readyState(){return this.#e?this.#e.readyState:C.CONNECTING}get binaryType(){return this.#a}set binaryType(e){this.#a=e,this.#e&&(this.#e.binaryType=e)}send(e){if(!this.#e)throw new DOMException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.");this.#e.send(e)}close(e,t){if(void 0!==e&&("number"!=typeof e&&(e=0),1e3!==e&&(e<3e3||e>4999)))throw new DOMException(`Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. ${e} is neither.`);this.#t.then((()=>this.#e.close(e,t)))}}H(C.prototype,"close"),H(C.prototype,"open"),H(C.prototype,"message"),H(C.prototype,"error");for(const e of["url","protocol","extensions","readyState","binaryType"]){const t=Object.getOwnPropertyDescriptor(s.WebSocket.prototype,e),a=Object.getOwnPropertyDescriptor(C.prototype,e);a?.get&&t?.get&&h.emit("wrap",a.get,t.get),a?.set&&t?.set&&h.emit("wrap",a.get,t.get)}if(h.emit("wrap",s.WebSocket.prototype.send,C.prototype.send),h.emit("wrap",s.WebSocket.prototype.close,C.prototype.close),h.override(s,"WebSocket",((e,t,a)=>new C(...a)),!0),C.prototype.constructor=s.WebSocket,h.function.on("function",(e=>{e.data.script=u.rewriteJS(e.data.script)})),h.function.on("toString",(e=>{u.methods.string in e.that&&e.respondWith(e.that[u.methods.string])})),h.object.on("getOwnPropertyNames",(e=>{e.data.names=e.data.names.filter((e=>!u.filterKeys.includes(e)))})),h.object.on("getOwnPropertyDescriptors",(e=>{for(const t of u.filterKeys)delete e.data.descriptors[t]})),h.style.on("setProperty",(e=>{h.style.dashedUrlProps.includes(e.data.property)&&(e.data.value=u.rewriteCSS(e.data.value,{context:"value",...u.meta}))})),h.style.on("getPropertyValue",(e=>{h.style.dashedUrlProps.includes(e.data.property)&&e.respondWith(u.sourceCSS(e.target.call(e.that,e.data.property),{context:"value",...u.meta}))})),"CSS2Properties"in s)for(const e of h.style.urlProps)h.overrideDescriptor(s.CSS2Properties.prototype,e,{get:(e,t)=>u.sourceCSS(e.call(t),{context:"value",...u.meta}),set:(e,t,a)=>{e.call(t,u.rewriteCSS(a,{context:"value",...u.meta}))}});else"HTMLElement"in s&&h.overrideDescriptor(s.HTMLElement.prototype,"style",{get:(e,t)=>{const a=e.call(t);if(!a.__uv$modifiedStyle)for(const e of h.style.urlProps)h.nativeMethods.defineProperty(a,e,{enumerable:!0,configurable:!0,get(){const t=h.style.getPropertyValue.call(this,e)||"";return u.sourceCSS(t,{context:"value",...u.meta})},set(t){h.style.setProperty.call(this,h.style.propToDashed[e]||e,u.rewriteCSS(t,{context:"value",...u.meta}))}}),h.nativeMethods.defineProperty(a,"__uv$modifiedStyle",{enumerable:!1,value:!0});return a}});h.style.on("setCssText",(e=>{e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList",...u.meta})})),h.style.on("getCssText",(e=>{e.data.value=u.sourceCSS(e.data.value,{context:"declarationList",...u.meta})})),u.addEventListener.call(s,"hashchange",(e=>{if(e.__uv$dispatched)return!1;e.stopImmediatePropagation();const t=s.location.hash;h.history.replaceState.call(s.history,"","",e.oldURL),u.location.hash=t})),h.location.on("hashchange",((e,t,a)=>{if(a.HashChangeEvent&&h.history.replaceState){h.history.replaceState.call(s.history,"","",u.rewriteUrl(t));const r=new a.HashChangeEvent("hashchange",{newURL:t,oldURL:e});h.nativeMethods.defineProperty(r,"__uv$dispatched",{value:!0,enumerable:!1}),u.dispatchEvent.call(s,r)}})),h.fetch.overrideRequest(),h.fetch.overrideUrl(),h.xhr.overrideOpen(),h.xhr.overrideResponseUrl(),h.element.overrideHtml(),h.element.overrideAttribute(),h.element.overrideInsertAdjacentHTML(),h.element.overrideAudio(),h.node.overrideBaseURI(),h.node.overrideTextContent(),h.attribute.overrideNameValue(),h.document.overrideDomain(),h.document.overrideURL(),h.document.overrideDocumentURI(),h.document.overrideWrite(),h.document.overrideReferrer(),h.document.overrideParseFromString(),h.storage.overrideMethods(),h.storage.overrideLength(),h.object.overrideGetPropertyNames(),h.object.overrideGetOwnPropertyDescriptors(),h.history.overridePushState(),h.history.overrideReplaceState(),h.eventSource.overrideConstruct(),h.eventSource.overrideUrl(),h.url.overrideObjectURL(),h.document.overrideCookie(),h.message.overridePostMessage(),h.message.overrideMessageOrigin(),h.message.overrideMessageData(),h.workers.overrideWorker(),h.workers.overrideAddModule(),h.workers.overrideImportScripts(),h.workers.overridePostMessage(),h.style.overrideSetGetProperty(),h.style.overrideCssText(),h.navigator.overrideSendBeacon(),h.function.overrideFunction(),h.function.overrideToString(),h.location.overrideWorkerLocation((e=>new URL(u.sourceUrl(e)))),h.overrideDescriptor(s,"localStorage",{get:(e,t)=>(t||s).__uv.lsWrap}),h.overrideDescriptor(s,"sessionStorage",{get:(e,t)=>(t||s).__uv.ssWrap}),h.override(s,"open",((e,t,a)=>{if(!a.length)return e.apply(t,a);let[r]=a;return r=u.rewriteUrl(r),e.call(t,r)})),u.$wrap=function(e){return"location"===e?u.methods.location:"eval"===e?u.methods.eval:e},u.$get=function(e){return e===s.location?u.location:e===s.eval?u.eval:e===s.parent?s.__uv$parent:e===s.top?s.__uv$top:e},u.eval=h.wrap(s,"eval",((e,t,a)=>{if(!a.length||"string"!=typeof a[0])return e.apply(t,a);let[r]=a;return r=u.rewriteJS(r),e.call(t,r)})),u.call=function(e,t,a){return a?e.apply(a,t):e(...t)},u.call$=function(e,t,a=[]){return e[t].apply(e,a)},h.nativeMethods.defineProperty(s.Object.prototype,d,{get:()=>u,enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.setSource,{value:function(e){return h.nativeMethods.isExtensible(this)?(h.nativeMethods.defineProperty(this,u.methods.source,{value:e,writable:!0,enumerable:!1}),this):this},enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.source,{value:u,writable:!0,enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.location,{configurable:!0,get(){return this===s.document||this===s?u.location:this.location},set(e){this===s.document||this===s?u.location.href=e:this.location=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.parent,{configurable:!0,get(){const e=this.parent;if(this===s)try{return"__uv"in e?e:this}catch(e){return this}return e},set(e){this.parent=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.top,{configurable:!0,get(){const e=this.top;if(this===s){if(e===this.parent)return this[u.methods.parent];try{if("__uv"in e)return e;{let t=this;for(;t.parent!==e;)t=t.parent;return"__uv"in t?t:this}}catch(e){return this}}return e},set(e){this.top=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.eval,{configurable:!0,get(){return this===s?u.eval:this.eval},set(e){this.eval=e}})}self.__uv||i(self),self.__uvHook=i})(); | ||
(()=>{"use strict";const e=self.Ultraviolet,t=self.UVClient,a=self.__uv$config,r=self.__uv$bareData,o=self.__uv$bareURL,n=self.__uv$cookies;if("object"!=typeof r||"string"!=typeof o||"string"!=typeof n)throw new TypeError("Unable to load global UV data");function i(s){if("__uv"in s&&s.__uv instanceof e)return!1;s.document&&s.window&&s.document.querySelectorAll("script[__uv-script]").forEach((e=>e.remove()));const l=!s.window,c="__uv",d="__uv$",u=new e(a),h=new t(s),{HTMLMediaElement:m,HTMLScriptElement:p,HTMLAudioElement:g,HTMLVideoElement:v,HTMLInputElement:b,HTMLEmbedElement:f,HTMLTrackElement:y,HTMLAnchorElement:_,HTMLIFrameElement:w,HTMLAreaElement:S,HTMLLinkElement:P,HTMLBaseElement:k,HTMLFormElement:U,HTMLImageElement:M,HTMLSourceElement:O}=s;h.nativeMethods.defineProperty(s,"__uv",{value:u,enumerable:!1}),u.meta.origin=location.origin,u.location=h.location.emulate((e=>e.startsWith("about:")?new URL(e):(e.startsWith("blob:")&&(e=e.slice("blob:".length)),new URL(u.sourceUrl(e)))),(e=>u.rewriteUrl(e)));let x=n;u.meta.url=u.location,u.domain=u.meta.url.host,u.blobUrls=new s.Map,u.referrer="",u.cookies=[],u.localStorageObj={},u.sessionStorageObj={};const E=new e.BareClient(o,r);if(s.EventTarget&&(u.addEventListener=s.EventTarget.prototype.addEventListener,u.removeListener=s.EventTarget.prototype.removeListener,u.dispatchEvent=s.EventTarget.prototype.dispatchEvent),h.nativeMethods.defineProperty(h.storage.storeProto,"__uv$storageObj",{get(){return this===h.storage.sessionStorage?u.sessionStorageObj:this===h.storage.localStorage?u.localStorageObj:void 0},enumerable:!1}),s.localStorage){for(const e in s.localStorage)e.startsWith(d+u.location.origin+"@")&&(u.localStorageObj[e.slice((d+u.location.origin+"@").length)]=s.localStorage.getItem(e));u.lsWrap=h.storage.emulate(h.storage.localStorage,u.localStorageObj)}if(s.sessionStorage){for(const e in s.sessionStorage)e.startsWith(d+u.location.origin+"@")&&(u.sessionStorageObj[e.slice((d+u.location.origin+"@").length)]=s.sessionStorage.getItem(e));u.ssWrap=h.storage.emulate(h.storage.sessionStorage,u.sessionStorageObj)}let j=s.document?h.node.baseURI.get.call(s.document):s.location.href,$=u.sourceUrl(j);h.nativeMethods.defineProperty(u.meta,"base",{get:()=>s.document?(h.node.baseURI.get.call(s.document)!==j&&(j=h.node.baseURI.get.call(s.document),$=u.sourceUrl(j)),$):u.meta.url.href}),u.methods={setSource:"__uv$setSource",source:"__uv$source",location:"__uv$location",function:"__uv$function",string:"__uv$string",eval:"__uv$eval",parent:"__uv$parent",top:"__uv$top"},u.filterKeys=[c,u.methods.setSource,u.methods.source,u.methods.location,u.methods.function,u.methods.string,u.methods.eval,u.methods.parent,u.methods.top,"__uv$protocol","__uv$storageObj","__uv$url","__uv$modifiedStyle","__uv$config","__uv$dispatched","Ultraviolet","__uvHook"],h.on("wrap",((e,t)=>{h.nativeMethods.defineProperty(t,"name",h.nativeMethods.getOwnPropertyDescriptor(e,"name")),h.nativeMethods.defineProperty(t,"length",h.nativeMethods.getOwnPropertyDescriptor(e,"length")),h.nativeMethods.defineProperty(t,u.methods.string,{enumerable:!1,value:h.nativeMethods.fnToString.call(e)}),h.nativeMethods.defineProperty(t,u.methods.function,{enumerable:!1,value:e})})),h.fetch.on("request",(e=>{e.data.input=u.rewriteUrl(e.data.input)})),h.fetch.on("requestUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.fetch.on("responseUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.xhr.on("open",(e=>{e.data.input=u.rewriteUrl(e.data.input)})),h.xhr.on("responseUrl",(e=>{e.data.value=u.sourceUrl(e.data.value)})),h.workers.on("worker",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.workers.on("addModule",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.workers.on("importScripts",(e=>{for(const t in e.data.scripts)e.data.scripts[t]=u.rewriteUrl(e.data.scripts[t])})),h.workers.on("postMessage",(e=>{let t=e.data.origin;e.data.origin="*",e.data.message={__data:e.data.message,__origin:u.meta.url.origin,__to:t}})),h.navigator.on("sendBeacon",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.document.on("getCookie",(e=>{e.data.value=x})),h.document.on("setCookie",(e=>{Promise.resolve(u.cookie.setCookies(e.data.value,u.db,u.meta)).then((()=>{u.cookie.db().then((e=>{u.cookie.getCookies(e).then((e=>{x=u.cookie.serialize(e,u.meta,!0)}))}))}));const t=u.cookie.setCookie(e.data.value)[0];t.path||(t.path="/"),t.domain||(t.domain=u.meta.url.hostname),u.cookie.validateCookie(t,u.meta,!0)&&(x.length&&(x+="; "),x+=`${t.name}=${t.value}`),e.respondWith(e.data.value)})),h.element.on("setInnerHTML",(e=>{switch(e.that.tagName){case"SCRIPT":e.data.value=u.js.rewrite(e.data.value);break;case"STYLE":e.data.value=u.rewriteCSS(e.data.value);break;default:e.data.value=u.rewriteHtml(e.data.value)}})),h.element.on("getInnerHTML",(e=>{if("SCRIPT"===e.that.tagName)e.data.value=u.js.source(e.data.value);else e.data.value=u.sourceHtml(e.data.value)})),h.element.on("setOuterHTML",(e=>{e.data.value=u.rewriteHtml(e.data.value,{document:"HTML"===e.that.tagName})})),h.element.on("getOuterHTML",(e=>{switch(e.that.tagName){case"HEAD":e.data.value=u.sourceHtml(e.data.value.replace(/<head(.*)>(.*)<\/head>/s,"<op-head$1>$2</op-head>")).replace(/<op-head(.*)>(.*)<\/op-head>/s,"<head$1>$2</head>");break;case"BODY":e.data.value=u.sourceHtml(e.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:e.data.value=u.sourceHtml(e.data.value,{document:"HTML"===e.that.tagName})}})),h.document.on("write",(e=>{if(!e.data.html.length)return!1;e.data.html=[u.rewriteHtml(e.data.html.join(""))]})),h.document.on("writeln",(e=>{if(!e.data.html.length)return!1;e.data.html=[u.rewriteHtml(e.data.html.join(""))]})),h.element.on("insertAdjacentHTML",(e=>{e.data.html=u.rewriteHtml(e.data.html)})),h.eventSource.on("construct",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.eventSource.on("url",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.history.on("replaceState",(e=>{e.data.url&&(e.data.url=u.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:u.meta))})),h.history.on("pushState",(e=>{e.data.url&&(e.data.url=u.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:u.meta))})),h.element.on("getAttribute",(e=>{h.element.hasAttribute.call(e.that,u.attributePrefix+"-attr-"+e.data.name)&&e.respondWith(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name))})),h.message.on("postMessage",(e=>{let t=e.data.origin,a=u.call;e.that&&(a=e.that.__uv$source.call),e.data.origin="*",e.data.message={__data:e.data.message,__origin:(e.that||e.target).__uv$source.location.origin,__to:t},e.respondWith(a(e.target,l?[e.data.message,e.data.transfer]:[e.data.message,e.data.origin,e.data.transfer],e.that))})),h.message.on("data",(e=>{const{value:t}=e.data;"object"==typeof t&&"__data"in t&&"__origin"in t&&e.respondWith(t.__data)})),h.message.on("origin",(e=>{const t=h.message.messageData.get.call(e.that);"object"==typeof t&&t.__data&&t.__origin&&e.respondWith(t.__origin)})),h.overrideDescriptor(s,"origin",{get:()=>u.location.origin}),h.node.on("baseURI",(e=>{e.data.value.startsWith(u.meta.origin)&&(e.data.value=u.sourceUrl(e.data.value))})),h.element.on("setAttribute",(e=>{if(e.that instanceof m&&"src"===e.data.name&&e.data.value.startsWith("blob:"))return e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),void(e.data.value=u.blobUrls.get(e.data.value));u.attrs.isUrl(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteUrl(e.data.value)),u.attrs.isStyle(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList"})),u.attrs.isHtml(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteHtml(e.data.value,{...u.meta,document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,x,s.location.href)})),u.attrs.isSrcset(e.data.name)&&(e.target.call(e.that,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.html.wrapSrcset(e.data.value.toString())),u.attrs.isForbidden(e.data.name)&&(e.data.name=u.attributePrefix+"-attr-"+e.data.name)})),h.element.on("audio",(e=>{e.data.url=u.rewriteUrl(e.data.url)})),h.element.hookProperty([_,S,P,k],"href",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-href",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([p,g,v,m,M,b,f,w,y,O],"src",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{if(new String(a).toString().trim().startsWith("blob:")&&t instanceof m)return h.element.setAttribute.call(t,u.attributePrefix+"-attr-src",a),e.call(t,u.blobUrls.get(a)||a);h.element.setAttribute.call(t,u.attributePrefix+"-attr-src",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([U],"action",{get:(e,t)=>u.sourceUrl(e.call(t)),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-action",a),e.call(t,u.rewriteUrl(a))}}),h.element.hookProperty([M],"srcset",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-srcset")||e.call(t),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-srcset",a),e.call(t,u.html.wrapSrcset(a.toString()))}}),h.element.hookProperty(p,"integrity",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-integrity"),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-integrity",a)}}),h.element.hookProperty(w,"sandbox",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-sandbox")||e.call(t),set:(e,t,[a])=>{h.element.setAttribute.call(t,u.attributePrefix+"-attr-sandbox",a)}});const T=w&&Object.getOwnPropertyDescriptor(w.prototype,"contentWindow").get;function L(e){if(!e.__uv)try{i(e)}catch(e){console.error("catastrophic failure"),console.error(e)}}h.element.hookProperty(w,"contentWindow",{get:(e,t)=>{const a=T.call(t);return L(a),A(a)}}),h.element.hookProperty(w,"contentDocument",{get:(e,t)=>{const a=T.call(t);L(a);try{return A(a).document}catch(e){return null}}});const H=new WeakMap;function W(){throw new DOMException(`Blocked a frame with "${u.location.origin}" from accessing a cross-origin frame.`)}function R(e){!function(e){Reflect.setPrototypeOf(e,null);for(const t of C)Reflect.defineProperty(e,t,{value:void 0,writable:!1,enumerable:!1,configurable:!1});for(const[t,a]of Object.entries(Object.getOwnPropertyDescriptors(e)))a.configurable&&(a.enumerable=!1,a.configurable=!0,"value"in a&&(a.writable=!1),Reflect.defineProperty(e,t,a))}(e);const t={};return Reflect.setPrototypeOf(t,null),new Proxy(t,{get:(t,a,r)=>{const o=Reflect.getOwnPropertyDescriptor(e,a);return a in e&&("value"in o||"function"==typeof o.get)||W(),Reflect.get(t,a,r)},set:(t,a,r)=>{const o=Reflect.getOwnPropertyDescriptor(e,a);return a in e&&"function"==typeof o.set||W(),Reflect.set(t,a,r)},defineProperty:()=>{W()},getOwnPropertyDescriptor:(t,a,r)=>(a in e||W(),Reflect.getOwnPropertyDescriptor(t,a,r)),setPrototypeOf:()=>{W()},has:(t,a)=>(a in e||W(),!0)})}const C=["then",Symbol.toStringTag,Symbol.hasInstance,Symbol.isConcatSpreadable];function A(e){if(H.has(e))return H.get(e);if(new URL(e.__uv.meta.base).origin===new URL(s.__uv.meta.base).origin)return e;const t={get window(){return r},get location(){return a},set location(t){e.__uv.location.href=t},get closed(){return e.closed},get frames(){return r},get length(){return e.length},get top(){return e[u.methods.top]},get opener(){return A(e.opener)},get parent(){return A(e.parent)},blur(){e.blur()},close(){e.close()},focus(){e.focus()},postMessage(...t){e.__uv$setSource(u).postMessage(...t)}},a=function(e){return R({set href(t){e.__uv.location.href=t},replace(t){e.__uv.location.replace(t)}})}(e.location),r=R(t);return r}function D(e,t){const a=`on${t}`,r=new WeakMap;Reflect.defineProperty(e,a,{enumerable:!0,configurable:!0,get(){return r.has(this)?r.get(this):null},set(e){"function"==typeof e&&(r.has(this)&&this.removeEventListener(t,r.get(this)),r.set(this,e),this.addEventListener(t,e))}})}h.element.hookProperty(w,"srcdoc",{get:(e,t)=>h.element.getAttribute.call(t,u.attributePrefix+"-attr-srcdoc")||e.call(t),set:(e,t,[a])=>{e.call(t,u.rewriteHtml(a,{document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,x,s.location.href)}))}}),h.node.on("getTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=u.js.source(e.data.value))})),h.node.on("setTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=u.js.rewrite(e.data.value))})),"serviceWorker"in s.navigator&&delete s.Navigator.prototype.serviceWorker,h.document.on("getDomain",(e=>{e.data.value=u.domain})),h.document.on("setDomain",(e=>{if(!e.data.value.toString().endsWith(u.meta.url.hostname.split(".").slice(-2).join(".")))return e.respondWith("");e.respondWith(u.domain=e.data.value)})),h.document.on("url",(e=>{e.data.value=u.location.href})),h.document.on("documentURI",(e=>{e.data.value=u.location.href})),h.document.on("referrer",(e=>{e.data.value=u.referrer||u.sourceUrl(e.data.value)})),h.document.on("parseFromString",(e=>{if("text/html"!==e.data.type)return!1;e.data.string=u.rewriteHtml(e.data.string,{...u.meta,document:!0})})),h.attribute.on("getValue",(e=>{h.element.hasAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name)&&(e.data.value=h.element.getAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name))})),h.attribute.on("setValue",(e=>{u.attrs.isUrl(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteUrl(e.data.value)),u.attrs.isStyle(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList"})),u.attrs.isHtml(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.rewriteHtml(e.data.value,{...u.meta,document:!0,injectHead:u.createHtmlInject(u.handlerScript,u.bundleScript,u.clientScript,u.configScript,o,r,x,s.location.href)})),u.attrs.isSrcset(e.data.name)&&(h.element.setAttribute.call(e.that.ownerElement,u.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=u.html.wrapSrcset(e.data.value.toString()))})),h.url.on("createObjectURL",(e=>{let t=e.target.call(e.that,e.data.object);if(t.startsWith("blob:"+location.origin)){let a="blob:"+("about:blank"!==u.meta.url.href?u.meta.url.origin:s.parent.__uv.meta.url.origin)+t.slice("blob:".length+location.origin.length);u.blobUrls.set(a,t),e.respondWith(a)}else e.respondWith(t)})),h.url.on("revokeObjectURL",(e=>{if(u.blobUrls.has(e.data.url)){const t=e.data.url;e.data.url=u.blobUrls.get(e.data.url),u.blobUrls.delete(t)}})),h.storage.on("get",(e=>{e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("set",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("delete",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("getItem",(e=>{e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("setItem",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("removeItem",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=d+u.meta.url.origin+"@"+e.data.name})),h.storage.on("clear",(e=>{if(e.that.__uv$storageObj)for(const t of h.nativeMethods.keys.call(null,e.that.__uv$storageObj))delete e.that.__uv$storageObj[t],h.storage.removeItem.call(e.that,d+u.meta.url.origin+"@"+t),e.respondWith()})),h.storage.on("length",(e=>{e.that.__uv$storageObj&&e.respondWith(h.nativeMethods.keys.call(null,e.that.__uv$storageObj).length)})),h.storage.on("key",(e=>{e.that.__uv$storageObj&&e.respondWith(h.nativeMethods.keys.call(null,e.that.__uv$storageObj)[e.data.index]||null)}));const I=["ws:","wss:"];class N extends EventTarget{#e;#t;#a="blob";#r="";#o="";#n="";async#i(e,t){const a={};Reflect.setPrototypeOf(a,null),a.Origin=u.meta.url.origin,a["User-Agent"]=navigator.userAgent,""!==x&&(a.Cookie=x.toString()),this.#e=await E.createWebSocket(e,a,t),this.#e.binaryType=this.#a,this.#e.addEventListener("message",(e=>{this.dispatchEvent(new MessageEvent("message",e))})),this.#e.addEventListener("open",(async e=>{this.dispatchEvent(new Event("open",e))})),this.#e.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",e))})),this.#e.addEventListener("close",(e=>{this.dispatchEvent(new Event("close",e))}));const r=await this.#e.meta;r.headers.has("sec-websocket-protocol")&&(this.#r=r.headers.get("sec-websocket-protocol")),r.headers.has("sec-websocket-extensions")&&(this.#o=r.headers.get("sec-websocket-extensions"));let o=r.rawHeaders["set-cookie"]||[];Array.isArray(o)||(o=[]);for(const e of o)document.cookie=e}get url(){return this.#n}constructor(...e){if(super(),!e.length)throw new DOMException("Failed to construct 'WebSocket': 1 argument required, but only 0 present.");const[t,a]=e;let r;try{r=new URL(t)}catch(e){throw new DOMException(`Faiiled to construct 'WebSocket': The URL '${t}' is invalid.`)}if(!I.includes(r.protocol))throw new DOMException(`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${r.protocol}' is not allowed.`);this.#t=this.#i(r,a)}get protocol(){return this.#r}get extensions(){return this.#o}get readyState(){return this.#e?this.#e.readyState:N.CONNECTING}get binaryType(){return this.#a}set binaryType(e){this.#a=e,this.#e&&(this.#e.binaryType=e)}send(e){if(!this.#e)throw new DOMException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.");this.#e.send(e)}close(e,t){if(void 0!==e&&("number"!=typeof e&&(e=0),1e3!==e&&(e<3e3||e>4999)))throw new DOMException(`Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. ${e} is neither.`);this.#t.then((()=>this.#e.close(e,t)))}}D(N.prototype,"close"),D(N.prototype,"open"),D(N.prototype,"message"),D(N.prototype,"error");for(const e of["url","protocol","extensions","readyState","binaryType"]){const t=Object.getOwnPropertyDescriptor(s.WebSocket.prototype,e),a=Object.getOwnPropertyDescriptor(N.prototype,e);a?.get&&t?.get&&h.emit("wrap",a.get,t.get),a?.set&&t?.set&&h.emit("wrap",a.get,t.get)}if(h.emit("wrap",s.WebSocket.prototype.send,N.prototype.send),h.emit("wrap",s.WebSocket.prototype.close,N.prototype.close),h.override(s,"WebSocket",((e,t,a)=>new N(...a)),!0),N.prototype.constructor=s.WebSocket,h.function.on("function",(e=>{e.data.script=u.rewriteJS(e.data.script)})),h.function.on("toString",(e=>{u.methods.string in e.that&&e.respondWith(e.that[u.methods.string])})),h.object.on("getOwnPropertyNames",(e=>{e.data.names=e.data.names.filter((e=>!u.filterKeys.includes(e)))})),h.object.on("getOwnPropertyDescriptors",(e=>{for(const t of u.filterKeys)delete e.data.descriptors[t]})),h.style.on("setProperty",(e=>{h.style.dashedUrlProps.includes(e.data.property)&&(e.data.value=u.rewriteCSS(e.data.value,{context:"value",...u.meta}))})),h.style.on("getPropertyValue",(e=>{h.style.dashedUrlProps.includes(e.data.property)&&e.respondWith(u.sourceCSS(e.target.call(e.that,e.data.property),{context:"value",...u.meta}))})),"CSS2Properties"in s)for(const e of h.style.urlProps)h.overrideDescriptor(s.CSS2Properties.prototype,e,{get:(e,t)=>u.sourceCSS(e.call(t),{context:"value",...u.meta}),set:(e,t,a)=>{e.call(t,u.rewriteCSS(a,{context:"value",...u.meta}))}});else"HTMLElement"in s&&h.overrideDescriptor(s.HTMLElement.prototype,"style",{get:(e,t)=>{const a=e.call(t);if(!a.__uv$modifiedStyle)for(const e of h.style.urlProps)h.nativeMethods.defineProperty(a,e,{enumerable:!0,configurable:!0,get(){const t=h.style.getPropertyValue.call(this,e)||"";return u.sourceCSS(t,{context:"value",...u.meta})},set(t){h.style.setProperty.call(this,h.style.propToDashed[e]||e,u.rewriteCSS(t,{context:"value",...u.meta}))}}),h.nativeMethods.defineProperty(a,"__uv$modifiedStyle",{enumerable:!1,value:!0});return a}});h.style.on("setCssText",(e=>{e.data.value=u.rewriteCSS(e.data.value,{context:"declarationList",...u.meta})})),h.style.on("getCssText",(e=>{e.data.value=u.sourceCSS(e.data.value,{context:"declarationList",...u.meta})})),u.addEventListener.call(s,"hashchange",(e=>{if(e.__uv$dispatched)return!1;e.stopImmediatePropagation();const t=s.location.hash;h.history.replaceState.call(s.history,"","",e.oldURL),u.location.hash=t})),h.location.on("hashchange",((e,t,a)=>{if(a.HashChangeEvent&&h.history.replaceState){h.history.replaceState.call(s.history,"","",u.rewriteUrl(t));const r=new a.HashChangeEvent("hashchange",{newURL:t,oldURL:e});h.nativeMethods.defineProperty(r,"__uv$dispatched",{value:!0,enumerable:!1}),u.dispatchEvent.call(s,r)}})),h.fetch.overrideRequest(),h.fetch.overrideUrl(),h.xhr.overrideOpen(),h.xhr.overrideResponseUrl(),h.element.overrideHtml(),h.element.overrideAttribute(),h.element.overrideInsertAdjacentHTML(),h.element.overrideAudio(),h.node.overrideBaseURI(),h.node.overrideTextContent(),h.attribute.overrideNameValue(),h.document.overrideDomain(),h.document.overrideURL(),h.document.overrideDocumentURI(),h.document.overrideWrite(),h.document.overrideReferrer(),h.document.overrideParseFromString(),h.storage.overrideMethods(),h.storage.overrideLength(),h.object.overrideGetPropertyNames(),h.object.overrideGetOwnPropertyDescriptors(),h.history.overridePushState(),h.history.overrideReplaceState(),h.eventSource.overrideConstruct(),h.eventSource.overrideUrl(),h.url.overrideObjectURL(),h.document.overrideCookie(),h.message.overridePostMessage(),h.message.overrideMessageOrigin(),h.message.overrideMessageData(),h.workers.overrideWorker(),h.workers.overrideAddModule(),h.workers.overrideImportScripts(),h.workers.overridePostMessage(),h.style.overrideSetGetProperty(),h.style.overrideCssText(),h.navigator.overrideSendBeacon(),h.function.overrideFunction(),h.function.overrideToString(),h.location.overrideWorkerLocation((e=>new URL(u.sourceUrl(e)))),h.overrideDescriptor(s,"localStorage",{get:(e,t)=>(t||s).__uv.lsWrap}),h.overrideDescriptor(s,"sessionStorage",{get:(e,t)=>(t||s).__uv.ssWrap}),h.override(s,"open",((e,t,a)=>{if(!a.length)return e.apply(t,a);let[r]=a;return r=u.rewriteUrl(r),e.call(t,r)})),u.$wrap=function(e){return"location"===e?u.methods.location:"eval"===e?u.methods.eval:e},u.$get=function(e){return e===s.location?u.location:e===s.eval?u.eval:e===s.parent?s.__uv$parent:e===s.top?s.__uv$top:e},u.eval=h.wrap(s,"eval",((e,t,a)=>{if(!a.length||"string"!=typeof a[0])return e.apply(t,a);let[r]=a;return r=u.rewriteJS(r),e.call(t,r)})),u.call=function(e,t,a){return a?e.apply(a,t):e(...t)},u.call$=function(e,t,a=[]){return e[t].apply(e,a)},h.nativeMethods.defineProperty(s.Object.prototype,c,{get:()=>u,enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.setSource,{value:function(e){return h.nativeMethods.isExtensible(this)?(h.nativeMethods.defineProperty(this,u.methods.source,{value:e,writable:!0,enumerable:!1}),this):this},enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.source,{value:u,writable:!0,enumerable:!1}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.location,{configurable:!0,get(){return this===s.document||this===s?u.location:this.location},set(e){this===s.document||this===s?u.location.href=e:this.location=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.parent,{configurable:!0,get(){const e=this.parent;if(this===s)try{return"__uv"in e?A(e):this}catch(e){return this}return e},set(e){this.parent=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.top,{configurable:!0,get(){const e=this.top;if(this===s){if(e===this.parent)return this[u.methods.parent];try{if("__uv"in e)return e;{let t=this;for(;t.parent!==e;)t=t.parent;return"__uv"in t?t:this}}catch(e){return this}}return e},set(e){this.top=e}}),h.nativeMethods.defineProperty(s.Object.prototype,u.methods.eval,{configurable:!0,get(){return this===s?u.eval:this.eval},set(e){this.eval=e}})}self.__uv||i(self),self.__uvHook=i})(); | ||
//# sourceMappingURL=uv.handler.js.map |
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";const e=self.Ultraviolet,t=["cross-origin-embedder-policy","cross-origin-opener-policy","cross-origin-resource-policy","content-security-policy","content-security-policy-report-only","expect-ct","feature-policy","origin-isolation","strict-transport-security","upgrade-insecure-requests","x-content-type-options","x-download-options","x-frame-options","x-permitted-cross-domain-policies","x-powered-by","x-xss-protection"],r=["GET","HEAD"];class i extends e.EventEmitter{constructor(t=__uv$config){super(),t.bare||(t.bare="/bare/"),t.prefix||(t.prefix="/service/"),this.config=t;const r=(Array.isArray(t.bare)?t.bare:[t.bare]).map((e=>new URL(e,location).toString()));this.address=r[~~(Math.random()*r.length)],this.bareClient=new e.BareClient(this.address)}async fetch({request:i}){let a;try{if(!i.url.startsWith(location.origin+this.config.prefix))return await fetch(i);const c=new e(this.config,this.address);"function"==typeof this.config.construct&&this.config.construct(c,"service");const l=await c.cookie.db();c.meta.origin=location.origin,c.meta.base=c.meta.url=new URL(c.sourceUrl(i.url));const d=new o(i,this,c,r.includes(i.method.toUpperCase())?null:await i.blob());if("blob:"===c.meta.url.protocol&&(d.blob=!0,d.base=d.url=new URL(d.url.pathname)),i.referrer&&i.referrer.startsWith(location.origin)){const e=new URL(c.sourceUrl(i.referrer));(d.headers.origin||c.meta.url.origin!==e.origin&&"cors"===i.mode)&&(d.headers.origin=e.origin),d.headers.referer=e.href}const h=await c.cookie.getCookies(l)||[],u=c.cookie.serialize(h,c.meta,!1);d.headers["user-agent"]=navigator.userAgent,u&&(d.headers.cookie=u);const p=new n(d,null,null);if(this.emit("request",p),p.intercepted)return p.returnValue;a=d.blob?"blob:"+location.origin+d.url.pathname:d.url;const m=await this.bareClient.fetch(a,{headers:d.headers,method:d.method,body:d.body,credentials:d.credentials,mode:location.origin!==d.address.origin?"cors":d.mode,cache:d.cache,redirect:d.redirect}),f=new s(d,m),b=new n(f,null,null);if(this.emit("beforemod",b),b.intercepted)return b.returnValue;for(const e of t)f.headers[e]&&delete f.headers[e];if(f.headers.location&&(f.headers.location=c.rewriteUrl(f.headers.location)),"document"===i.destination){const e=f.headers["content-disposition"];if(console.log({header:e},/filename=/i.test(e),/^\s*?attachment/i.test(e)),!/\s*?((inline|attachment);\s*?)filename=/i.test(e)){const t=/^\s*?attachment/i.test(e)?"attachment":"inline",[r]=new URL(m.finalURL).pathname.split("/").slice(-1);f.headers["content-disposition"]=`${t}; filename=${JSON.stringify(r)}`}}if(f.headers["set-cookie"]&&(Promise.resolve(c.cookie.setCookies(f.headers["set-cookie"],l,c.meta)).then((()=>{self.clients.matchAll().then((function(e){e.forEach((function(e){e.postMessage({msg:"updateCookies",url:c.meta.url.href})}))}))})),delete f.headers["set-cookie"]),f.body)switch(i.destination){case"script":case"worker":{const e=[c.bundleScript,c.clientScript,c.configScript,c.handlerScript].map((e=>JSON.stringify(e))).join(",");f.body=`if (!self.__uv && self.importScripts) { ${c.createJsInject(this.address,this.bareClient.data,c.cookie.serialize(h,c.meta,!0),i.referrer)} importScripts(${e}); }\n`,f.body+=c.js.rewrite(await m.text())}break;case"style":f.body=c.rewriteCSS(await m.text());break;case"iframe":case"document":(function(t,r=""){return"text/html"===(e.mime.contentType(r||t.pathname)||"text/html").split(";")[0]})(c.meta.url,f.headers["content-type"]||"")&&(f.body=c.rewriteHtml(await m.text(),{document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,this.address,this.bareClient.data,c.cookie.serialize(h,c.meta,!0),i.referrer)}))}return"text/event-stream"===d.headers.accept&&(f.headers["content-type"]="text/event-stream"),this.emit("response",b),b.intercepted?b.returnValue:new Response(f.body,{headers:f.headers,status:f.status,statusText:f.statusText})}catch(e){return["document","iframe"].includes(i.destination)?(console.error(e),function(e,t,r){let i,s,o,n,a="";!function(e){return e instanceof Error&&"object"==typeof e.body}(e)?(i=500,s="Error processing your request",n="Internal Server Error",o=e instanceof Error?e.name:"UNKNOWN"):(i=e.status,s="Error communicating with the Bare server",n=e.body.message,o=e.body.code,a=e.body.id);return new Response(function(e,t,r,i,s,o,n){if("The specified host could not be resolved."===i)return function(e,t){const r=new URL(e),i=`remoteHostname.textContent = ${JSON.stringify(r.hostname)};bareServer.href = ${JSON.stringify(t)};uvHostname.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());uvVersion.textContent = ${JSON.stringify("1.0.8")};`;return`<!DOCTYPE html><html><head><meta charset='utf-8' /><title>Error</title></head><body><h1>This site can’t be reached</h1><hr /><p><b id="remoteHostname"></b>’s server IP address could not be found.</p><p>Try:</p><ul><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>'s administrator</li><li>Verifying the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p><script src="${"data:application/javascript,"+encodeURIComponent(i)}"><\/script></body></html>`}(o,n);const a=`errorTitle.textContent = ${JSON.stringify(e)};errorCode.textContent = ${JSON.stringify(t)};`+(r?`errorId.textContent = ${JSON.stringify(r)};`:"")+`errorMessage.textContent = ${JSON.stringify(i)};`+`errorTrace.value = ${JSON.stringify(s)};`+`fetchedURL.textContent = ${JSON.stringify(o)};`+`bareServer.href = ${JSON.stringify(n)};`+`for (const node of document.querySelectorAll("#uvHostname")) node.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());`+`uvVersion.textContent = ${JSON.stringify("1.0.8")};`;return'<!DOCTYPE html><html><head><meta charset=\'utf-8\' /><title>Error</title></head><body><h1 id=\'errorTitle\'></h1><hr /><p>Failed to load <b id="fetchedURL"></b></p><p id="errorMessage"></p><table><tbody><tr><td>Code:</td><td id="errorCode"></td></tr>'+(r?'<tr><td>ID:</td><td id="errorId"></td></tr>':"")+'</tbody></table><textarea id="errorTrace" cols="40" rows="10" readonly></textarea><p>Try:</p><ul><li>Checking your internet connection</li><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>\'s administrator</li><li>Verify the <a id=\'bareServer\' title=\'Bare server\'>Bare server</a> isn\'t censored</li></ul><p>If you\'re the administrator of <b id="uvHostname"></b>, try:</p><ul><li>Restarting your Bare server</li><li>Updating Ultraviolet</li><li>Troubleshooting the error on the <a href="https://github.com/titaniumnetwork-dev/Ultraviolet">GitHub repository</a></li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p>'+`<script src="${"data:application/javascript,"+encodeURIComponent(a)}"><\/script></body></html>`}(s,o,a,n,String(e),t,r),{status:i,headers:{"content-type":"text/html"}})}(e,a,this.address)):new Response(void 0,{status:500})}}static Ultraviolet=e}self.UVServiceWorker=i;class s{constructor(e,t){this.request=e,this.raw=t,this.ultraviolet=e.ultraviolet,this.headers={};for(const e in t.rawHeaders)this.headers[e.toLowerCase()]=t.rawHeaders[e];this.status=t.status,this.statusText=t.statusText,this.body=t.body}get url(){return this.request.url}get base(){return this.request.base}set base(e){this.request.base=e}}class o{constructor(e,t,r,i=null){this.ultraviolet=r,this.request=e,this.headers=Object.fromEntries(e.headers.entries()),this.method=e.method,this.address=t.address,this.body=i||null,this.cache=e.cache,this.redirect=e.redirect,this.credentials="omit",this.mode="cors"===e.mode?e.mode:"same-origin",this.blob=!1}get url(){return this.ultraviolet.meta.url}set url(e){this.ultraviolet.meta.url=e}get base(){return this.ultraviolet.meta.base}set base(e){this.ultraviolet.meta.base=e}}class n{#e;#t;constructor(e={},t=null,r=null){this.#e=!1,this.#t=null,this.data=e,this.target=t,this.that=r}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(e){this.#t=e,this.#e=!0}}})(); | ||
(()=>{"use strict";const e=self.Ultraviolet,t=["cross-origin-embedder-policy","cross-origin-opener-policy","cross-origin-resource-policy","content-security-policy","content-security-policy-report-only","expect-ct","feature-policy","origin-isolation","strict-transport-security","upgrade-insecure-requests","x-content-type-options","x-download-options","x-frame-options","x-permitted-cross-domain-policies","x-powered-by","x-xss-protection"],r=["GET","HEAD"];class i extends e.EventEmitter{constructor(t=__uv$config){super(),t.bare||(t.bare="/bare/"),t.prefix||(t.prefix="/service/"),this.config=t;const r=(Array.isArray(t.bare)?t.bare:[t.bare]).map((e=>new URL(e,location).toString()));this.address=r[~~(Math.random()*r.length)],this.bareClient=new e.BareClient(this.address)}async fetch({request:i}){let a;try{if(!i.url.startsWith(location.origin+this.config.prefix))return await fetch(i);const c=new e(this.config,this.address);"function"==typeof this.config.construct&&this.config.construct(c,"service");const l=await c.cookie.db();c.meta.origin=location.origin,c.meta.base=c.meta.url=new URL(c.sourceUrl(i.url));const d=new o(i,this,c,r.includes(i.method.toUpperCase())?null:await i.blob());if("blob:"===c.meta.url.protocol&&(d.blob=!0,d.base=d.url=new URL(d.url.pathname)),i.referrer&&i.referrer.startsWith(location.origin)){const e=new URL(c.sourceUrl(i.referrer));(d.headers.origin||c.meta.url.origin!==e.origin&&"cors"===i.mode)&&(d.headers.origin=e.origin),d.headers.referer=e.href}const h=await c.cookie.getCookies(l)||[],u=c.cookie.serialize(h,c.meta,!1);d.headers["user-agent"]=navigator.userAgent,u&&(d.headers.cookie=u);const p=new n(d,null,null);if(this.emit("request",p),p.intercepted)return p.returnValue;a=d.blob?"blob:"+location.origin+d.url.pathname:d.url;const m=await this.bareClient.fetch(a,{headers:d.headers,method:d.method,body:d.body,credentials:d.credentials,mode:location.origin!==d.address.origin?"cors":d.mode,cache:d.cache,redirect:d.redirect}),f=new s(d,m),b=new n(f,null,null);if(this.emit("beforemod",b),b.intercepted)return b.returnValue;for(const e of t)f.headers[e]&&delete f.headers[e];if(f.headers.location&&(f.headers.location=c.rewriteUrl(f.headers.location)),"document"===i.destination){const e=f.headers["content-disposition"];if(!/\s*?((inline|attachment);\s*?)filename=/i.test(e)){const t=/^\s*?attachment/i.test(e)?"attachment":"inline",[r]=new URL(m.finalURL).pathname.split("/").slice(-1);f.headers["content-disposition"]=`${t}; filename=${JSON.stringify(r)}`}}if(f.headers["set-cookie"]&&(Promise.resolve(c.cookie.setCookies(f.headers["set-cookie"],l,c.meta)).then((()=>{self.clients.matchAll().then((function(e){e.forEach((function(e){e.postMessage({msg:"updateCookies",url:c.meta.url.href})}))}))})),delete f.headers["set-cookie"]),f.body)switch(i.destination){case"script":case"worker":{const e=[c.bundleScript,c.clientScript,c.configScript,c.handlerScript].map((e=>JSON.stringify(e))).join(",");f.body=`if (!self.__uv && self.importScripts) { ${c.createJsInject(this.address,this.bareClient.data,c.cookie.serialize(h,c.meta,!0),i.referrer)} importScripts(${e}); }\n`,f.body+=c.js.rewrite(await m.text())}break;case"style":f.body=c.rewriteCSS(await m.text());break;case"iframe":case"document":(function(t,r=""){return"text/html"===(e.mime.contentType(r||t.pathname)||"text/html").split(";")[0]})(c.meta.url,f.headers["content-type"]||"")&&(f.body=c.rewriteHtml(await m.text(),{document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,this.address,this.bareClient.data,c.cookie.serialize(h,c.meta,!0),i.referrer)}))}return"text/event-stream"===d.headers.accept&&(f.headers["content-type"]="text/event-stream"),this.emit("response",b),b.intercepted?b.returnValue:new Response(f.body,{headers:f.headers,status:f.status,statusText:f.statusText})}catch(e){return["document","iframe"].includes(i.destination)?(console.error(e),function(e,t,r){let i,s,o,n,a="";!function(e){return e instanceof Error&&"object"==typeof e.body}(e)?(i=500,s="Error processing your request",n="Internal Server Error",o=e instanceof Error?e.name:"UNKNOWN"):(i=e.status,s="Error communicating with the Bare server",n=e.body.message,o=e.body.code,a=e.body.id);return new Response(function(e,t,r,i,s,o,n){if("The specified host could not be resolved."===i)return function(e,t){const r=new URL(e),i=`remoteHostname.textContent = ${JSON.stringify(r.hostname)};bareServer.href = ${JSON.stringify(t)};uvHostname.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());uvVersion.textContent = ${JSON.stringify("1.0.9")};`;return`<!DOCTYPE html><html><head><meta charset='utf-8' /><title>Error</title></head><body><h1>This site can’t be reached</h1><hr /><p><b id="remoteHostname"></b>’s server IP address could not be found.</p><p>Try:</p><ul><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>'s administrator</li><li>Verifying the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p><script src="${"data:application/javascript,"+encodeURIComponent(i)}"><\/script></body></html>`}(o,n);const a=`errorTitle.textContent = ${JSON.stringify(e)};errorCode.textContent = ${JSON.stringify(t)};`+(r?`errorId.textContent = ${JSON.stringify(r)};`:"")+`errorMessage.textContent = ${JSON.stringify(i)};`+`errorTrace.value = ${JSON.stringify(s)};`+`fetchedURL.textContent = ${JSON.stringify(o)};`+`bareServer.href = ${JSON.stringify(n)};`+`for (const node of document.querySelectorAll("#uvHostname")) node.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());`+`uvVersion.textContent = ${JSON.stringify("1.0.9")};`;return'<!DOCTYPE html><html><head><meta charset=\'utf-8\' /><title>Error</title></head><body><h1 id=\'errorTitle\'></h1><hr /><p>Failed to load <b id="fetchedURL"></b></p><p id="errorMessage"></p><table><tbody><tr><td>Code:</td><td id="errorCode"></td></tr>'+(r?'<tr><td>ID:</td><td id="errorId"></td></tr>':"")+'</tbody></table><textarea id="errorTrace" cols="40" rows="10" readonly></textarea><p>Try:</p><ul><li>Checking your internet connection</li><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>\'s administrator</li><li>Verify the <a id=\'bareServer\' title=\'Bare server\'>Bare server</a> isn\'t censored</li></ul><p>If you\'re the administrator of <b id="uvHostname"></b>, try:</p><ul><li>Restarting your Bare server</li><li>Updating Ultraviolet</li><li>Troubleshooting the error on the <a href="https://github.com/titaniumnetwork-dev/Ultraviolet">GitHub repository</a></li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p>'+`<script src="${"data:application/javascript,"+encodeURIComponent(a)}"><\/script></body></html>`}(s,o,a,n,String(e),t,r),{status:i,headers:{"content-type":"text/html"}})}(e,a,this.address)):new Response(void 0,{status:500})}}static Ultraviolet=e}self.UVServiceWorker=i;class s{constructor(e,t){this.request=e,this.raw=t,this.ultraviolet=e.ultraviolet,this.headers={};for(const e in t.rawHeaders)this.headers[e.toLowerCase()]=t.rawHeaders[e];this.status=t.status,this.statusText=t.statusText,this.body=t.body}get url(){return this.request.url}get base(){return this.request.base}set base(e){this.request.base=e}}class o{constructor(e,t,r,i=null){this.ultraviolet=r,this.request=e,this.headers=Object.fromEntries(e.headers.entries()),this.method=e.method,this.address=t.address,this.body=i||null,this.cache=e.cache,this.redirect=e.redirect,this.credentials="omit",this.mode="cors"===e.mode?e.mode:"same-origin",this.blob=!1}get url(){return this.ultraviolet.meta.url}set url(e){this.ultraviolet.meta.url=e}get base(){return this.ultraviolet.meta.base}set base(e){this.ultraviolet.meta.base=e}}class n{#e;#t;constructor(e={},t=null,r=null){this.#e=!1,this.#t=null,this.data=e,this.target=t,this.that=r}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(e){this.#t=e,this.#e=!0}}})(); | ||
//# sourceMappingURL=uv.sw.js.map |
{ | ||
"name": "@titaniumnetwork-dev/ultraviolet", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.cjs", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2969331
2921