@duplicati/ngclient 0.0.208 → 0.0.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/dest-icons/digitalocean.png +0 -0
- package/assets/dest-icons/hetzner.png +0 -0
- package/{chunk-7B4AIHYK.js → chunk-23BFPX3M.js} +1 -1
- package/{chunk-RC3UQLPB.js → chunk-2FD4SR65.js} +1 -1
- package/chunk-3ULPLOSF.js +1 -0
- package/chunk-562BU33Q.js +1 -0
- package/{chunk-Q5WLMQD4.js → chunk-76USHURS.js} +1 -1
- package/{chunk-5ECY4LSP.js → chunk-AQWULDGL.js} +1 -1
- package/{chunk-GLR4FXRG.js → chunk-BDC5JQVQ.js} +1 -1
- package/{chunk-4QE3MT56.js → chunk-CKVJ36E5.js} +1 -1
- package/{chunk-BSYMQ4VF.js → chunk-DJAQY2GM.js} +1 -1
- package/{chunk-KQZNQ7RD.js → chunk-DJJ3VITJ.js} +1 -1
- package/chunk-DKA7IP53.js +1 -0
- package/{chunk-7YLK4QIL.js → chunk-DMMZWQEZ.js} +1 -1
- package/{chunk-AZJ2P3YU.js → chunk-DWFQAX4H.js} +1 -1
- package/{chunk-47PB4WN3.js → chunk-EVMEYZB7.js} +1 -1
- package/chunk-F3TYSZ53.js +1 -0
- package/{chunk-NCN2TOJR.js → chunk-FG4GOBKA.js} +1 -1
- package/{chunk-3SSB4QCJ.js → chunk-FKYRYVJD.js} +1 -1
- package/{chunk-CNUQWXBC.js → chunk-FZQEPDIF.js} +1 -1
- package/{chunk-JW6W3ER7.js → chunk-GVXQIOKE.js} +1 -1
- package/{chunk-3WOW2XM3.js → chunk-I2BAH6NC.js} +1 -1
- package/chunk-I6Y22V2Q.js +1 -0
- package/{chunk-RCZGOO7K.js → chunk-I7U3XXJD.js} +1 -1
- package/{chunk-64IX6ISO.js → chunk-IGEX5B3E.js} +1 -1
- package/{chunk-LQKADAHT.js → chunk-INI4AJEU.js} +1 -1
- package/{chunk-HA7XREWO.js → chunk-IUJGDYFS.js} +1 -1
- package/{chunk-JKIZ6U22.js → chunk-JFUWTLM7.js} +1 -1
- package/{chunk-WZV32HLQ.js → chunk-JIJGVYNW.js} +1 -1
- package/{chunk-J33RTTTX.js → chunk-KNB7LCAL.js} +1 -1
- package/{chunk-ODHFI4PA.js → chunk-KXBEW3N2.js} +1 -1
- package/{chunk-2V75WWT2.js → chunk-LP2DMTA7.js} +1 -1
- package/{chunk-7ZA3Q6TS.js → chunk-LSIAE7ZL.js} +1 -1
- package/{chunk-UUQWSINE.js → chunk-LTVI3WYF.js} +1 -1
- package/{chunk-AZFGZQQK.js → chunk-M3JOG5RD.js} +1 -1
- package/{chunk-2T442RZU.js → chunk-M7QNSQM2.js} +1 -1
- package/chunk-MYHC4Y56.js +1 -0
- package/{chunk-BT44N2RL.js → chunk-NBPZDFGF.js} +1 -1
- package/{chunk-LSF3JCSI.js → chunk-NXF5BMPG.js} +1 -1
- package/{chunk-OISQ63OG.js → chunk-NYX7YT7G.js} +1 -1
- package/{chunk-IXUAJIIQ.js → chunk-PAPOSE5G.js} +1 -1
- package/chunk-PRBKV7LX.js +1 -0
- package/{chunk-P5MXBPC4.js → chunk-PUBEHQ4W.js} +1 -1
- package/{chunk-MAKVVEKB.js → chunk-S2F2BNOG.js} +1 -1
- package/{chunk-5VSRHMHD.js → chunk-T3YMO3FB.js} +1 -1
- package/{chunk-FSFXGPH3.js → chunk-TDEVA3XM.js} +1 -1
- package/{chunk-CPI5ZQUF.js → chunk-UQLHXE6V.js} +1 -1
- package/{chunk-5KQZMHFN.js → chunk-V43VAZTT.js} +1 -1
- package/{chunk-AYCSIHGS.js → chunk-VOJGEOOO.js} +1 -1
- package/chunk-VUABEJRL.js +1 -0
- package/{chunk-I2HYK2BL.js → chunk-XHUQYWAM.js} +1 -1
- package/{chunk-B6CAREL6.js → chunk-YE7IXREK.js} +1 -1
- package/{chunk-B35WNLRM.js → chunk-YF6ULZXZ.js} +1 -1
- package/chunk-ZOOFKMMI.js +1 -0
- package/chunk-ZVTMKBV5.js +1 -0
- package/index.html +1 -1
- package/main-IO5OKXBW.js +1 -0
- package/package.json +1 -1
- package/chunk-4FDBDI3J.js +0 -1
- package/chunk-4KNVWFT2.js +0 -1
- package/chunk-54PAHILA.js +0 -1
- package/chunk-COKAO446.js +0 -1
- package/chunk-GG5S6RWM.js +0 -1
- package/chunk-K32ZRHDV.js +0 -1
- package/chunk-LO5YNFFR.js +0 -1
- package/chunk-O7MDPYFW.js +0 -1
- package/chunk-R63C22I3.js +0 -1
- package/chunk-XQTUBHIK.js +0 -1
- package/main-BYMMXHVT.js +0 -1
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-R63C22I3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b}from"./chunk-B6CAREL6.js";import"./chunk-BT44N2RL.js";import"./chunk-FSFXGPH3.js";import"./chunk-ITA7DTN3.js";import"./chunk-Q72Y55NB.js";import"./chunk-LSF3JCSI.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-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-BYMMXHVT.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-KQZNQ7RD.js")},Oe,{path:"destinations",loadComponent:()=>import("./chunk-AYCSIHGS.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-LQKADAHT.js"),loadChildren:()=>import("./chunk-54PAHILA.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-LQKADAHT.js"),loadChildren:()=>import("./chunk-54PAHILA.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-GLR4FXRG.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-NCN2TOJR.js"),loadChildren:()=>import("./chunk-GG5S6RWM.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-NCN2TOJR.js"),loadChildren:()=>import("./chunk-GG5S6RWM.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-NCN2TOJR.js"),loadChildren:()=>import("./chunk-GG5S6RWM.js")},{path:"status",loadComponent:()=>import("./chunk-64IX6ISO.js")},{path:"settings",loadComponent:()=>import("./chunk-7B4AIHYK.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);
|