@duplicati/ngclient 0.0.209 → 0.0.211
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/{chunk-7J6AVYZE.js → chunk-2TGB7FK7.js} +1 -1
- package/{chunk-5ECY4LSP.js → chunk-36J3WTHV.js} +1 -1
- package/{chunk-WZV32HLQ.js → chunk-3DFXRSFL.js} +1 -1
- package/{chunk-5KQZMHFN.js → chunk-5MOLXRIQ.js} +1 -1
- package/{chunk-UGEDZCTM.js → chunk-5N2VOOTZ.js} +1 -1
- package/{chunk-7ZA3Q6TS.js → chunk-64W3VKAP.js} +1 -1
- package/{chunk-EL2UKEXS.js → chunk-6FBNKISB.js} +1 -1
- package/{chunk-ODHFI4PA.js → chunk-7HXPIZN6.js} +1 -1
- package/{chunk-OSAM5F7M.js → chunk-A7BE7GAK.js} +1 -1
- package/{chunk-TYEWJKJU.js → chunk-ANLSBAWJ.js} +1 -1
- package/{chunk-64IX6ISO.js → chunk-AXBVBB2B.js} +1 -1
- package/{chunk-RNTBVXBV.js → chunk-BKEVAAWN.js} +1 -1
- package/{chunk-AZFGZQQK.js → chunk-CCUGG5E4.js} +1 -1
- package/{chunk-JW6W3ER7.js → chunk-COT66FJB.js} +1 -1
- package/chunk-CVTB53TL.js +1 -0
- package/{chunk-3WOW2XM3.js → chunk-DGPSGSEP.js} +1 -1
- package/{chunk-Q5WLMQD4.js → chunk-DV7RWC4G.js} +1 -1
- package/{chunk-6HMNDYMY.js → chunk-EGJL4XXZ.js} +1 -1
- package/chunk-FCVVFGU2.js +1 -0
- package/{chunk-BSYMQ4VF.js → chunk-FXZ3K2FU.js} +1 -1
- package/{chunk-2V75WWT2.js → chunk-GCFBX62M.js} +1 -1
- package/{chunk-I2HYK2BL.js → chunk-GSDHTV3P.js} +1 -1
- package/{chunk-UUQWSINE.js → chunk-HDJL2F2F.js} +1 -1
- package/{chunk-AZJ2P3YU.js → chunk-HUJGWHH6.js} +1 -1
- package/chunk-I7HI454U.js +1 -0
- package/chunk-IHB6NRMQ.js +1 -0
- package/chunk-IV3M3Q6B.js +1 -0
- package/{chunk-2XMYVT7N.js → chunk-JTO22TJU.js} +1 -1
- package/{chunk-2T442RZU.js → chunk-KAZ3YMHR.js} +1 -1
- package/chunk-KEHA3UWS.js +1 -0
- package/chunk-KQZRDX7C.js +1 -0
- package/{chunk-CPI5ZQUF.js → chunk-LIDIFLHF.js} +1 -1
- package/{chunk-HA7XREWO.js → chunk-MI32HHLT.js} +1 -1
- package/{chunk-4QE3MT56.js → chunk-MNK3XRJD.js} +1 -1
- package/{chunk-7YLK4QIL.js → chunk-N35VE3MO.js} +1 -1
- package/{chunk-QEIGUOTC.js → chunk-NQIZGFSO.js} +1 -1
- package/{chunk-LMZN2X5M.js → chunk-PSRISEFO.js} +1 -1
- package/{chunk-FE3ADWR5.js → chunk-SA6PEMWL.js} +1 -1
- package/{chunk-DHOED4DH.js → chunk-SP3KG7FO.js} +1 -1
- package/{chunk-BQEUHLSB.js → chunk-SSUCTZ3H.js} +1 -1
- package/{chunk-3SSB4QCJ.js → chunk-UY2WEUKC.js} +1 -1
- package/{chunk-B35WNLRM.js → chunk-WBTDGQME.js} +1 -1
- package/{chunk-RC3UQLPB.js → chunk-WSFAOFM3.js} +1 -1
- package/chunk-XE42CXGY.js +1 -0
- package/{chunk-4NENQSXM.js → chunk-XRSDTFDU.js} +1 -1
- package/{chunk-47PB4WN3.js → chunk-YIKPWYEP.js} +1 -1
- package/{chunk-JKIZ6U22.js → chunk-YIM56S4M.js} +1 -1
- package/{chunk-MAKVVEKB.js → chunk-Z772CHAB.js} +1 -1
- package/{chunk-CNOKPOR3.js → chunk-ZVWTSTR6.js} +1 -1
- package/{chunk-CNUQWXBC.js → chunk-ZY64T3CX.js} +1 -1
- package/index.html +1 -1
- package/main-4RMOPKNF.js +1 -0
- package/package.json +1 -1
- package/chunk-77ALZWIA.js +0 -1
- package/chunk-FKCZIBN3.js +0 -1
- package/chunk-G7XKFPGX.js +0 -1
- package/chunk-LO5YNFFR.js +0 -1
- package/chunk-O7MDPYFW.js +0 -1
- package/chunk-SEFBKH36.js +0 -1
- package/chunk-XHUMSL6X.js +0 -1
- package/chunk-XQTUBHIK.js +0 -1
- package/main-7RC24G3G.js +0 -1
package/main-4RMOPKNF.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Ie,c as ke}from"./chunk-LGILJ5LY.js";import{a as we}from"./chunk-Z772CHAB.js";import{a as Ee}from"./chunk-3ZCJK7PY.js";import{b as I}from"./chunk-GSDHTV3P.js";import"./chunk-WBTDGQME.js";import{a as Me}from"./chunk-SLS3DCJP.js";import{b as Te}from"./chunk-SUY5AQLW.js";import{a as V}from"./chunk-6Q6SSTBK.js";import{a as Se}from"./chunk-I4XRVBRQ.js";import"./chunk-RFB5A3B7.js";import"./chunk-HUJGWHH6.js";import"./chunk-HDJL2F2F.js";import{a as H}from"./chunk-BEXYTIOL.js";import{a as h,b as ye,c as v,d as Re,e as E}from"./chunk-I7HI454U.js";import{u as be,x as Ce}from"./chunk-YCLTQEU6.js";import{a as ge,e as ve}from"./chunk-2LSZ2I43.js";import{c as le,d as me,g as de,h as ue,i as he,j as fe}from"./chunk-BMWZYMK6.js";import{a as ne}from"./chunk-7FYL7MVA.js";import{a as re,b as se,c as ie,e as ae,f as pe,g as ce}from"./chunk-NBTTYKXH.js";import{ha as te,ma as oe}from"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import{Db as Y,E as J,K as T,Kc as Z,Lc as ee,M as K,U as C,X as _,Z as s,eb as Q,f as F,g as W,ga as q,ha as z,l as $,m as G,oa as d,p as w,qa as X,y as P,z as B}from"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";var k=class e{#e=s(h);#d=s(v);ngOnInit(){ye(),this.#d.fetchConfig(),this.#e.clearAllNotCurrentVersion()}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Q({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&Y(0,"router-outlet")},dependencies:[le],encapsulation:2})};var Ae={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var f=new _("ENVIRONMENT");var A=class e{#e=s(ve);isLoaded=d(!1);webmodules=d(null);preload(o=!1){let t=this.#e.getApiV1Webmodules().pipe(K(n=>this.webmodules.set(n)),J(()=>this.isLoaded.set(!0)));if(o)return t;t.subscribe()}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var Ue=()=>{let e=s(E);return e.token()?!0:e.checkProxyAuthed().pipe(T(o=>o?$(!0):e.refreshToken().pipe(w(()=>!0))))},je=()=>{let e=s(v),o=s(I),t=s(q),n=e.relayIsEnabled()?"longpoll":"websocket",i=[t.get(H).preload(!0),t.get(H).preloadFilterGroups(!0),t.get(A).preload(!0)];return e.configLoaded===null?P(i).pipe(w(()=>n)):e.configLoaded?.pipe(T(()=>P(i)))},Fe=()=>!0,Ne={path:"connect/:typeParam",loadComponent:()=>import("./chunk-N35VE3MO.js")},We=()=>{let e=s(h);return!e.getItem("locale")&&navigator.language&&e.setItem("locale",navigator.language),!0},Oe=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-KQZRDX7C.js")},{path:"logout",loadComponent:()=>import("./chunk-36J3WTHV.js")},{path:"",canActivate:[Ue],children:[{path:"",canActivate:[je,Fe,We],children:[{path:"welcome",loadComponent:()=>import("./chunk-VTFVTC7O.js"),children:[{path:"",redirectTo:"select",pathMatch:"full"},{path:"select",loadComponent:()=>import("./chunk-DV7RWC4G.js")},Ne]},{path:"",loadComponent:()=>import("./chunk-LIDIFLHF.js"),children:[{path:"",loadComponent:()=>import("./chunk-2TGB7FK7.js")},Ne,{path:"destinations",loadComponent:()=>import("./chunk-SSUCTZ3H.js")},{path:"add-backup",loadComponent:()=>import("./chunk-ZY64T3CX.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-WSFAOFM3.js")},{path:"backup/import",loadComponent:()=>import("./chunk-64W3VKAP.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-SP3KG7FO.js"),loadChildren:()=>import("./chunk-FCVVFGU2.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-SP3KG7FO.js"),loadChildren:()=>import("./chunk-FCVVFGU2.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-5MOLXRIQ.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-KAZ3YMHR.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-SA6PEMWL.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-7HXPIZN6.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-DGPSGSEP.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-FXZ3K2FU.js")},{path:"from-config",loadComponent:()=>import("./chunk-C6RVYQ4M.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-ANLSBAWJ.js"),loadChildren:()=>import("./chunk-IV3M3Q6B.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-ANLSBAWJ.js"),loadChildren:()=>import("./chunk-IV3M3Q6B.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-ANLSBAWJ.js"),loadChildren:()=>import("./chunk-IV3M3Q6B.js")},{path:"status",loadComponent:()=>import("./chunk-AXBVBB2B.js")},{path:"settings",loadComponent:()=>import("./chunk-XRSDTFDU.js")},{path:"about",loadComponent:()=>import("./chunk-CCUGG5E4.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-3DFXRSFL.js")},{path:"changelog",loadComponent:()=>import("./chunk-IZCDGVXJ.js")},{path:"libraries",loadComponent:()=>import("./chunk-3KMV4PTJ.js")},{path:"system-info",loadComponent:()=>import("./chunk-U3SGWHNI.js")},{path:"server-settings",loadComponent:()=>import("./chunk-YIKPWYEP.js")},{path:"logs",loadChildren:()=>import("./chunk-NDLPNBGE.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-BKQA64HZ.js")}]}]}]}]}]}];var xe=(e,o)=>{let t=s(E),n=s(me),i=s(h),p=s(f),m=i.getItem("locale"),a=s(Ce),g=Ie(m),r=ge.BASE||"",c=e.url===`${r}/api/v1/auth/login`,u=e.url===`${r}/api/v1/auth/logout`,S=e.url===`${r}/api/v1/auth/refresh`,y=e.url===`${r}/api/v1/progressstate`,x=e.url===`${r}/api/v1/remoteoperation/test`,M=e.url===`${r}/api/v1/filesystem/validate`,De=e.url.startsWith(`${r}/api/v2/`),L=t.token(),U=e,j=e.headers.has("custom-proxy-check")||L===Re;if(L&&e.url.startsWith(r+p.baseUrl)&&!j){let l=e.headers.set("Authorization",`Bearer ${L}`);m&&m!=="en-US"&&(l=l.set("X-Ui-Language",g)),U=e.clone({headers:l})}return o(U).pipe(w(l=>{if(l.type===4&&l.status===200&&De){let b=l.body;if(b?.Success===!1)throw{status:200,message:b?.Error??"Unknown error",error:{Error:b?.Error??"Unknown error"},requestBody:b}}return l}),B(l=>{let b=l.error?.Error||`Error Code: ${l.status}, Message: ${l.message}`;if(!j){let R=!0;if((y&&l.status===404||x||M)&&(R=!1),S&&l.status===401&&(R=!1,t.logout(),n.navigate(["/logout"])),!c&&!S&&!u&&l.status===401)return R=!1,t.refreshToken().pipe(T(()=>o(e.clone({headers:e.headers.set("Authorization",`Bearer ${t.token()}`)}))));R&&a.error(b)}return G(()=>({error:l,message:b}))}))};var N=class e{#e=s(z);showError(o){let t=this.#e.querySelector("body > .loading");if(!t)return;t.classList.add("has-error"),t.innerHTML="";let n=this.#e.createElement("div");n.classList.add("loading-title"),n.textContent="Unable to connect";let i=this.#e.createElement("div");i.classList.add("loading-error"),i.textContent=o||"Unknown error";let p=this.#e.createElement("button");p.type="button",p.classList.add("retry-button"),p.textContent="Retry",p.addEventListener("click",()=>{this.#e.defaultView?.location.reload()}),t.append(n,i,p)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var $e="1.0.0",Le=`portal-proxy-client-${V()}`,Ge=1,O=class e{#e=1e3;#d=s(f);#u=s(N);#o=d("disconnected");#h=d(this.#e);#a=d(!1);#n=d(!1);#p=d(null);#c=d(null);#s=!1;isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#o.asReadonly();#l=[];#r={};#t=null;#f=new TextDecoder("utf-8");#m=null;#y=X(()=>{let o=this.#a(),t=this.#h(),n=this.#p(),i=this.#c();if(!n||!i||!o||!t||t<this.#e){this.#m&&window.clearInterval(this.#m);return}this.#m=window.setInterval(()=>{this.connectToMachineServer(n,i)},t)});#i(o){this.#s||(this.#s=!0,this.#u.showError(o||"Unable to connect to the server."))}#g(){this.#s||(this.#s=!0)}utf8Atob(o){let t=Uint8Array.from(atob(o),i=>i.charCodeAt(0)),n=this.#f.decode(t);return n?JSON.parse(n):null}connectToMachineServer(o,t,n){let i=n?.reconnect??!1,p=this.wsState();(p==="disconnected"||p==="error"||i)&&(this.#t?.close(),this.#t=null),!this.#t&&(this.#s=!1,this.#t=new WebSocket(t),this.#o.set("connecting"),this.#t.onopen=()=>{this.#o.set("connect"),this.#n.set(!0),this.#a.set(!1),this.#p.set(null),this.#c.set(null)},this.#t.onclose=()=>{this.#o.set("disconnected"),this.#n.set(!1),this.#p.set(o),this.#c.set(t),this.#a.set(!0)},this.#t.onerror=()=>{this.#o.set("error")},this.#t.onmessage=m=>{let a=JSON.parse(m.data);if(this.wsState()==="connect"){if(a.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${a.type}'`);return}let r={token:o,publicKey:"",clientVersion:$e,protocolVersion:Ge},c=this.createResponse(a,"authportal",r);this.#o.set("welcome"),this.#t?.send(c)}else if(this.wsState()==="welcome"){if(a.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${a.type}'`);return}var g=JSON.parse(a.payload??"");if(g.accepted===!1){this.#i("Authentication failed"),this.disconnectFromMachineServer("Authentication failed");return}for(this.#o.set("authenticated"),this.#n.set(!0);this.#l.length>0;){let r=this.#l.pop();r&&this.#r[r.messageId]&&this.activateCommand(r)}}else if(this.wsState()==="authenticated"){if(a.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${a.type}'`);return}let r=this.#r[a.messageId];if(r){if(a.errorMessage)this.#i(a.errorMessage),r.reject(a.errorMessage);else{let c=JSON.parse(a.payload??"");c.statusCode>=400?this.#i(c.body||`Initial request failed with status code ${c.statusCode}`):this.#g(),c.body=c?.body==null?null:this.utf8Atob(c.body),r.resolve(c)}delete this.#r[a.messageId],window.clearTimeout(r.timer)}}})}disconnectFromMachineServer(o=null){o&&console.error(o),this.#t?.close(),this.#t=null,this.#o.set("disconnected"),this.#n.set(!1)}createResponse(o,t,n){let i={from:Le,to:o.from,type:t,messageId:o.messageId,payload:JSON.stringify(n)};return JSON.stringify(i)}sendCommand(o,t,n,i,p,m,a,g=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(o,n),new Promise((r,c)=>{let u=V(),y={from:Le,to:t,type:"command",messageId:u,payload:JSON.stringify({method:i,path:p,body:m,headers:a})},x={resolve:r,reject:c,timer:window.setTimeout(()=>{let M=this.#r[u];M&&(delete this.#r[u],this.#i("The request timed out before receiving a response."),M.reject("Timeout"))},g)};this.#r[u]=x,this.#n()?this.activateCommand(y):this.#l.push(y)})}activateCommand(o){this.#t?.send(JSON.stringify(o))}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};function Be(e){if(typeof e!="string")return null;let t=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...t))}function Pe(e,o,t){let n=e.relayconfigState.config();if(n===null)return t(o);let i=Be(o.body),p={};o.headers.keys().forEach(r=>{p[r]=o.headers.get(r)??""});let m=o.headers.get("timeout"),a=m!==null?parseInt(m):e.defaultTimeout;o.url.startsWith("/api/v1/serverstate")&&o.url.includes("longpoll=true")&&(a=1e3*99);let g=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,n.machineServerUrl,o.method,o.url,i,p,a);return new F(r=>{g.then(c=>{let u=new re;p!=null&&Object.keys(p).forEach(y=>{u.set(y,p[y])});let S=new se({body:c.body,status:c.statusCode,statusText:"OK",headers:u});r.next(S),r.complete()}).catch(c=>{r.error(new ie({error:c??"Unknown error",status:0,statusText:c??"Unknown error"}))})})}var He=(e,o)=>{let t={relayconfigState:s(v),defaultTimeout:s(f).defaultTimeout,relayWebsocket:s(O)},n=t.relayconfigState.config();if(t.relayconfigState.configLoaded!==null&&n===null){let i=new W;return t.relayconfigState.configLoaded.subscribe(p=>{p&&Pe(t,e,o).subscribe(i)}),i}return Pe(t,e,o)};var Ve={providers:[Z(),ue(Oe,fe(),he(de)),ae(ce(),pe([He,xe])),h,{provide:f,useValue:Ae},{provide:ee,useValue:ke()},{provide:be,useValue:{alertVariant:"simple"}},we,I,Te,oe,Se,te,Me,Ee]};ne(k,Ve);
|
package/package.json
CHANGED
package/chunk-77ALZWIA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as a,h as b,i as c,j as d}from"./chunk-UGEDZCTM.js";import"./chunk-ITA7DTN3.js";import"./chunk-Q72Y55NB.js";import"./chunk-NXF5BMPG.js";import"./chunk-6Q6SSTBK.js";import"./chunk-HA7XREWO.js";import"./chunk-X64LSE6Y.js";import"./chunk-RFB5A3B7.js";import"./chunk-3SSB4QCJ.js";import"./chunk-AYOFR344.js";import"./chunk-UUQWSINE.js";import"./chunk-BEXYTIOL.js";import"./chunk-LO5YNFFR.js";import"./chunk-YCLTQEU6.js";import"./chunk-2LSZ2I43.js";import"./chunk-BMWZYMK6.js";import"./chunk-7FYL7MVA.js";import"./chunk-NBTTYKXH.js";import"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";export{a as SCHEDULE_DEFAULT_OPTIONS,c as SCHEDULE_FIELD_DEFAULTS,d as default,b as scheduleOptionToSchedule};
|
package/chunk-FKCZIBN3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-7CGTOI24.js";var o=[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-OSAM5F7M.js")},{path:"destination",loadComponent:()=>import("./chunk-CNOKPOR3.js")},{path:"source-data",loadComponent:()=>import("./chunk-6HMNDYMY.js")},{path:"schedule",loadComponent:()=>import("./chunk-77ALZWIA.js")},{path:"options",loadComponent:()=>import("./chunk-LMZN2X5M.js")}];export{o as default};
|
package/chunk-G7XKFPGX.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-2XMYVT7N.js";import"./chunk-NBPZDFGF.js";import"./chunk-UGEDZCTM.js";import"./chunk-ITA7DTN3.js";import"./chunk-Q72Y55NB.js";import"./chunk-NXF5BMPG.js";import"./chunk-6Q6SSTBK.js";import"./chunk-I4XRVBRQ.js";import"./chunk-HA7XREWO.js";import"./chunk-X64LSE6Y.js";import"./chunk-RFB5A3B7.js";import"./chunk-3SSB4QCJ.js";import"./chunk-AYOFR344.js";import"./chunk-UUQWSINE.js";import"./chunk-BEXYTIOL.js";import"./chunk-LO5YNFFR.js";import"./chunk-YCLTQEU6.js";import"./chunk-2LSZ2I43.js";import"./chunk-BMWZYMK6.js";import"./chunk-7FYL7MVA.js";import"./chunk-NBTTYKXH.js";import"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";export{a as createRestoreOptionsForm,b as default};
|
package/chunk-LO5YNFFR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as l,d as k}from"./chunk-2LSZ2I43.js";import{d as O}from"./chunk-BMWZYMK6.js";import{a as T,d as b}from"./chunk-NBTTYKXH.js";import{xa as v,ya as n}from"./chunk-OQ6BKP5N.js";import{C as u,E as N,M as f,U as c,Z as i,f as A,i as E,l as R,oa as a,p as m,ya as P,z as y}from"./chunk-ERITO7WM.js";import{a as I}from"./chunk-7CGTOI24.js";var g=class r{platformId=i(P);STORAGE_VERSION="v1";APP_NAME="duplicati";PERSISTED_PREFIX="persist:";getItemParsed(e,t=!1){return n(this.platformId)?null:JSON.parse(localStorage.getItem(`${this.STORAGE_VERSION}:${t?this.PERSISTED_PREFIX:""}${this.APP_NAME}:${e}`)??"null")}setItemParsed(e,t,o=!1){if(!n(this.platformId))return localStorage.setItem(`${this.STORAGE_VERSION}:${o?this.PERSISTED_PREFIX:""}${this.APP_NAME}:${e}`,JSON.stringify(t))}get length(){return v(this.platformId)?localStorage.length:0}getItem(e){return n(this.platformId)?null:localStorage.getItem(`${this.STORAGE_VERSION}:${this.APP_NAME}:${e}`)??null}setItem(e,t){if(!n(this.platformId))return localStorage.setItem(`${this.STORAGE_VERSION}:${this.APP_NAME}:${e}`,t)}removeItem(e){n(this.platformId)||(localStorage.removeItem(`${this.STORAGE_VERSION}:${this.APP_NAME}:${e}`),localStorage.removeItem(`${this.STORAGE_VERSION}:${this.PERSISTED_PREFIX}${this.APP_NAME}:${e}`))}clearAllNotCurrentVersion(){if(!n(this.platformId))for(var e in localStorage)!e.startsWith(this.STORAGE_VERSION)&&e.includes(this.APP_NAME)&&localStorage.removeItem(e)}clearAll(){n(this.platformId)||localStorage.clear()}clear(){if(!n(this.platformId))for(var e in localStorage)e.includes(this.APP_NAME)&&!e.includes(this.PERSISTED_PREFIX)&&localStorage.removeItem(e)}key(e){return n(this.platformId)?null:localStorage.key(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=c({token:r,factory:r.\u0275fac})};function M(){try{let r=document.querySelector('meta[name="duplicati-proxy-config"]');if(r){let e=(r.getAttribute("content")||"").trim();if(e&&e.startsWith("/"))return e}}catch(r){console.warn("Failed to read proxy configuration from meta tag:",r)}return null}function _(){try{let r=document.querySelector('meta[name="duplicati-enable-iframe-hosting"]');if(r){let e=(r.getAttribute("content")||"").trim();if(e&&e.length>0)return e.toLowerCase()!=="true"}}catch(r){console.warn("Failed to read disable relay support configuration from meta tag:",r)}return!0}function L(){try{let r=document.querySelector('meta[name="duplicati-xsrf-config"]');if(r){let e=(r.getAttribute("data-header-name")||"").trim(),t=(r.getAttribute("data-query-name")||"").trim();if(e&&t&&e.length>0&&t.length>0){let s=new URLSearchParams(window.location.search).get(t);if(s)return{headerName:e,queryName:t,headerValue:s}}}}catch(r){console.warn("Failed to read XSRF configuration from meta tags:",r)}return null}function x(){let r=L();return r?`${r.queryName}=${encodeURIComponent(r.headerValue)}`:null}function G(){let r=M();if(r&&r.length>0){let t=r;t.startsWith("/")||(t=`/${t}`),t.endsWith("/")&&(t=t.slice(0,-1)),l.BASE=t}else l.BASE="";let e=L();e&&(l.HEADERS={[e.headerName]:e.headerValue})}var h=class r{#s=i(g);#o=a(null);#t=window.self!==window.top&&_();#r=a(this.#t);relayIsEnabled=this.#r.asReadonly();config=this.#o.asReadonly();configLoaded=this.#t?new E:null;isLoading=a(this.#t);parentIframeListner=null;parentOrigin="*";fetchConfig(){this.#n(),this.#t&&(this.#r.set(!0),this.parentIframeListner=new AbortController,this.#e("connected"),window.addEventListener("message",e=>{if(e.data.startsWith("access:")){let t=e.data.replace("access:",""),o=JSON.parse(t);if(!o?.accessToken||!o?.clientId){this.#e("error:invalid-config"),this.#r.set(!1);return}if(typeof o.clientId!="string"){this.#e("error:invalid-config"),this.#r.set(!1);return}if(typeof o.accessToken!="string"){this.#e("error:invalid-config"),this.#r.set(!1);return}let s=this.#s.getItem("locale")??"en-US",S=o.locale??"en-US";s!==S&&(this.#s.setItem("locale",S),window.location.reload()),this.#o.set(o),this.configLoaded?.next(!0),this.isLoading.set(!1),this.#e("handshake-complete")}},{signal:this.parentIframeListner.signal}))}#e(e){window.parent.postMessage(e,"*")}#n(){this.parentIframeListner&&(this.parentIframeListner.abort(),this.parentIframeListner=null)}setConfig(e){this.#o.set(e)}clearConfig(){this.#o.set(null)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})};var $="PROXY_AUTHED_FAKE_TOKEN",d="refreshNonce",p="v1:persist:duplicati:refreshNonce",D=class r{#s=i(O);#o=i(b);#t=i(k);#r=i(h);#e=a(null);#n=a(!1);#i=a(!1);#a=a(x());xsrfQueryParam=this.#a.asReadonly();token=this.#e.asReadonly();isLoggingOut=this.#n.asReadonly();setRefreshNonce(e,t){if(!e){sessionStorage.removeItem(d);return}t?localStorage.setItem(p,e||""):sessionStorage.setItem(d,e||"")}getRefreshNonceBody(){let e=sessionStorage.getItem(d),t=localStorage.getItem(p),o=e||t;return{requestBody:o?{requestBody:{Nonce:o}}:void 0,local:o===t}}login(e,t){return this.#t.postApiV1AuthLogin({requestBody:{Password:e,RememberMe:t}}).pipe(u(1),f(o=>{o.AccessToken?(this.#e.set(o.AccessToken),this.setRefreshNonce(o.RefreshNonce,t)):this.#e.set(null)}))}refreshToken(){if(this.#r.relayIsEnabled())return this.#e.set($),new A(o=>{o.next({AccessToken:$}),o.complete()});if(this.#i())return this.#t.postApiV1AuthIssuetokenByOperation({operation:"websocket"}).pipe(u(1),f(o=>{o.Token&&this.#e.set(o.Token)}),m(o=>({AccessToken:o.Token})));let{requestBody:e,local:t}=this.getRefreshNonceBody();return this.#t.postApiV1AuthRefresh(e).pipe(u(1),f(o=>{o.AccessToken&&(this.#e.set(o.AccessToken),this.setRefreshNonce(o.RefreshNonce,t))}))}checkProxyAuthed(){let e=new T(I({"custom-proxy-check":"true"},l.HEADERS??{})),t=l.BASE||"";return this.#o.post(`${t}/api/v1/auth/status`,null,{headers:e}).pipe(m(o=>{let s=o;return s?.authorized&&s?.socketToken?(this.#e.set(s.socketToken),this.#i.set(!0),!0):!1}),y(()=>R(!1)))}logout(){this.#n.set(!0);let{requestBody:e,local:t}=this.getRefreshNonceBody();sessionStorage.removeItem(d),t&&localStorage.removeItem(p),this.#t.postApiV1AuthRefreshLogout(e).pipe(u(1),N(()=>{this.#n.set(!1),this.#e.set(null),this.#s.navigate(["/login"])})).subscribe()}static \u0275fac=function(t){return new(t||r)};static \u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})};export{g as a,G as b,h as c,$ as d,D as e};
|
package/chunk-O7MDPYFW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-4QE3MT56.js";import"./chunk-I2HYK2BL.js";import"./chunk-B35WNLRM.js";import"./chunk-SLS3DCJP.js";import"./chunk-SUY5AQLW.js";import"./chunk-6Q6SSTBK.js";import"./chunk-I4XRVBRQ.js";import"./chunk-RFB5A3B7.js";import"./chunk-AZJ2P3YU.js";import"./chunk-UUQWSINE.js";import"./chunk-BEXYTIOL.js";import"./chunk-LO5YNFFR.js";import"./chunk-YCLTQEU6.js";import"./chunk-2LSZ2I43.js";import"./chunk-BMWZYMK6.js";import"./chunk-7FYL7MVA.js";import"./chunk-NBTTYKXH.js";import"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";export{a as BackupProgressComponent};
|
package/chunk-SEFBKH36.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b}from"./chunk-2XMYVT7N.js";import"./chunk-NBPZDFGF.js";import"./chunk-UGEDZCTM.js";import"./chunk-ITA7DTN3.js";import"./chunk-Q72Y55NB.js";import"./chunk-NXF5BMPG.js";import"./chunk-6Q6SSTBK.js";import"./chunk-I4XRVBRQ.js";import"./chunk-HA7XREWO.js";import"./chunk-X64LSE6Y.js";import"./chunk-RFB5A3B7.js";import"./chunk-3SSB4QCJ.js";import"./chunk-AYOFR344.js";import"./chunk-UUQWSINE.js";import"./chunk-BEXYTIOL.js";import"./chunk-LO5YNFFR.js";import"./chunk-YCLTQEU6.js";import"./chunk-2LSZ2I43.js";import"./chunk-BMWZYMK6.js";import"./chunk-7FYL7MVA.js";import"./chunk-NBTTYKXH.js";import"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";export{a as createEncryptionForm,b as default};
|
package/chunk-XHUMSL6X.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-7CGTOI24.js";var o=[{path:"",redirectTo:"select-files",pathMatch:"full"},{path:"destination",loadComponent:()=>import("./chunk-EL2UKEXS.js")},{path:"encryption",loadComponent:()=>import("./chunk-SEFBKH36.js")},{path:"select-files",loadComponent:()=>import("./chunk-QEIGUOTC.js")},{path:"options",loadComponent:()=>import("./chunk-G7XKFPGX.js")},{path:":taskid/progress",loadComponent:()=>import("./chunk-RNTBVXBV.js")}],t=o;export{t as default};
|
package/chunk-XQTUBHIK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-GROPRXXJ.js";import{a as B}from"./chunk-AZJ2P3YU.js";import{e as j}from"./chunk-LO5YNFFR.js";import{B as H,D as K,H as V,b as D,c as y,d as R,e as $,f as A,j as v,p as k,q as x,r as J,t as X,v as q,w as z}from"./chunk-YCLTQEU6.js";import"./chunk-2LSZ2I43.js";import{d as G}from"./chunk-BMWZYMK6.js";import"./chunk-7FYL7MVA.js";import"./chunk-NBTTYKXH.js";import"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import{Ab as p,Bb as t,Cb as i,Db as r,E as C,Ra as a,Rb as d,Sb as g,Tb as I,Wc as w,Xb as F,Z as _,eb as S,ec as E,fc as M,ic as O,lc as P,mc as b,oa as s,qa as N,ub as T,vb as L}from"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";var U=["passwordInput"];function W(l,o){l&1&&(t(0,"sh-alert",6),I(1,4),i())}var u=new J,f=class l{#e=_(G);#n=_(j);rememberMe=B("rememberMe",!1,!0);failedLogin=s(!1);successLogin=s(!1);isLoading=s(!1);loginForm=u.group({email_address:u.control(""),pass:u.control("",R.required),rememberMe:u.control(this.rememberMe())});showPassword=s(!1);passwordInput=w("passwordInput");passwordEffect=N(()=>{this.failedLogin()&&queueMicrotask(()=>this.passwordInput()?.nativeElement?.focus())});ngOnInit(){this.loginForm.controls.rememberMe.valueChanges.subscribe(o=>this.rememberMe.set(o??!1)),queueMicrotask(()=>this.passwordInput()?.nativeElement?.focus())}submit(){let o=this.loginForm.value.pass,n=this.loginForm.value.email_address;this.rememberMe.set(this.loginForm.value.rememberMe??!1),!n&&o&&(this.isLoading.set(!0),this.#n.login(o,this.rememberMe()).pipe(C(()=>{this.isLoading.set(!1),this.failedLogin.set(!0)})).subscribe({next:()=>{this.successLogin.set(!0),this.#e.navigate(["/"])}}))}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=S({type:l,selectors:[["app-login"]],viewQuery:function(n,e){n&1&&E(e.passwordInput,U,5),n&2&&M()},decls:24,vars:6,consts:()=>{let o;o=$localize`Enter your password`;let n;n=$localize` Password ${"\uFFFD#10\uFFFD"}:START_LINK:${"\uFFFD#11\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#11\uFFFD"}:CLOSE_TAG_SH_ICON:${"\uFFFD/#10\uFFFD"}:CLOSE_LINK:`;let e;e=$localize` Login ${"\uFFFD#18\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#18\uFFFD"}:CLOSE_TAG_SH_ICON:`;let m;m=$localize` Keep me logged in ${"\uFFFD#21\uFFFD\uFFFD/#21\uFFFD"}:TAG_INPUT:`;let h;return h=$localize` Remember to enter a password, if you can't remember the password open the duplicati client on the machine in question and make sure you open it through the tray icon then go into settings to change the password. `,[["passwordInput",""],n,e,m,h,[3,"submit","formGroup"],["type","warning"],[1,"logo-login"],[1,"inner"],[1,"login-row"],["type","text","hidden","","autocomplete","off","formControlName","email_address"],["for","password"],["href","https://docs.duplicati.com/detailed-descriptions/duplicati-access-password","target","_blank","rel","noopener noreferrer"],["name","password","autocomplete","current-password","placeholder",o,"tabindex","1","formControlName","pass",3,"type"],["suffix","",3,"click"],["shButton","","type","submit",1,"raised","primary","login-button"],[1,"raised","primary"],["type","checkbox","id","rememberMe","tabindex","2","formControlName","rememberMe"],[1,"login-row","checkbox"],["for","rememberMe",1,"remember-me"]]},template:function(n,e){n&1&&(t(0,"form",5),F("submit",function(){return e.submit()}),T(1,W,2,0,"sh-alert",6),t(2,"div",7),r(3,"app-logo"),i(),t(4,"div",8)(5,"div",9),r(6,"input",10),t(7,"sh-form-field")(8,"label",11),d(9,1),t(10,"a",12),r(11,"sh-icon"),i(),g(),i(),r(12,"input",13,0),t(14,"sh-icon",14),F("click",function(){return e.showPassword.set(!e.showPassword())}),P(15),i()(),t(16,"button",15),d(17,2),r(18,"sh-icon"),g(),i()(),t(19,"sh-checkbox",16),d(20,3),r(21,"input",17),g(),i(),t(22,"div",18),r(23,"label",19),i()()()),n&2&&(p("formGroup",e.loginForm),a(),L(e.failedLogin()&&!e.successLogin()?1:-1),a(11),p("type",e.showPassword()?"text":"password"),a(3),b(e.showPassword()?"eye":"eye-slash"),a(),O("loading",e.isLoading()))},dependencies:[X,v,y,D,$,A,x,k,Q,V,q,H,z,K],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{width:100vw;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem}form[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:1rem}form[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .checkbox[_ngcontent-%COMP%]{align-self:flex-start}sh-alert[_ngcontent-%COMP%]{max-width:20rem;margin:0 auto}h3[_ngcontent-%COMP%]{font:var(--title-30)}.login-row[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.logo-login[_ngcontent-%COMP%]{top:0;left:0;padding:1.25rem;position:fixed}.login-button[_ngcontent-%COMP%]{padding-left:1.5rem;padding-right:1.5rem}"],changeDetection:0})};export{f as default};
|
package/main-7RC24G3G.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as ke,c as Ae}from"./chunk-LGILJ5LY.js";import{a as Te}from"./chunk-MAKVVEKB.js";import{a as Ie}from"./chunk-3ZCJK7PY.js";import{b as k}from"./chunk-I2HYK2BL.js";import"./chunk-B35WNLRM.js";import{a as Me}from"./chunk-SLS3DCJP.js";import{b as Ee}from"./chunk-SUY5AQLW.js";import{a as D}from"./chunk-6Q6SSTBK.js";import{a as Re}from"./chunk-I4XRVBRQ.js";import"./chunk-RFB5A3B7.js";import"./chunk-AZJ2P3YU.js";import"./chunk-UUQWSINE.js";import{a as H}from"./chunk-BEXYTIOL.js";import{a as h,b as be,c as v,d as we,e as I}from"./chunk-LO5YNFFR.js";import{u as Ce,x as ve}from"./chunk-YCLTQEU6.js";import{a as ye,e as Se}from"./chunk-2LSZ2I43.js";import{c as me,d as de,g as ue,h as he,i as fe,j as ge}from"./chunk-BMWZYMK6.js";import{a as re}from"./chunk-7FYL7MVA.js";import{a as se,b as ie,c as ae,e as pe,f as le,g as ce}from"./chunk-NBTTYKXH.js";import{ha as oe,ma as ne}from"./chunk-OQ6BKP5N.js";import"./chunk-VAQ435AR.js";import{Db as Z,E as M,I as K,K as T,Kc as ee,Lc as te,M as _,U as C,X as q,Z as s,eb as Y,f as W,g as $,ga as z,ha as X,l as G,m as B,oa as d,p as w,qa as Q,y as P,z as J}from"./chunk-ERITO7WM.js";import"./chunk-7CGTOI24.js";var A=class e{#e=s(h);#a=s(v);ngOnInit(){be(),this.#a.fetchConfig(),this.#e.clearAllNotCurrentVersion()}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=Y({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(o,n){o&1&&Z(0,"router-outlet")},dependencies:[me],encapsulation:2})};var Ne={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var f=new q("ENVIRONMENT");var N=class e{#e=s(Se);isLoaded=d(!1);webmodules=d(null);preload(t=!1){let o=this.#e.getApiV1Webmodules().pipe(_(n=>this.webmodules.set(n)),M(()=>this.isLoaded.set(!0)));if(t)return o;o.subscribe()}static \u0275fac=function(o){return new(o||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var Fe=()=>{let e=s(I);return e.token()?!0:e.checkProxyAuthed().pipe(T(t=>t?G(!0):e.refreshToken().pipe(w(()=>!0))))},We=()=>{let e=s(v),t=s(k),o=s(z),n=e.relayIsEnabled()?"longpoll":"websocket",a=[o.get(H).preload(!0),o.get(H).preloadFilterGroups(!0),o.get(N).preload(!0)];return e.configLoaded===null?P(a).pipe(w(()=>n)):e.configLoaded?.pipe(T(()=>P(a)))},$e=()=>!0,Oe={path:"connect/:typeParam",loadComponent:()=>import("./chunk-7YLK4QIL.js")},Ge=()=>{let e=s(h);return!e.getItem("locale")&&navigator.language&&e.setItem("locale",navigator.language),!0},xe=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-XQTUBHIK.js")},{path:"logout",loadComponent:()=>import("./chunk-5ECY4LSP.js")},{path:"",canActivate:[Fe],children:[{path:"",canActivate:[We,$e,Ge],children:[{path:"welcome",loadComponent:()=>import("./chunk-VTFVTC7O.js"),children:[{path:"",redirectTo:"select",pathMatch:"full"},{path:"select",loadComponent:()=>import("./chunk-Q5WLMQD4.js")},Oe]},{path:"",loadComponent:()=>import("./chunk-CPI5ZQUF.js"),children:[{path:"",loadComponent:()=>import("./chunk-7J6AVYZE.js")},Oe,{path:"destinations",loadComponent:()=>import("./chunk-BQEUHLSB.js")},{path:"add-backup",loadComponent:()=>import("./chunk-CNUQWXBC.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-RC3UQLPB.js")},{path:"backup/import",loadComponent:()=>import("./chunk-7ZA3Q6TS.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-DHOED4DH.js"),loadChildren:()=>import("./chunk-FKCZIBN3.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-DHOED4DH.js"),loadChildren:()=>import("./chunk-FKCZIBN3.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-5KQZMHFN.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-2T442RZU.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-FE3ADWR5.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-ODHFI4PA.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-3WOW2XM3.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-BSYMQ4VF.js")},{path:"from-config",loadComponent:()=>import("./chunk-C6RVYQ4M.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-TYEWJKJU.js"),loadChildren:()=>import("./chunk-XHUMSL6X.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-TYEWJKJU.js"),loadChildren:()=>import("./chunk-XHUMSL6X.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-TYEWJKJU.js"),loadChildren:()=>import("./chunk-XHUMSL6X.js")},{path:"status",loadComponent:()=>import("./chunk-64IX6ISO.js")},{path:"settings",loadComponent:()=>import("./chunk-4NENQSXM.js")},{path:"about",loadComponent:()=>import("./chunk-AZFGZQQK.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-WZV32HLQ.js")},{path:"changelog",loadComponent:()=>import("./chunk-IZCDGVXJ.js")},{path:"libraries",loadComponent:()=>import("./chunk-3KMV4PTJ.js")},{path:"system-info",loadComponent:()=>import("./chunk-U3SGWHNI.js")},{path:"server-settings",loadComponent:()=>import("./chunk-47PB4WN3.js")},{path:"logs",loadChildren:()=>import("./chunk-NDLPNBGE.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-BKQA64HZ.js")}]}]}]}]}]}];var U=null,Le=(e,t)=>{let o=s(I),n=s(de),a=s(h),p=s(f),i=a.getItem("locale"),u=s(ve),l=ke(i),r=ye.BASE||"",m=e.url===`${r}/api/v1/auth/login`,S=e.url===`${r}/api/v1/auth/logout`,g=e.url===`${r}/api/v1/auth/refresh`,b=e.url===`${r}/api/v1/progressstate`,E=e.url===`${r}/api/v1/remoteoperation/test`,Ue=e.url===`${r}/api/v1/filesystem/validate`,je=e.url.startsWith(`${r}/api/v2/`),L=o.token(),j=e,F=e.headers.has("custom-proxy-check")||L===we;if(L&&e.url.startsWith(r+p.baseUrl)&&!F){let c=e.headers.set("Authorization",`Bearer ${L}`);i&&i!=="en-US"&&(c=c.set("X-Ui-Language",l)),j=e.clone({headers:c})}return t(j).pipe(w(c=>{if(c.type===4&&c.status===200&&je){let y=c.body;if(y?.Success===!1)throw{status:200,message:y?.Error??"Unknown error",error:{Error:y?.Error??"Unknown error"},requestBody:y}}return c}),J(c=>{let y=c.error?.Error||`Error Code: ${c.status}, Message: ${c.message}`;if(!F){let R=!0;if((b&&c.status===404||E||Ue)&&(R=!1),g&&c.status===401&&(R=!1,o.logout(),n.navigate(["/logout"])),!m&&!g&&!S&&c.status===401)return R=!1,U??=o.refreshToken().pipe(K()),U.pipe(T(()=>t(e.clone({headers:e.headers.set("Authorization",`Bearer ${o.token()}`)}))),M(()=>U=null));R&&u.error(y)}return B(()=>({error:c,message:y}))}))};var O=class e{#e=s(X);showError(t){let o=this.#e.querySelector("body > .loading");if(!o)return;o.classList.add("has-error"),o.innerHTML="";let n=this.#e.createElement("div");n.classList.add("loading-title"),n.textContent="Unable to connect";let a=this.#e.createElement("div");a.classList.add("loading-error"),a.textContent=t||"Unknown error";let p=this.#e.createElement("button");p.type="button",p.classList.add("retry-button"),p.textContent="Retry",p.addEventListener("click",()=>{this.#e.defaultView?.location.reload()}),o.append(n,a,p)}static \u0275fac=function(o){return new(o||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var Be="1.0.0",Pe=`portal-proxy-client-${D()}`,Je=1,x=class e{#e=1e3;#a=s(f);#d=s(O);#o=d("disconnected");#u=d(this.#e);#p=d(!1);#n=d(!1);#l=d(null);#s=!1;isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#o.asReadonly();#c=[];#r={};#t=null;#h=new TextDecoder("utf-8");#m=null;#g=Q(()=>{let t=this.#p(),o=this.#u(),n=this.#l();if(!n||!t||!o||o<this.#e){this.#m&&window.clearInterval(this.#m);return}this.#m=window.setInterval(()=>{this.connectToMachineServer(n)},o)});#i(t){this.#s||(this.#s=!0,this.#d.showError(t||"Unable to connect to the server."))}#f(){this.#s||(this.#s=!0)}utf8Atob(t){let o=Uint8Array.from(atob(t),a=>a.charCodeAt(0)),n=this.#h.decode(o);return n?JSON.parse(n):null}connectToMachineServer(t,o){let n=o?.reconnect??!1,a=this.wsState();(a==="disconnected"||a==="error"||n)&&(this.#t?.close(),this.#t=null),!this.#t&&(this.#s=!1,this.#t=new WebSocket(this.#a.machineServerUrl),this.#o.set("connecting"),this.#t.onopen=()=>{this.#o.set("connect"),this.#n.set(!0),this.#p.set(!1),this.#l.set(null)},this.#t.onclose=()=>{this.#o.set("disconnected"),this.#n.set(!1),this.#l.set(t),this.#p.set(!0)},this.#t.onerror=()=>{this.#o.set("error")},this.#t.onmessage=p=>{let i=JSON.parse(p.data);if(this.wsState()==="connect"){if(i.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${i.type}'`);return}let l={token:t,publicKey:"",clientVersion:Be,protocolVersion:Je},r=this.createResponse(i,"authportal",l);this.#o.set("welcome"),this.#t?.send(r)}else if(this.wsState()==="welcome"){if(i.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${i.type}'`);return}var u=JSON.parse(i.payload??"");if(u.accepted===!1){this.#i("Authentication failed"),this.disconnectFromMachineServer("Authentication failed");return}for(this.#o.set("authenticated"),this.#n.set(!0);this.#c.length>0;){let l=this.#c.pop();l&&this.#r[l.messageId]&&this.activateCommand(l)}}else if(this.wsState()==="authenticated"){if(i.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${i.type}'`);return}let l=this.#r[i.messageId];if(l){if(i.errorMessage)this.#i(i.errorMessage),l.reject(i.errorMessage);else{let r=JSON.parse(i.payload??"");r.statusCode>=400?this.#i(r.body||`Initial request failed with status code ${r.statusCode}`):this.#f(),r.body=r?.body==null?null:this.utf8Atob(r.body),l.resolve(r)}delete this.#r[i.messageId],window.clearTimeout(l.timer)}}})}disconnectFromMachineServer(t=null){t&&console.error(t),this.#t?.close(),this.#t=null,this.#o.set("disconnected"),this.#n.set(!1)}createResponse(t,o,n){let a={from:Pe,to:t.from,type:o,messageId:t.messageId,payload:JSON.stringify(n)};return JSON.stringify(a)}sendCommand(t,o,n,a,p,i,u=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(t),new Promise((l,r)=>{let m=D(),g={from:Pe,to:o,type:"command",messageId:m,payload:JSON.stringify({method:n,path:a,body:p,headers:i})},b={resolve:l,reject:r,timer:window.setTimeout(()=>{let E=this.#r[m];E&&(delete this.#r[m],this.#i("The request timed out before receiving a response."),E.reject("Timeout"))},u)};this.#r[m]=b,this.#n()?this.activateCommand(g):this.#c.push(g)})}activateCommand(t){this.#t?.send(JSON.stringify(t))}static \u0275fac=function(o){return new(o||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};function Ke(e){if(typeof e!="string")return null;let o=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...o))}function He(e,t,o){let n=e.relayconfigState.config();if(n===null)return o(t);let a=Ke(t.body),p={};t.headers.keys().forEach(r=>{p[r]=t.headers.get(r)??""});let i=t.headers.get("timeout"),u=i!==null?parseInt(i):e.defaultTimeout;t.url.startsWith("/api/v1/serverstate")&&t.url.includes("longpoll=true")&&(u=1e3*99);let l=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,t.method,t.url,a,p,u);return new W(r=>{l.then(m=>{let S=new se;p!=null&&Object.keys(p).forEach(b=>{S.set(b,p[b])});let g=new ie({body:m.body,status:m.statusCode,statusText:"OK",headers:S});r.next(g),r.complete()}).catch(m=>{r.error(new ae({error:m??"Unknown error",status:0,statusText:m??"Unknown error"}))})})}var De=(e,t)=>{let o={relayconfigState:s(v),defaultTimeout:s(f).defaultTimeout,relayWebsocket:s(x)},n=o.relayconfigState.config();if(o.relayconfigState.configLoaded!==null&&n===null){let a=new $;return o.relayconfigState.configLoaded.subscribe(p=>{p&&He(o,e,t).subscribe(a)}),a}return He(o,e,t)};var Ve={providers:[ee(),he(xe,ge(),fe(ue)),pe(ce(),le([De,Le])),h,{provide:f,useValue:Ne},{provide:te,useValue:Ae()},{provide:Ce,useValue:{alertVariant:"simple"}},Te,k,Ee,ne,Re,oe,Me,Ie]};re(A,Ve);
|