homebridge-config-ui-x 5.11.2-beta.5 → 5.11.2-beta.7
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/package.json +2 -2
- package/public/{chunk-P2U63MCR.js → chunk-2HDDFLX5.js} +1 -1
- package/public/{chunk-N74OZDD6.js → chunk-2KUGAT6L.js} +1 -1
- package/public/chunk-2QHT7UTY.js +1 -0
- package/public/{chunk-BHYS7LPU.js → chunk-3B6IFS6E.js} +1 -1
- package/public/chunk-4HJPJ6JO.js +1 -0
- package/public/chunk-4ZCBTPFQ.js +1 -0
- package/public/{chunk-D3NFARXL.js → chunk-5DKBUEKC.js} +1 -1
- package/public/{chunk-LKRXJ4NQ.js → chunk-6SPNUKCU.js} +1 -1
- package/public/{chunk-D3MUNCMG.js → chunk-6UOFHEOA.js} +1 -1
- package/public/chunk-73LLH6JC.js +1 -0
- package/public/chunk-7KQJO6II.js +1 -0
- package/public/{chunk-LQNKSANI.js → chunk-AK7DHUFI.js} +1 -1
- package/public/chunk-BQLUKGX4.js +1 -0
- package/public/chunk-CAKM6QQD.js +19 -0
- package/public/{chunk-QCD43BXL.js → chunk-CJ6ENU5Q.js} +1 -1
- package/public/chunk-EHWZNITX.js +16 -0
- package/public/chunk-FSIP765D.js +1 -0
- package/public/chunk-G5KKSLRH.js +1 -0
- package/public/{chunk-RMWS37MG.js → chunk-IPCY24VP.js} +1 -1
- package/public/chunk-K7P4YW6C.js +1 -0
- package/public/chunk-KXDUZHXM.js +1 -0
- package/public/{chunk-ZDIBPB2V.js → chunk-LPHPZZDD.js} +1 -1
- package/public/chunk-LSBNAQT7.js +1 -0
- package/public/{chunk-B6EPFA4V.js → chunk-M6KB66ZD.js} +1 -1
- package/public/{chunk-CYKWMDCC.js → chunk-MJD4YCIZ.js} +1 -1
- package/public/{chunk-72SK6LN3.js → chunk-MXLTCL2C.js} +1 -1
- package/public/chunk-Q5BDQ6UK.js +4 -0
- package/public/chunk-QD7ZQ5KN.js +1 -0
- package/public/{chunk-K3VXCKFJ.js → chunk-QZUDFUPG.js} +1 -1
- package/public/{chunk-5F6SGJZO.js → chunk-R7CS5PVV.js} +1 -1
- package/public/chunk-RP6CIVXA.js +1 -0
- package/public/chunk-SWHMQNYH.js +68 -0
- package/public/chunk-TO4NLBFG.js +3 -0
- package/public/{chunk-J6JCLCR6.js → chunk-TSNTAL5D.js} +1 -1
- package/public/{chunk-746K2W65.js → chunk-UCQTJGBG.js} +1 -1
- package/public/chunk-UIRBXR5P.js +19 -0
- package/public/chunk-VUOEARGI.js +1 -0
- package/public/{chunk-WPJDSHYO.js → chunk-YTCQIUDM.js} +1 -1
- package/public/{chunk-YAUW3QQV.js → chunk-Z62MEN4O.js} +1 -1
- package/public/{chunk-BQMRSELR.js → chunk-ZCXLNQRQ.js} +1 -1
- package/public/{chunk-IMR3XZ37.js → chunk-ZMZV3OZR.js} +1 -1
- package/public/{chunk-W3WJ3GLW.js → chunk-ZT2XJVT5.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-VBBHOBST.js → main-ORJXWFOK.js} +1 -1
- package/public/chunk-2YQMYSXT.js +0 -1
- package/public/chunk-3JBXVUFP.js +0 -19
- package/public/chunk-47LZZIPJ.js +0 -68
- package/public/chunk-5UTHYAO4.js +0 -16
- package/public/chunk-5V5T5YDK.js +0 -1
- package/public/chunk-CDVVVWKM.js +0 -1
- package/public/chunk-G7V2J2JO.js +0 -1
- package/public/chunk-GFM46DC6.js +0 -1
- package/public/chunk-H53NQXNF.js +0 -1
- package/public/chunk-HBNZXYWD.js +0 -4
- package/public/chunk-HQLIDFFL.js +0 -1
- package/public/chunk-IF2VXUU3.js +0 -3
- package/public/chunk-J24WFLH3.js +0 -1
- package/public/chunk-PK2CVZPI.js +0 -1
- package/public/chunk-S6MSUZ3J.js +0 -1
- package/public/chunk-TRA6X3HB.js +0 -1
- package/public/chunk-VQI4BA3M.js +0 -19
- package/public/chunk-XF7D4C2H.js +0 -1
- package/public/chunk-YDOFHXZH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as S}from"./chunk-
|
|
1
|
+
import{b as S}from"./chunk-MXLTCL2C.js";import{J as h,K as j,x as E}from"./chunk-M6KB66ZD.js";import{$ as c,X as l,Y as T,_ as v,aa as f,i as u,la as y,o as g,ob as I,q as m,t as k}from"./chunk-MKV5RAJQ.js";import{h as a}from"./chunk-B4AJQJMI.js";var w=new v("JWT_OPTIONS"),p=(()=>{class o{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let r=0,s,n,x=0;n=e.charAt(x++);~n&&(s=r%4?s*64+n:n,r++%4)?i+=String.fromCharCode(255&s>>(-2*r&6)):0)n=t.indexOf(n);return i}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let i=this.urlBase64Decode(t[1]);if(!i)throw new Error("Cannot decode the token.");return JSON.parse(i)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let i=new Date(0);return i.setUTCSeconds(t.exp),i}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(i=>this._isTokenExpired(i,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let i=this.getTokenExpirationDate(e);return t=t||0,i===null?!1:!(i.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return o.\u0275fac=function(e){return new(e||o)(c(w))},o.\u0275prov=l({token:o,factory:o.\u0275fac}),o})(),$=o=>o instanceof Promise?k(()=>o):u(o),R=(()=>{class o{constructor(e,t,i){this.jwtHelper=t,this.document=i,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let i=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(r=>typeof r=="string"?r===i:r instanceof RegExp?r.test(i):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(i=>{if(typeof i=="string"){let r=new URL(i,this.document.location.origin);return r.hostname===t.hostname&&r.pathname===t.pathname}return i instanceof RegExp?i.test(e.url):!1})>-1}handleInterception(e,t,i){let r=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=u(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):u(!0)),e?s.pipe(g(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${r}${e}`}})),m(n=>i.handle(n))):i.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let i=this.tokenGetter(e);return $(i).pipe(m(r=>this.handleInterception(r,e,t)))}}return o.\u0275fac=function(e){return new(e||o)(c(w),c(p),c(y))},o.\u0275prov=l({token:o,factory:o.\u0275fac}),o})(),L=(()=>{class o{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:o,providers:[{provide:E,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:w,useValue:e.config},p]}}}return o.\u0275fac=function(e){return new(e||o)(c(o,12))},o.\u0275mod=I({type:o}),o.\u0275inj=T({}),o})();var z=(()=>{class o{$api=f(j);$jwtHelper=f(p);$settings=f(S);token;user={};logoutTimer;lastRefreshTime=Date.now();isRefreshing=!1;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield this.$api.post("/auth/login",e);if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(h.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield this.$api.post("/auth/noauth",{});if(this.validateToken(e.access_token))window.localStorage.setItem(h.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,clearTimeout(this.logoutTimer),window.localStorage.removeItem(h.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield this.$settings.onSettingsLoaded);let e=window.localStorage.getItem(h.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){if(!this.token||this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){console.warn("Token expired on client side, logging out immediately"),this.logout();return}try{return yield this.$api.get("/auth/check")}catch(e){throw e.status===401&&(console.warn("Current token is not valid on server"),this.logout()),e}})}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}validateToken(e){try{return this.$jwtHelper.isTokenExpired(e,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(e),this.token=e,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(h.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let e=this.$settings.sessionTimeout*1e3;e<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),e))}}checkAndRefreshIfNeeded(){return a(this,null,function*(){if(!this.$settings.formAuth||!this.$settings.sessionTimeoutInactivityBased||!this.token||!this.isLoggedIn()||this.isRefreshing)return;let t=Date.now()-this.lastRefreshTime,r=this.$settings.sessionTimeout*1e3*.7;if(t>r)try{yield this.refreshSession()}catch(s){console.error("Failed to refresh session:",s)}})}refreshSession(){return a(this,null,function*(){if(!this.isRefreshing){this.isRefreshing=!0;try{let e=yield this.$api.post("/auth/refresh",{});e.access_token&&(this.token=e.access_token,window.localStorage.setItem(h.jwt.tokenKey,e.access_token),this.lastRefreshTime=Date.now(),this.setLogoutTimer())}finally{this.isRefreshing=!1}}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=l({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();export{L as a,z as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as se}from"./chunk-
|
|
1
|
+
import{a as se}from"./chunk-IPCY24VP.js";import{b as Q}from"./chunk-5DKBUEKC.js";import{C as oe,D as ae,c as X,d as k,e as Y,f as Z,g as ee,j as $,m as te,r as ie,s as ne,z as re}from"./chunk-Z62MEN4O.js";import{b as J}from"./chunk-MXLTCL2C.js";import{C as q,E as G,F as j,H as K,J as E,K as A,q as R}from"./chunk-M6KB66ZD.js";import{Ab as T,Ec as a,Fb as f,Fc as s,Gb as o,Hb as r,Ib as m,Rb as I,Ua as D,Xb as C,Za as n,Zb as u,aa as w,ga as x,ha as v,hc as W,ic as V,jc as M,kc as l,lc as g,mc as h,n as P,nb as O,sa as _,xc as H,yb as L,zb as z,zc as B}from"./chunk-MKV5RAJQ.js";import{h as F}from"./chunk-B4AJQJMI.js";var de=()=>["restoring","restarting","restore-complete"],N=(t,d)=>({"is-valid":t,"is-invalid":d});function ce(t,d){if(t&1){let e=I();o(0,"div",5)(1,"h4",6),l(2),a(3,"translate"),r(),m(4,"div",7),a(5,"translate"),o(6,"button",8),C("click",function(){x(e);let i=u();return v(i.onClickGettingStarted())}),l(7),a(8,"translate"),r(),o(9,"a",9),C("click",function(){x(e);let i=u();return v(i.onClickRestoreBackup())}),l(10),a(11,"translate"),r()()}t&2&&(n(2),g(s(3,4,"setup.welcome_to_homebridge")),n(2),f("innerHTML",s(5,6,"setup.intro"),D),n(3),h(" ",s(8,8,"setup.button_get_started")," "),n(3),g(s(11,10,"setup_wizard_restore")))}function me(t,d){if(t&1){let e=I();o(0,"div",5)(1,"h4",6),l(2),a(3,"translate"),r(),o(4,"div",10),l(5),a(6,"translate"),r(),o(7,"div",11)(8,"form",12),C("ngSubmit",function(){x(e);let i=u();return v(i.createFirstUser())}),o(9,"div",13)(10,"span",14),m(11,"i",15),r(),m(12,"input",16),a(13,"translate"),r(),o(14,"div",13)(15,"span",14),m(16,"i",17),r(),m(17,"input",18),a(18,"translate"),r(),o(19,"div",13)(20,"span",14),m(21,"i",17),r(),m(22,"input",19),a(23,"translate"),r(),o(24,"div",20)(25,"button",21),C("click",function(){x(e);let i=u();return v(i.onClickCancelRestore())}),l(26),a(27,"translate"),r(),o(28,"button",22),l(29),a(30,"translate"),r()()()()()}if(t&2){let e=u();n(2),g(s(3,19,"setup.create_account")),n(3),g(s(6,21,"setup_wizard_create_info")),n(3),f("formGroup",e.createUserForm),n(4),M(B(33,N,e.createUserForm.controls.username.dirty&&e.createUserForm.controls.username.valid,e.createUserForm.controls.username.dirty&&e.createUserForm.controls.username.invalid)),f("readonly",e.loading())("placeholder",s(13,23,"users.label_username")),n(5),M(B(36,N,e.createUserForm.controls.password.dirty&&e.createUserForm.controls.password.valid,e.createUserForm.controls.password.dirty&&e.createUserForm.controls.password.errors)),f("readonly",e.loading())("placeholder",s(18,25,"users.label_password")),n(5),M(B(39,N,e.createUserForm.controls.passwordConfirm.dirty&&e.createUserForm.controls.passwordConfirm.valid,e.createUserForm.controls.passwordConfirm.dirty&&e.createUserForm.controls.passwordConfirm.errors)),f("readonly",e.loading())("placeholder",s(23,27,"users.label_confirm_password")),n(3),f("disabled",e.restoreUploading()),n(),h(" ",s(27,29,"form.button_back")," "),n(2),f("disabled",e.createUserForm.invalid||e.loading()),n(),h(" ",s(30,31,"form.button_continue")," ")}}function ue(t,d){t&1&&(m(0,"i",25),l(1),a(2,"translate")),t&2&&(n(),h(" ",s(2,1,"backup.label_uploading")," "))}function ge(t,d){t&1&&(l(0),a(1,"translate")),t&2&&h(" ",s(1,1,"form.button_continue")," ")}function _e(t,d){if(t&1){let e=I();o(0,"div",5)(1,"h4",6),l(2),a(3,"translate"),r(),o(4,"div",10),l(5),a(6,"translate"),r(),o(7,"input",23),C("change",function(i){x(e);let b=u();return v(b.handleRestoreFileInput(i.target.files))}),r(),o(8,"div",20)(9,"button",21),C("click",function(){x(e);let i=u();return v(i.onClickCancelRestore())}),l(10),a(11,"translate"),r(),o(12,"button",24),C("click",function(){x(e);let i=u();return v(i.onRestoreBackupClick())}),z(13,ue,3,3)(14,ge,2,3),r()()()}if(t&2){let e=u();n(2),g(s(3,6,"setup_wizard_restore")),n(3),g(s(6,8,"backup.restore_help_one")),n(4),f("disabled",e.restoreUploading()),n(),h(" ",s(11,10,"form.button_back")," "),n(2),f("disabled",e.restoreUploading()||!e.selectedFile()),n(),T(e.restoreUploading()?13:14)}}function fe(t,d){t&1&&(l(0),a(1,"translate")),t&2&&h(" ",s(1,1,"setup_wizard_restoring")," ")}function he(t,d){t&1&&(l(0),a(1,"translate")),t&2&&h(" ",s(1,1,"setup_wizard_starting")," ")}function be(t,d){t&1&&(l(0),a(1,"translate")),t&2&&h(" ",s(1,1,"setup_wizard_complete")," ")}function we(t,d){t&1&&(o(0,"a",27),l(1),a(2,"translate"),r()),t&2&&(n(),g(s(2,1,"form.button_continue")))}function xe(t,d){if(t&1&&(o(0,"div",5)(1,"h4",6),z(2,fe,2,3)(3,he,2,3)(4,be,2,3),r(),m(5,"div",26),z(6,we,3,3,"a",27),r()),t&2){let e=u();n(2),T(e.step()==="restoring"?2:e.step()==="restarting"?3:e.step()==="restore-complete"?4:-1),n(4),T(e.step()==="restore-complete"?6:-1)}}function ve(t,d){t&1&&(o(0,"div",5)(1,"h4",28),l(2),a(3,"translate"),r(),o(4,"div",10),l(5),a(6,"translate"),r(),o(7,"a",29),l(8),a(9,"translate"),r()()),t&2&&(n(2),g(s(3,3,"setup_wizard_complete_title")),n(3),g(s(6,5,"setup_wizard_completed")),n(3),g(s(9,7,"form.button_continue")))}var Ne=(()=>{class t{$api=w(A);$auth=w(Q);$settings=w(J);$title=w(q);$toastr=w(K);$translate=w(G);$ws=w(se);step=_("welcome",{});backgroundStyle=_(void 0,{});progress=_(1,{});restoreInProgress=_(!1,{});restoreStarted=_(!1,{});restoreFailed=_(!1,{});loading=_(!1,{});selectedFile=_(void 0,{});restoreUploading=_(!1,{});io;createUserForm=new ee({username:new $("",[k.required]),password:new $("",[k.compose([k.required,k.minLength(4)])]),passwordConfirm:new $("",[k.required])},this.matchPassword);ngOnInit(){this.$title.setTitle(this.$translate.instant("setup_wizard_page_title")),this.setBackground()}onClickGettingStarted(){this.step.set("create-account"),this.progress.set(50)}onClickRestoreBackup(){this.step.set("restore-backup"),this.progress.set(20)}onClickCancelRestore(){this.selectedFile.set(void 0),this.step.set("welcome"),this.progress.set(1)}createFirstUser(){return F(this,null,function*(){this.loading.set(!0),this.progress.set(75);let e=this.createUserForm.getRawValue();e.name=e.username;try{yield this.$api.post("/setup-wizard/create-first-user",e),this.$settings.env.setupWizardComplete=!0,this.progress.set(100),this.loading.set(!1),yield this.$auth.login({username:e.username,password:e.password}),this.step.set("setup-complete")}catch(p){this.loading.set(!1),this.progress.set(50),console.error(p),this.$toastr.error(p.message,this.$translate.instant("toast.title_error"))}})}handleRestoreFileInput(e){e.length?(this.selectedFile.set(e[0]),this.progress.set(40)):(this.selectedFile.set(void 0),this.progress.set(20))}onRestoreBackupClick(){return F(this,null,function*(){this.restoreUploading.set(!0),this.step.set("restoring"),this.progress.set(60);try{let e=yield this.$api.get("/setup-wizard/get-setup-wizard-token");window.localStorage.setItem(E.jwt.tokenKey,e.access_token),this.$auth.token=e.access_token,this.progress.set(65);let p=new FormData,i=this.selectedFile();p.append("restoreArchive",i,i.name),yield this.$api.post("/backup/restore",p),this.progress.set(70),this.io=this.$ws.connectToNamespace("backup");let b=document.getElementById("output");this.io.socket.on("stdout",c=>{c.split(`
|
|
2
2
|
\r`).forEach(y=>{if(y&&!/^[⠇⠏⠋⠙⠹⠸]+$/.test(y)){let S=document.createElement("div"),pe=/\x1B\[(\d{1,2}(;\d{1,2})?)?[mGK]/g;S.innerHTML=y.replace(pe,""),y.includes("[0;31m")?S.classList.add("red-text"):y.includes("[0;32m")?S.classList.add("green-text"):y.includes("[0;33m")?S.classList.add("orange-text"):y.includes("[0;36m")&&S.classList.add("cyan-text"),b.appendChild(S),b.scrollTop=b.scrollHeight}})}),this.restoreStarted.set(!0),this.restoreInProgress.set(!0),this.progress.set(75),yield P(this.io.request("do-restore")),this.progress.set(80),this.restoreInProgress.set(!1),yield this.$api.put("/backup/restart",{}),this.step.set("restarting"),this.progress.set(85),window.localStorage.removeItem(E.jwt.tokenKey),this.$auth.token=null;let U=document.createElement("div");U.classList.add("orange-text"),U.innerHTML="Starting Homebridge, please wait...",b.appendChild(U),b.scrollTop=b.scrollHeight,yield new Promise(c=>setTimeout(c,3e3)),this.progress.set(88),yield new Promise(c=>setTimeout(c,3e3)),this.progress.set(91),yield new Promise(c=>setTimeout(c,3e3)),this.progress.set(94),yield new Promise(c=>setTimeout(c,3e3)),this.progress.set(97),yield new Promise(c=>setTimeout(c,3e3)),this.progress.set(99);let le=setInterval(()=>F(this,null,function*(){try{yield this.$api.get("/auth/settings"),clearInterval(le),this.progress.set(100),this.restoreUploading.set(!1),this.step.set("restore-complete")}catch{}}),1e3)}catch(e){console.error(e),this.restoreUploading.set(!1),this.restoreFailed.set(!0),this.progress.set(20),this.step.set("restore-backup"),this.$toastr.error(e.message,this.$translate.instant("toast.title_error"))}finally{this.io&&this.io.end()}})}setBackground(){return F(this,null,function*(){if(this.$settings.settingsLoaded||(yield P(this.$settings.onSettingsLoaded)),this.$settings.env.customWallpaperHash){let e=`${E.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`;this.backgroundStyle.set(`url('${e}') center/cover`)}})}matchPassword(e){let p=e.get("password").value,i=e.get("passwordConfirm").value;if(p!==i)e.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=O({type:t,selectors:[["ng-component"]],decls:10,vars:11,consts:[[1,"setup-container","gradient","d-flex","align-items-start","justify-content-center"],[1,"w-100","setup-card","d-flex","py-4","flex-column"],["ngSrc","assets/homebridge-color-round.svg","alt","Homebridge Logo","height","100","width","100","priority","true",1,"homebridge-logo","mx-auto","my-3"],[1,"progress","w-100","my-4"],["role","progressbar","aria-valuemin","0","aria-valuemax","100",1,"progress-bar","progress-bar-striped","bg-success"],[1,"w-100","d-flex","flex-column","align-items-center","mb-2"],[1,"mb-3","text-center"],[1,"mb-4","small","grey-text","text-center",3,"innerHTML"],["type","button",1,"btn","btn-lg","btn-primary","mb-4",3,"click"],["href","javascript:void(0)",1,"grey-text",3,"click"],[1,"mb-4","small","grey-text","text-center"],[1,"w-100"],["novalidate","",3,"ngSubmit","formGroup"],[1,"input-group","mb-4"],[1,"input-group-text","custom-input"],[1,"fas","fa-user","primary-text","fa-lg"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none","tabindex","1","required","",1,"form-control","custom-input",3,"readonly","placeholder"],[1,"fas","fa-lock","primary-text","fa-lg"],["formControlName","password","type","password","id","form-pass","autocomplete","new-password","tabindex","2","required","",1,"form-control","custom-input",3,"readonly","placeholder"],["formControlName","passwordConfirm","type","password","id","form-pass-confirm","autocomplete","new-password","tabindex","2","required","",1,"form-control","custom-input",3,"readonly","placeholder"],[1,"mt-3","w-100","d-flex","justify-content-between"],["type","button",1,"btn","btn-elegant","ms-0",3,"click","disabled"],["type","submit",1,"btn","btn-primary",3,"disabled"],["type","file","id","restoreFileUpload","accept","application/gzip, .gz",1,"form-control","custom-input","mb-3",3,"change"],["type","button",1,"btn","btn-primary","me-0",3,"click","disabled"],[1,"fas","fa-spinner","fa-pulse"],["id","output",1,"font-monospace","small","alert","alert-info","w-100","text-start","mt-1","mb-0"],["href","/login",1,"btn","btn-lg","btn-primary","mt-4"],[1,"mb-3"],["href","/",1,"btn","btn-lg","btn-primary"]],template:function(p,i){p&1&&(o(0,"div",0)(1,"div",1),m(2,"img",2),o(3,"div",3),m(4,"div",4),r(),z(5,ce,12,12,"div",5)(6,me,31,42,"div",5)(7,_e,15,12,"div",5)(8,xe,7,2,"div",5)(9,ve,10,9,"div",5),r()()),p&2&&(W("background",i.backgroundStyle()),V("anim",!i.backgroundStyle()),n(4),W("width",i.progress()+"%"),V("progress-bar-animated",i.loading()||i.restoreUploading()),L("aria-valuenow",i.progress()),n(),T(i.step()==="welcome"?5:i.step()==="create-account"?6:i.step()==="restore-backup"?7:H(10,de).includes(i.step())?8:i.step()==="setup-complete"?9:-1))},dependencies:[R,oe,te,X,Y,Z,re,ae,ne,ie,j],styles:["body{overflow:scroll!important} body.dark-mode .setup-card{background-color:#2b2b2b;color:#fff}.setup-container[_ngcontent-%COMP%]{z-index:-1;padding-top:2em;padding-bottom:2em;min-height:100%;background-size:300% 300%}.anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.setup-card[_ngcontent-%COMP%]{max-width:550px;border-radius:1rem;padding-right:25px;padding-left:25px;background-color:#ffffffe6}.setup-card[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{background-color:inherit!important}@media screen and (max-width:575px){.setup-card[_ngcontent-%COMP%]{margin-left:1em;margin-right:1em}}.homebridge-logo[_ngcontent-%COMP%]{margin-bottom:10px}.progress[_ngcontent-%COMP%]{background-color:#ddd}#output[_ngcontent-%COMP%]{height:200px;overflow-y:scroll;white-space:pre-wrap}"]})}return t})();export{Ne as SetupWizardComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as z,b as S,c as F}from"./chunk-BMOLDRJ3.js";import{a}from"./chunk-
|
|
1
|
+
import{a as z,b as S,c as F}from"./chunk-BMOLDRJ3.js";import{a}from"./chunk-IPCY24VP.js";import{F as c,X as f,aa as u,d as m}from"./chunk-MKV5RAJQ.js";import{g as h}from"./chunk-B4AJQJMI.js";var d=h(z(),1),p=h(S(),1),b=h(F(),1);var B=(()=>{class s{$ws=u(a);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;connectedSubscription;resizeSubscription;elementResizeSubscription;searchFilter=null;logBuffer=[];maxBufferSize=1e3;term;startTerminal(e,r={},n,w){this.pluginName=w,this.elementResize=n,this.io=this.$ws.connectToNamespace("log"),this.fitAddon=new d.FitAddon,this.webLinksAddon=new p.WebLinksAddon,this.term=new b.Terminal(r),this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon),this.resize=new m,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.fit()}),this.connectedSubscription=this.io.connected.subscribe(()=>{this.term.reset(),this.logBuffer=[],this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.connected&&this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows}),this.io.socket.on("disconnect",()=>{this.term.write(`
|
|
2
2
|
\r
|
|
3
3
|
\rWebsocket failed to connect. Is the server running?
|
|
4
4
|
\r
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as o}from"./chunk-MKV5RAJQ.js";var A=new o("ConfirmModalData"),a=new o("InformationModalData"),D=new o("PluginModalData"),e=new o("PluginBridgeModalData"),n=new o("CustomPluginsModalData"),_=new o("PluginLogsModalData"),M=new o("UninstallPluginModalData"),s=new o("ResetAccessoriesModalData"),O=new o("ManagePluginModalData"),T=new o("DisablePluginModalData"),L=new o("PluginCompatibilityModalData"),r=new o("ManageVersionModalData"),l=new o("SwitchToScopedModalData"),I=new o("UserModalData"),c=new o("NetworkInterfacesModalData"),i=new o("AccessoryControlListsModalData"),d=new o("RestoreModalData"),S=new o("RemoveIndividualAccessoriesModalData"),E=new o("AccessoryInfoModalData"),p=new o("ConfigRestoreModalData"),R=new o("WidgetControlModalData"),w=new o("WidgetVisibilityModalData"),N=new o("RestartChildBridgesModalData"),x=new o("NodeVersionModalData"),C=new o("HbV2ModalData");export{A as a,a as b,D as c,e as d,n as e,_ as f,M as g,s as h,O as i,T as j,L as k,r as l,l as m,I as n,c as o,i as p,d as q,S as r,E as s,p as t,R as u,w as v,N as w,x,C as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as z}from"./chunk-IPCY24VP.js";import{e as w}from"./chunk-2HDDFLX5.js";import{a as x}from"./chunk-BGCYR25X.js";import"./chunk-5DKBUEKC.js";import{b as M}from"./chunk-MXLTCL2C.js";import{E as T,F as D,H as R,K as I}from"./chunk-M6KB66ZD.js";import{Ab as h,Ec as m,Fc as c,Gc as $,Jb as o,Kb as i,Lb as d,Sb as k,Ua as E,Za as r,Zb as v,aa as n,kc as s,lc as a,ma as b,nb as S,sa as u,w as l,yc as C,zb as f}from"./chunk-MKV5RAJQ.js";import{h as y}from"./chunk-B4AJQJMI.js";var B=t=>({command:t});function O(t,_){if(t&1&&(o(0,"div",7),s(1),i()),t&2){let e=v();r(),a(e.error())}}function j(t,_){t&1&&(o(0,"p",9),s(1),m(2,"translate"),i(),o(3,"div",10)(4,"div",11),d(5,"i",12),i()()),t&2&&(r(),a(c(2,1,"restart.please_wait_while_server_restarts")))}function H(t,_){if(t&1&&(o(0,"div",8)(1,"p"),s(2),m(3,"translate"),i(),d(4,"p",13),m(5,"translate"),i()),t&2){let e=v();r(2),a(c(3,2,"platform.docker.server_long_time")),r(2),k("innerHTML",$(5,4,"platform.docker.run_with_restart",C(7,B,e.command)),E)}}var Q=(()=>{class t{$api=n(I);$router=n(w);$settings=n(M);$toastr=n(R);$translate=n(T);$ws=n(z);destroyRef=n(b);checkTimeoutSubscription=null;checkDelaySubscription=null;io;resp={};timeout=u(!1,{});error=u(!1,{});command='<span class="font-monospace">--restart=always</span>';ngOnInit(){this.initialize()}initialize(){return y(this,null,function*(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})});try{let e=yield this.$api.put("/platform-tools/docker/restart-container",{});this.resp=e,this.checkIfServerUp()}catch(e){this.error.set(this.$translate.instant("restart.toast_server_restart_error")),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}ngOnDestroy(){this.io.end(),this.checkDelaySubscription&&this.checkDelaySubscription.unsubscribe(),this.checkTimeoutSubscription&&this.checkTimeoutSubscription.unsubscribe()}checkIfServerUp(){this.checkDelaySubscription=l(1e4).pipe(x(this.destroyRef)).subscribe(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="ok"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})}),this.checkTimeoutSubscription=l(6e4).pipe(x(this.destroyRef)).subscribe(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout.set(!0)})}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fab","fa-docker",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(p,g){p&1&&(o(0,"div",0)(1,"h3",1),s(2),m(3,"translate"),i()(),o(4,"div",2)(5,"div",3),d(6,"i",4),i(),o(7,"div",5)(8,"h4",6),s(9),m(10,"translate"),i(),f(11,O,2,1,"div",7)(12,j,6,3),f(13,H,6,9,"div",8),i()()),p&2&&(r(2),a(c(3,4,"menu.restart.title")),r(7),a(c(10,6,"platform.docker.title_restarting")),r(2),h(g.error()?11:12),r(2),h(g.timeout()?13:-1))},dependencies:[D],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{Q as ContainerRestartComponent};
|