homebridge-config-ui-x 5.11.2-beta.8 → 5.11.2-beta.9
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 +3 -3
- package/public/{chunk-OF2SRCQW.js → chunk-2OWZ4XP5.js} +1 -1
- package/public/{chunk-QMWN5KPC.js → chunk-3N7C33O4.js} +1 -1
- package/public/{chunk-G2KWTNHR.js → chunk-4XUH7NXA.js} +1 -1
- package/public/{chunk-CEMVTOZG.js → chunk-6CBJSM3U.js} +1 -1
- package/public/{chunk-NIS65GVY.js → chunk-7JIIKSDG.js} +1 -1
- package/public/{chunk-AXMO2G45.js → chunk-A2MXGFJ6.js} +1 -1
- package/public/{chunk-J7UDRE66.js → chunk-AWTSOXJ2.js} +1 -1
- package/public/{chunk-XORPUWNC.js → chunk-BBBDRQZR.js} +1 -1
- package/public/{chunk-KTQBVBY4.js → chunk-CKURAGOR.js} +1 -1
- package/public/{chunk-N5ONV6TU.js → chunk-DFG4HJK5.js} +1 -1
- package/public/{chunk-VY7HWBNV.js → chunk-DPITSP7F.js} +1 -1
- package/public/{chunk-JY5ZEEL2.js → chunk-DSSLC7R5.js} +1 -1
- package/public/{chunk-CMO4UANJ.js → chunk-F635TFLI.js} +1 -1
- package/public/{chunk-G2GGYHA2.js → chunk-GVFAT25G.js} +1 -1
- package/public/{chunk-XNZA4UBO.js → chunk-HBUIXUR3.js} +1 -1
- package/public/{chunk-5WSUQV2C.js → chunk-HN6QQBDC.js} +1 -1
- package/public/{chunk-OBV66CW4.js → chunk-HYHFIPBC.js} +1 -1
- package/public/{chunk-CP6FP6S2.js → chunk-IDVQIBZN.js} +1 -1
- package/public/{chunk-TPUA4UIN.js → chunk-K7PJFUH4.js} +1 -1
- package/public/{chunk-F5AJLGGI.js → chunk-KV4RQA3A.js} +1 -1
- package/public/{chunk-XOPZ7U6G.js → chunk-LAVT57X4.js} +1 -1
- package/public/{chunk-N7UWTPTT.js → chunk-LI37IF2Z.js} +1 -1
- package/public/chunk-LLNAB3NM.js +35 -0
- package/public/{chunk-Q7EXN4JA.js → chunk-LO72RI4S.js} +1 -1
- package/public/{chunk-ZNN6GWYK.js → chunk-LZTSIWKP.js} +1 -1
- package/public/{chunk-XTYMIZVV.js → chunk-N3SESV2P.js} +1 -1
- package/public/{chunk-PWCLNQBI.js → chunk-OS475ZQO.js} +1 -1
- package/public/{chunk-BB35SJH2.js → chunk-OVQGZ4C6.js} +1 -1
- package/public/{chunk-EWS4VSZB.js → chunk-PD3Q2PZE.js} +1 -1
- package/public/{chunk-GDWF2NMA.js → chunk-PYPOWROR.js} +1 -1
- package/public/{chunk-OOILCTQ3.js → chunk-R2CO54AK.js} +1 -1
- package/public/{chunk-6INJQUJQ.js → chunk-TCJMUYCJ.js} +1 -1
- package/public/{chunk-WVG4A2SW.js → chunk-TJXF3MRO.js} +1 -1
- package/public/{chunk-JWRZMMRO.js → chunk-UFVCK77E.js} +1 -1
- package/public/{chunk-4WEBTV3N.js → chunk-V2TVR4X3.js} +1 -1
- package/public/{chunk-4YNYBAGL.js → chunk-W4WAFNIS.js} +1 -1
- package/public/{chunk-2V4LIZUH.js → chunk-WU7URLRW.js} +1 -1
- package/public/{chunk-H3BKW5W3.js → chunk-X6RWNTC7.js} +1 -1
- package/public/{chunk-7DFQDPRM.js → chunk-YHBVXMFX.js} +1 -1
- package/public/{chunk-D3Q5QTFY.js → chunk-ZAWMHW3P.js} +1 -1
- package/public/{chunk-GGTS2YBW.js → chunk-ZSFO6PRU.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-O5PA2XOA.js → main-EZDP2TWN.js} +1 -1
- package/public/chunk-BFGRDXJK.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as $}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-HYHFIPBC.js";import{J as h,K as S,x as j}from"./chunk-AWTSOXJ2.js";import{$ as c,X as l,Y as v,_ as y,aa as f,i as u,la as I,n as g,o as k,ob as E,q as m,t as T}from"./chunk-HUTYOGRH.js";import{h as a}from"./chunk-B4AJQJMI.js";var w=new y("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,D=0;n=e.charAt(D++);~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})(),x=o=>o instanceof Promise?T(()=>o):u(o),b=(()=>{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?x(this.jwtHelper.isTokenExpired(e)):u(!0)),e?s.pipe(k(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 x(i).pipe(m(r=>this.handleInterception(r,e,t)))}}return o.\u0275fac=function(e){return new(e||o)(c(w),c(p),c(I))},o.\u0275prov=l({token:o,factory:o.\u0275fac}),o})(),U=(()=>{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:j,useClass:b,multi:!0},e.jwtOptionsProvider||{provide:w,useValue:e.config},p]}}}return o.\u0275fac=function(e){return new(e||o)(c(o,12))},o.\u0275mod=E({type:o}),o.\u0275inj=v({}),o})();var X=(()=>{class o{$api=f(S);$jwtHelper=f(p);$settings=f($);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 g(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{U as a,X as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-CKURAGOR.js";import{J as r}from"./chunk-AWTSOXJ2.js";import{X as a,aa as o}from"./chunk-HUTYOGRH.js";import{h as i}from"./chunk-B4AJQJMI.js";var h=(()=>{class t{cache=null;CACHE_DURATION_MS=6e4;getToken(){let n=Date.now();if(this.cache&&n-this.cache.timestamp<this.CACHE_DURATION_MS)return this.cache.token;let e=window.localStorage.getItem(r.jwt.tokenKey);return this.cache={token:e,timestamp:n},e}invalidateCache(){this.cache=null}static \u0275fac=function(e){return new(e||t)};static \u0275prov=a({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var p=(()=>{class t{$auth=o(c);$tokenCache=o(h);isAuthenticated(){return i(this,null,function*(){if(!this.$tokenCache.getToken())return this.$auth.token=null,this.$auth.user={},this.$tokenCache.invalidateCache(),!1;try{let e=this.$auth.isLoggedIn();return e||(this.$auth.token=null,this.$auth.user={},this.$tokenCache.invalidateCache()),e}catch{return console.warn("Token validation error, clearing auth state"),this.$auth.logout(),this.$tokenCache.invalidateCache(),!1}})}static \u0275fac=function(e){return new(e||t)};static \u0275prov=a({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{p as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f,b as z,c as S}from"./chunk-BMOLDRJ3.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as f,b as z,c as S}from"./chunk-BMOLDRJ3.js";import{a as b}from"./chunk-OS475ZQO.js";import{K as u}from"./chunk-AWTSOXJ2.js";import{F as t,X as p,aa as c,d as h}from"./chunk-HUTYOGRH.js";import{g as r,h as m}from"./chunk-B4AJQJMI.js";var a=r(f(),1),l=r(z(),1),d=r(S(),1);var D=(()=>{class n{$ws=c(b);$api=c(u);io;fitAddon;webLinksAddon;resize;elementResize;dataDisposable=null;isInitializing=!1;hasUserTyped=!1;resizeSubscription;elementResizeSubscription;connectedSubscription;term;destroyTerminal(){this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=null),this.resizeSubscription&&(this.resizeSubscription.unsubscribe(),this.resizeSubscription=null),this.elementResizeSubscription&&(this.elementResizeSubscription.unsubscribe(),this.elementResizeSubscription=null),this.connectedSubscription&&(this.connectedSubscription.unsubscribe(),this.connectedSubscription=null),this.io&&this.io.end(),this.term&&(this.term.dispose(),this.term=null),this.resize&&this.resize.complete(),this.elementResize&&this.elementResize.complete(),this.isInitializing=!1,this.hasUserTyped=!1}destroyPersistentSession(){return m(this,null,function*(){this.destroyTerminal();try{yield this.$api.post("/platform-tools/terminal/destroy-persistent-session",{})}catch(e){console.error("Failed to destroy persistent session:",e)}})}detachTerminal(){this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=null),this.resizeSubscription&&(this.resizeSubscription.unsubscribe(),this.resizeSubscription=null),this.elementResizeSubscription&&(this.elementResizeSubscription.unsubscribe(),this.elementResizeSubscription=null),this.connectedSubscription&&(this.connectedSubscription.unsubscribe(),this.connectedSubscription=null),this.term&&this.term.dispose(),this.resize&&this.resize.complete(),this.elementResize&&this.elementResize.complete(),this.isInitializing=!1}hasActiveSession(){return this.io&&this.io.socket&&this.io.socket.connected}hasUserTypedInSession(){return this.hasUserTyped}isTerminalReady(){return this.term&&!this.isInitializing}reconnectTerminal(e,s={},o){if(this.isInitializing)return!1;this.isInitializing=!0,this.elementResize=o,this.io&&this.io.socket&&this.io.socket.connected?(this.term=new d.Terminal(s),this.fitAddon=new a.FitAddon,this.webLinksAddon=new l.WebLinksAddon,setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.resize=new h,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.io.socket.removeAllListeners("stdout"),this.io.socket.removeAllListeners("process-exit"),this.io.socket.on("stdout",i=>{this.term.write(i)}),this.io.socket.on("process-exit",()=>{this.startSession()}),this.dataDisposable&&this.dataDisposable.dispose(),this.dataDisposable=this.term.onData(i=>{this.hasUserTyped=!0,this.io.socket.emit("stdin",i)}),this.term.onResize(i=>{this.resize.next(i)}),this.resizeSubscription=this.resize.pipe(t(500)).subscribe(i=>{this.io.socket.emit("resize",i)}),this.elementResize&&(this.elementResizeSubscription=this.elementResize.pipe(t(100)).subscribe({next:()=>{this.fitAddon.fit()}})),this.io.socket.emit("start-session",{cols:this.term.cols,rows:this.term.rows}),this.isInitializing=!1):this.startTerminal(e,s,o)}startTerminal(e,s={},o){return this.isInitializing?!1:(this.isInitializing=!0,this.elementResize=o,this.io=this.$ws.connectToNamespace("platform-tools/terminal"),this.term=new d.Terminal(s),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new a.FitAddon,this.webLinksAddon=new l.WebLinksAddon,this.resize=new h,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.connectedSubscription=this.io.connected.pipe(t(200)).subscribe(()=>{this.startSession()}),this.io.socket.on("disconnect",()=>{this.term.write(`
|
|
2
2
|
\r
|
|
3
3
|
\rTerminal disconnected. Is the server running?
|
|
4
4
|
\r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-LO72RI4S.js";import{a as S}from"./chunk-DPITSP7F.js";import"./chunk-BMOLDRJ3.js";import"./chunk-F635TFLI.js";import"./chunk-PRGOUVRO.js";import"./chunk-OS475ZQO.js";import"./chunk-2OWZ4XP5.js";import"./chunk-Z5PUNNUZ.js";import"./chunk-CKURAGOR.js";import"./chunk-K7PJFUH4.js";import{b as C}from"./chunk-HYHFIPBC.js";import{E as b,F as w}from"./chunk-AWTSOXJ2.js";import{Dc as T,Ec as y,Jb as s,Kb as l,Lb as u,Oc as $,Xb as v,Ya as a,Za as d,aa as n,d as m,ec as h,fc as f,kc as g,lc as p,nb as c}from"./chunk-HUTYOGRH.js";import"./chunk-B4AJQJMI.js";var B=["terminaloutput"],L=(()=>{class r{$terminal=n(S);$settings=n(C);$navigationGuard=n(E);$translate=n(b);resizeEvent=new m;termTarget=$("terminaloutput",{});onWindowResize(){this.resizeEvent.next(void 0)}onBeforeUnload(i){return this.$navigationGuard.handleBeforeUnload(i)}onWindowFocus(){this.activateTerminal()}onClick(){this.activateTerminal()}activateTerminal(){this.$terminal.isTerminalReady()&&this.$terminal.term&&this.$terminal.term.focus()}ngOnInit(){let i=this.$translate.instant("menu.linux.label_terminal");this.$settings.setPageTitle(i),window.document.querySelector("body").classList.add("bg-black"),this.$terminal.isTerminalReady()&&this.$terminal.destroyTerminal(),this.$settings.env.terminal?.persistence&&this.$terminal.hasActiveSession()?this.$terminal.reconnectTerminal(this.termTarget(),{},this.resizeEvent):(!this.$settings.env.terminal?.persistence&&this.$terminal.hasActiveSession()&&this.$terminal.destroyPersistentSession(),this.$terminal.startTerminal(this.termTarget(),{},this.resizeEvent)),requestAnimationFrame(()=>{this.activateTerminal()})}ngAfterViewInit(){document.addEventListener("visibilitychange",this.onVisibilityChange.bind(this))}onVisibilityChange(){!document.hidden&&this.$terminal.isTerminalReady()&&requestAnimationFrame(()=>{this.activateTerminal()})}canDeactivate(){return this.$navigationGuard.canDeactivate()}ngOnDestroy(){document.removeEventListener("visibilitychange",this.onVisibilityChange.bind(this)),window.document.querySelector("body").classList.remove("bg-black"),this.$settings.env.terminal?.persistence?this.$terminal.detachTerminal():this.$terminal.destroyPersistentSession()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=c({type:r,selectors:[["ng-component"]],viewQuery:function(e,t){e&1&&h(t.termTarget,B,5),e&2&&f()},hostBindings:function(e,t){e&1&&v("resize",function(){return t.onWindowResize()},a)("beforeunload",function(_){return t.onBeforeUnload(_)},a)("focus",function(){return t.onWindowFocus()},a)("click",function(){return t.onClick()})},decls:8,vars:3,consts:[["terminaloutput",""],[1,"row","mb-3"],[1,"col-12"],[1,"primary-text","m-0"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","docker-terminal",1,"align-self-end","w-100","h-100","mb-1"]],template:function(e,t){e&1&&(s(0,"div",1)(1,"div",2)(2,"h3",3),g(3),T(4,"translate"),l()()(),s(5,"div",4),u(6,"div",5,0),l()),e&2&&(d(3),p(y(4,1,"menu.linux.label_terminal")))},dependencies:[w],encapsulation:2})}return r})();export{L as TerminalComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-PRGOUVRO.js";import{m as k}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-PRGOUVRO.js";import{m as k}from"./chunk-2OWZ4XP5.js";import{F as h}from"./chunk-AWTSOXJ2.js";import{Ab as c,Dc as b,Ec as _,Jb as o,Kb as a,Lb as m,Rb as y,Sb as f,Ua as r,Yb as u,Za as i,Zb as l,aa as v,ga as L,ha as D,jc as E,kc as C,lc as B,mc as M,nb as T,uc as g,yb as p,zb as d}from"./chunk-HUTYOGRH.js";function S(t,x){if(t&1&&m(0,"i",14),t&2){let e=l();E(g("fas ",e.faIconClass," mb-3"))}}function w(t,x){if(t&1&&m(0,"p",7),t&2){let e=l();f("innerHTML",e.message2,r)}}function z(t,x){if(t&1&&m(0,"p",7),t&2){let e=l();f("innerHTML",e.message3,r)}}function A(t,x){if(t&1){let e=y();o(0,"button",15),u("click",function(){L(e);let n=l();return D(n.closeModal())}),C(1),a()}if(t&2){let e=l();E(g("btn ",e.confirmButtonClass||"btn-primary")),i(),M(" ",e.confirmButtonLabel," ")}}var O=(()=>{class t{$activeModal=v(k);modalData=v(H);title=this.modalData.title;message=this.modalData.message;message2=this.modalData.message2;message3=this.modalData.message3;confirmButtonLabel=this.modalData.confirmButtonLabel;confirmButtonClass=this.modalData.confirmButtonClass;faIconClass=this.modalData.faIconClass;ctaButtonLabel=this.modalData.ctaButtonLabel;ctaButtonLink=this.modalData.ctaButtonLink;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close()}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=T({type:t,selectors:[["ng-component"]],decls:20,vars:16,consts:[["role","dialog","aria-modal","true",1,"modal-content"],[1,"modal-header"],["id","confirm-modal-title",1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],[2,"font-size","75px",3,"class"],[1,"mb-0","text-center",3,"innerHTML"],[1,"mt-2","mb-0","text-center",3,"innerHTML"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",3,"class"],[2,"font-size","75px"],["type","button","data-bs-dismiss","modal",3,"click"]],template:function(s,n){s&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),C(3),a(),o(4,"button",3),b(5,"translate"),u("click",function(){return n.dismissModal()}),a()(),o(6,"div",4),d(7,S,1,3,"i",5),m(8,"p",6),d(9,w,1,1,"p",7),d(10,z,1,1,"p",7),a(),o(11,"div",8)(12,"div",9)(13,"button",10),b(14,"translate"),u("click",function(){return n.dismissModal()}),C(15),b(16,"translate"),a()(),m(17,"div",11),o(18,"div",12),d(19,A,2,4,"button",13),a()()()),s&2&&(p("aria-labelledby","confirm-modal-title"),i(3),B(n.title),i(),p("aria-label",_(5,10,"form.button_close")),i(3),c(n.faIconClass?7:-1),i(),f("innerHTML",n.message,r),i(),c(n.message2?9:-1),i(),c(n.message3?10:-1),i(3),p("aria-label",_(14,12,"form.button_cancel")),i(2),M(" ",_(16,14,"form.button_cancel")," "),i(4),c(n.confirmButtonLabel?19:-1))},dependencies:[h],encapsulation:2})}return t})();export{O as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as nt}from"./chunk-
|
|
1
|
+
import{a as nt}from"./chunk-HBUIXUR3.js";import"./chunk-BMOLDRJ3.js";import{a as E}from"./chunk-F635TFLI.js";import{a as ct}from"./chunk-H7F7H5MW.js";import{a as L}from"./chunk-PRGOUVRO.js";import"./chunk-OS475ZQO.js";import{n as ot,t as it}from"./chunk-2OWZ4XP5.js";import"./chunk-Z5PUNNUZ.js";import{b as R}from"./chunk-CKURAGOR.js";import{D as et,c as W,e as J,f as K,g as U,j as X,m as Y,r as Z,s as tt}from"./chunk-K7PJFUH4.js";import{b as H}from"./chunk-HYHFIPBC.js";import{E as z,F as A,H as G,K as Q}from"./chunk-AWTSOXJ2.js";import{Ab as x,Dc as a,Ec as s,Fb as f,Gb as p,Hb as c,Ib as d,Oc as T,Rb as v,Xb as h,Ya as I,Za as r,Zb as m,aa as l,d as k,ea as F,ec as $,fc as q,ga as u,ha as g,ic as B,jc as D,kc as O,lc as P,mb as S,nb as j,sa as y,uc as N,yb as b,zb as w}from"./chunk-HUTYOGRH.js";import{g as lt,h as C}from"./chunk-B4AJQJMI.js";var M=lt(ct(),1);var pt=["logoutput"],mt=["searchInput"];function dt(i,V){if(i&1){let e=v();p(0,"div",5)(1,"button",9),a(2,"translate"),a(3,"translate"),h("click",function(){u(e);let t=m();return g(t.showSearch())}),d(4,"i"),c(),p(5,"button",9),a(6,"translate"),a(7,"translate"),h("click",function(){u(e);let t=m();return g(t.downloadLogFile())}),d(8,"i",10),c(),p(9,"button",11),a(10,"translate"),a(11,"translate"),h("click",function(){u(e);let t=m();return g(t.truncateLogFile())}),d(12,"i",12),c()()}if(i&2){let e=m();r(),f("openDelay",150)("ngbTooltip",s(2,12,"form.search")),b("aria-label",s(3,14,"form.search")),r(3),D(N("fas",e.showSearchBar()?" primary-text":""," fa-search")),r(),f("openDelay",150)("ngbTooltip",s(6,16,"form.button_download")),b("aria-label",s(7,18,"form.button_download")),r(4),f("openDelay",150)("ngbTooltip",s(10,20,"form.button_delete")),b("aria-label",s(11,22,"form.button_delete"))}}function ht(i,V){if(i&1){let e=v();p(0,"button",17),a(1,"translate"),h("click",function(){u(e);let t=m(2);return g(t.onClearSearch())}),d(2,"i",18),c()}i&2&&b("aria-label",s(1,1,"form.button_clear"))}function ut(i,V){if(i&1){let e=v();p(0,"div",6)(1,"div",13)(2,"form",14),h("ngSubmit",function(){u(e);let t=m();return g(t.onSubmit(t.form.value))}),d(3,"input",15,1),a(5,"translate"),w(6,ht,3,3,"button",16),c()()()}if(i&2){let e,o=m();r(2),f("formGroup",o.form),r(),B("is-invalid",o.searchInputInvalid),f("placeholder",s(5,5,"logs.placeholder_search_logs")),r(3),x((e=o.form.get("query"))!=null&&e.value?6:-1)}}var kt=(()=>{class i{injector=l(F);$api=l(Q);$auth=l(R);$log=l(nt);$modal=l(ot);$settings=l(H);$toastr=l(G);$translate=l(z);termTarget=T("logoutput",{});searchInput=T("searchInput",{});resizeEvent=new k;valueChangesSubscription;isAdmin=this.$auth.user.admin;showSearchBar=y(!1,{});showExitButton=y(!1,{});form=new U({query:new X("")});get searchInputInvalid(){let e=(this.form.get("query")?.value||"").trim();return e.length>0&&e.length<3}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){let e=this.$translate.instant("menu.linux.label_logs");this.$settings.setPageTitle(e),window.document.querySelector("body").classList.add("bg-black"),this.$log.startTerminal(this.termTarget(),{allowProposedApi:!0},this.resizeEvent),this.valueChangesSubscription=this.form.get("query")?.valueChanges.subscribe(o=>{let t=o||"",n=t.trim();n!==t&&this.form.get("query")?.setValue(n,{emitEvent:!1}),this.showExitButton()&&n.length<3&&(this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom())})}showSearch(){if(this.showSearchBar())this.showSearchBar.set(!1),this.showExitButton.set(!1),this.form.setValue({query:""}),this.$log.clearSearchFilter(),this.$log.scrollToBottom();else{this.showSearchBar.set(!0);let e=this.searchInput();e&&setTimeout(()=>e.nativeElement.focus(),0)}}onSubmit(e){let o=(e.query||"").trim();!o.length||o.length<3?(o.length||this.showSearchBar.set(!1),this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom()):(this.showExitButton.set(!0),this.$log.setSearchFilter(o),this.$log.scrollToBottom())}onClearSearch(){this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom()}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.valueChangesSubscription&&this.valueChangesSubscription.unsubscribe(),this.resizeEvent.complete(),this.$log.destroyTerminal()}downloadLogFile(){return C(this,null,function*(){let e=S([{provide:L,useValue:{title:this.$translate.instant("logs.title_download_log_file"),message:this.$translate.instant("logs.download_warning"),confirmButtonLabel:this.$translate.instant("form.button_download"),faIconClass:"fas fa-user-secret primary-text"}}],this.injector),o=this.$modal.open(E,{size:"lg",backdrop:"static",injector:e});try{yield o.result;try{let t=yield this.$api.get("/platform-tools/hb-service/log/download",{observe:"response",responseType:"blob"}),n=this.$log.getSearchFilter();if(n){let rt=(yield t.body.text()).split(`
|
|
2
2
|
`).filter(st=>st.replace(/\x1b\[[0-9;]*m/g,"").toLowerCase().includes(n.toLowerCase())),at=new Blob([rt.join(`
|
|
3
3
|
`)],{type:"text/plain"});(0,M.saveAs)(at,"homebridge.log.txt")}else(0,M.saveAs)(t.body,"homebridge.log.txt")}catch(t){let n;try{if(t&&typeof t=="object"&&"error"in t){let _=yield t.error.text();n=JSON.parse(_).message}}catch(_){console.error(_)}this.$toastr.error(n||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))}}catch{}})}truncateLogFile(){return C(this,null,function*(){let e=S([{provide:L,useValue:{title:this.$translate.instant("logs.title_truncate_log_file"),message:this.$translate.instant("logs.truncate_log_warning"),confirmButtonLabel:this.$translate.instant("form.button_delete"),confirmButtonClass:"btn-danger",faIconClass:"fas fa-circle-exclamation primary-text"}}],this.injector),o=this.$modal.open(E,{size:"lg",backdrop:"static",injector:e});try{yield o.result;try{yield this.$api.put("/platform-tools/hb-service/log/truncate",{}),this.$toastr.success(this.$translate.instant("logs.log_file_truncated"),this.$translate.instant("toast.title_success")),this.$log.term.clear()}catch(t){console.error(t);let n=t&&typeof t=="object"&&"error"in t&&t.error&&typeof t.error=="object"&&"message"in t.error?String(t.error.message):this.$translate.instant("logs.truncate.error");this.$toastr.error(n,this.$translate.instant("toast.title_error"))}}catch{}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=j({type:i,selectors:[["ng-component"]],viewQuery:function(o,t){o&1&&($(t.termTarget,pt,5),$(t.searchInput,mt,5)),o&2&&q(2)},hostBindings:function(o,t){o&1&&h("resize",function(){return t.onWindowResize()},I)},decls:10,vars:9,consts:[["logoutput",""],["searchInput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"row"],[1,"flex-column","d-flex","align-items-stretch"],["id","log-output",1,"align-self-end","w-100","h-100","mb-1"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","openDelay","ngbTooltip"],[1,"fas","fa-download"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-0",3,"click","openDelay","ngbTooltip"],[1,"fas","fa-trash-alt"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","formControlName","query",1,"search-bar",3,"placeholder"],["type","button",1,"search-bar-clear"],["type","button",1,"search-bar-clear",3,"click"],["aria-hidden","true",1,"fas","fa-square-xmark"]],template:function(o,t){o&1&&(p(0,"div",2)(1,"div",3)(2,"h3",4),O(3),a(4,"translate"),c()(),w(5,dt,13,24,"div",5),c(),w(6,ut,7,7,"div",6),p(7,"div",7),d(8,"div",8,0),c()),o&2&&(r(3),P(s(4,7,"menu.linux.label_logs")),r(2),x(t.isAdmin?5:-1),r(),x(t.showSearchBar()?6:-1),r(),B("adjust-for-mobile",!t.showSearchBar())("adjust-for-mobile-with-search",t.showSearchBar()))},dependencies:[it,et,Y,W,J,K,tt,Z,A],styles:["form[_ngcontent-%COMP%]{position:relative}.search-bar[_ngcontent-%COMP%]{outline:none;box-sizing:inherit!important;background-color:inherit;height:50px!important;width:100%;border-width:.5px;padding:10px 45px 10px 10px;margin-bottom:15px}@media(hover:hover){.search-bar[_ngcontent-%COMP%]:hover{border:1px solid #000000}}.search-bar[_ngcontent-%COMP%]:focus{border:1px solid #000000;box-shadow:0 1px #000}.search-bar.is-invalid[_ngcontent-%COMP%]{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}@media(hover:hover){.search-bar.is-invalid[_ngcontent-%COMP%]:hover{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}}.search-bar.is-invalid[_ngcontent-%COMP%]:focus{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}.search-bar-clear[_ngcontent-%COMP%]{position:absolute;right:8px;top:25px;height:50px;background:transparent;border:none;font-size:20px;color:#d0d0d0;cursor:pointer;padding:0 8px;display:flex;align-items:center}.search-bar-clear[_ngcontent-%COMP%]:hover{color:#a0a0a0}.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 95px);width:calc(100% + 17px);overflow:hidden}@media(max-width:767px){.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 125px)}}"]})}return i})();export{kt as LogsComponent};
|
|
@@ -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-OS475ZQO.js";import{F as c,X as f,aa as u,d as m}from"./chunk-HUTYOGRH.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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk-
|
|
1
|
+
import{e as a}from"./chunk-PD3Q2PZE.js";import{E as n,H as p,K as i}from"./chunk-AWTSOXJ2.js";import{aa as r}from"./chunk-HUTYOGRH.js";import{h as o}from"./chunk-B4AJQJMI.js";var c=()=>o(null,null,function*(){let t=r(i),s=r(a),m=r(p),h=r(n);try{return yield t.get("/platform-tools/docker/startup-script")}catch(e){console.error(e),m.error(e.message,h.instant("toast.title_error")),s.navigate(["/"]);return}});var R=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"docker",children:[{path:"",redirectTo:"/",pathMatch:"full"},{path:"startup-script",loadComponent:()=>import("./chunk-6CBJSM3U.js").then(t=>t.StartupScriptComponent),resolve:{startupScript:c}},{path:"restart-container",loadComponent:()=>import("./chunk-KV4RQA3A.js").then(t=>t.ContainerRestartComponent)}]},{path:"linux",children:[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",loadComponent:()=>import("./chunk-4XUH7NXA.js").then(t=>t.RestartLinuxComponent)},{path:"shutdown-server",loadComponent:()=>import("./chunk-3N7C33O4.js").then(t=>t.ShutdownLinuxComponent)}]},{path:"terminal",loadComponent:()=>import("./chunk-DSSLC7R5.js").then(t=>t.TerminalComponent),canDeactivate:[t=>t.canDeactivate?t.canDeactivate():!0]}];export{R as PLATFORM_TOOLS_ROUTES};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as G,E as X,H as tt,K as et}from"./chunk-J7UDRE66.js";import{L as Q,X as R,aa as W,d as P}from"./chunk-HUTYOGRH.js";import{e as at,g as ut,h as z}from"./chunk-B4AJQJMI.js";var it=at((B,U)=>{(function(w,k){typeof B=="object"&&typeof U<"u"?U.exports=k():typeof define=="function"&&define.amd?define(k):(w=typeof globalThis<"u"?globalThis:w||self).dayjs=k()})(B,function(){"use strict";var w=1e3,k=6e4,s=36e5,h="millisecond",d="second",m="minute",v="hour",y="day",f="week",L="month",J="quarter",S="year",_="date",K="Invalid Date",st=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,nt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,rt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},F=function(r,i,t){var n=String(r);return!n||n.length>=i?r:""+Array(i+1-n.length).join(t)+r},ot={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),n=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(n,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var n=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(n,L),o=t-e<0,a=i.clone().add(n+(o?-1:1),L);return+(-(n+(t-e)/(o?e-a:a-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:L,y:S,w:f,d:y,D:_,h:v,m,s:d,ms:h,Q:J}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},I="en",D={};D[I]=rt;var q="$isDayjsObject",N=function(r){return r instanceof C||!(!r||!r[q])},Y=function r(i,t,n){var e;if(!i)return I;if(typeof i=="string"){var o=i.toLowerCase();D[o]&&(e=o),t&&(D[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;D[c]=i,e=c}return!n&&e&&(I=e),e||!n&&I},g=function(r,i){if(N(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new C(t)},u=ot;u.l=Y,u.i=N,u.w=function(r,i){return g(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var C=(function(){function r(t){this.$L=Y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[q]=!0}var i=r.prototype;return i.parse=function(t){this.$d=(function(n){var e=n.date,o=n.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(st);if(a){var c=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(e)})(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==K},i.isSame=function(t,n){var e=g(t);return this.startOf(n)<=e&&e<=this.endOf(n)},i.isAfter=function(t,n){return g(t)<this.startOf(n)},i.isBefore=function(t,n){return this.endOf(n)<g(t)},i.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,n){var e=this,o=!!u.u(n)||n,a=u.p(t),c=function(x,M){var T=u.w(e.$u?Date.UTC(e.$y,M,x):new Date(e.$y,M,x),e);return o?T:T.endOf(y)},l=function(x,M){return u.w(e.toDate()[x].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},$=this.$W,p=this.$M,b=this.$D,H="set"+(this.$u?"UTC":"");switch(a){case S:return o?c(1,0):c(31,11);case L:return o?c(1,p):c(0,p+1);case f:var O=this.$locale().weekStart||0,j=($<O?$+7:$)-O;return c(o?b-j:b+(6-j),p);case y:case _:return l(H+"Hours",0);case v:return l(H+"Minutes",1);case m:return l(H+"Seconds",2);case d:return l(H+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,n){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[y]=a+"Date",e[_]=a+"Date",e[L]=a+"Month",e[S]=a+"FullYear",e[v]=a+"Hours",e[m]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],l=o===y?this.$D+(n-this.$W):n;if(o===L||o===S){var $=this.clone().set(_,1);$.$d[c](l),$.init(),this.$d=$.set(_,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](l);return this.init(),this},i.set=function(t,n){return this.clone().$set(t,n)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,n){var e,o=this;t=Number(t);var a=u.p(n),c=function(p){var b=g(o);return u.w(b.date(b.date()+Math.round(p*t)),o)};if(a===L)return this.set(L,this.$M+t);if(a===S)return this.set(S,this.$y+t);if(a===y)return c(1);if(a===f)return c(7);var l=(e={},e[m]=k,e[v]=s,e[d]=w,e)[a]||1,$=this.$d.getTime()+t*l;return u.w($,this)},i.subtract=function(t,n){return this.add(-1*t,n)},i.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||K;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,l=this.$m,$=this.$M,p=e.weekdays,b=e.months,H=e.meridiem,O=function(M,T,A,V){return M&&(M[T]||M(n,o))||A[T].slice(0,V)},j=function(M){return u.s(c%12||12,M,"0")},x=H||function(M,T,A){var V=M<12?"AM":"PM";return A?V.toLowerCase():V};return o.replace(nt,function(M,T){return T||(function(A){switch(A){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return $+1;case"MM":return u.s($+1,2,"0");case"MMM":return O(e.monthsShort,$,b,3);case"MMMM":return O(b,$);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return O(e.weekdaysMin,n.$W,p,2);case"ddd":return O(e.weekdaysShort,n.$W,p,3);case"dddd":return p[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return x(c,l,!0);case"A":return x(c,l,!1);case"m":return String(l);case"mm":return u.s(l,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return a}return null})(M)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,n,e){var o,a=this,c=u.p(n),l=g(t),$=(l.utcOffset()-this.utcOffset())*k,p=this-l,b=function(){return u.m(a,l)};switch(c){case S:o=b()/12;break;case L:o=b();break;case J:o=b()/3;break;case f:o=(p-$)/6048e5;break;case y:o=(p-$)/864e5;break;case v:o=p/s;break;case m:o=p/k;break;case d:o=p/w;break;default:o=p}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(L).$D},i.$locale=function(){return D[this.$L]},i.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),o=Y(t,n,!0);return o&&(e.$L=o),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r})(),Z=C.prototype;return g.prototype=Z,[["$ms",h],["$s",d],["$m",m],["$H",v],["$W",y],["$M",L],["$y",S],["$D",_]].forEach(function(r){Z[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),g.extend=function(r,i){return r.$i||(r(i,C,g),r.$i=!0),g},g.locale=Y,g.isDayjs=N,g.unix=function(r){return g(1e3*r)},g.en=D[I],g.Ls=D,g.p={},g})});var E=ut(it(),1);var vt=(()=>{class w{$api=W(et);$title=W(G);$toastr=W(tt);$translate=W(X);settingsLoadedSubject=new P;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];serverTimeToastSubscription;restartToastRef=null;env={};host;proxyHost;webroot;originalWebroot;formAuth=!0;sessionTimeout=28800;sessionTimeoutInactivityBased=!1;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;keepOrphans;wallpaper;serverTimeOffset=0;rtl=!1;browserLang;onSettingsLoaded=this.settingsLoadedSubject.pipe(Q());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return z(this,null,function*(){let s=yield this.$api.get("/auth/settings");this.formAuth=s.formAuth,this.sessionTimeout=s.sessionTimeout,this.sessionTimeoutInactivityBased=s.sessionTimeoutInactivityBased,this.env=s.env,this.host=s.host,this.webroot=s.webroot,this.originalWebroot=s.originalWebroot,this.proxyHost=s.proxyHost,this.lightingMode=s.lightingMode,this.wallpaper=s.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(s.theme),this.setMenuMode(s.menuMode),this.setKeepOrphans(s.keepOrphans),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(s.serverTimestamp),this.setUiVersion(s.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0),this.browserLang=this.$translate.getBrowserCultureLang()})}setBrowserLightingMode(s){this.browserLightingMode=s,this.lightingMode==="auto"&&this.setLightingMode(s,"browser")}setLightingMode(s,h){h==="user"&&(this.lightingMode=s),this.currentLightingMode=s,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(s){(!s||!this.themeList.includes(s))&&(s=this.defaultTheme,this.$api.put("/config-editor/ui",{key:"theme",value:s}).catch(m=>console.error("Error saving setTheme:",m)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=s,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((m,v)=>{try{let y=m.contentDocument;if(y){let f=y.body;this.actualLightingMode==="dark"?(f.classList.contains(`config-ui-x-${this.theme}`)&&f.classList.remove(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)||f.classList.add(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")||f.classList.add("dark-mode"),f.style.backgroundColor="#242424 !important",f.style.color="#ffffff !important"):(f.classList.contains(`config-ui-x-${this.theme}`)||f.classList.add(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)&&f.classList.remove(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")&&f.classList.remove("dark-mode"),f.style.backgroundColor="#ffffff !important",f.style.color="#000000 !important"),m.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:s},window.location.origin)}}catch(y){console.warn(`Iframe ${v}: Access denied (cross-origin?)`,{error:y,src:m.src})}})}setMenuMode(s){this.menuMode=s}setKeepOrphans(s){this.keepOrphans=s}setLang(s){s?this.$translate.use(s):s="auto",this.env.lang=s}setItem(s,h){this[s]=h}setEnvItem(s,h){if(s.includes(".")){let d=s.split("."),m=this.env;for(let v=0;v<d.length-1;v+=1){if(this.forbiddenKeys.includes(d[v]))return;m[d[v]]||(m[d[v]]={}),m=m[d[v]]}this.forbiddenKeys.includes(d[d.length-1])||(m[d[d.length-1]]=h)}else this.env[s]=h}checkServerTime(s){let d=(0,E.default)(s).diff((0,E.default)(),"hour");if(this.serverTimeOffset=d*60*60,d>=8||d<=-8){let m=this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1});this.serverTimeToastSubscription&&this.serverTimeToastSubscription.unsubscribe(),this.serverTimeToastSubscription=m.onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}}setUiVersion(s){this.uiVersion||(this.uiVersion=s)}setTitle(s){this.$title.setTitle(s||"Homebridge")}setPageTitle(s){let h=this.env.homebridgeInstanceName||"Homebridge";s?this.$title.setTitle(`${h} \u2014 ${s}`):this.$title.setTitle(h)}isFeatureEnabled(s){return this.env.featureFlags?.[s]??!1}static \u0275fac=function(h){return new(h||w)};static \u0275prov=R({token:w,factory:w.\u0275fac,providedIn:"root"})}return w})();export{it as a,vt as b};
|
|
1
|
+
import{C as G,E as X,H as tt,K as et}from"./chunk-AWTSOXJ2.js";import{L as Q,X as R,aa as W,d as P}from"./chunk-HUTYOGRH.js";import{e as at,g as ut,h as z}from"./chunk-B4AJQJMI.js";var it=at((B,U)=>{(function(w,k){typeof B=="object"&&typeof U<"u"?U.exports=k():typeof define=="function"&&define.amd?define(k):(w=typeof globalThis<"u"?globalThis:w||self).dayjs=k()})(B,function(){"use strict";var w=1e3,k=6e4,s=36e5,h="millisecond",d="second",m="minute",v="hour",y="day",f="week",L="month",J="quarter",S="year",_="date",K="Invalid Date",st=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,nt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,rt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},F=function(r,i,t){var n=String(r);return!n||n.length>=i?r:""+Array(i+1-n.length).join(t)+r},ot={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),n=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(n,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var n=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(n,L),o=t-e<0,a=i.clone().add(n+(o?-1:1),L);return+(-(n+(t-e)/(o?e-a:a-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:L,y:S,w:f,d:y,D:_,h:v,m,s:d,ms:h,Q:J}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},I="en",D={};D[I]=rt;var q="$isDayjsObject",N=function(r){return r instanceof C||!(!r||!r[q])},Y=function r(i,t,n){var e;if(!i)return I;if(typeof i=="string"){var o=i.toLowerCase();D[o]&&(e=o),t&&(D[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;D[c]=i,e=c}return!n&&e&&(I=e),e||!n&&I},g=function(r,i){if(N(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new C(t)},u=ot;u.l=Y,u.i=N,u.w=function(r,i){return g(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var C=(function(){function r(t){this.$L=Y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[q]=!0}var i=r.prototype;return i.parse=function(t){this.$d=(function(n){var e=n.date,o=n.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(st);if(a){var c=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(e)})(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==K},i.isSame=function(t,n){var e=g(t);return this.startOf(n)<=e&&e<=this.endOf(n)},i.isAfter=function(t,n){return g(t)<this.startOf(n)},i.isBefore=function(t,n){return this.endOf(n)<g(t)},i.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,n){var e=this,o=!!u.u(n)||n,a=u.p(t),c=function(x,M){var T=u.w(e.$u?Date.UTC(e.$y,M,x):new Date(e.$y,M,x),e);return o?T:T.endOf(y)},l=function(x,M){return u.w(e.toDate()[x].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},$=this.$W,p=this.$M,b=this.$D,H="set"+(this.$u?"UTC":"");switch(a){case S:return o?c(1,0):c(31,11);case L:return o?c(1,p):c(0,p+1);case f:var O=this.$locale().weekStart||0,j=($<O?$+7:$)-O;return c(o?b-j:b+(6-j),p);case y:case _:return l(H+"Hours",0);case v:return l(H+"Minutes",1);case m:return l(H+"Seconds",2);case d:return l(H+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,n){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[y]=a+"Date",e[_]=a+"Date",e[L]=a+"Month",e[S]=a+"FullYear",e[v]=a+"Hours",e[m]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],l=o===y?this.$D+(n-this.$W):n;if(o===L||o===S){var $=this.clone().set(_,1);$.$d[c](l),$.init(),this.$d=$.set(_,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](l);return this.init(),this},i.set=function(t,n){return this.clone().$set(t,n)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,n){var e,o=this;t=Number(t);var a=u.p(n),c=function(p){var b=g(o);return u.w(b.date(b.date()+Math.round(p*t)),o)};if(a===L)return this.set(L,this.$M+t);if(a===S)return this.set(S,this.$y+t);if(a===y)return c(1);if(a===f)return c(7);var l=(e={},e[m]=k,e[v]=s,e[d]=w,e)[a]||1,$=this.$d.getTime()+t*l;return u.w($,this)},i.subtract=function(t,n){return this.add(-1*t,n)},i.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||K;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,l=this.$m,$=this.$M,p=e.weekdays,b=e.months,H=e.meridiem,O=function(M,T,A,V){return M&&(M[T]||M(n,o))||A[T].slice(0,V)},j=function(M){return u.s(c%12||12,M,"0")},x=H||function(M,T,A){var V=M<12?"AM":"PM";return A?V.toLowerCase():V};return o.replace(nt,function(M,T){return T||(function(A){switch(A){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return $+1;case"MM":return u.s($+1,2,"0");case"MMM":return O(e.monthsShort,$,b,3);case"MMMM":return O(b,$);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return O(e.weekdaysMin,n.$W,p,2);case"ddd":return O(e.weekdaysShort,n.$W,p,3);case"dddd":return p[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return x(c,l,!0);case"A":return x(c,l,!1);case"m":return String(l);case"mm":return u.s(l,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return a}return null})(M)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,n,e){var o,a=this,c=u.p(n),l=g(t),$=(l.utcOffset()-this.utcOffset())*k,p=this-l,b=function(){return u.m(a,l)};switch(c){case S:o=b()/12;break;case L:o=b();break;case J:o=b()/3;break;case f:o=(p-$)/6048e5;break;case y:o=(p-$)/864e5;break;case v:o=p/s;break;case m:o=p/k;break;case d:o=p/w;break;default:o=p}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(L).$D},i.$locale=function(){return D[this.$L]},i.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),o=Y(t,n,!0);return o&&(e.$L=o),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r})(),Z=C.prototype;return g.prototype=Z,[["$ms",h],["$s",d],["$m",m],["$H",v],["$W",y],["$M",L],["$y",S],["$D",_]].forEach(function(r){Z[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),g.extend=function(r,i){return r.$i||(r(i,C,g),r.$i=!0),g},g.locale=Y,g.isDayjs=N,g.unix=function(r){return g(1e3*r)},g.en=D[I],g.Ls=D,g.p={},g})});var E=ut(it(),1);var vt=(()=>{class w{$api=W(et);$title=W(G);$toastr=W(tt);$translate=W(X);settingsLoadedSubject=new P;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];serverTimeToastSubscription;restartToastRef=null;env={};host;proxyHost;webroot;originalWebroot;formAuth=!0;sessionTimeout=28800;sessionTimeoutInactivityBased=!1;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;keepOrphans;wallpaper;serverTimeOffset=0;rtl=!1;browserLang;onSettingsLoaded=this.settingsLoadedSubject.pipe(Q());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return z(this,null,function*(){let s=yield this.$api.get("/auth/settings");this.formAuth=s.formAuth,this.sessionTimeout=s.sessionTimeout,this.sessionTimeoutInactivityBased=s.sessionTimeoutInactivityBased,this.env=s.env,this.host=s.host,this.webroot=s.webroot,this.originalWebroot=s.originalWebroot,this.proxyHost=s.proxyHost,this.lightingMode=s.lightingMode,this.wallpaper=s.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(s.theme),this.setMenuMode(s.menuMode),this.setKeepOrphans(s.keepOrphans),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(s.serverTimestamp),this.setUiVersion(s.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0),this.browserLang=this.$translate.getBrowserCultureLang()})}setBrowserLightingMode(s){this.browserLightingMode=s,this.lightingMode==="auto"&&this.setLightingMode(s,"browser")}setLightingMode(s,h){h==="user"&&(this.lightingMode=s),this.currentLightingMode=s,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(s){(!s||!this.themeList.includes(s))&&(s=this.defaultTheme,this.$api.put("/config-editor/ui",{key:"theme",value:s}).catch(m=>console.error("Error saving setTheme:",m)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=s,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((m,v)=>{try{let y=m.contentDocument;if(y){let f=y.body;this.actualLightingMode==="dark"?(f.classList.contains(`config-ui-x-${this.theme}`)&&f.classList.remove(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)||f.classList.add(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")||f.classList.add("dark-mode"),f.style.backgroundColor="#242424 !important",f.style.color="#ffffff !important"):(f.classList.contains(`config-ui-x-${this.theme}`)||f.classList.add(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)&&f.classList.remove(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")&&f.classList.remove("dark-mode"),f.style.backgroundColor="#ffffff !important",f.style.color="#000000 !important"),m.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:s},window.location.origin)}}catch(y){console.warn(`Iframe ${v}: Access denied (cross-origin?)`,{error:y,src:m.src})}})}setMenuMode(s){this.menuMode=s}setKeepOrphans(s){this.keepOrphans=s}setLang(s){s?this.$translate.use(s):s="auto",this.env.lang=s}setItem(s,h){this[s]=h}setEnvItem(s,h){if(s.includes(".")){let d=s.split("."),m=this.env;for(let v=0;v<d.length-1;v+=1){if(this.forbiddenKeys.includes(d[v]))return;m[d[v]]||(m[d[v]]={}),m=m[d[v]]}this.forbiddenKeys.includes(d[d.length-1])||(m[d[d.length-1]]=h)}else this.env[s]=h}checkServerTime(s){let d=(0,E.default)(s).diff((0,E.default)(),"hour");if(this.serverTimeOffset=d*60*60,d>=8||d<=-8){let m=this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1});this.serverTimeToastSubscription&&this.serverTimeToastSubscription.unsubscribe(),this.serverTimeToastSubscription=m.onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}}setUiVersion(s){this.uiVersion||(this.uiVersion=s)}setTitle(s){this.$title.setTitle(s||"Homebridge")}setPageTitle(s){let h=this.env.homebridgeInstanceName||"Homebridge";s?this.$title.setTitle(`${h} \u2014 ${s}`):this.$title.setTitle(h)}isFeatureEnabled(s){return this.env.featureFlags?.[s]??!1}static \u0275fac=function(h){return new(h||w)};static \u0275prov=R({token:w,factory:w.\u0275fac,providedIn:"root"})}return w})();export{it as a,vt as b};
|