homebridge-config-ui-x 5.12.1-beta.4 → 5.12.1-beta.5
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 +9 -9
- package/public/{chunk-Q3NZLPIF.js → chunk-2DRLNNDM.js} +1 -1
- package/public/{chunk-W2KCSDQF.js → chunk-2K66PSKD.js} +1 -1
- package/public/{chunk-U5MVAF2Z.js → chunk-2QSUQ4VI.js} +1 -1
- package/public/{chunk-YPN7FV6O.js → chunk-3LY5FRVV.js} +1 -1
- package/public/{chunk-ALOGQFKU.js → chunk-3N3RJBS3.js} +1 -1
- package/public/{chunk-T4UELVH7.js → chunk-4OEYZBSF.js} +1 -1
- package/public/{chunk-SHUCVS7I.js → chunk-4P4VAV7I.js} +1 -1
- package/public/{chunk-KQSZ6SGH.js → chunk-5QHRLSAE.js} +1 -1
- package/public/{chunk-TKVKJ7BH.js → chunk-664C4LX2.js} +1 -1
- package/public/{chunk-AMSZTHK7.js → chunk-6U3YEWBO.js} +1 -1
- package/public/{chunk-QNOVJEHS.js → chunk-A5JF6PDD.js} +1 -1
- package/public/{chunk-EQBPB35I.js → chunk-ATJM3XYR.js} +1 -1
- package/public/{chunk-STRIQHMU.js → chunk-AY35X64S.js} +1 -1
- package/public/{chunk-5GOLEPOT.js → chunk-BRGXDZZE.js} +1 -1
- package/public/{chunk-UOW2U4BJ.js → chunk-BZLBFDQG.js} +1 -1
- package/public/{chunk-A7OA7EDC.js → chunk-C5CMRH2U.js} +1 -1
- package/public/{chunk-A7MBTNVM.js → chunk-CAY6MDP6.js} +1 -1
- package/public/{chunk-DW4GVDBD.js → chunk-CP2QJXVO.js} +1 -1
- package/public/{chunk-SH2LIQC2.js → chunk-FH62LNHX.js} +1 -1
- package/public/{chunk-M5HSZY2K.js → chunk-GDBXX4WT.js} +1 -1
- package/public/{chunk-7SWRANGJ.js → chunk-H2UKSDHZ.js} +1 -1
- package/public/{chunk-AJNVPC3P.js → chunk-JBILFYTL.js} +1 -1
- package/public/{chunk-UUTQE5VH.js → chunk-JPAZUSRO.js} +1 -1
- package/public/{chunk-D4MLVPZP.js → chunk-KIFEAONI.js} +1 -1
- package/public/{chunk-AUCDLTKK.js → chunk-M3DSUNBG.js} +1 -1
- package/public/{chunk-IL3A5BIS.js → chunk-MAJDTCMY.js} +1 -1
- package/public/{chunk-UP6OS2GK.js → chunk-MVT3BOGV.js} +1 -1
- package/public/{chunk-TTY6CFWI.js → chunk-NPMJGEDY.js} +1 -1
- package/public/{chunk-KCDMHC2Q.js → chunk-NYEZF6Y3.js} +1 -1
- package/public/{chunk-LF27VVUY.js → chunk-RMDVYT7X.js} +1 -1
- package/public/{chunk-V2JVDEX6.js → chunk-RWABUVQY.js} +1 -1
- package/public/{chunk-4G3SMV26.js → chunk-S2GJNEOI.js} +1 -1
- package/public/{chunk-EFYVUQZK.js → chunk-TV5ACJCB.js} +1 -1
- package/public/{chunk-CH4W3VJQ.js → chunk-UH3C2FAE.js} +1 -1
- package/public/{chunk-LMPJJK5P.js → chunk-VFMCVZHO.js} +1 -1
- package/public/{chunk-FHRZH5HG.js → chunk-VV4S6PBO.js} +1 -1
- package/public/{chunk-B23NNBW7.js → chunk-VWUZDCBZ.js} +1 -1
- package/public/{chunk-WE4CGPHP.js → chunk-WGTVNYII.js} +1 -1
- package/public/{chunk-Y7OC2MBV.js → chunk-XUP37AHQ.js} +1 -1
- package/public/{chunk-ASKLCERP.js → chunk-Y6B4ENQ3.js} +1 -1
- package/public/{chunk-RRPHHKF2.js → chunk-ZVU2KU6A.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-ZCE52DX6.js → main-QHHXZV7U.js} +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "homebridge-config-ui-x",
|
|
3
3
|
"displayName": "Homebridge UI",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "5.12.1-beta.
|
|
5
|
+
"version": "5.12.1-beta.5",
|
|
6
6
|
"description": "A web based management, configuration and control platform for Homebridge.",
|
|
7
7
|
"author": "oznu <dev@oz.nu>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
"@homebridge/hap-client": "3.1.2",
|
|
86
86
|
"@homebridge/node-pty-prebuilt-multiarch": "0.13.1",
|
|
87
87
|
"@nestjs/axios": "4.0.1",
|
|
88
|
-
"@nestjs/common": "11.1.
|
|
89
|
-
"@nestjs/core": "11.1.
|
|
88
|
+
"@nestjs/common": "11.1.10",
|
|
89
|
+
"@nestjs/core": "11.1.10",
|
|
90
90
|
"@nestjs/jwt": "11.0.2",
|
|
91
91
|
"@nestjs/passport": "11.0.5",
|
|
92
|
-
"@nestjs/platform-fastify": "11.1.
|
|
93
|
-
"@nestjs/platform-socket.io": "11.1.
|
|
92
|
+
"@nestjs/platform-fastify": "11.1.10",
|
|
93
|
+
"@nestjs/platform-socket.io": "11.1.10",
|
|
94
94
|
"@nestjs/swagger": "11.2.3",
|
|
95
|
-
"@nestjs/websockets": "11.1.
|
|
95
|
+
"@nestjs/websockets": "11.1.10",
|
|
96
96
|
"axios": "1.13.2",
|
|
97
97
|
"bash-color": "0.0.4",
|
|
98
98
|
"bonjour-service": "1.3.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"commander": "14.0.2",
|
|
102
102
|
"dayjs": "1.11.19",
|
|
103
103
|
"fastify": "5.6.2",
|
|
104
|
-
"fs-extra": "
|
|
104
|
+
"fs-extra": "11.3.3",
|
|
105
105
|
"jsonwebtoken": "9.0.3",
|
|
106
106
|
"lodash": "4.17.21",
|
|
107
107
|
"node-cache": "5.1.2",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"reflect-metadata": "0.2.2",
|
|
116
116
|
"rxjs": "7.8.2",
|
|
117
117
|
"semver": "7.7.3",
|
|
118
|
-
"systeminformation": "
|
|
118
|
+
"systeminformation": "5.27.14",
|
|
119
119
|
"tail": "2.2.6",
|
|
120
120
|
"tar": "7.5.2",
|
|
121
121
|
"tcp-port-used": "1.0.2",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@antfu/eslint-config": "^6.7.3",
|
|
126
|
-
"@nestjs/testing": "^11.1.
|
|
126
|
+
"@nestjs/testing": "^11.1.10",
|
|
127
127
|
"@prettier/plugin-xml": "^3.4.2",
|
|
128
128
|
"@types/fs-extra": "^11.0.4",
|
|
129
129
|
"@types/lodash": "^4.17.21",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as D,c as S,d as H}from"./chunk-
|
|
1
|
+
import{b as D,c as S,d as H}from"./chunk-RMDVYT7X.js";import{b as B}from"./chunk-HH2FDI7W.js";import{s as L}from"./chunk-RDHUW73W.js";import{D as T}from"./chunk-VWUZDCBZ.js";import{Ab as l,Dc as g,Ec as _,Fb as p,Gb as i,Hb as a,Ib as m,Rb as P,Ua as C,Va as k,Xb as b,Za as o,Zb as d,aa as h,ga as x,ha as O,jc as y,kc as u,lc as I,mc as M,nb as v,uc as w,yb as f,zb as r}from"./chunk-F5MBSCH4.js";function E(t,c){if(t&1&&m(0,"i",16),t&2){let n=d();y(w("fas ",n.faIconClass," mb-3"))}}function z(t,c){if(t&1&&m(0,"h5",6),t&2){let n=d();p("innerHTML",n.subtitle,C)}}function A(t,c){if(t&1&&m(0,"p",8),t&2){let n=d();p("innerHTML",n.message2,C)}}function V(t,c){if(t&1&&m(0,"markdown",9),t&2){let n=d();p("data",n.markdownMessage2)}}function N(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function F(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function j(t,c){if(t&1&&(i(0,"a",15),u(1),m(2,"i",18),a()),t&2){let n=d();p("href",n.ctaButtonLink,k),o(),M(" ",n.ctaButtonLabel," ")}}var Y=(()=>{class t{$activeModal=h(L);modalData=h(B);title=this.modalData.title;subtitle=this.modalData.subtitle;message=this.modalData.message;message2=this.modalData.markdownMessage2;ctaButtonLabel=this.modalData.ctaButtonLabel;ctaButtonLink=this.modalData.ctaButtonLink;faIconClass=this.modalData.faIconClass;markdownMessage2=this.modalData.markdownMessage2;dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=v({type:t,selectors:[["ng-component"]],decls:19,vars:13,consts:[["role","dialog","aria-modal","true",1,"modal-content"],[1,"modal-header"],["id","information-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-3",3,"innerHTML"],[1,"mb-0",3,"innerHTML"],[1,"mb-0","mt-3",3,"innerHTML"],[1,"plugin-md",3,"data"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[2,"font-size","75px"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"fas","fa-external-link-alt"]],template:function(s,e){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),u(3),a(),i(4,"button",3),g(5,"translate"),b("click",function(){return e.dismissModal()}),a()(),i(6,"div",4),r(7,E,1,3,"i",5),r(8,z,1,1,"h5",6),m(9,"p",7),r(10,A,1,1,"p",8),r(11,V,1,1,"markdown",9),a(),i(12,"div",10)(13,"div",11),r(14,N,4,6,"button",12),a(),i(15,"div",13),r(16,F,4,6,"button",12),a(),i(17,"div",14),r(18,j,3,2,"a",15),a()()()),s&2&&(f("aria-labelledby","information-modal-title"),o(3),I(e.title),o(),f("aria-label",_(5,11,"form.button_close")),o(3),l(e.faIconClass?7:-1),o(),l(e.subtitle?8:-1),o(),p("innerHTML",e.message,C),o(),l(e.message2?10:-1),o(),l(e.markdownMessage2?11:-1),o(3),l(e.ctaButtonLink?14:-1),o(2),l(e.ctaButtonLink?-1:16),o(2),l(e.ctaButtonLink?18:-1))},dependencies:[S,D,H,T],styles:["[_nghost-%COMP%] .plugin-md{display:block!important;background-color:#f6f8fa!important;border-radius:6px!important;padding:16px!important;margin:16px auto!important;width:100%!important;max-width:632px!important}[_nghost-%COMP%] .plugin-md table{width:100%;max-width:600px;margin:0 auto!important;border-collapse:collapse;border:1px solid #d0d7de!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif!important;font-size:14px!important;color:#24292e!important}[_nghost-%COMP%] .plugin-md th, [_nghost-%COMP%] .plugin-md td{padding:6px 13px!important;border:1px solid #d0d7de!important;text-align:left;color:#24292e!important}[_nghost-%COMP%] .plugin-md th{background-color:#f6f8fa!important;font-weight:600!important;text-align:center!important}[_nghost-%COMP%] .plugin-md td[align=center]{text-align:center!important}[_nghost-%COMP%] .plugin-md tr{color:#24292e!important}[_nghost-%COMP%] .plugin-md tr:nth-child(odd){background-color:#fff!important}[_nghost-%COMP%] .plugin-md tr:nth-child(2n){background-color:#f6f8fa!important}[_nghost-%COMP%] .plugin-md tr:hover{background-color:#f0f2f5!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%]{background-color:#2b2b2b!important;color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] table[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#3c3c3c!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(odd){background-color:#323232!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#2b2b2b!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:#454545!important}"]})}return t})();export{Y as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-RWABUVQY.js";import{a as E}from"./chunk-MVT3BOGV.js";import"./chunk-BMOLDRJ3.js";import"./chunk-6U3YEWBO.js";import"./chunk-HH2FDI7W.js";import"./chunk-H2UKSDHZ.js";import"./chunk-RDHUW73W.js";import"./chunk-664C4LX2.js";import{b as S}from"./chunk-MAJDTCMY.js";import{C as _,D as C}from"./chunk-VWUZDCBZ.js";import{Dc as b,Ec as w,Jb as l,Kb as m,Lb as h,Oc as $,Xb as f,Ya as s,Za as u,aa as o,d as c,ec as v,fc as p,kc as y,lc as T,nb as g}from"./chunk-F5MBSCH4.js";import{h as d}from"./chunk-B4AJQJMI.js";var L=["terminaloutput"],A=(()=>{class a{$terminal=o(E);$settings=o(S);$navigationGuard=o(k);$translate=o(_);resizeEvent=new c;termTarget=$("terminaloutput");onWindowResize(){this.resizeEvent.next(void 0)}onBeforeUnload(t){return this.$navigationGuard.handleBeforeUnload(t)}onWindowFocus(){this.activateTerminal()}onClick(){this.activateTerminal()}activateTerminal(){this.$terminal.isTerminalReady()&&this.$terminal.term&&this.$terminal.term.focus()}ngOnInit(){let t=this.$translate.instant("menu.linux.label_terminal");if(this.$settings.setPageTitle(t),window.document.querySelector("body").classList.add("bg-black"),this.$settings.actualLightingMode==="light"){window.document.querySelector("body").classList.add("light-mode");let e=this.termTarget()?.nativeElement;e&&e.classList.add("light-mode")}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(t){return d(this,null,function*(){let e=yield this.$navigationGuard.canDeactivate();if(e===!1)return e;if(this.$settings.actualLightingMode!=="light")return window.document.querySelector("body").classList.remove("bg-black"),Promise.resolve(!0);window.document.querySelector("body").classList.remove("light-mode");let i=t&&(t.includes("/platform-tools/terminal")||t.includes("/logs"));return new Promise(n=>{let r=this.termTarget()?.nativeElement;r&&r.classList.add("fade-out"),i?setTimeout(()=>{n(!0)},250):(setTimeout(()=>{window.document.querySelector("body").classList.remove("bg-black")},250),setTimeout(()=>{n(!0)},500))})})}ngOnDestroy(){document.removeEventListener("visibilitychange",this.onVisibilityChange.bind(this)),window.document.querySelector("body").classList.remove("light-mode"),this.$settings.env.terminal?.persistence?this.$terminal.detachTerminal():this.$terminal.destroyPersistentSession()}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=g({type:a,selectors:[["ng-component"]],viewQuery:function(e,i){e&1&&v(i.termTarget,L,5),e&2&&p()},hostBindings:function(e,i){e&1&&f("resize",function(){return i.onWindowResize()},s)("beforeunload",function(r){return i.onBeforeUnload(r)},s)("focus",function(){return i.onWindowFocus()},s)("click",function(){return i.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,i){e&1&&(l(0,"div",1)(1,"div",2)(2,"h3",3),y(3),b(4,"translate"),m()()(),l(5,"div",4),h(6,"div",5,0),m()),e&2&&(u(3),T(w(4,1,"menu.linux.label_terminal")))},dependencies:[C],styles:["body.light-mode{transition:background-color .25s ease-in-out}#docker-terminal.light-mode[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_fadeIn .25s ease-in-out .25s forwards}#docker-terminal.light-mode.fade-out[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeOut .25s ease-in-out forwards!important;opacity:1}@keyframes _ngcontent-%COMP%_fadeIn{to{opacity:1}}@keyframes _ngcontent-%COMP%_fadeOut{to{opacity:0}}.adjust-for-mobile[_ngcontent-%COMP%]{height:calc(100% - 60px)}"]})}return a})();export{A as TerminalComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as W}from"./chunk-
|
|
1
|
+
import{a as W}from"./chunk-H2UKSDHZ.js";import{e as T}from"./chunk-CAY6MDP6.js";import{a as C}from"./chunk-C64AHVUO.js";import"./chunk-664C4LX2.js";import{b as P}from"./chunk-MAJDTCMY.js";import{C as A,D as B,F as N,I as U}from"./chunk-VWUZDCBZ.js";import{Ab as v,Dc as c,Ec as l,Jb as o,Kb as n,Kc as E,Lb as f,Qc as M,Rb as O,Yb as R,Za as e,Zb as h,aa as m,ga as y,ha as I,ic as D,jc as b,kc as a,lc as d,ma as S,mc as g,nb as k,sa as p,w as x,zb as u}from"./chunk-F5MBSCH4.js";import{h as w}from"./chunk-B4AJQJMI.js";function j(i,_){if(i&1&&(o(0,"div",7),a(1),n()),i&2){let t=h();e(),d(t.error())}}function q(i,_){if(i&1&&(o(0,"p",9),a(1),c(2,"translate"),n(),o(3,"div",10)(4,"div",11)(5,"span"),f(6,"i"),a(7),c(8,"translate"),n()(),o(9,"div",11)(10,"span"),f(11,"i"),a(12),c(13,"translate"),n()()()),i&2){let t=h();e(),d(l(2,9,"restart.please_wait_while_server_restarts")),e(5),b(t.uiIcon()),e(),g(" ",l(8,11,"restart.ui_online")," "),e(3),D("grey-text",!t.uiOnline()),e(),b(t.serviceIcon()),e(),g(" ",l(13,13,"restart.service_ready")," ")}}function z(i,_){if(i&1){let t=O();o(0,"p",14)(1,"button",15),R("click",function(){y(t);let s=h(2);return I(s.viewLogs())}),a(2),c(3,"translate"),n()()}i&2&&(e(2),d(l(3,1,"menu.tooltip_view_logs")))}function L(i,_){if(i&1&&(o(0,"div",8)(1,"p"),a(2),c(3,"translate"),n(),o(4,"p",12),a(5),c(6,"translate"),o(7,"span",13),a(8),n()(),u(9,z,4,3,"p",14),n()),i&2){let t=h();e(2),d(l(3,4,"restart.server_is_taking_long_time_to_restart")),e(3),g(" ",l(6,6,"restart.label_restart_command_executed"),": "),e(3),d(t.resp().command||"End Process"),e(),v(t.uiOnline()?9:-1)}}var et=(()=>{class i{$api=m(U);$router=m(T);$settings=m(P);$toastr=m(N);$translate=m(A);$ws=m(W);destroyRef=m(S);uiOnline=p(!1);error=p(!1);resp=p({});timeout=p(!1);uiIcon=E(()=>this.uiOnline()?"far fa-check-circle":"fas fa-circle-notch fa-spin");serviceIcon=E(()=>this.uiOnline()?"fas fa-circle-notch fa-spin":"far fa-circle");io;webrootChanged=!1;statusCheckActive=p(!1);ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.io.socket.connected&&(this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})),this.io.socket.on("homebridge-status",s=>{if(this.statusCheckActive()&&(this.uiOnline.set(!0),s.status==="ok"||s.status==="pending"))if(this.$toastr.success(this.$translate.instant("restart.toast_server_restarted"),this.$translate.instant("toast.title_success")),this.webrootChanged&&!M()){let $=this.$settings.webroot?.replace(/^\/+|\/+$/g,"")||"";window.location.href=$?`/${$}/`:"/"}else this.$router.navigate(["/"])}),this.$router.parseUrl(this.$router.url).queryParams.restarting==="true"?(this.uiOnline.set(!0),this.checkIfServerUp()):this.performRestart()}ngOnDestroy(){this.io.end(),this.statusCheckActive.set(!1)}viewLogs(){this.$router.navigate(["/logs"])}performRestart(){return w(this,null,function*(){try{let t=this.$settings.originalWebroot||"",r=this.$settings.webroot||"";this.webrootChanged=t!==r&&t!==globalThis.webroot.errorCode,this.webrootChanged&&(yield this.$api.put("/server/webroot",{webroot:r}));try{let s=yield this.$api.put("/server/restart",{});this.resp.set(s),this.checkIfServerUp(),s.restartingUI||this.uiOnline.set(!0)}catch(s){console.error(s),this.error.set(this.$translate.instant("restart.toast_server_restart_error")),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}}catch(t){console.error("Failed to update webroot:",t);try{let r=yield this.$api.put("/server/restart",{});this.resp.set(r),this.checkIfServerUp(),r.restartingUI||this.uiOnline.set(!0)}catch(r){console.error(r),this.error.set(this.$translate.instant("restart.toast_server_restart_error")),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}}})}checkIfServerUp(){x(7e3).pipe(C(this.destroyRef)).subscribe(()=>{this.statusCheckActive.set(!0)}),x(4e4).pipe(C(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(r){return new(r||i)};static \u0275cmp=k({type:i,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,"fas","fa-power-off",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,"grey-text","mb-0"],[1,"font-monospace"],[1,"mt-2","mb-0"],[1,"btn","btn-primary","mb-0",3,"click"]],template:function(r,s){r&1&&(o(0,"div",0)(1,"h3",1),a(2),c(3,"translate"),n()(),o(4,"div",2)(5,"div",3),f(6,"i",4),n(),o(7,"div",5)(8,"h4",6),a(9),c(10,"translate"),n(),u(11,j,2,1,"div",7)(12,q,14,15),u(13,L,10,8,"div",8),n()()),r&2&&(e(2),d(l(3,4,"menu.restart.title")),e(7),d(l(10,6,"restart.title_restart")),e(2),v(s.error()?11:12),e(2),v(s.timeout()?13:-1))},dependencies:[B],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return i})();export{et as RestartComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-UVWXUC5Y.js";import{D as l}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-UVWXUC5Y.js";import{D as l}from"./chunk-VWUZDCBZ.js";import{Dc as a,Fb as o,Fc as m,Ib as p,Ua as i,nb as r,yc as s}from"./chunk-F5MBSCH4.js";var f=(e,d)=>({github:e,discord:d}),k=(()=>{class e{linkGithub='<a href="https://github.com/homebridge/homebridge-config-ui-x/issues/new?template=feature-request.yml" target="_blank" rel="noopener noreferrer">GitHub</a>';linkDiscord='<a href="https://discord.gg/kqNCe2D" target="_blank" rel="noopener noreferrer">Discord</a>';static \u0275fac=function(t){return new(t||e)};static \u0275cmp=r({type:e,selectors:[["app-support-banner"]],decls:2,vars:8,consts:[["type","info",1,"mt-3","mb-0","grey-text","small",3,"dismissible","innerHtml"]],template:function(t,n){t&1&&(p(0,"ngb-alert",0),a(1,"translate")),t&2&&o("dismissible",!1)("innerHtml",m(1,2,"common.phrases.support",s(5,f,n.linkGithub,n.linkDiscord)),i)},dependencies:[c,l],encapsulation:2})}return e})();export{k as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as bi}from"./chunk-T4UELVH7.js";import{a as ot,b as Pe,c as Ie,d as $e}from"./chunk-LF27VVUY.js";import{a as ue,b as pi,c as En,d as Et}from"./chunk-DW4GVDBD.js";import{a as ai}from"./chunk-UHG23NUX.js";import{a as di}from"./chunk-Y7OC2MBV.js";import{a as ii,b as ni,c as oi}from"./chunk-BMOLDRJ3.js";import{a as ti}from"./chunk-AMSZTHK7.js";import{a as Ge}from"./chunk-H7F7H5MW.js";import{a as si}from"./chunk-X66UFY6K.js";import{a as Zt,c as Se,d as at,e as qe,f as rt,g as lt,h as st,i as xe,k as dt,l as ct,m as mt,x as ei,z as pt}from"./chunk-HH2FDI7W.js";import{a as yn}from"./chunk-5A2G7KDR.js";import{a as Bn}from"./chunk-YDYBCBXX.js";import{a as wn}from"./chunk-F2HGBWZZ.js";import{a as kn}from"./chunk-3YXAYQFV.js";import{a as Sn}from"./chunk-XTQWZF3J.js";import{a as Mn}from"./chunk-V45KU64F.js";import{a as ve}from"./chunk-7SWRANGJ.js";import{a as un}from"./chunk-DCBZUBGA.js";import{a as _n}from"./chunk-QSXJHCTT.js";import{a as fn}from"./chunk-Q5X66PGK.js";import{a as hn}from"./chunk-FLCYKKEZ.js";import{a as bn}from"./chunk-3NHWMCB7.js";import{a as Cn}from"./chunk-4BX7KSQH.js";import{a as vn}from"./chunk-J56ZFHCF.js";import{a as xn}from"./chunk-3BODPB3K.js";import{a as rn}from"./chunk-AHIRH7NQ.js";import{a as ln}from"./chunk-LR2GN2Y2.js";import{a as sn}from"./chunk-NTQWCIIF.js";import{a as dn}from"./chunk-E55EDX5Y.js";import{a as cn}from"./chunk-PTJ3UZME.js";import{a as mn}from"./chunk-TR77UVYU.js";import{a as pn}from"./chunk-DJGU4NTG.js";import{a as gn}from"./chunk-YCASP3MF.js";import{a as Mt,b as gt,c as ci,d as mi,e as gi,f as ui,g as _i,h as fi,i as hi,l as ut,m as _t,n as ft,o as ht,p as bt,q as Ct}from"./chunk-SH2LIQC2.js";import{a as St,c as ri,d as li}from"./chunk-ZCGZM7LU.js";import{a as Ci}from"./chunk-KCDMHC2Q.js";import{a as ye}from"./chunk-OTMZDL7S.js";import{a as De}from"./chunk-UVWXUC5Y.js";import{s as q,t as re}from"./chunk-RDHUW73W.js";import{e as pe}from"./chunk-A7MBTNVM.js";import{C as Ce,D as Xt,b as Ve,c as qt,e as he,j as Gt,l as be,n as Jt,q as Kt,t as tt,u as it,w as nt,x as Qt,y as Yt}from"./chunk-UUTQE5VH.js";import{b as W}from"./chunk-IL3A5BIS.js";import{C as F,D as j,F as U,H as fe,I as N,o as zt,u as Wt}from"./chunk-B23NNBW7.js";import{Ab as _,Ac as Te,Bc as Xe,Cb as Y,Db as X,Dc as m,Eb as Z,Ec as g,F as Me,Fb as x,Fc as z,Gb as l,Hb as r,Ib as v,Jb as V,Kb as P,Lb as G,Mb as Ht,Mc as Ze,Nb as Ot,Nc as We,O as wt,Oc as et,R as Oe,Rb as T,Sb as ae,Ua as ce,Va as Lt,X as Ee,Xb as E,Ya as Ft,Yb as ee,Za as o,Zb as p,aa as b,d as me,ea as se,ec as Je,fc as Ke,ga as B,gc as Qe,ha as w,hc as Re,ic as ke,jc as J,kc as c,lc as k,mb as R,mc as y,n as He,nb as L,nc as _e,oc as Ye,pb as Ut,qb as jt,rc as te,sa as C,sc as ie,tb as kt,tc as ne,uc as Rt,va as At,wc as oe,xc as de,yb as I,yc as ze,zb as u,zc as le}from"./chunk-F5MBSCH4.js";import{a as Zi}from"./chunk-DUPASTS2.js";import{a as en}from"./chunk-DOJGHPYJ.js";import{a as tn}from"./chunk-QGJKMFM5.js";import{a as nn}from"./chunk-Z2RGI4BU.js";import{a as on}from"./chunk-IXMOGLOS.js";import{a as an}from"./chunk-65AW3ZMH.js";import{a as D,b as A,c as Nt,g as Q,h as S}from"./chunk-B4AJQJMI.js";var Le=Q(ot(),1);var vi=(()=>{class i{jsonSchemaForm=b(gt,{host:!0,self:!0,optional:!0});jsfPatch=We(!1);constructor(){let e=this.jsonSchemaForm,n=e.jsf.buildLayout.bind(e.jsf);e.jsf.buildLayout=t=>{if(n(t),e.jsf.formValues&&this.jsfPatch())return this.fixNestedArrayLayout(e.jsf.layout,e.jsf.formValues)}}fixNestedArrayLayout(e,n){return this.fixArray(e,n,""),e}fixArray(e,n,t){if(Array.isArray(e)){let a=e.filter(f=>f.name!=="_bridge"),d=a.filter(f=>f.items&&Array.isArray(f.items)).flatMap(f=>f.items).filter(f=>f.dataType==="array"||f.arrayItem);a.concat(d).filter(f=>f.dataType==="array"||f.arrayItem).forEach(f=>{this.fixNestedArray(f,n,t)})}else this.fixNestedArray(e,n,t)}fixNestedArray(e,n,t){if(e.items&&Array.isArray(e.items)){let a=e.items.find(d=>d.type==="$ref");if(a){let d=e.items.filter(M=>M.type==="section"||M.type==="div"),h=d.length>0?d.reduce((M,$)=>M.id>$.id?M:$):this.getItemTemplateFromRef(a),f=this.getDataFromPointer(n,a.dataPointer.replace(t,""));if(f===null)return;if(Array.isArray(f)){for(;e.items.length-1<f.length;){let M=St(h);M._id=li("new_"),e.items.unshift(M)}f.forEach((M,$)=>{this.fixArray(e.items[$],M,a.dataPointer)})}else this.fixArray(e.items,n,a.dataPointer)}else this.fixArray(e.items,n,t);e.items.filter(d=>d.items&&Array.isArray(d.items)).forEach(d=>{this.fixArray(d.items,n,t)})}}getDataFromPointer(e,n){let t=e;return n.substring(1).split(/\//).filter(a=>a!=="-").forEach(a=>{try{t=t[a]}catch{t=null}}),t}getItemTemplateFromRef(e){let n={type:"section",items:[]},t=St(e);return ri(t,n),t}static \u0275fac=function(n){return new(n||i)};static \u0275dir=Ut({type:i,selectors:[["","jsfPatch",""]],inputs:{jsfPatch:[1,"jsfPatch"]}})}return i})();function Tn(i,s){if(i&1){let e=T();l(0,"json-schema-form",1),E("onChanges",function(t){B(e);let a=p();return w(a.onChanges(t))})("isValid",function(t){B(e);let a=p();return w(a.validChange(t))}),r()}if(i&2){let e=p();x("jsfPatch",e.configSchema().fixArrays)("options",e.jsonFormOptions)("schema",e.configSchema().schema)("UISchema",e.configSchema().uiSchema)("layout",e.configSchema().layout)("form",e.configSchema().form)("data",e.currentData())("language",e.language())}}var vt=(()=>{class i{$settings=b(W);availableLanguages=["de","en","es","fr","it","pt","zh"];configSchema=We.required();data=We.required();dataChange=Ze();dataChanged=Ze();isValid=Ze();currentData=C(null);language=C("en");jsonFormOptions={addSubmit:!1,loadExternalAssets:!1,returnEmptyFields:!1,setSchemaDefaults:!0,autocomplete:!1};lastValidState=void 0;validationTimeout=null;constructor(){At(()=>{this.currentData.set(this.data())})}ngOnInit(){let e=this.$settings.env.lang.split("-")[0];this.availableLanguages.includes(e)&&this.language.set(e)}ngOnDestroy(){this.validationTimeout&&clearTimeout(this.validationTimeout)}onChanges(e){this.dataChange.emit(e),this.dataChanged.emit(e)}validChange(e){this.validationTimeout&&clearTimeout(this.validationTimeout),this.validationTimeout=setTimeout(()=>{this.lastValidState!==e&&(this.lastValidState=e,this.isValid.emit(e))},100)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=L({type:i,selectors:[["app-schema-form"]],inputs:{configSchema:[1,"configSchema"],data:[1,"data"]},outputs:{dataChange:"dataChange",dataChanged:"dataChanged",isValid:"isValid"},decls:2,vars:1,consts:[["framework","bootstrap-5",1,"ng-bs5-validate",3,"jsfPatch","options","schema","UISchema","layout","form","data","language"],["framework","bootstrap-5",1,"ng-bs5-validate",3,"onChanges","isValid","jsfPatch","options","schema","UISchema","layout","form","data","language"]],template:function(n,t){n&1&&(Ht(0),u(1,Tn,1,8,"json-schema-form",0),Ot()),n&2&&(o(),_(t.configSchema().schema?1:-1))},dependencies:[ci,gt,vi],encapsulation:2})}return i})();var Ne=(()=>{class i{$api=b(N);$modal=b(re);$toastr=b(U);$translate=b(F);injector=b(se);openCorrectRestartModalForPlugin(e){return S(this,null,function*(){let n=yield this.getChildBridgesForPlugin(e);if(n.length){let t=R([{provide:ei,useValue:{bridges:n.map(a=>({name:a.name,username:a.username,matterSerialNumber:a.matterSerialNumber}))}}],this.injector);this.$modal.open(pi,{size:"lg",backdrop:"static",injector:t})}else this.$modal.open(ue,{size:"lg",backdrop:"static"})})}getChildBridgesForPlugin(e){return S(this,null,function*(){try{return(yield this.$api.get("/status/homebridge/child-bridges")).filter(t=>e===t.plugin)}catch(n){return console.error(n),this.$toastr.error(n.message,this.$translate.instant("toast.title_error")),[]}})}static \u0275fac=function(n){return new(n||i)};static \u0275prov=Ee({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Vn=Nt({"../../../../i18n/bg.json":()=>Zi(),"../../../../i18n/ca.json":()=>en(),"../../../../i18n/cs.json":()=>tn(),"../../../../i18n/de.json":()=>nn(),"../../../../i18n/en.json":()=>on(),"../../../../i18n/es.json":()=>an(),"../../../../i18n/fi.json":()=>rn(),"../../../../i18n/fr.json":()=>ln(),"../../../../i18n/he.json":()=>sn(),"../../../../i18n/hu.json":()=>dn(),"../../../../i18n/id.json":()=>cn(),"../../../../i18n/it.json":()=>mn(),"../../../../i18n/ja.json":()=>pn(),"../../../../i18n/ko.json":()=>gn(),"../../../../i18n/mk.json":()=>un(),"../../../../i18n/nl.json":()=>_n(),"../../../../i18n/no.json":()=>fn(),"../../../../i18n/pl.json":()=>hn(),"../../../../i18n/pt-BR.json":()=>bn(),"../../../../i18n/pt.json":()=>Cn(),"../../../../i18n/ru.json":()=>vn(),"../../../../i18n/sl.json":()=>xn(),"../../../../i18n/sv.json":()=>yn(),"../../../../i18n/th.json":()=>Bn(),"../../../../i18n/tr.json":()=>wn(),"../../../../i18n/uk.json":()=>kn(),"../../../../i18n/zh-CN.json":()=>Sn(),"../../../../i18n/zh-TW.json":()=>Mn()});var Pn=["custompluginui"];function In(i,s){i&1&&(l(0,"div",6),v(1,"i",18),r())}function $n(i,s){if(i&1){let e=T();l(0,"div",8)(1,"app-schema-form",19),E("dataChanged",function(t){B(e);let a=p();return w(a.schemaFormUpdatedSubject.next(t))})("isValid",function(t){B(e);let a=p();return w(a.onIsValid(t))}),r()()}if(i&2){let e=p();o(),x("configSchema",e.schema)("data",e.pluginConfig[0])}}function Dn(i,s){if(i&1){let e=T();l(0,"button",24),E("click",function(){B(e);let t=p(2);return w(t.formActionSubject.next("cancel"))}),c(1),r()}if(i&2){let e=p(2);o(),y(" ",e.formCancelButtonLabel()," ")}}function Nn(i,s){if(i&1){let e=T();l(0,"button",25),E("click",function(){B(e);let t=p(2);return w(t.formActionSubject.next("submit"))}),c(1),r()}if(i&2){let e=p(2);x("disabled",!e.formValid()),o(),y(" ",e.formSubmitButtonLabel()," ")}}function An(i,s){if(i&1){let e=T();l(0,"div",8)(1,"app-schema-form",20),E("dataChange",function(t){B(e);let a=p();return w(a.formData.set(t))})("dataChanged",function(t){B(e);let a=p();return w(a.formUpdatedSubject.next(t))})("isValid",function(t){B(e);let a=p();return w(a.formValidEvent(t))}),r(),l(2,"div",21),u(3,Dn,2,1,"button",22),u(4,Nn,2,2,"button",23),r()()}if(i&2){let e=p();o(),x("configSchema",e.formSchema())("data",e.formData()),o(2),_(e.formCancelButtonLabel()?3:-1),o(),_(e.formSubmitButtonLabel()?4:-1)}}function Ln(i,s){i&1&&(l(0,"div",9),v(1,"i",18),r())}function Fn(i,s){if(i&1&&(v(0,"i",26),m(1,"translate")),i&2){let e=p();J(e.formIsValid()?"fa-circle-check green-text":e.strictValidation()?"fa-circle-exclamation red-text":"fa-circle-exclamation orange-text"),x("ngbTooltip",g(1,4,e.formIsValid()?"form.label_valid":e.strictValidation()?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150)}}function Un(i,s){i&1&&(c(0),m(1,"translate")),i&2&&y(" ",g(1,1,"form.button_save")," ")}function jn(i,s){i&1&&v(0,"i",17)}var xi=(()=>{class i{$activeModal=b(q);$api=b(N);$cb=b(Ne);$plugin=b(Be);$settings=b(W);$toastr=b(U);$translate=b(F);$ws=b(ve);modalData=b(qe);customPluginUiElementTarget=et("custompluginui");plugin=this.modalData.plugin;schema=this.modalData.schema;pluginConfig=this.modalData.pluginConfig??[];pluginAlias=C("");pluginType=C("platform");loading=C(!0);saveInProgress=C(!1);pluginSpinner=C(!1);saveButtonDisabled=C(!1);uiLoaded=C(!1);showSchemaForm=C(!1);formId=C(void 0);formSchema=C(void 0);formData=C(void 0);formSubmitButtonLabel=C(void 0);formCancelButtonLabel=C(void 0);formValid=C(!0);isFirstSave=C(!1);formIsValid=C(!0);strictValidation=C(!1);io;basePath="";iframe;schemaFormRecentlyUpdated=!1;schemaFormRecentlyRefreshed=!1;destroy$=new me;schemaFormUpdatedSubject=new me;schemaFormRefreshSubject=new me;formUpdatedSubject=new me;formActionSubject=new me;ngOnInit(){let e=this.schema,n=this.plugin;if(!e||!n){console.error("CustomPluginsComponent: schema or plugin not provided"),this.$activeModal.dismiss("Missing required data");return}this.pluginAlias.set(e.pluginAlias),this.pluginType.set(e.pluginType),this.strictValidation.set(e.strictValidation),this.pluginConfig.length===0&&this.isFirstSave.set(!0),this.io=this.$ws.connectToNamespace("plugins/settings-ui"),this.basePath=`/plugins/settings-ui/${encodeURIComponent(n.name)}`,this.initialize(),this.schemaFormRefreshSubject.pipe(Me(250),Oe(this.destroy$)).subscribe(this.schemaFormRefresh.bind(this)),this.schemaFormUpdatedSubject.pipe(Me(250),wt(1),Oe(this.destroy$)).subscribe(t=>{this.schemaFormUpdated(t)}),this.formUpdatedSubject.pipe(Me(100),wt(1),Oe(this.destroy$)).subscribe(this.formUpdated.bind(this)),this.formActionSubject.pipe(Oe(this.destroy$)).subscribe(this.formActionEvent.bind(this)),window.addEventListener("message",this.handleMessage,!1)}ngOnDestroy(){window.removeEventListener("message",this.handleMessage),this.destroy$.next(),this.destroy$.complete(),this.io&&this.io.end(),this.schemaFormRefreshSubject.complete(),this.schemaFormUpdatedSubject.complete(),this.formUpdatedSubject.complete(),this.formActionSubject.complete()}onIsValid(e){this.formIsValid.set(e)}formValidEvent(e){this.formValid.set(e)}savePluginConfig(e=!1){return S(this,null,function*(){let n=this.plugin;if(n){this.saveInProgress.set(!0);try{let t=yield this.$api.post(`/config-editor/plugin/${encodeURIComponent(n.name)}`,this.pluginConfig);if(this.saveInProgress.set(!1),e){if(this.isFirstSave()&&this.$settings.env.recommendChildBridges&&t[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(n,!0);return}this.$activeModal.close(),yield this.$cb.openCorrectRestartModalForPlugin(n.name)}}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error")),this.saveInProgress.set(!1)}}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}initialize(){return S(this,null,function*(){let e=this.plugin;e&&(this.io.socket.emit("start",e.name),this.io.socket.on("response",n=>{n.action="response",this.iframe.contentWindow.postMessage(n,fe.api.origin)}),this.io.socket.on("stream",n=>{n.action="stream",this.iframe.contentWindow.postMessage(n,fe.api.origin)}),this.io.socket.on("ready",()=>{this.loading.set(!1),this.loadUi()}))})}loadUi(){let e=this.plugin;e&&(this.iframe=this.customPluginUiElementTarget()?.nativeElement,this.iframe&&(this.iframe.src=`${fe.api.base+this.basePath}/index.html?origin=${encodeURIComponent(location.origin)}&v=${encodeURIComponent(e.installedVersion)}`))}handleMessage=e=>{if(e.origin===fe.api.origin||e.origin===window.origin)switch(e.data.action){case"loaded":this.injectDefaultStyles(e),this.confirmReady(e);break;case"request":{this.handleRequest(e);break}case"scrollHeight":this.setiFrameHeight(e),this.uiLoaded.set(!0);break;case"config.get":{this.requestResponse(e,this.getConfigBlocks());break}case"config.save":{this.requestResponse(e,this.savePluginConfig());break}case"config.update":{this.handleUpdateConfig(e,e.data.pluginConfig);break}case"config.schema":{this.requestResponse(e,this.schema);break}case"cachedAccessories.get":{this.handleGetCachedAccessories(e);break}case"cachedMatterAccessories.get":{this.handleGetCachedMatterAccessories(e);break}case"schema.show":{this.formEnd(),this.showSchemaForm.set(!0);break}case"schema.hide":{this.showSchemaForm.set(!1);break}case"form.create":{this.showSchemaForm.set(!1),this.formCreate(e.data.formId,e.data.schema,e.data.data,e.data.submitButton,e.data.cancelButton);break}case"form.end":{this.formEnd();break}case"user.lightingMode":{this.requestResponse(e,this.$settings.actualLightingMode);break}case"i18n.lang":{this.requestResponse(e,this.$translate.getCurrentLang());break}case"i18n.translations":{this.requestResponse(e,Vn(`../../../../i18n/${this.$translate.getCurrentLang()}.json`));break}case"close":{this.$activeModal.close();break}case"toast.success":this.$toastr.success(e.data.message,e.data.title);break;case"toast.error":this.$toastr.error(e.data.message,e.data.title);break;case"toast.warning":this.$toastr.warning(e.data.message,e.data.title);break;case"toast.info":this.$toastr.info(e.data.message,e.data.title);break;case"spinner.show":this.pluginSpinner.set(!0);break;case"spinner.hide":this.pluginSpinner.set(!1);break;case"button.save.disabled":this.saveButtonDisabled.set(!0);break;case"button.save.enabled":this.saveButtonDisabled.set(!1);break}};confirmReady(e){e.source.postMessage({action:"ready"},e.origin)}setiFrameHeight(e){this.iframe.style.height=`${e.data.scrollHeight+10}px`}handleRequest(e){this.io.socket.emit("request",e.data)}handleUpdateConfig(e,n){if(this.showSchemaForm()&&this.schemaFormRefreshSubject.next(void 0),!Array.isArray(n))return this.$toastr.error(this.$translate.instant("plugins.config.must_be_array"),this.$translate.instant("toast.title_error")),this.requestResponse(e,{message:this.$translate.instant("plugins.config.must_be_array")},!1);for(let t of n)if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("plugins.config.must_be_array_objects"),this.$translate.instant("toast.title_error")),this.requestResponse(e,{message:this.$translate.instant("plugins.config.must_be_array_objects")},!1);return this.updateConfigBlocks(n),this.requestResponse(e,this.getConfigBlocks())}requestResponse(e,n,t=!0){e.source.postMessage({action:"response",requestId:e.data.requestId,success:t,data:n},e.origin)}injectDefaultStyles(e){return S(this,null,function*(){let n=Array.from(window.document.body.classList).find(M=>M.startsWith("config-ui-x-")),t=window.document.body.classList.contains("dark-mode"),a=e.source;a.postMessage({action:"body-class",class:n},e.origin),a.postMessage({action:"body-class",class:"modal-content"},e.origin),t&&a.postMessage({action:"body-class",class:"dark-mode"},e.origin);let d=Array.from(document.querySelectorAll("link"));for(let M of d)if(M.getAttribute("rel")==="stylesheet"){let $=M.getAttribute("href"),ge=document.baseURI+($.startsWith("/")?$.substring(1):$);a.postMessage({action:"link-element",href:ge,rel:"stylesheet"},e.origin)}let h=Array.from(document.querySelectorAll("style"));for(let M of h)a.postMessage({action:"inline-style",style:M.innerHTML},e.origin);let f=`
|
|
1
|
+
import{a as bi}from"./chunk-4OEYZBSF.js";import{a as ot,b as Pe,c as Ie,d as $e}from"./chunk-RMDVYT7X.js";import{a as ue,b as pi,c as En,d as Et}from"./chunk-CP2QJXVO.js";import{a as ai}from"./chunk-UHG23NUX.js";import{a as di}from"./chunk-XUP37AHQ.js";import{a as ii,b as ni,c as oi}from"./chunk-BMOLDRJ3.js";import{a as ti}from"./chunk-6U3YEWBO.js";import{a as Ge}from"./chunk-H7F7H5MW.js";import{a as si}from"./chunk-X66UFY6K.js";import{a as Zt,c as Se,d as at,e as qe,f as rt,g as lt,h as st,i as xe,k as dt,l as ct,m as mt,x as ei,z as pt}from"./chunk-HH2FDI7W.js";import{a as yn}from"./chunk-5A2G7KDR.js";import{a as Bn}from"./chunk-YDYBCBXX.js";import{a as wn}from"./chunk-F2HGBWZZ.js";import{a as kn}from"./chunk-3YXAYQFV.js";import{a as Sn}from"./chunk-XTQWZF3J.js";import{a as Mn}from"./chunk-V45KU64F.js";import{a as ve}from"./chunk-H2UKSDHZ.js";import{a as un}from"./chunk-DCBZUBGA.js";import{a as _n}from"./chunk-QSXJHCTT.js";import{a as fn}from"./chunk-Q5X66PGK.js";import{a as hn}from"./chunk-FLCYKKEZ.js";import{a as bn}from"./chunk-3NHWMCB7.js";import{a as Cn}from"./chunk-4BX7KSQH.js";import{a as vn}from"./chunk-J56ZFHCF.js";import{a as xn}from"./chunk-3BODPB3K.js";import{a as rn}from"./chunk-AHIRH7NQ.js";import{a as ln}from"./chunk-LR2GN2Y2.js";import{a as sn}from"./chunk-NTQWCIIF.js";import{a as dn}from"./chunk-E55EDX5Y.js";import{a as cn}from"./chunk-PTJ3UZME.js";import{a as mn}from"./chunk-TR77UVYU.js";import{a as pn}from"./chunk-DJGU4NTG.js";import{a as gn}from"./chunk-YCASP3MF.js";import{a as Mt,b as gt,c as ci,d as mi,e as gi,f as ui,g as _i,h as fi,i as hi,l as ut,m as _t,n as ft,o as ht,p as bt,q as Ct}from"./chunk-FH62LNHX.js";import{a as St,c as ri,d as li}from"./chunk-ZCGZM7LU.js";import{a as Ci}from"./chunk-NYEZF6Y3.js";import{a as ye}from"./chunk-OTMZDL7S.js";import{a as De}from"./chunk-UVWXUC5Y.js";import{s as q,t as re}from"./chunk-RDHUW73W.js";import{e as pe}from"./chunk-CAY6MDP6.js";import{C as Ce,D as Xt,b as Ve,c as qt,e as he,j as Gt,l as be,n as Jt,q as Kt,t as tt,u as it,w as nt,x as Qt,y as Yt}from"./chunk-JPAZUSRO.js";import{b as W}from"./chunk-MAJDTCMY.js";import{C as F,D as j,F as U,H as fe,I as N,o as zt,u as Wt}from"./chunk-VWUZDCBZ.js";import{Ab as _,Ac as Te,Bc as Xe,Cb as Y,Db as X,Dc as m,Eb as Z,Ec as g,F as Me,Fb as x,Fc as z,Gb as l,Hb as r,Ib as v,Jb as V,Kb as P,Lb as G,Mb as Ht,Mc as Ze,Nb as Ot,Nc as We,O as wt,Oc as et,R as Oe,Rb as T,Sb as ae,Ua as ce,Va as Lt,X as Ee,Xb as E,Ya as Ft,Yb as ee,Za as o,Zb as p,aa as b,d as me,ea as se,ec as Je,fc as Ke,ga as B,gc as Qe,ha as w,hc as Re,ic as ke,jc as J,kc as c,lc as k,mb as R,mc as y,n as He,nb as L,nc as _e,oc as Ye,pb as Ut,qb as jt,rc as te,sa as C,sc as ie,tb as kt,tc as ne,uc as Rt,va as At,wc as oe,xc as de,yb as I,yc as ze,zb as u,zc as le}from"./chunk-F5MBSCH4.js";import{a as Zi}from"./chunk-DUPASTS2.js";import{a as en}from"./chunk-DOJGHPYJ.js";import{a as tn}from"./chunk-QGJKMFM5.js";import{a as nn}from"./chunk-Z2RGI4BU.js";import{a as on}from"./chunk-IXMOGLOS.js";import{a as an}from"./chunk-65AW3ZMH.js";import{a as D,b as A,c as Nt,g as Q,h as S}from"./chunk-B4AJQJMI.js";var Le=Q(ot(),1);var vi=(()=>{class i{jsonSchemaForm=b(gt,{host:!0,self:!0,optional:!0});jsfPatch=We(!1);constructor(){let e=this.jsonSchemaForm,n=e.jsf.buildLayout.bind(e.jsf);e.jsf.buildLayout=t=>{if(n(t),e.jsf.formValues&&this.jsfPatch())return this.fixNestedArrayLayout(e.jsf.layout,e.jsf.formValues)}}fixNestedArrayLayout(e,n){return this.fixArray(e,n,""),e}fixArray(e,n,t){if(Array.isArray(e)){let a=e.filter(f=>f.name!=="_bridge"),d=a.filter(f=>f.items&&Array.isArray(f.items)).flatMap(f=>f.items).filter(f=>f.dataType==="array"||f.arrayItem);a.concat(d).filter(f=>f.dataType==="array"||f.arrayItem).forEach(f=>{this.fixNestedArray(f,n,t)})}else this.fixNestedArray(e,n,t)}fixNestedArray(e,n,t){if(e.items&&Array.isArray(e.items)){let a=e.items.find(d=>d.type==="$ref");if(a){let d=e.items.filter(M=>M.type==="section"||M.type==="div"),h=d.length>0?d.reduce((M,$)=>M.id>$.id?M:$):this.getItemTemplateFromRef(a),f=this.getDataFromPointer(n,a.dataPointer.replace(t,""));if(f===null)return;if(Array.isArray(f)){for(;e.items.length-1<f.length;){let M=St(h);M._id=li("new_"),e.items.unshift(M)}f.forEach((M,$)=>{this.fixArray(e.items[$],M,a.dataPointer)})}else this.fixArray(e.items,n,a.dataPointer)}else this.fixArray(e.items,n,t);e.items.filter(d=>d.items&&Array.isArray(d.items)).forEach(d=>{this.fixArray(d.items,n,t)})}}getDataFromPointer(e,n){let t=e;return n.substring(1).split(/\//).filter(a=>a!=="-").forEach(a=>{try{t=t[a]}catch{t=null}}),t}getItemTemplateFromRef(e){let n={type:"section",items:[]},t=St(e);return ri(t,n),t}static \u0275fac=function(n){return new(n||i)};static \u0275dir=Ut({type:i,selectors:[["","jsfPatch",""]],inputs:{jsfPatch:[1,"jsfPatch"]}})}return i})();function Tn(i,s){if(i&1){let e=T();l(0,"json-schema-form",1),E("onChanges",function(t){B(e);let a=p();return w(a.onChanges(t))})("isValid",function(t){B(e);let a=p();return w(a.validChange(t))}),r()}if(i&2){let e=p();x("jsfPatch",e.configSchema().fixArrays)("options",e.jsonFormOptions)("schema",e.configSchema().schema)("UISchema",e.configSchema().uiSchema)("layout",e.configSchema().layout)("form",e.configSchema().form)("data",e.currentData())("language",e.language())}}var vt=(()=>{class i{$settings=b(W);availableLanguages=["de","en","es","fr","it","pt","zh"];configSchema=We.required();data=We.required();dataChange=Ze();dataChanged=Ze();isValid=Ze();currentData=C(null);language=C("en");jsonFormOptions={addSubmit:!1,loadExternalAssets:!1,returnEmptyFields:!1,setSchemaDefaults:!0,autocomplete:!1};lastValidState=void 0;validationTimeout=null;constructor(){At(()=>{this.currentData.set(this.data())})}ngOnInit(){let e=this.$settings.env.lang.split("-")[0];this.availableLanguages.includes(e)&&this.language.set(e)}ngOnDestroy(){this.validationTimeout&&clearTimeout(this.validationTimeout)}onChanges(e){this.dataChange.emit(e),this.dataChanged.emit(e)}validChange(e){this.validationTimeout&&clearTimeout(this.validationTimeout),this.validationTimeout=setTimeout(()=>{this.lastValidState!==e&&(this.lastValidState=e,this.isValid.emit(e))},100)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=L({type:i,selectors:[["app-schema-form"]],inputs:{configSchema:[1,"configSchema"],data:[1,"data"]},outputs:{dataChange:"dataChange",dataChanged:"dataChanged",isValid:"isValid"},decls:2,vars:1,consts:[["framework","bootstrap-5",1,"ng-bs5-validate",3,"jsfPatch","options","schema","UISchema","layout","form","data","language"],["framework","bootstrap-5",1,"ng-bs5-validate",3,"onChanges","isValid","jsfPatch","options","schema","UISchema","layout","form","data","language"]],template:function(n,t){n&1&&(Ht(0),u(1,Tn,1,8,"json-schema-form",0),Ot()),n&2&&(o(),_(t.configSchema().schema?1:-1))},dependencies:[ci,gt,vi],encapsulation:2})}return i})();var Ne=(()=>{class i{$api=b(N);$modal=b(re);$toastr=b(U);$translate=b(F);injector=b(se);openCorrectRestartModalForPlugin(e){return S(this,null,function*(){let n=yield this.getChildBridgesForPlugin(e);if(n.length){let t=R([{provide:ei,useValue:{bridges:n.map(a=>({name:a.name,username:a.username,matterSerialNumber:a.matterSerialNumber}))}}],this.injector);this.$modal.open(pi,{size:"lg",backdrop:"static",injector:t})}else this.$modal.open(ue,{size:"lg",backdrop:"static"})})}getChildBridgesForPlugin(e){return S(this,null,function*(){try{return(yield this.$api.get("/status/homebridge/child-bridges")).filter(t=>e===t.plugin)}catch(n){return console.error(n),this.$toastr.error(n.message,this.$translate.instant("toast.title_error")),[]}})}static \u0275fac=function(n){return new(n||i)};static \u0275prov=Ee({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Vn=Nt({"../../../../i18n/bg.json":()=>Zi(),"../../../../i18n/ca.json":()=>en(),"../../../../i18n/cs.json":()=>tn(),"../../../../i18n/de.json":()=>nn(),"../../../../i18n/en.json":()=>on(),"../../../../i18n/es.json":()=>an(),"../../../../i18n/fi.json":()=>rn(),"../../../../i18n/fr.json":()=>ln(),"../../../../i18n/he.json":()=>sn(),"../../../../i18n/hu.json":()=>dn(),"../../../../i18n/id.json":()=>cn(),"../../../../i18n/it.json":()=>mn(),"../../../../i18n/ja.json":()=>pn(),"../../../../i18n/ko.json":()=>gn(),"../../../../i18n/mk.json":()=>un(),"../../../../i18n/nl.json":()=>_n(),"../../../../i18n/no.json":()=>fn(),"../../../../i18n/pl.json":()=>hn(),"../../../../i18n/pt-BR.json":()=>bn(),"../../../../i18n/pt.json":()=>Cn(),"../../../../i18n/ru.json":()=>vn(),"../../../../i18n/sl.json":()=>xn(),"../../../../i18n/sv.json":()=>yn(),"../../../../i18n/th.json":()=>Bn(),"../../../../i18n/tr.json":()=>wn(),"../../../../i18n/uk.json":()=>kn(),"../../../../i18n/zh-CN.json":()=>Sn(),"../../../../i18n/zh-TW.json":()=>Mn()});var Pn=["custompluginui"];function In(i,s){i&1&&(l(0,"div",6),v(1,"i",18),r())}function $n(i,s){if(i&1){let e=T();l(0,"div",8)(1,"app-schema-form",19),E("dataChanged",function(t){B(e);let a=p();return w(a.schemaFormUpdatedSubject.next(t))})("isValid",function(t){B(e);let a=p();return w(a.onIsValid(t))}),r()()}if(i&2){let e=p();o(),x("configSchema",e.schema)("data",e.pluginConfig[0])}}function Dn(i,s){if(i&1){let e=T();l(0,"button",24),E("click",function(){B(e);let t=p(2);return w(t.formActionSubject.next("cancel"))}),c(1),r()}if(i&2){let e=p(2);o(),y(" ",e.formCancelButtonLabel()," ")}}function Nn(i,s){if(i&1){let e=T();l(0,"button",25),E("click",function(){B(e);let t=p(2);return w(t.formActionSubject.next("submit"))}),c(1),r()}if(i&2){let e=p(2);x("disabled",!e.formValid()),o(),y(" ",e.formSubmitButtonLabel()," ")}}function An(i,s){if(i&1){let e=T();l(0,"div",8)(1,"app-schema-form",20),E("dataChange",function(t){B(e);let a=p();return w(a.formData.set(t))})("dataChanged",function(t){B(e);let a=p();return w(a.formUpdatedSubject.next(t))})("isValid",function(t){B(e);let a=p();return w(a.formValidEvent(t))}),r(),l(2,"div",21),u(3,Dn,2,1,"button",22),u(4,Nn,2,2,"button",23),r()()}if(i&2){let e=p();o(),x("configSchema",e.formSchema())("data",e.formData()),o(2),_(e.formCancelButtonLabel()?3:-1),o(),_(e.formSubmitButtonLabel()?4:-1)}}function Ln(i,s){i&1&&(l(0,"div",9),v(1,"i",18),r())}function Fn(i,s){if(i&1&&(v(0,"i",26),m(1,"translate")),i&2){let e=p();J(e.formIsValid()?"fa-circle-check green-text":e.strictValidation()?"fa-circle-exclamation red-text":"fa-circle-exclamation orange-text"),x("ngbTooltip",g(1,4,e.formIsValid()?"form.label_valid":e.strictValidation()?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150)}}function Un(i,s){i&1&&(c(0),m(1,"translate")),i&2&&y(" ",g(1,1,"form.button_save")," ")}function jn(i,s){i&1&&v(0,"i",17)}var xi=(()=>{class i{$activeModal=b(q);$api=b(N);$cb=b(Ne);$plugin=b(Be);$settings=b(W);$toastr=b(U);$translate=b(F);$ws=b(ve);modalData=b(qe);customPluginUiElementTarget=et("custompluginui");plugin=this.modalData.plugin;schema=this.modalData.schema;pluginConfig=this.modalData.pluginConfig??[];pluginAlias=C("");pluginType=C("platform");loading=C(!0);saveInProgress=C(!1);pluginSpinner=C(!1);saveButtonDisabled=C(!1);uiLoaded=C(!1);showSchemaForm=C(!1);formId=C(void 0);formSchema=C(void 0);formData=C(void 0);formSubmitButtonLabel=C(void 0);formCancelButtonLabel=C(void 0);formValid=C(!0);isFirstSave=C(!1);formIsValid=C(!0);strictValidation=C(!1);io;basePath="";iframe;schemaFormRecentlyUpdated=!1;schemaFormRecentlyRefreshed=!1;destroy$=new me;schemaFormUpdatedSubject=new me;schemaFormRefreshSubject=new me;formUpdatedSubject=new me;formActionSubject=new me;ngOnInit(){let e=this.schema,n=this.plugin;if(!e||!n){console.error("CustomPluginsComponent: schema or plugin not provided"),this.$activeModal.dismiss("Missing required data");return}this.pluginAlias.set(e.pluginAlias),this.pluginType.set(e.pluginType),this.strictValidation.set(e.strictValidation),this.pluginConfig.length===0&&this.isFirstSave.set(!0),this.io=this.$ws.connectToNamespace("plugins/settings-ui"),this.basePath=`/plugins/settings-ui/${encodeURIComponent(n.name)}`,this.initialize(),this.schemaFormRefreshSubject.pipe(Me(250),Oe(this.destroy$)).subscribe(this.schemaFormRefresh.bind(this)),this.schemaFormUpdatedSubject.pipe(Me(250),wt(1),Oe(this.destroy$)).subscribe(t=>{this.schemaFormUpdated(t)}),this.formUpdatedSubject.pipe(Me(100),wt(1),Oe(this.destroy$)).subscribe(this.formUpdated.bind(this)),this.formActionSubject.pipe(Oe(this.destroy$)).subscribe(this.formActionEvent.bind(this)),window.addEventListener("message",this.handleMessage,!1)}ngOnDestroy(){window.removeEventListener("message",this.handleMessage),this.destroy$.next(),this.destroy$.complete(),this.io&&this.io.end(),this.schemaFormRefreshSubject.complete(),this.schemaFormUpdatedSubject.complete(),this.formUpdatedSubject.complete(),this.formActionSubject.complete()}onIsValid(e){this.formIsValid.set(e)}formValidEvent(e){this.formValid.set(e)}savePluginConfig(e=!1){return S(this,null,function*(){let n=this.plugin;if(n){this.saveInProgress.set(!0);try{let t=yield this.$api.post(`/config-editor/plugin/${encodeURIComponent(n.name)}`,this.pluginConfig);if(this.saveInProgress.set(!1),e){if(this.isFirstSave()&&this.$settings.env.recommendChildBridges&&t[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(n,!0);return}this.$activeModal.close(),yield this.$cb.openCorrectRestartModalForPlugin(n.name)}}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error")),this.saveInProgress.set(!1)}}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}initialize(){return S(this,null,function*(){let e=this.plugin;e&&(this.io.socket.emit("start",e.name),this.io.socket.on("response",n=>{n.action="response",this.iframe.contentWindow.postMessage(n,fe.api.origin)}),this.io.socket.on("stream",n=>{n.action="stream",this.iframe.contentWindow.postMessage(n,fe.api.origin)}),this.io.socket.on("ready",()=>{this.loading.set(!1),this.loadUi()}))})}loadUi(){let e=this.plugin;e&&(this.iframe=this.customPluginUiElementTarget()?.nativeElement,this.iframe&&(this.iframe.src=`${fe.api.base+this.basePath}/index.html?origin=${encodeURIComponent(location.origin)}&v=${encodeURIComponent(e.installedVersion)}`))}handleMessage=e=>{if(e.origin===fe.api.origin||e.origin===window.origin)switch(e.data.action){case"loaded":this.injectDefaultStyles(e),this.confirmReady(e);break;case"request":{this.handleRequest(e);break}case"scrollHeight":this.setiFrameHeight(e),this.uiLoaded.set(!0);break;case"config.get":{this.requestResponse(e,this.getConfigBlocks());break}case"config.save":{this.requestResponse(e,this.savePluginConfig());break}case"config.update":{this.handleUpdateConfig(e,e.data.pluginConfig);break}case"config.schema":{this.requestResponse(e,this.schema);break}case"cachedAccessories.get":{this.handleGetCachedAccessories(e);break}case"cachedMatterAccessories.get":{this.handleGetCachedMatterAccessories(e);break}case"schema.show":{this.formEnd(),this.showSchemaForm.set(!0);break}case"schema.hide":{this.showSchemaForm.set(!1);break}case"form.create":{this.showSchemaForm.set(!1),this.formCreate(e.data.formId,e.data.schema,e.data.data,e.data.submitButton,e.data.cancelButton);break}case"form.end":{this.formEnd();break}case"user.lightingMode":{this.requestResponse(e,this.$settings.actualLightingMode);break}case"i18n.lang":{this.requestResponse(e,this.$translate.getCurrentLang());break}case"i18n.translations":{this.requestResponse(e,Vn(`../../../../i18n/${this.$translate.getCurrentLang()}.json`));break}case"close":{this.$activeModal.close();break}case"toast.success":this.$toastr.success(e.data.message,e.data.title);break;case"toast.error":this.$toastr.error(e.data.message,e.data.title);break;case"toast.warning":this.$toastr.warning(e.data.message,e.data.title);break;case"toast.info":this.$toastr.info(e.data.message,e.data.title);break;case"spinner.show":this.pluginSpinner.set(!0);break;case"spinner.hide":this.pluginSpinner.set(!1);break;case"button.save.disabled":this.saveButtonDisabled.set(!0);break;case"button.save.enabled":this.saveButtonDisabled.set(!1);break}};confirmReady(e){e.source.postMessage({action:"ready"},e.origin)}setiFrameHeight(e){this.iframe.style.height=`${e.data.scrollHeight+10}px`}handleRequest(e){this.io.socket.emit("request",e.data)}handleUpdateConfig(e,n){if(this.showSchemaForm()&&this.schemaFormRefreshSubject.next(void 0),!Array.isArray(n))return this.$toastr.error(this.$translate.instant("plugins.config.must_be_array"),this.$translate.instant("toast.title_error")),this.requestResponse(e,{message:this.$translate.instant("plugins.config.must_be_array")},!1);for(let t of n)if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("plugins.config.must_be_array_objects"),this.$translate.instant("toast.title_error")),this.requestResponse(e,{message:this.$translate.instant("plugins.config.must_be_array_objects")},!1);return this.updateConfigBlocks(n),this.requestResponse(e,this.getConfigBlocks())}requestResponse(e,n,t=!0){e.source.postMessage({action:"response",requestId:e.data.requestId,success:t,data:n},e.origin)}injectDefaultStyles(e){return S(this,null,function*(){let n=Array.from(window.document.body.classList).find(M=>M.startsWith("config-ui-x-")),t=window.document.body.classList.contains("dark-mode"),a=e.source;a.postMessage({action:"body-class",class:n},e.origin),a.postMessage({action:"body-class",class:"modal-content"},e.origin),t&&a.postMessage({action:"body-class",class:"dark-mode"},e.origin);let d=Array.from(document.querySelectorAll("link"));for(let M of d)if(M.getAttribute("rel")==="stylesheet"){let $=M.getAttribute("href"),ge=document.baseURI+($.startsWith("/")?$.substring(1):$);a.postMessage({action:"link-element",href:ge,rel:"stylesheet"},e.origin)}let h=Array.from(document.querySelectorAll("style"));for(let M of h)a.postMessage({action:"inline-style",style:M.innerHTML},e.origin);let f=`
|
|
2
2
|
body {
|
|
3
3
|
height: unset !important;
|
|
4
4
|
background-color: ${t?"#242424":"#FFFFFF"} !important;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-H7F7H5MW.js";import{C as n,F as c,I as p}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-H7F7H5MW.js";import{C as n,F as c,I as p}from"./chunk-VWUZDCBZ.js";import{X as r,aa as a}from"./chunk-F5MBSCH4.js";import{g as b,h as s}from"./chunk-B4AJQJMI.js";var m=b(d(),1);var v=(()=>{class e{$api=a(p);$toastr=a(c);$translate=a(n);downloadBackup(){return s(this,null,function*(){let t=yield this.$api.get("/backup/download",{observe:"response",responseType:"blob"}),i=t.headers.get("File-Name")||"homebridge-backup.tar.gz",o=t.body.size;if(o>globalThis.backup.maxBackupSize){let l=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(o/1048576).toFixed(1)}MB`});this.$toastr.warning(l,this.$translate.instant("toast.title_warning"))}(0,m.saveAs)(t.body,i)})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=r({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{v as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as i}from"./chunk-
|
|
1
|
+
import{e as i}from"./chunk-CAY6MDP6.js";import{C as c,F as s,I as m}from"./chunk-VWUZDCBZ.js";import{aa as r}from"./chunk-F5MBSCH4.js";import{h as p}from"./chunk-B4AJQJMI.js";var h=()=>p(null,null,function*(){let t=r(m),o=r(i),a=r(s),e=r(c);try{return yield t.get("/platform-tools/docker/startup-script")}catch(n){console.error(n),a.error(n.message,e.instant("toast.title_error")),o.navigate(["/"]);return}});var R=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"docker",children:[{path:"",redirectTo:"/",pathMatch:"full"},{path:"startup-script",loadComponent:()=>import("./chunk-BRGXDZZE.js").then(t=>t.StartupScriptComponent),resolve:{startupScript:h}},{path:"restart-container",loadComponent:()=>import("./chunk-VFMCVZHO.js").then(t=>t.ContainerRestartComponent)}]},{path:"linux",children:[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",loadComponent:()=>import("./chunk-KIFEAONI.js").then(t=>t.RestartLinuxComponent)},{path:"shutdown-server",loadComponent:()=>import("./chunk-Y6B4ENQ3.js").then(t=>t.ShutdownLinuxComponent)}]},{path:"terminal",loadComponent:()=>import("./chunk-2K66PSKD.js").then(t=>t.TerminalComponent),canDeactivate:[(t,o,a,e)=>t.canDeactivate?t.canDeactivate(e?.url):!0]}];export{R as PLATFORM_TOOLS_ROUTES};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-664C4LX2.js";import{H as r}from"./chunk-VWUZDCBZ.js";import{X as a,aa as o}from"./chunk-F5MBSCH4.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 +1 @@
|
|
|
1
|
-
import{b as $}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-MAJDTCMY.js";import{H as h,I as S,v as j}from"./chunk-VWUZDCBZ.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-F5MBSCH4.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{a as H}from"./chunk-HH2FDI7W.js";import{s as k}from"./chunk-RDHUW73W.js";import{D as h}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-HH2FDI7W.js";import{s as k}from"./chunk-RDHUW73W.js";import{D as h}from"./chunk-VWUZDCBZ.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-F5MBSCH4.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};
|