homebridge-config-ui-x 5.2.1-beta.4 → 5.2.1-beta.6
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/CHANGELOG.md +1 -0
- package/dist/bin/hb-service.js +2 -2
- package/dist/core/config/config.service.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/public/3rdpartylicenses.txt +8 -8
- package/public/{chunk-BDGX3TPD.js → chunk-27UZT7QO.js} +1 -1
- package/public/{chunk-D32NXBKL.js → chunk-3CZYTU6H.js} +1 -1
- package/public/chunk-3E7VFMCX.js +1 -0
- package/public/{chunk-UZZQ6FK7.js → chunk-3JJZ6QQL.js} +1 -1
- package/public/{chunk-YPSEKDJZ.js → chunk-3RBJMR2C.js} +1 -1
- package/public/{chunk-JUNUASP3.js → chunk-3WSNVOIX.js} +1 -1
- package/public/{chunk-WGY4AVVT.js → chunk-5RUM7CEH.js} +2 -2
- package/public/{chunk-CE7OVISJ.js → chunk-7LKAZJLI.js} +1 -1
- package/public/chunk-BYZJWNCS.js +1 -0
- package/public/{chunk-F7KN6SGX.js → chunk-C7JD6G6I.js} +1 -1
- package/public/{chunk-PURQ26Z3.js → chunk-CJMOVRVH.js} +1 -1
- package/public/{chunk-ROEV5JQZ.js → chunk-D6ZBL5RI.js} +1 -1
- package/public/{chunk-KX3A2TMK.js → chunk-DDHA6TIL.js} +1 -1
- package/public/{chunk-Z5CQQDBM.js → chunk-DTCAZU55.js} +1 -1
- package/public/{chunk-ZNKFUL7Z.js → chunk-EQXTGFHJ.js} +1 -1
- package/public/{chunk-BBTNODGX.js → chunk-FA5WDZUY.js} +1 -1
- package/public/{chunk-JYDMQWOG.js → chunk-FO55QKB4.js} +1 -1
- package/public/{chunk-5VPU2MAW.js → chunk-GEBXCYRI.js} +1 -1
- package/public/{chunk-X3JAGHJK.js → chunk-HTVAIF5H.js} +1 -1
- package/public/{chunk-VQVQ7IY7.js → chunk-HZZEPY33.js} +1 -1
- package/public/{chunk-BVZWVIXL.js → chunk-IVYKLQQ6.js} +1 -1
- package/public/{chunk-GBYD7PEO.js → chunk-J66U6NNP.js} +1 -1
- package/public/{chunk-JORJGGYF.js → chunk-JC4MK5CR.js} +1 -1
- package/public/{chunk-R4QPH5AB.js → chunk-L7SKQHJB.js} +1 -1
- package/public/{chunk-75KAGSZ4.js → chunk-LNOENQHV.js} +1 -1
- package/public/{chunk-46RUL2XE.js → chunk-MIUGSJFM.js} +1 -1
- package/public/{chunk-4LVGGRJG.js → chunk-MWYTIOLE.js} +1 -1
- package/public/{chunk-726ATBO7.js → chunk-NEOF7IDY.js} +1 -1
- package/public/{chunk-6N55TNJG.js → chunk-OM5RO73A.js} +1 -1
- package/public/{chunk-DA3GZP6L.js → chunk-OYH5M6P2.js} +1 -1
- package/public/{chunk-MEKSPPI3.js → chunk-Q5QGEORA.js} +7 -7
- package/public/{chunk-X5UDVMII.js → chunk-QMG5LBOF.js} +1 -1
- package/public/{chunk-636IQVQ6.js → chunk-ROLHL6HW.js} +1 -1
- package/public/{chunk-PSGAWGOS.js → chunk-S4NXS63I.js} +1 -1
- package/public/{chunk-TIO3GNB7.js → chunk-S4PTOZSW.js} +1 -1
- package/public/{chunk-XDDPTQEI.js → chunk-S6JCPVMC.js} +1 -1
- package/public/{chunk-44D3RT6C.js → chunk-SNMFTZGU.js} +1 -1
- package/public/chunk-SVVKLOZB.js +7 -0
- package/public/{chunk-XBVV5T2W.js → chunk-VTFS626J.js} +1 -1
- package/public/{chunk-4YD636D6.js → chunk-WEB6J2BW.js} +1 -1
- package/public/{chunk-KSAOC3CS.js → chunk-WPEQOABL.js} +1 -1
- package/public/{chunk-PK3IEBRR.js → chunk-XEB3TWDU.js} +1 -1
- package/public/{chunk-UB3D74GZ.js → chunk-XGID6EOR.js} +1 -1
- package/public/{chunk-LTGIRFYB.js → chunk-XIWOJ72I.js} +1 -1
- package/public/{chunk-GVBPTSHE.js → chunk-XPOM5GS4.js} +1 -1
- package/public/{chunk-LBTU3QZ3.js → chunk-XU6URLCY.js} +1 -1
- package/public/{chunk-V5OEAUHL.js → chunk-XVUZXOZJ.js} +1 -1
- package/public/{chunk-OR2NR7FR.js → chunk-YJDZC3X3.js} +1 -1
- package/public/index.html +2 -2
- package/public/{main-7B7QR472.js → main-WEOOYKNT.js} +1 -1
- package/public/styles-Y3F34BOG.css +1 -0
- package/public/chunk-BSZ6MHFZ.js +0 -9
- package/public/chunk-F6WTXQF2.js +0 -1
- package/public/chunk-OY4HWAQQ.js +0 -1
- package/public/styles-F7TCZAA2.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-IVYKLQQ6.js";import{a as m}from"./chunk-W6RS6NBX.js";import{n as s}from"./chunk-PSSVCFFV.js";import{b as o}from"./chunk-JC4MK5CR.js";import{a as i}from"./chunk-ZG3HINDJ.js";import{ga as r,la as n}from"./chunk-V7SOQAC5.js";var I=(()=>{class e{$terminal=n(l);$settings=n(o);$modal=n(s);$translate=n(i);handleBeforeUnload(t){if(!this.$settings.env.terminal?.persistence&&!this.$settings.env.terminal?.hideWarning&&this.$terminal.hasActiveSession()&&this.$terminal.hasUserTypedInSession()){let a=this.$translate.instant("platform.terminal.terminate_unload");return t.preventDefault(),t.returnValue=a,a}}canDeactivate(){if(this.$settings.env.terminal?.persistence||this.$settings.env.terminal?.hideWarning||!this.$terminal.hasActiveSession()||!this.$terminal.hasUserTypedInSession())return!0;let t=this.$modal.open(m,{size:"lg",backdrop:"static"});return t.componentInstance.title=this.$translate.instant("platform.terminal.terminate_title"),t.componentInstance.message=this.$translate.instant("platform.terminal.terminate_message_1"),t.componentInstance.message2=this.$translate.instant("platform.terminal.terminate_message_2"),t.componentInstance.message3=this.$translate.instant("common.phrases.are_you_sure"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_continue"),t.componentInstance.confirmButtonClass="btn-primary",t.componentInstance.faIconClass="fas fa-exclamation-triangle text-warning",t.result.then(()=>!0).catch(()=>!1)}static \u0275fac=function(a){return new(a||e)};static \u0275prov=r({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{I as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-7LKAZJLI.js";import"./chunk-GEBXCYRI.js";import{d as k}from"./chunk-QRQBCPWO.js";import{b as S}from"./chunk-JC4MK5CR.js";import{k as T,n as w}from"./chunk-27UZT7QO.js";import{a as C,b as $}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$b as E,Dc as g,Hc as m,Ib as d,Ic as c,Jb as f,Jc as y,Sb as r,Tb as i,Ub as l,Xa as x,ab as n,dc as h,la as o,mb as _,qc as a,rc as s}from"./chunk-V7SOQAC5.js";var I=t=>({command:t});function D(t,u){if(t&1&&(r(0,"div",7),a(1),i()),t&2){let e=h();n(),s(e.error)}}function R(t,u){t&1&&(r(0,"p",9),a(1),m(2,"translate"),i(),r(3,"div",10)(4,"div",11),l(5,"i",12),i()()),t&2&&(n(),s(c(2,1,"restart.please_wait_while_server_restarts")))}function B(t,u){if(t&1&&(r(0,"div",8)(1,"p"),a(2),m(3,"translate"),i(),l(4,"p",13),m(5,"translate"),i()),t&2){let e=h();n(2),s(c(3,2,"platform.docker.server_long_time")),n(2),E("innerHTML",y(5,4,"platform.docker.run_with_restart",g(7,I,e.command)),x)}}var U=(()=>{class t{$api=o(w);$router=o(k);$settings=o(S);$toastr=o(T);$translate=o(C);$ws=o(b);checkTimeout;checkDelay;io;resp={};timeout=!1;error=!1;command='<span class="font-monospace">--restart=always</span>';ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/docker/restart-container",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{this.error=this.$translate.instant("restart.toast_server_restart_error"),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},1e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},6e4)}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=_({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fab","fa-fw","fa-docker",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(p,v){p&1&&(r(0,"div",0)(1,"h3",1),a(2),m(3,"translate"),i()(),r(4,"div",2)(5,"div",3),l(6,"i",4),i(),r(7,"div",5)(8,"h4",6),a(9),m(10,"translate"),i(),d(11,D,2,1,"div",7)(12,R,6,3),d(13,B,6,9,"div",8),i()()),p&2&&(n(2),s(c(3,4,"menu.restart.title")),n(7),s(c(10,6,"platform.docker.title_restarting")),n(2),f(v.error?11:12),n(2),f(v.timeout?13:-1))},dependencies:[$],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{U as ContainerRestartComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s}from"./chunk-
|
|
1
|
+
import{b as s}from"./chunk-GEBXCYRI.js";import{d as i}from"./chunk-QRQBCPWO.js";import{k as o}from"./chunk-27UZT7QO.js";import{a}from"./chunk-ZG3HINDJ.js";import{ga as e,la as r}from"./chunk-V7SOQAC5.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-ERUJZRID.js";import{a as X}from"./chunk-B3QDBZSW.js";import{a as Z}from"./chunk-7FO4RGTF.js";import"./chunk-2KOR6LRK.js";import{a as R}from"./chunk-W6RS6NBX.js";import{n as E}from"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import{a as j}from"./chunk-CE7OVISJ.js";import{b as A}from"./chunk-5VPU2MAW.js";import{a as W,c as q,d as V,e as N,f as D}from"./chunk-QRQBCPWO.js";import{b as T}from"./chunk-JORJGGYF.js";import{m as $}from"./chunk-BDGX3TPD.js";import{a as L,b as U}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Cc as h,Dc as M,Hb as m,Hc as s,Ib as x,Ic as d,Jb as y,Ob as c,Pb as n,Qb as a,Rb as p,_b as S,ab as o,bc as _,dc as C,fb as F,g as Y,h as I,id as O,la as u,mb as P,qc as f,ra as b,rc as v,sa as w,w as z,zd as K}from"./chunk-V7SOQAC5.js";var Q=Y(Z(),1);function G(){var i;return typeof window<"u"&&(window?.matchMedia("(display-mode: standalone)").matches||((i=window.navigator)===null||i===void 0?void 0:i.standalone)||document.referrer.startsWith("android-app://")||window?.Windows||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var B=()=>["/"],te=i=>({"hamburger-icon-cross":i}),ne=i=>({expanded:i}),ie=()=>({exact:!0}),oe=()=>["/plugins"],re=()=>["/accessories"],ae=()=>["/logs"],se=()=>["/support"],de=()=>["/platform-tools/terminal"],le=()=>["/config"],pe=()=>["/settings"],ce=()=>["/power-options"];function me(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),s(3,"translate"),_("click",function(){b(e);let t=C();return w(t.openUnderVoltageModal())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",21),a(),n(6,"div",14),f(7),s(8,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"rpi.throttled.undervoltage_title")+" - "+d(3,4,"rpi.throttled.undervoltage_description")),o(6),v(d(8,6,"rpi.throttled.undervoltage_title")))}function ue(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,de))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.linux.label_terminal")),o(5),v(d(7,6,"menu.linux.label_terminal")))}function _e(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,le))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.config_json_editor")),o(5),v(d(7,6,"menu.config_json_editor")))}function fe(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,pe))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.label_settings")),o(5),v(d(7,6,"menu.label_settings")))}function ge(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,ce))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.restart.title")),o(5),v(d(7,6,"menu.restart.title")))}function ve(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),_("click",function(){b(e);let t=C();return w(t.reloadPage())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"menu.reload")),o(5),v(d(7,4,"menu.reload")))}function he(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),_("click",function(){b(e);let t=C();return w(t.logout())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"menu.tooltip_logout")),o(5),v(d(7,4,"menu.tooltip_logout")))}var J=(()=>{class i{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(X);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=G();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(l=>{l instanceof W&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),l=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!l.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),l.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),l.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(H,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-fw fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let l=e.target;["menuitem","button"].includes(l.getAttribute("role"))&&l.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(l){return new(l||i)};static \u0275cmp=P({type:i,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:68,vars:75,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","../../../../assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-fw","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-fw","fa-plug"],[1,"fa","fa-fw","fa-lightbulb"],[1,"fa","fa-fw","fa-wave-square"],[1,"fa","fa-fw","fa-question-circle-o"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-fw","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-fw","fa-terminal"],[1,"fa","fa-fw","fa-code"],[1,"fa","fa-fw","fa-cog"],[1,"fa","fa-fw","fa-power-off"],[1,"fa","fa-fw","fa-refresh"],[1,"fa","fa-fw","fa-right-from-bracket"]],template:function(l,t){l&1&&(n(0,"div",0),s(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(g){return t.handleKeydown(g)}),p(2,"span",1),n(3,"a",2),s(4,"translate"),p(5,"img",3),n(6,"div",4),f(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(g){return t.handleKeydown(g)}),n(15,"a",2),s(16,"translate"),p(17,"img",3),n(18,"div",8),f(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),s(23,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),f(27),s(28,"translate"),a()()(),x(29,me,9,8,"div",10),n(30,"div",10)(31,"div",15),s(32,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(33,"div",12),p(34,"i",16),a(),n(35,"div",14),f(36),s(37,"translate"),a()()(),n(38,"div",10)(39,"div",15),s(40,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(41,"div",12),p(42,"i",17),a(),n(43,"div",14),f(44),s(45,"translate"),a()()(),n(46,"div",10)(47,"div",15),s(48,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(49,"div",12),p(50,"i",18),a(),n(51,"div",14),f(52),s(53,"translate"),a()()(),x(54,ue,8,9,"div",10),x(55,_e,8,9,"div",10),x(56,fe,8,9,"div",10),n(57,"div",10)(58,"div",15),s(59,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(60,"div",12),p(61,"i",19),a(),n(62,"div",14),f(63),s(64,"translate"),a()()(),x(65,ge,8,9,"div",10),x(66,ve,8,6,"div",10),x(67,he,8,6,"div",10),a()()),l&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",d(1,37,"menu.sidebar.aria_menu")),o(3),c("routerLink",h(63,B)),m("aria-label",d(4,39,"menu.label_status")),o(5),c("ngClass",M(64,te,t.isExpanded)),o(5),c("ngClass",M(66,ne,t.isExpanded)),o(2),c("routerLink",h(68,B)),m("aria-label",d(16,41,"menu.label_status")),o(7),c("routerLink",h(69,B))("routerLinkActive","active")("routerLinkActiveOptions",h(70,ie)),m("aria-label",d(23,43,"menu.label_status")),o(5),v(d(28,45,"menu.label_status")),o(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),o(2),c("routerLink",h(71,oe))("routerLinkActive","active"),m("aria-label",d(32,47,"menu.label_plugins")),o(5),v(d(37,49,"menu.label_plugins")),o(3),c("routerLink",h(72,re))("routerLinkActive","active"),m("aria-label",d(40,51,"menu.label_accessories")),o(5),v(d(45,53,"menu.label_accessories")),o(3),c("routerLink",h(73,ae))("routerLinkActive","active"),m("aria-label",d(48,55,"menu.linux.label_logs")),o(5),v(d(53,57,"menu.linux.label_logs")),o(2),y(t.enableTerminalAccess&&t.isAdmin?54:-1),o(),y(t.isAdmin?55:-1),o(),y(t.isAdmin?56:-1),o(2),c("routerLink",h(74,se))("routerLinkActive","active"),m("aria-label",d(59,59,"support.title")),o(5),v(d(64,61,"support.title")),o(2),y(t.isAdmin?65:-1),o(),y(t.isPwa?66:-1),o(),y(t.formAuth?67:-1))},dependencies:[N,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-y:auto;max-height:calc(100vh - 80px)!important}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.5s ease-in-out;-moz-transition:.5s ease-in-out;-o-transition:.5s ease-in-out;transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.25s ease-in-out;-moz-transition:.25s ease-in-out;-o-transition:.25s ease-in-out;transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return i})();var be=i=>({sidebarExpanded:i}),He=(()=>{class i{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),this.$router.url!=="/restart"&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(l){return new(l||i)};static \u0275cmp=P({type:i,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(l,t){l&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),l&2&&(c("isExpanded",t.sidebarExpanded),o(),c("ngClass",M(2,be,t.sidebarExpanded)))},dependencies:[J,O,q],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return i})();export{He as LayoutComponent};
|
|
1
|
+
import{a as H}from"./chunk-ERUJZRID.js";import{a as X}from"./chunk-B3QDBZSW.js";import{a as Z}from"./chunk-7FO4RGTF.js";import"./chunk-2KOR6LRK.js";import{a as R}from"./chunk-W6RS6NBX.js";import{n as E}from"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import{a as j}from"./chunk-7LKAZJLI.js";import{b as A}from"./chunk-GEBXCYRI.js";import{a as W,c as q,d as V,e as N,f as D}from"./chunk-QRQBCPWO.js";import{b as T}from"./chunk-JC4MK5CR.js";import{m as $}from"./chunk-27UZT7QO.js";import{a as L,b as U}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Cc as h,Dc as M,Hb as m,Hc as s,Ib as x,Ic as d,Jb as y,Ob as c,Pb as n,Qb as a,Rb as p,_b as S,ab as o,bc as _,dc as C,fb as F,g as Y,h as I,id as O,la as u,mb as P,qc as f,ra as b,rc as v,sa as w,w as z,zd as K}from"./chunk-V7SOQAC5.js";var Q=Y(Z(),1);function G(){var i;return typeof window<"u"&&(window?.matchMedia("(display-mode: standalone)").matches||((i=window.navigator)===null||i===void 0?void 0:i.standalone)||document.referrer.startsWith("android-app://")||window?.Windows||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var B=()=>["/"],te=i=>({"hamburger-icon-cross":i}),ne=i=>({expanded:i}),ie=()=>({exact:!0}),oe=()=>["/plugins"],re=()=>["/accessories"],ae=()=>["/logs"],se=()=>["/support"],de=()=>["/platform-tools/terminal"],le=()=>["/config"],pe=()=>["/settings"],ce=()=>["/power-options"];function me(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),s(3,"translate"),_("click",function(){b(e);let t=C();return w(t.openUnderVoltageModal())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",21),a(),n(6,"div",14),f(7),s(8,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"rpi.throttled.undervoltage_title")+" - "+d(3,4,"rpi.throttled.undervoltage_description")),o(6),v(d(8,6,"rpi.throttled.undervoltage_title")))}function ue(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,de))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.linux.label_terminal")),o(5),v(d(7,6,"menu.linux.label_terminal")))}function _e(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,le))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.config_json_editor")),o(5),v(d(7,6,"menu.config_json_editor")))}function fe(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,pe))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.label_settings")),o(5),v(d(7,6,"menu.label_settings")))}function ge(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),s(2,"translate"),_("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),c("routerLink",h(8,ce))("routerLinkActive","active"),m("aria-label",d(2,4,"menu.restart.title")),o(5),v(d(7,6,"menu.restart.title")))}function ve(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),_("click",function(){b(e);let t=C();return w(t.reloadPage())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"menu.reload")),o(5),v(d(7,4,"menu.reload")))}function he(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",20),s(2,"translate"),_("click",function(){b(e);let t=C();return w(t.logout())})("keydown",function(t){b(e);let r=C();return w(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),f(6),s(7,"translate"),a()()()}i&2&&(o(),m("aria-label",d(2,2,"menu.tooltip_logout")),o(5),v(d(7,4,"menu.tooltip_logout")))}var J=(()=>{class i{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(X);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=G();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(l=>{l instanceof W&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),l=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!l.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),l.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),l.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(H,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-fw fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let l=e.target;["menuitem","button"].includes(l.getAttribute("role"))&&l.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(l){return new(l||i)};static \u0275cmp=P({type:i,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:68,vars:75,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","../../../../assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-fw","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-fw","fa-plug"],[1,"fa","fa-fw","fa-lightbulb"],[1,"fa","fa-fw","fa-wave-square"],[1,"fa","fa-fw","fa-question-circle-o"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-fw","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-fw","fa-terminal"],[1,"fa","fa-fw","fa-code"],[1,"fa","fa-fw","fa-cog"],[1,"fa","fa-fw","fa-power-off"],[1,"fa","fa-fw","fa-refresh"],[1,"fa","fa-fw","fa-right-from-bracket"]],template:function(l,t){l&1&&(n(0,"div",0),s(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(g){return t.handleKeydown(g)}),p(2,"span",1),n(3,"a",2),s(4,"translate"),p(5,"img",3),n(6,"div",4),f(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(g){return t.handleKeydown(g)}),n(15,"a",2),s(16,"translate"),p(17,"img",3),n(18,"div",8),f(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),s(23,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),f(27),s(28,"translate"),a()()(),x(29,me,9,8,"div",10),n(30,"div",10)(31,"div",15),s(32,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(33,"div",12),p(34,"i",16),a(),n(35,"div",14),f(36),s(37,"translate"),a()()(),n(38,"div",10)(39,"div",15),s(40,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(41,"div",12),p(42,"i",17),a(),n(43,"div",14),f(44),s(45,"translate"),a()()(),n(46,"div",10)(47,"div",15),s(48,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(49,"div",12),p(50,"i",18),a(),n(51,"div",14),f(52),s(53,"translate"),a()()(),x(54,ue,8,9,"div",10),x(55,_e,8,9,"div",10),x(56,fe,8,9,"div",10),n(57,"div",10)(58,"div",15),s(59,"translate"),_("keydown",function(g){return t.handleKeydown(g)}),n(60,"div",12),p(61,"i",19),a(),n(62,"div",14),f(63),s(64,"translate"),a()()(),x(65,ge,8,9,"div",10),x(66,ve,8,6,"div",10),x(67,he,8,6,"div",10),a()()),l&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",d(1,37,"menu.sidebar.aria_menu")),o(3),c("routerLink",h(63,B)),m("aria-label",d(4,39,"menu.label_status")),o(5),c("ngClass",M(64,te,t.isExpanded)),o(5),c("ngClass",M(66,ne,t.isExpanded)),o(2),c("routerLink",h(68,B)),m("aria-label",d(16,41,"menu.label_status")),o(7),c("routerLink",h(69,B))("routerLinkActive","active")("routerLinkActiveOptions",h(70,ie)),m("aria-label",d(23,43,"menu.label_status")),o(5),v(d(28,45,"menu.label_status")),o(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),o(2),c("routerLink",h(71,oe))("routerLinkActive","active"),m("aria-label",d(32,47,"menu.label_plugins")),o(5),v(d(37,49,"menu.label_plugins")),o(3),c("routerLink",h(72,re))("routerLinkActive","active"),m("aria-label",d(40,51,"menu.label_accessories")),o(5),v(d(45,53,"menu.label_accessories")),o(3),c("routerLink",h(73,ae))("routerLinkActive","active"),m("aria-label",d(48,55,"menu.linux.label_logs")),o(5),v(d(53,57,"menu.linux.label_logs")),o(2),y(t.enableTerminalAccess&&t.isAdmin?54:-1),o(),y(t.isAdmin?55:-1),o(),y(t.isAdmin?56:-1),o(2),c("routerLink",h(74,se))("routerLinkActive","active"),m("aria-label",d(59,59,"support.title")),o(5),v(d(64,61,"support.title")),o(2),y(t.isAdmin?65:-1),o(),y(t.isPwa?66:-1),o(),y(t.formAuth?67:-1))},dependencies:[N,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-y:auto;max-height:calc(100vh - 80px)!important}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.5s ease-in-out;-moz-transition:.5s ease-in-out;-o-transition:.5s ease-in-out;transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.25s ease-in-out;-moz-transition:.25s ease-in-out;-o-transition:.25s ease-in-out;transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return i})();var be=i=>({sidebarExpanded:i}),He=(()=>{class i{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),this.$router.url!=="/restart"&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(l){return new(l||i)};static \u0275cmp=P({type:i,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(l,t){l&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),l&2&&(c("isExpanded",t.sidebarExpanded),o(),c("ngClass",M(2,be,t.sidebarExpanded)))},dependencies:[J,O,q],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return i})();export{He as LayoutComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,g as n}from"./chunk-QRQBCPWO.js";import{k as l,n as d}from"./chunk-
|
|
1
|
+
import{d as u,g as n}from"./chunk-QRQBCPWO.js";import{k as l,n as d}from"./chunk-27UZT7QO.js";import{a as f}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ga as p,h as m,ha as i,la as o,nb as s,w as c}from"./chunk-V7SOQAC5.js";var a=(()=>{class r{$api=o(d);$router=o(u);$toastr=o(l);$translate=o(f);resolve(){return m(this,null,function*(){try{return yield c(this.$api.get("/users"))}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=p({token:r,factory:r.\u0275fac})}return r})();var h=[{path:"",loadComponent:()=>import("./chunk-XIWOJ72I.js").then(r=>r.UsersComponent),resolve:{homebridgeUsers:a}}],v=(()=>{class r{static \u0275fac=function(e){return new(e||r)};static \u0275mod=s({type:r});static \u0275inj=i({imports:[n.forChild(h),n]})}return r})();var T=(()=>{class r{static \u0275fac=function(e){return new(e||r)};static \u0275mod=s({type:r});static \u0275inj=i({providers:[a],imports:[v]})}return r})();export{T as UsersModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as _,b as D}from"./chunk-
|
|
1
|
+
import{a as _,b as D}from"./chunk-JC4MK5CR.js";import{m as c,n as S}from"./chunk-27UZT7QO.js";import{f as x}from"./chunk-K7QEGT3E.js";import{C as v,g as O,ga as h,h as a,ha as E,ja as y,ka as l,la as f,nb as I,r as p,va as j,w as d,x as T,z as w}from"./chunk-V7SOQAC5.js";var g=new y("JWT_OPTIONS"),m=(()=>{class r{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+/=",o="";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 i=0,s,n,b=0;n=e.charAt(b++);~n&&(s=i%4?s*64+n:n,i++%4)?o+=String.fromCharCode(255&s>>(-2*i&6)):0)n=t.indexOf(n);return o}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 o=this.urlBase64Decode(t[1]);if(!o)throw new Error("Cannot decode the token.");return JSON.parse(o)}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 o=new Date(0);return o.setUTCSeconds(t.exp),o}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(o=>this._isTokenExpired(o,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let o=this.getTokenExpirationDate(e);return t=t||0,o===null?!1:!(o.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return r.\u0275fac=function(e){return new(e||r)(l(g))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),$=r=>r instanceof Promise?v(()=>r):p(r),R=(()=>{class r{constructor(e,t,o){this.jwtHelper=t,this.document=o,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 o=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===o:i instanceof RegExp?i.test(o):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(o=>{if(typeof o=="string"){let i=new URL(o,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return o instanceof RegExp?o.test(e.url):!1})>-1}handleInterception(e,t,o){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=p(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):p(!0)),e?s.pipe(T(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(n=>o.handle(n))):o.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let o=this.tokenGetter(e);return $(o).pipe(w(i=>this.handleInterception(i,e,t)))}}return r.\u0275fac=function(e){return new(e||r)(l(g),l(m),l(j))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),F=(()=>{class r{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:r,providers:[{provide:x,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return r.\u0275fac=function(e){return new(e||r)(l(r,12))},r.\u0275mod=I({type:r}),r.\u0275inj=E({}),r})();var k=O(_(),1);var q=(()=>{class r{$api=f(S);$jwtHelper=f(m);$settings=f(D);token;user={};logoutTimer;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield d(this.$api.post("/auth/login",e));if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(c.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield d(this.$api.post("/auth/noauth",{}));if(this.validateToken(e.access_token))window.localStorage.setItem(c.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(c.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield d(this.$settings.onSettingsLoaded));let e=window.localStorage.getItem(c.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){try{return yield d(this.$api.get("/auth/check"))}catch(e){e.status===401&&(console.error("Current token is not valid"),this.logout())}})}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(c.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let t=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");t<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),t))}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=h({token:r,factory:r.\u0275fac})}return r})();export{F as a,q as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as Q,c as $,d as C,e as B,f as O,g as T,j as w,m as q,p as z,q as D,w as H,x as A,z as G}from"./chunk-K2NEWUWG.js";import{b as K}from"./chunk-
|
|
1
|
+
import{A as Q,c as $,d as C,e as B,f as O,g as T,j as w,m as q,p as z,q as D,w as H,x as A,z as G}from"./chunk-K2NEWUWG.js";import{b as K}from"./chunk-GEBXCYRI.js";import{d as U}from"./chunk-QRQBCPWO.js";import{b as J}from"./chunk-JC4MK5CR.js";import{m as W}from"./chunk-27UZT7QO.js";import{b as j}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Dc as f,Hc as l,Ib as u,Ic as d,Jb as c,M as I,Ob as m,Pb as r,Qb as a,Rb as s,Sc as b,Uc as L,Xa as x,ab as i,bc as E,dc as M,h as y,id as N,kc as v,la as p,lc as F,ld as V,mb as k,qc as g,rc as h,sc as R,w as S,zd as P}from"./chunk-V7SOQAC5.js";var Y=["password"],Z=["username"],ee=["otp"],te=e=>({background:e}),ie=e=>({anim:e}),X=e=>({"is-invalid":e});function ne(e,_){if(e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",13),a(),s(3,"input",14,0),l(5,"translate"),a(),r(6,"div",8)(7,"span",12),s(8,"i",15),a(),s(9,"input",16,1),l(11,"translate"),a()),e&2){let n=M();i(3),m("placeholder",d(5,4,"users.label_username"))("ngClass",f(8,X,n.form.controls.username.dirty&&n.form.controls.username.errors)),i(6),m("placeholder",d(11,6,"users.label_password"))("ngClass",f(10,X,n.form.controls.password.dirty&&n.form.controls.password.errors))}}function oe(e,_){e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",17),a(),s(3,"input",18,2),l(5,"translate"),a()),e&2&&(i(3),m("placeholder",d(5,1,"login.label_2fa_code")))}function ae(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_credentials")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}function re(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_code")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}var _e=(()=>{class e{$auth=p(K);$cdr=p(L);$router=p(U);$settings=p(J);targetRoute;validNonAdminRoutes=["/accessories","/plugins","/logs","/support"];passwordInput=b("password");usernameInput=b("username");otpInput=b("otp");backgroundStyle;invalidCredentials=!1;invalid2faCode=!1;twoFactorCodeRequired=!1;inProgress=!1;form;ngOnInit(){this.form=new T({username:new w(""),password:new w("")}),this.form.valueChanges.pipe(I(500)).subscribe(n=>{let o=this.passwordInput()?.nativeElement.value;o&&o!==n.password&&this.form.controls.password.setValue(o)}),this.targetRoute=window.sessionStorage.getItem("target_route")||"",this.setBackground()}ngAfterViewChecked(){this.$cdr.detectChanges()}onSubmit(){return y(this,null,function*(){this.invalidCredentials=!1,this.invalid2faCode=!1,this.inProgress=!0,document.getElementById("submit-button")?.blur();let n=this.passwordInput()?.nativeElement.value;n&&n!==this.form.get("password").value&&this.form.controls.password.setValue(n);let o=this.usernameInput()?.nativeElement.value;if(o&&o!==this.form.get("username").value&&this.form.controls.username.setValue(o),this.twoFactorCodeRequired){let t=this.otpInput()?.nativeElement.value;t&&t!==this.form.get("otp").value&&this.form.controls.username.setValue(t)}try{yield this.$auth.login(this.form.getRawValue()),!this.$auth.user.admin&&!this.validNonAdminRoutes.includes(this.targetRoute)&&(this.targetRoute="/"),this.$router.navigateByUrl(this.targetRoute),window.sessionStorage.removeItem("target_route")}catch(t){t.status===412?(this.form.controls.otp?(this.form.controls.otp.setErrors(["Invalid Code"]),this.invalid2faCode=!0):this.form.addControl("otp",new w("",[C.required,C.minLength(6),C.maxLength(6)])),this.twoFactorCodeRequired=!0,setTimeout(()=>{document.getElementById("form-ota").focus()},100)):this.invalidCredentials=!0}this.inProgress=!1})}setBackground(){return y(this,null,function*(){if(this.$settings.settingsLoaded||(yield S(this.$settings.onSettingsLoaded)),this.$settings.env.customWallpaperHash){let n=`${W.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`;this.backgroundStyle=`url('${n}') center/cover`}})}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=k({type:e,selectors:[["ng-component"]],viewQuery:function(o,t){o&1&&(v(t.passwordInput,Y,5),v(t.usernameInput,Z,5),v(t.otpInput,ee,5)),o&2&&F(3)},decls:15,vars:18,consts:[["username",""],["password",""],["otp",""],[1,"login-container","gradient","d-flex","align-items-start","justify-content-center",3,"ngStyle","ngClass"],[1,"w-100","login-card","d-flex","py-4","flex-column"],["ngSrc","/assets/homebridge-color-round.svg","alt","Homebridge Logo","height","100","width","100","priority","true",1,"homebridge-logo","mx-auto","my-3"],["novalidate","",3,"ngSubmit","formGroup"],[1,"mb-4","text-center"],[1,"input-group","mb-4"],[1,"input-group","no-border","mb-4"],[1,"text-center"],["tabindex","3","id","submit-button","type","submit",1,"btn","btn-primary","mb-2",3,"disabled"],[1,"input-group-text","custom-input"],[1,"fas","fa-fw","fa-user","primary-text","fa-lg"],["formControlName","username","type","text","id","form-username","autofocus","","autocomplete","username","autocapitalize","none","tabindex","1","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-lock","primary-text","fa-lg"],["formControlName","password","type","password","id","form-pass","autocomplete","current-password","tabindex","2","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-key","primary-text","fa-lg"],["formControlName","otp","type","text","id","form-ota","autofocus","","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*","tabindex","1",1,"form-control","custom-input",3,"placeholder"],[1,"fas","fa-fw","fa-exclamation-triangle","pink-text","fa-lg"],[1,"form-control","custom-input"],[1,"small","grey-text","fw-semibold"],[1,"small","grey-text",3,"innerHTML"]],template:function(o,t){o&1&&(r(0,"div",3)(1,"div",4),s(2,"img",5),r(3,"form",6),E("ngSubmit",function(){return t.onSubmit()}),r(4,"h4",7),g(5),l(6,"translate"),a(),u(7,ne,12,12),u(8,oe,6,3,"div",8),u(9,ae,9,6,"div",9),u(10,re,9,6,"div",9),r(11,"div",10)(12,"button",11),g(13),l(14,"translate"),a()()()()()),o&2&&(m("ngStyle",f(14,te,t.backgroundStyle))("ngClass",f(16,ie,!t.backgroundStyle)),i(3),m("formGroup",t.form),i(2),h(d(6,10,"setup.welcome_to_homebridge")),i(2),c(t.twoFactorCodeRequired?-1:7),i(),c(t.twoFactorCodeRequired?8:-1),i(),c(t.invalidCredentials?9:-1),i(),c(t.invalid2faCode?10:-1),i(2),m("disabled",t.form.invalid),i(),R(" ",d(14,12,"form.button_continue")," "))},dependencies:[V,G,q,$,B,O,H,A,Q,z,D,N,P,j],styles:["body{overflow:scroll!important} body.dark-mode .login-card{background-color:#2b2b2b;color:#fff}.login-container[_ngcontent-%COMP%]{z-index:-1;padding-top:2em;padding-bottom:2em;min-height:100%;background-size:300% 300%}.anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.login-card[_ngcontent-%COMP%]{max-width:550px;border-radius:1rem;padding-right:25px;padding-left:25px;background-color:#ffffffe6}.login-card[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{background-color:inherit!important}@media screen and (max-width: 575px){.login-card[_ngcontent-%COMP%]{margin-left:1em;margin-right:1em}}.homebridge-logo[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return e})();export{_e as LoginComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-7LKAZJLI.js";import"./chunk-GEBXCYRI.js";import{d as E}from"./chunk-QRQBCPWO.js";import{b as R}from"./chunk-JC4MK5CR.js";import{k as O,n as B}from"./chunk-27UZT7QO.js";import{a as k,b as I}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Dc as b,Ec as g,Hc as o,Ib as f,Ic as l,Jb as _,Ob as x,Pb as r,Qb as n,Rb as v,_b as $,ab as i,bc as S,dc as d,id as T,la as m,mb as w,qc as a,ra as C,rc as c,sa as y,sc as h}from"./chunk-V7SOQAC5.js";var U=(t,p)=>({"fas fa-fw fa-spinner fa-spin":t,"far fa-fw fa-check-circle":p}),F=t=>({"grey-text":t}),P=(t,p)=>({"far fa-fw fa-circle":t,"fas fa-fw fa-spinner fa-spin":p});function j(t,p){if(t&1&&(r(0,"div",7),a(1),n()),t&2){let e=d();i(),c(e.error)}}function M(t,p){if(t&1&&(r(0,"p",9),a(1),o(2,"translate"),n(),r(3,"div",10)(4,"div",11)(5,"span"),v(6,"i",12),a(7),o(8,"translate"),n()(),r(9,"div",11)(10,"span",12),v(11,"i",12),a(12),o(13,"translate"),n()()()),t&2){let e=d();i(),c(l(2,6,"restart.please_wait_while_server_restarts")),i(5),x("ngClass",g(12,U,!e.uiOnline,e.uiOnline)),i(),h(" ",l(8,8,"restart.ui_online")," "),i(3),x("ngClass",b(15,F,!e.uiOnline)),i(),x("ngClass",g(17,P,!e.uiOnline,e.uiOnline)),i(),h(" ",l(13,10,"restart.service_ready")," ")}}function V(t,p){if(t&1){let e=$();r(0,"p",15)(1,"button",16),S("click",function(){C(e);let u=d(2);return y(u.viewLogs())}),a(2),o(3,"translate"),n()()}t&2&&(i(2),c(l(3,1,"menu.tooltip_view_logs")))}function z(t,p){if(t&1&&(r(0,"div",8)(1,"p"),a(2),o(3,"translate"),n(),r(4,"p",13),a(5),o(6,"translate"),r(7,"span",14),a(8),n()(),f(9,V,4,3,"p",15),n()),t&2){let e=d();i(2),c(l(3,4,"restart.server_is_taking_long_time_to_restart")),i(3),h(" ",l(6,6,"restart.label_restart_command_executed"),": "),i(3),c(e.resp.command||"End Process"),i(),_(e.uiOnline?9:-1)}}var X=(()=>{class t{$api=m(B);$router=m(E);$settings=m(R);$toastr=m(O);$translate=m(k);$ws=m(D);checkTimeout;checkDelay;io;uiOnline=!1;error=!1;resp={};timeout=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$router.parseUrl(this.$router.url).queryParams.restarting?(this.uiOnline=!0,this.checkIfServerUp()):this.$api.put("/server/restart",{}).subscribe({next:s=>{this.resp=s,this.checkIfServerUp(),s.restartingUI||(this.uiOnline=!0)},error:s=>{console.error(s),this.error=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"))}})}viewLogs(){this.$router.navigate(["/logs"])}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{this.uiOnline=!0,(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("restart.toast_server_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},7e3),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},4e4)}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=w({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","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"],[3,"ngClass"],[1,"grey-text","mb-0"],[1,"font-monospace"],[1,"mt-2","mb-0"],[1,"btn","btn-primary","mb-0",3,"click"]],template:function(s,u){s&1&&(r(0,"div",0)(1,"h3",1),a(2),o(3,"translate"),n()(),r(4,"div",2)(5,"div",3),v(6,"i",4),n(),r(7,"div",5)(8,"h4",6),a(9),o(10,"translate"),n(),f(11,j,2,1,"div",7)(12,M,14,20),f(13,z,10,8,"div",8),n()()),s&2&&(i(2),c(l(3,4,"menu.restart.title")),i(7),c(l(10,6,"restart.title_restart")),i(2),_(u.error?11:12),i(2),_(u.timeout?13:-1))},dependencies:[T,I],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{X as RestartComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as z,b,c as k}from"./chunk-
|
|
1
|
+
import{a as z,b,c as k}from"./chunk-SVVKLOZB.js";import{a as u}from"./chunk-7LKAZJLI.js";import{n as f}from"./chunk-27UZT7QO.js";import{M as t,g as n,ga as p,h as c,la as a,n as h}from"./chunk-V7SOQAC5.js";var d=n(z(),1),l=n(b(),1),m=n(k(),1);var g=(()=>{class o{$ws=a(u);$api=a(f);io;fitAddon;webLinksAddon;resize;elementResize;dataDisposable=null;isInitializing=!1;hasUserTyped=!1;term;destroyTerminal(){this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=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(){this.destroyTerminal(),this.$api.post("/platform-tools/terminal/destroy-persistent-session",{}).subscribe({next:()=>console.log("Persistent session destroyed"),error:e=>console.error("Failed to destroy persistent session:",e)})}detachTerminal(){this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=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}checkBackendPersistentSession(){return c(this,null,function*(){try{return(yield this.$api.get("/platform-tools/terminal/has-persistent-session").toPromise()).hasPersistentSession}catch(e){return console.error("Failed to check backend persistent session:",e),!1}})}hasUserTypedInSession(){return this.hasUserTyped}isTerminalReady(){return this.term&&!this.isInitializing}reconnectTerminal(e,i={},r){if(this.isInitializing)return!1;this.isInitializing=!0,this.elementResize=r,this.io&&this.io.socket&&this.io.socket.connected?(this.term=new d.Terminal(i),this.fitAddon=new l.FitAddon,this.webLinksAddon=new m.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",s=>{this.term.write(s)}),this.io.socket.on("process-exit",()=>{this.startSession()}),this.dataDisposable&&this.dataDisposable.dispose(),this.dataDisposable=this.term.onData(s=>{this.hasUserTyped=!0,this.io.socket.emit("stdin",s)}),this.term.onResize(s=>{this.resize.next(s)}),this.resize.pipe(t(500)).subscribe(s=>{this.io.socket.emit("resize",s)}),this.elementResize&&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,i,r)}startTerminal(e,i={},r){return this.isInitializing?!1:(this.isInitializing=!0,this.elementResize=r,this.io=this.$ws.connectToNamespace("platform-tools/terminal"),this.term=new d.Terminal(i),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new l.FitAddon,this.webLinksAddon=new m.WebLinksAddon,this.resize=new h,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),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{d as n}from"./chunk-QRQBCPWO.js";import{b as s}from"./chunk-
|
|
1
|
+
import{d as n}from"./chunk-QRQBCPWO.js";import{b as s}from"./chunk-JC4MK5CR.js";import{ga as o,h as r,la as e,w as i}from"./chunk-V7SOQAC5.js";var l=(()=>{class t{$router=e(n);$settings=e(s);canActivate(){return r(this,null,function*(){return this.$settings.settingsLoaded||(yield i(this.$settings.onSettingsLoaded)),this.$settings.env.setupWizardComplete===!1||this.$router.navigate(["/"]),!0})}static \u0275fac=function(a){return new(a||t)};static \u0275prov=o({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as et,n as it}from"./chunk-BDGX3TPD.js";import{a as tt}from"./chunk-ZG3HINDJ.js";import{m as X}from"./chunk-K7QEGT3E.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-V7SOQAC5.js";var st=ut((J,q)=>{(function(L,T){typeof J=="object"&&typeof q<"u"?q.exports=T():typeof define=="function"&&define.amd?define(T):(L=typeof globalThis<"u"?globalThis:L||self).dayjs=T()})(J,function(){"use strict";var L=1e3,T=6e4,n=36e5,h="millisecond",d="second",l="minute",p="hour",v="day",y="week",S="month",Z="quarter",b="year",x="date",z="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|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,ot={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 s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},at={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(s,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,S),o=t-e<0,a=i.clone().add(s+(o?-1:1),S);return+(-(s+(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:S,y:b,w:y,d:v,D:x,h:p,m:l,s:d,ms:h,Q:Z}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",k={};k[A]=ot;var B="$isDayjsObject",U=function(r){return r instanceof W||!(!r||!r[B])},V=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var o=i.toLowerCase();k[o]&&(e=o),t&&(k[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;k[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},m=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new W(t)},u=at;u.l=V,u.i=U,u.w=function(r,i){return m(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var W=function(){function r(t){this.$L=V(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[B]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,o=s.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(nt);if(a){var c=a[2]-1||0,f=(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,f)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,f)}}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()!==z},i.isSame=function(t,s){var e=m(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return m(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<m(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,o=!!u.u(s)||s,a=u.p(t),c=function(_,M){var D=u.w(e.$u?Date.UTC(e.$y,M,_):new Date(e.$y,M,_),e);return o?D:D.endOf(v)},f=function(_,M){return u.w(e.toDate()[_].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},g=this.$W,$=this.$M,w=this.$D,j="set"+(this.$u?"UTC":"");switch(a){case b:return o?c(1,0):c(31,11);case S:return o?c(1,$):c(0,$+1);case y:var O=this.$locale().weekStart||0,H=(g<O?g+7:g)-O;return c(o?w-H:w+(6-H),$);case v:case x:return f(j+"Hours",0);case p:return f(j+"Minutes",1);case l:return f(j+"Seconds",2);case d:return f(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[v]=a+"Date",e[x]=a+"Date",e[S]=a+"Month",e[b]=a+"FullYear",e[p]=a+"Hours",e[l]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],f=o===v?this.$D+(s-this.$W):s;if(o===S||o===b){var g=this.clone().set(x,1);g.$d[c](f),g.init(),this.$d=g.set(x,Math.min(this.$D,g.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,o=this;t=Number(t);var a=u.p(s),c=function($){var w=m(o);return u.w(w.date(w.date()+Math.round($*t)),o)};if(a===S)return this.set(S,this.$M+t);if(a===b)return this.set(b,this.$y+t);if(a===v)return c(1);if(a===y)return c(7);var f=(e={},e[l]=T,e[p]=n,e[d]=L,e)[a]||1,g=this.$d.getTime()+t*f;return u.w(g,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||z;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,f=this.$m,g=this.$M,$=e.weekdays,w=e.months,j=e.meridiem,O=function(M,D,I,C){return M&&(M[D]||M(s,o))||I[D].slice(0,C)},H=function(M){return u.s(c%12||12,M,"0")},_=j||function(M,D,I){var C=M<12?"AM":"PM";return I?C.toLowerCase():C};return o.replace(rt,function(M,D){return D||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return g+1;case"MM":return u.s(g+1,2,"0");case"MMM":return O(e.monthsShort,g,w,3);case"MMMM":return O(w,g);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,$,2);case"ddd":return O(e.weekdaysShort,s.$W,$,3);case"dddd":return $[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,f,!0);case"A":return _(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$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,s,e){var o,a=this,c=u.p(s),f=m(t),g=(f.utcOffset()-this.utcOffset())*T,$=this-f,w=function(){return u.m(a,f)};switch(c){case b:o=w()/12;break;case S:o=w();break;case Z:o=w()/3;break;case y:o=($-g)/6048e5;break;case v:o=($-g)/864e5;break;case p:o=$/n;break;case l:o=$/T;break;case d:o=$/L;break;default:o=$}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(S).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),o=V(t,s,!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}(),K=W.prototype;return m.prototype=K,[["$ms",h],["$s",d],["$m",l],["$H",p],["$W",v],["$M",S],["$y",b],["$D",x]].forEach(function(r){K[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),m.extend=function(r,i){return r.$i||(r(i,W,m),r.$i=!0),m},m.locale=V,m.isDayjs=U,m.unix=function(r){return m(1e3*r)},m.en=k[A],m.Ls=k,m.p={},m})});var E=ct(st(),1);var vt=(()=>{class L{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return P(this,null,function*(){let n=yield N(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(l=>console.error("Error saving setTheme:",l)));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=n,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((l,p)=>{try{let v=l.contentDocument;if(v){let y=v.body;y.classList.remove(`config-ui-x-${this.theme}`),y.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.actualLightingMode==="dark"?(y.classList.add(`config-ui-x-dark-mode-${this.theme}`),y.classList.contains("dark-mode")||y.classList.add("dark-mode")):(y.classList.add(`config-ui-x-${this.theme}`),y.classList.contains("dark-mode")&&y.classList.remove("dark-mode")),l.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(v){console.warn(`Iframe ${p}: Access denied (cross-origin?)`,{error:v,src:l.src})}})}setMenuMode(n){this.menuMode=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),l=this.env;for(let p=0;p<d.length-1;p++){if(this.forbiddenKeys.includes(d[p]))return;l[d[p]]||(l[d[p]]={}),l=l[d[p]]}this.forbiddenKeys.includes(d[d.length-1])||(l[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,E.default)(n).diff((0,E.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||L)};static \u0275prov=R({token:L,factory:L.\u0275fac,providedIn:"root"})}return L})();export{st as a,vt as b};
|
|
1
|
+
import{k as et,n as it}from"./chunk-27UZT7QO.js";import{a as tt}from"./chunk-ZG3HINDJ.js";import{m as X}from"./chunk-K7QEGT3E.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-V7SOQAC5.js";var st=ut((J,q)=>{(function(L,T){typeof J=="object"&&typeof q<"u"?q.exports=T():typeof define=="function"&&define.amd?define(T):(L=typeof globalThis<"u"?globalThis:L||self).dayjs=T()})(J,function(){"use strict";var L=1e3,T=6e4,n=36e5,h="millisecond",d="second",l="minute",p="hour",v="day",y="week",S="month",Z="quarter",b="year",x="date",z="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|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,ot={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 s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},at={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(s,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,S),o=t-e<0,a=i.clone().add(s+(o?-1:1),S);return+(-(s+(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:S,y:b,w:y,d:v,D:x,h:p,m:l,s:d,ms:h,Q:Z}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",k={};k[A]=ot;var B="$isDayjsObject",U=function(r){return r instanceof W||!(!r||!r[B])},V=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var o=i.toLowerCase();k[o]&&(e=o),t&&(k[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;k[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},m=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new W(t)},u=at;u.l=V,u.i=U,u.w=function(r,i){return m(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var W=function(){function r(t){this.$L=V(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[B]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,o=s.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(nt);if(a){var c=a[2]-1||0,f=(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,f)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,f)}}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()!==z},i.isSame=function(t,s){var e=m(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return m(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<m(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,o=!!u.u(s)||s,a=u.p(t),c=function(_,M){var D=u.w(e.$u?Date.UTC(e.$y,M,_):new Date(e.$y,M,_),e);return o?D:D.endOf(v)},f=function(_,M){return u.w(e.toDate()[_].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},g=this.$W,$=this.$M,w=this.$D,j="set"+(this.$u?"UTC":"");switch(a){case b:return o?c(1,0):c(31,11);case S:return o?c(1,$):c(0,$+1);case y:var O=this.$locale().weekStart||0,H=(g<O?g+7:g)-O;return c(o?w-H:w+(6-H),$);case v:case x:return f(j+"Hours",0);case p:return f(j+"Minutes",1);case l:return f(j+"Seconds",2);case d:return f(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[v]=a+"Date",e[x]=a+"Date",e[S]=a+"Month",e[b]=a+"FullYear",e[p]=a+"Hours",e[l]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],f=o===v?this.$D+(s-this.$W):s;if(o===S||o===b){var g=this.clone().set(x,1);g.$d[c](f),g.init(),this.$d=g.set(x,Math.min(this.$D,g.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,o=this;t=Number(t);var a=u.p(s),c=function($){var w=m(o);return u.w(w.date(w.date()+Math.round($*t)),o)};if(a===S)return this.set(S,this.$M+t);if(a===b)return this.set(b,this.$y+t);if(a===v)return c(1);if(a===y)return c(7);var f=(e={},e[l]=T,e[p]=n,e[d]=L,e)[a]||1,g=this.$d.getTime()+t*f;return u.w(g,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||z;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,f=this.$m,g=this.$M,$=e.weekdays,w=e.months,j=e.meridiem,O=function(M,D,I,C){return M&&(M[D]||M(s,o))||I[D].slice(0,C)},H=function(M){return u.s(c%12||12,M,"0")},_=j||function(M,D,I){var C=M<12?"AM":"PM";return I?C.toLowerCase():C};return o.replace(rt,function(M,D){return D||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return g+1;case"MM":return u.s(g+1,2,"0");case"MMM":return O(e.monthsShort,g,w,3);case"MMMM":return O(w,g);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,$,2);case"ddd":return O(e.weekdaysShort,s.$W,$,3);case"dddd":return $[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,f,!0);case"A":return _(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$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,s,e){var o,a=this,c=u.p(s),f=m(t),g=(f.utcOffset()-this.utcOffset())*T,$=this-f,w=function(){return u.m(a,f)};switch(c){case b:o=w()/12;break;case S:o=w();break;case Z:o=w()/3;break;case y:o=($-g)/6048e5;break;case v:o=($-g)/864e5;break;case p:o=$/n;break;case l:o=$/T;break;case d:o=$/L;break;default:o=$}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(S).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),o=V(t,s,!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}(),K=W.prototype;return m.prototype=K,[["$ms",h],["$s",d],["$m",l],["$H",p],["$W",v],["$M",S],["$y",b],["$D",x]].forEach(function(r){K[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),m.extend=function(r,i){return r.$i||(r(i,W,m),r.$i=!0),m},m.locale=V,m.isDayjs=U,m.unix=function(r){return m(1e3*r)},m.en=k[A],m.Ls=k,m.p={},m})});var E=ct(st(),1);var vt=(()=>{class L{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return P(this,null,function*(){let n=yield N(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(l=>console.error("Error saving setTheme:",l)));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=n,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((l,p)=>{try{let v=l.contentDocument;if(v){let y=v.body;y.classList.remove(`config-ui-x-${this.theme}`),y.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.actualLightingMode==="dark"?(y.classList.add(`config-ui-x-dark-mode-${this.theme}`),y.classList.contains("dark-mode")||y.classList.add("dark-mode")):(y.classList.add(`config-ui-x-${this.theme}`),y.classList.contains("dark-mode")&&y.classList.remove("dark-mode")),l.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(v){console.warn(`Iframe ${p}: Access denied (cross-origin?)`,{error:v,src:l.src})}})}setMenuMode(n){this.menuMode=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),l=this.env;for(let p=0;p<d.length-1;p++){if(this.forbiddenKeys.includes(d[p]))return;l[d[p]]||(l[d[p]]={}),l=l[d[p]]}this.forbiddenKeys.includes(d[d.length-1])||(l[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,E.default)(n).diff((0,E.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||L)};static \u0275prov=R({token:L,factory:L.\u0275fac,providedIn:"root"})}return L})();export{st as a,vt as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as z,b as A,c as k}from"./chunk-
|
|
1
|
+
import{a as z,b as A,c as k}from"./chunk-SVVKLOZB.js";import{a as l}from"./chunk-7LKAZJLI.js";import{M as n,g as r,ga as c,la as d,n as h}from"./chunk-V7SOQAC5.js";var f=r(z(),1),a=r(A(),1),p=r(k(),1);var $=(()=>{class t{$ws=d(l);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;term;startTerminal(m,s={},u,w){this.pluginName=w,this.elementResize=u,this.io=this.$ws.connectToNamespace("log"),this.term=new f.Terminal(s),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new a.FitAddon,this.webLinksAddon=new p.WebLinksAddon,this.resize=new h,this.term.open(m.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.io.connected.subscribe(()=>{this.term.reset(),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{m as J}from"./chunk-PSSVCFFV.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-K2NEWUWG.js";import{d as Y}from"./chunk-QRQBCPWO.js";import{k as X,n as Z}from"./chunk-
|
|
1
|
+
import{m as J}from"./chunk-PSSVCFFV.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-K2NEWUWG.js";import{d as Y}from"./chunk-QRQBCPWO.js";import{k as X,n as Z}from"./chunk-27UZT7QO.js";import{a as K,b as Q}from"./chunk-ZG3HINDJ.js";import{Ec as N,Fc as P,Hb as A,Hc as m,Ib as _,Ic as p,Jb as u,Lb as k,Mb as E,Nb as $,Ob as C,Pb as o,Qb as a,Rb as w,_b as B,a as T,ab as s,b as R,bc as b,dc as d,h as M,id as j,la as y,mb as D,qc as c,ra as f,rc as g,sa as v,sc as h,tc as V,w as S,xc as F,yc as U,zc as L}from"./chunk-V7SOQAC5.js";var te=(t,l)=>({"btn-danger":t,"btn-elegant":l}),ie=(t,l,e)=>({"fa-trash":t,"fa-undo":l,"fa-spinner fa-pulse":e});function ne(t,l){t&1&&(o(0,"div",12),w(1,"i",13),a(),o(2,"p",14),c(3),m(4,"translate"),a()),t&2&&(s(3),g(p(4,1,"reset.no_accessories")))}function se(t,l){if(t&1&&(o(0,"option",24),c(1),a()),t&2){let e=l.$implicit;C("value",e._id),s(),V("",e.name," (",e._username,")")}}function oe(t,l){if(t&1){let e=B();o(0,"li",20),c(1),m(2,"translate"),a(),o(3,"li",18)(4,"label",21),c(5),m(6,"translate"),a(),o(7,"div",22)(8,"select",23),L("ngModelChange",function(i){f(e);let r=d(2);return U(r.selectedBridge,i)||(r.selectedBridge=i),v(i)}),b("change",function(i){f(e);let r=d(2);return v(r.onBridgeChange(i.target.value))}),E(9,se,2,3,"option",24,k),a()()()}if(t&2){let e=d(2);s(),g(p(2,3,"form.label.changes_kept")),s(4),g(p(6,5,"reset.accessory_ind.bridge")),s(3),F("ngModel",e.selectedBridge),s(),$(e.pairings)}}function ae(t,l){if(t&1&&(o(0,"li",18)(1,"label",25),c(2),m(3,"translate"),a(),o(4,"div",26),c(5),a()()),t&2){let e=d(2);s(2),g(p(3,2,"reset.accessory_ind.bridge")),s(3),h(" ",e.getCurrentlySelectedBridge()," ")}}function re(t,l){if(t&1){let e=B();o(0,"li",19)(1,"span"),c(2),w(3,"br"),o(4,"small")(5,"span",27),c(6),a()()(),o(7,"button",28),m(8,"translate"),b("click",function(){let i=f(e).$implicit,r=d(2);return v(r.toggleList(i.UUID,i.$cacheFile))}),w(9,"i",29),a()()}if(t&2){let e=l.$implicit,n=d(2);s(2),h(" ",e.displayName),s(4),g(e.UUID),s(),C("disabled",n.clicked)("ngClass",N(8,te,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile))),A("aria-label",p(8,6,"form.button_delete")),s(2),C("ngClass",P(11,ie,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile)&&!n.clicked,n.isInList(e.UUID,e.$cacheFile)&&n.clicked))}}function le(t,l){if(t&1&&(o(0,"div",12),w(1,"i",15),a(),o(2,"ul",16)(3,"li"),c(4),m(5,"translate"),a(),o(6,"li"),c(7),m(8,"translate"),a(),o(9,"li"),c(10),m(11,"translate"),a()(),o(12,"ul",17),_(13,oe,11,7),_(14,ae,6,4,"li",18),E(15,re,10,15,"li",19,k),a()),t&2){let e=d();s(4),g(p(5,5,"reset.accessory_ind.list_1")),s(3),g(p(8,7,"reset.accessory_ind.list_2")),s(3),g(p(11,9,"reset.accessory_ind.list_3")),s(3),u(e.pairings.length>1?13:-1),s(),u(e.pairings.length===1?14:-1),s(),$(e.selectedBridgeAccessories)}}function ce(t,l){if(t&1){let e=B();o(0,"button",30),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}if(t&2){let e=d();C("disabled",e.clicked),s(),h(" ",p(2,2,"form.button_close")," ")}}function de(t,l){if(t&1){let e=B();o(0,"button",31),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}t&2&&(s(),h(" ",p(2,1,"form.button_close")," "))}function me(t,l){if(t&1&&c(0),t&2){let e=d(3);h(" (",e.toDelete.length,") ")}}function pe(t,l){if(t&1&&(c(0),m(1,"translate"),_(2,me,1,1)),t&2){let e=d(2);h(" ",p(1,2,"form.button_remove")," "),s(2),u(e.toDelete.length>0?2:-1)}}function _e(t,l){t&1&&w(0,"i",33)}function ue(t,l){if(t&1){let e=B();o(0,"button",32),b("click",function(){f(e);let i=d();return v(i.removeAccessories())}),_(1,pe,3,4),_(2,_e,1,0,"i",33),a()}if(t&2){let e=d();C("disabled",!e.toDelete.length||e.clicked),s(),u(e.clicked?-1:1),s(),u(e.clicked?2:-1)}}var ke=(()=>{class t{$activeModal=y(J);$api=y(Z);$router=y(Y);$toastr=y(X);$translate=y(K);selectedBridge="";pairings=[];clicked=!1;selectedBridgeAccessories=[];accessoriesExist=!1;toDelete=[];ngOnInit(){this.loadCachedAccessories()}onBridgeChange(e){this.selectedBridge=e,this.selectedBridgeAccessories=this.pairings.find(n=>n._id===this.selectedBridge)?.accessories}getCurrentlySelectedBridge(){let e=this.pairings.find(n=>n._id===this.selectedBridge);return`${e.name} - ${e._username}`}toggleList(e,n){this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)?this.toDelete=this.toDelete.filter(i=>i.uuid!==e||i.cacheFile!==n):this.toDelete.push({cacheFile:n,uuid:e})}isInList(e,n){return this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)}removeAccessories(){return this.clicked=!0,this.$api.delete("/server/cached-accessories",{body:this.toDelete}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadCachedAccessories(){return M(this,null,function*(){try{let[e,n]=yield Promise.all([S(this.$api.get("/server/cached-accessories")),S(this.$api.get("/server/pairings"))]),i=new Map(n.map(r=>[r._id,R(T({},r),{accessories:[]})]));e.sort((r,x)=>r.displayName.localeCompare(x.displayName)).forEach(r=>{let x=n.find(ee=>ee._main),I=r.$cacheFile?.split(".")?.[1]||x._id;(!this.selectedBridge||this.selectedBridge===I)&&(i.has(I)||i.set(I,{_id:I,_username:I.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),i.get(I).accessories.push(r))}),this.pairings=Array.from(i.values()).filter(r=>r.accessories.length>0).sort((r,x)=>r._main&&!x._main?-1:!r._main&&x._main?1:r.name.localeCompare(x.name)),this.selectedBridge=this.selectedBridge||this.pairings[0]?._id,this.selectedBridge&&(this.accessoriesExist=!0,this.selectedBridgeAccessories=this.pairings[0].accessories)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=D({type:t,selectors:[["ng-component"]],inputs:{selectedBridge:"selectedBridge"},decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-network-wired","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"list-group-item","text-center","grey-text","small"],["for","bridgeSelect",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["id","bridgeSelect",1,"custom-select",3,"ngModelChange","change","ngModel"],[3,"value"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text","font-monospace"],[1,"font-monospace","grey-text"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(n,i){n&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),c(3),m(4,"translate"),a(),o(5,"button",3),m(6,"translate"),b("click",function(){return i.dismissModal()}),a()(),o(7,"div",4),_(8,ne,5,3),_(9,le,17,11),a(),o(10,"div",5)(11,"div",6),_(12,ce,3,4,"button",7),a(),o(13,"div",8),_(14,de,3,3,"button",9),a(),o(15,"div",10),_(16,ue,3,3,"button",11),a()()()),n&2&&(s(3),g(p(4,8,"reset.accessory_ind.title")),s(2),C("disabled",i.clicked),A("aria-label",p(6,10,"form.button_close")),s(3),u(i.accessoriesExist?-1:8),s(),u(i.accessoriesExist?9:-1),s(3),u(i.accessoriesExist?12:-1),s(2),u(i.accessoriesExist?-1:14),s(2),u(i.accessoriesExist?16:-1))},dependencies:[j,H,q,G,z,O,W,Q],encapsulation:2})}return t})();export{ke as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-J66U6NNP.js";import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-JC4MK5CR.js";import"./chunk-27UZT7QO.js";import"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ha as o,nb as r}from"./chunk-V7SOQAC5.js";var a=[{path:"",loadComponent:()=>import("./chunk-3WSNVOIX.js").then(t=>t.SetupWizardComponent)}],u=(()=>{class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=r({type:t});static \u0275inj=o({imports:[i.forChild(a),i]})}return t})();var l=(()=>{class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=r({type:t});static \u0275inj=o({providers:[n],imports:[u]})}return t})();export{l as SetupWizardModule};
|