homebridge-config-ui-x 5.8.1-beta.9 → 5.9.0

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +12 -8
  2. package/dist/core/auth/auth.controller.d.ts +0 -5
  3. package/dist/core/config/config.interfaces.d.ts +0 -10
  4. package/dist/core/config/config.service.d.ts +0 -9
  5. package/dist/core/config/config.service.js +0 -18
  6. package/dist/core/config/config.service.js.map +1 -1
  7. package/dist/core/config/config.startup.js +17 -48
  8. package/dist/core/config/config.startup.js.map +1 -1
  9. package/dist/core/feature-flags/feature-flags.registry.js +0 -5
  10. package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
  11. package/dist/core/spa/spa.filter.d.ts +0 -3
  12. package/dist/core/spa/spa.filter.js +2 -21
  13. package/dist/core/spa/spa.filter.js.map +1 -1
  14. package/dist/globalDefaults.js +0 -3
  15. package/dist/globalDefaults.js.map +1 -1
  16. package/dist/main.js +4 -18
  17. package/dist/main.js.map +1 -1
  18. package/dist/modules/child-bridges/child-bridges.interfaces.d.ts +0 -9
  19. package/dist/modules/config-editor/config-editor.controller.d.ts +0 -5
  20. package/dist/modules/config-editor/config-editor.controller.js +1 -46
  21. package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
  22. package/dist/modules/config-editor/config-editor.module.js +0 -2
  23. package/dist/modules/config-editor/config-editor.module.js.map +1 -1
  24. package/dist/modules/config-editor/config-editor.service.d.ts +1 -9
  25. package/dist/modules/config-editor/config-editor.service.js +3 -42
  26. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  27. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +1 -1
  28. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
  29. package/dist/modules/plugins/plugins.service.js +0 -15
  30. package/dist/modules/plugins/plugins.service.js.map +1 -1
  31. package/dist/modules/server/server.controller.d.ts +0 -20
  32. package/dist/modules/server/server.controller.js +1 -86
  33. package/dist/modules/server/server.controller.js.map +1 -1
  34. package/dist/modules/server/server.service.d.ts +0 -18
  35. package/dist/modules/server/server.service.js +14 -243
  36. package/dist/modules/server/server.service.js.map +1 -1
  37. package/dist/modules/status/status.gateway.d.ts +0 -2
  38. package/dist/modules/status/status.interfaces.d.ts +0 -11
  39. package/dist/modules/status/status.service.d.ts +1 -4
  40. package/dist/modules/status/status.service.js +0 -9
  41. package/dist/modules/status/status.service.js.map +1 -1
  42. package/package.json +18 -20
  43. package/public/assets/plugin-ui-utils/ui.js +0 -3
  44. package/public/assets/plugin-ui-utils/ui.js.map +1 -1
  45. package/public/{chunk-KXMAXE4R.js → chunk-2JSU6A57.js} +1 -1
  46. package/public/chunk-3DANXKYW.js +1 -0
  47. package/public/{chunk-7SIYOZHS.js → chunk-3HKQMTY5.js} +1 -1
  48. package/public/{chunk-3FAMSVXD.js → chunk-3PJWBNGU.js} +1 -1
  49. package/public/chunk-4E3QJA2Q.js +1 -0
  50. package/public/{chunk-CQLJRFML.js → chunk-4FV7QIK7.js} +1 -1
  51. package/public/{chunk-O6NBNFQY.js → chunk-57P3RXT7.js} +1 -1
  52. package/public/{chunk-TM3GPSGY.js → chunk-5PCQVX7H.js} +1 -1
  53. package/public/{chunk-UVJAAX6F.js → chunk-5R3NYRBJ.js} +1 -1
  54. package/public/{chunk-G7YHKE6Q.js → chunk-5WH5JZQ5.js} +1 -1
  55. package/public/{chunk-JMEKE42E.js → chunk-6W43YCZG.js} +1 -1
  56. package/public/{chunk-XUNLDCRF.js → chunk-75E7S6CO.js} +1 -1
  57. package/public/{chunk-YEGUQ6BV.js → chunk-7F2HVPC5.js} +1 -1
  58. package/public/{chunk-JPABYNGA.js → chunk-7PXKC75G.js} +1 -1
  59. package/public/{chunk-UFWKHJBO.js → chunk-AOCOR5BO.js} +1 -1
  60. package/public/{chunk-EMATQSTM.js → chunk-AYMJQ6UO.js} +1 -1
  61. package/public/chunk-BJ4JCAZT.js +1 -0
  62. package/public/{chunk-YLFJH4ZN.js → chunk-BJ7NEXKS.js} +1 -1
  63. package/public/chunk-BQ2T2C4E.js +1 -0
  64. package/public/{chunk-FWFAITD5.js → chunk-CDA3O4BZ.js} +1 -1
  65. package/public/{chunk-FV3HFHGO.js → chunk-CFEDPWK5.js} +1 -1
  66. package/public/chunk-CLRVHL2M.js +1 -0
  67. package/public/{chunk-J6Q2DPRL.js → chunk-CUP4YO7L.js} +1 -1
  68. package/public/{chunk-4HK45EZZ.js → chunk-DRO3CNQN.js} +1 -1
  69. package/public/{chunk-KYFLQ7R3.js → chunk-DT6ICOAZ.js} +1 -1
  70. package/public/{chunk-I3LS2LYV.js → chunk-DWKQU3C2.js} +1 -1
  71. package/public/{chunk-BVPKNRJ5.js → chunk-EUGVBS4N.js} +1 -1
  72. package/public/{chunk-MX4QIKLG.js → chunk-EV5RCPGM.js} +1 -1
  73. package/public/{chunk-BIXWXEEW.js → chunk-F2E7FMEJ.js} +1 -1
  74. package/public/chunk-F72JFLBX.js +1 -0
  75. package/public/{chunk-HW3MSWTY.js → chunk-FJCVFWLW.js} +1 -1
  76. package/public/{chunk-GTDW723Y.js → chunk-FW6YLROT.js} +1 -1
  77. package/public/{chunk-FL5WOIA5.js → chunk-ICEM4QHU.js} +4 -4
  78. package/public/{chunk-TXPILR4Q.js → chunk-IDDSROZF.js} +1 -1
  79. package/public/{chunk-Q433GZ7T.js → chunk-IESBL4DA.js} +1 -1
  80. package/public/chunk-J7EVJFYY.js +16 -0
  81. package/public/{chunk-M7KNBKKW.js → chunk-KW266TAV.js} +1 -1
  82. package/public/{chunk-JEYVH76Q.js → chunk-KX4SDDFZ.js} +1 -1
  83. package/public/{chunk-GZCP5O2M.js → chunk-LRD25TWX.js} +1 -1
  84. package/public/{chunk-TVXZP4H4.js → chunk-LTQGLD2K.js} +1 -1
  85. package/public/{chunk-QBXFYFYT.js → chunk-LWOAR6BY.js} +1 -1
  86. package/public/{chunk-JXIXFPYL.js → chunk-M4T2RO3I.js} +1 -1
  87. package/public/{chunk-DY2KPRGT.js → chunk-MFEME63Q.js} +1 -1
  88. package/public/{chunk-YYORCSG2.js → chunk-MMLBIEDP.js} +2 -2
  89. package/public/chunk-MY3FPHNS.js +1 -0
  90. package/public/{chunk-O4BJGTI7.js → chunk-MYSGML5C.js} +1 -1
  91. package/public/chunk-N5GOQDTB.js +1 -0
  92. package/public/{chunk-3EGKGDG3.js → chunk-OQ5J7Z5A.js} +1 -1
  93. package/public/{chunk-BZ3A4ACS.js → chunk-PK7EWRSF.js} +1 -1
  94. package/public/{chunk-E4F7OMPM.js → chunk-PYFU3YSX.js} +1 -1
  95. package/public/{chunk-HEPGRHAI.js → chunk-QTJ3CQHI.js} +1 -1
  96. package/public/chunk-RSNBQILW.js +4 -0
  97. package/public/{chunk-2J443NKY.js → chunk-TCYDYM5A.js} +1 -1
  98. package/public/{chunk-Q3I2P3QX.js → chunk-U3JDCGCU.js} +1 -1
  99. package/public/chunk-UBFASDE7.js +1 -0
  100. package/public/{chunk-ZUOOJCCP.js → chunk-UGSDROFZ.js} +1 -1
  101. package/public/{chunk-IHRS3X44.js → chunk-UHOVCHON.js} +1 -1
  102. package/public/{chunk-LFBPJ5H2.js → chunk-VB3KKHCI.js} +1 -1
  103. package/public/chunk-VLG3LTSC.js +50 -0
  104. package/public/{chunk-Y7FUFGRH.js → chunk-WGFPD4J2.js} +1 -1
  105. package/public/chunk-WHIRPY75.js +1 -0
  106. package/public/{chunk-IT7RBQCC.js → chunk-WZ6CFZR4.js} +1 -1
  107. package/public/{chunk-PELXH4TO.js → chunk-X2HK2VP5.js} +1 -1
  108. package/public/{chunk-RM3JSPOW.js → chunk-X3DENUZZ.js} +1 -1
  109. package/public/chunk-X7FSVUGO.js +19 -0
  110. package/public/chunk-XYUTAICH.js +1 -0
  111. package/public/{chunk-NAQHC4AS.js → chunk-XYVHCMEV.js} +1 -1
  112. package/public/{chunk-JKWMQZ3W.js → chunk-YZT252N4.js} +1 -1
  113. package/public/index.html +2 -2
  114. package/public/{main-AKOTWTVU.js → main-OQMKHLDX.js} +1 -1
  115. package/public/{styles-CSF457UW.css → styles-7EFV5QBG.css} +1 -1
  116. package/scripts/extract-plugin-alias.js +2 -53
  117. package/dist/core/spa/spa-html.service.d.ts +0 -5
  118. package/dist/core/spa/spa-html.service.js +0 -38
  119. package/dist/core/spa/spa-html.service.js.map +0 -1
  120. package/dist/core/ssl/ssl-cert-generator.service.d.ts +0 -15
  121. package/dist/core/ssl/ssl-cert-generator.service.js +0 -127
  122. package/dist/core/ssl/ssl-cert-generator.service.js.map +0 -1
  123. package/public/assets/matter.svg +0 -8
  124. package/public/chunk-4JJLG2LI.js +0 -1
  125. package/public/chunk-AIOEOAJT.js +0 -1
  126. package/public/chunk-ALTGKKWS.js +0 -19
  127. package/public/chunk-D4JE2PJM.js +0 -1
  128. package/public/chunk-DO4ZVBIN.js +0 -1
  129. package/public/chunk-ITYYVISK.js +0 -1
  130. package/public/chunk-JVGI7EYV.js +0 -1
  131. package/public/chunk-KTSCOZH6.js +0 -1
  132. package/public/chunk-MX4NRP2P.js +0 -1
  133. package/public/chunk-NKVA4YGF.js +0 -1
  134. package/public/chunk-OKDXVFVJ.js +0 -1
  135. package/public/chunk-R6QXBK7G.js +0 -50
  136. package/public/chunk-RALJDJBK.js +0 -1
  137. package/public/chunk-XAMKEFQQ.js +0 -16
  138. package/public/chunk-YKCEZ4EC.js +0 -4
  139. package/public/media/matter-P563JGDL.svg +0 -8
@@ -6,7 +6,6 @@
6
6
 
7
7
  const process = require('node:process')
8
8
  const EventEmitter = require('node:events').EventEmitter
9
- const { readFileSync } = require('node:fs')
10
9
  const path = require('node:path')
11
10
 
12
11
  let pluginAlias
@@ -37,26 +36,6 @@ const HomebridgeApiMock = {
37
36
  serverVersion: '1.2.3',
38
37
  on: () => { /** mock */ },
39
38
  emit: () => { /** mock */ },
40
- // Mock Matter API
41
- isMatterAvailable() {
42
- return true
43
- },
44
- isMatterEnabled() {
45
- return true
46
- },
47
- matterDeviceTypes: new Proxy({}, {
48
- get() {
49
- return {} // Return empty object for any device type
50
- },
51
- }),
52
- matterClusters: new Proxy({}, {
53
- get() {
54
- return {} // Return empty object for any cluster
55
- },
56
- }),
57
- registerMatterAccessory: () => { /** mock */ },
58
- unregisterMatterAccessory: () => { /** mock */ },
59
- updateMatterAccessoryState: () => { /** mock */ },
60
39
  hap: {
61
40
  Characteristic: new class Characteristic extends EventEmitter {
62
41
  constructor() {
@@ -120,41 +99,11 @@ const HomebridgeApiMock = {
120
99
  },
121
100
  }
122
101
 
123
- async function main() {
102
+ function main() {
124
103
  try {
125
104
  let pluginInitializer
126
105
  const pluginPath = process.env.UIX_EXTRACT_PLUGIN_PATH
127
-
128
- // Read package.json to get the proper entry point
129
- let actualEntryPoint = pluginPath
130
- try {
131
- const packageJsonPath = path.join(pluginPath, 'package.json')
132
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
133
-
134
- if (packageJson.main) {
135
- actualEntryPoint = path.join(pluginPath, packageJson.main)
136
- }
137
- } catch (err) {
138
- console.error('[extract-plugin-alias] Could not read package.json, using directory path')
139
- }
140
-
141
- let pluginModules
142
-
143
- // Try to load as CommonJS first
144
- try {
145
- pluginModules = require(actualEntryPoint)
146
- } catch (requireError) {
147
- // If require fails, try dynamic import for ESM modules
148
- try {
149
- // For ESM, we need to use file:// URL on some platforms
150
- const importPath = actualEntryPoint.startsWith('/') || actualEntryPoint.startsWith('file://')
151
- ? actualEntryPoint
152
- : path.resolve(actualEntryPoint)
153
- pluginModules = await import(importPath)
154
- } catch (importError) {
155
- throw requireError // Throw the original error
156
- }
157
- }
106
+ const pluginModules = require(pluginPath)
158
107
 
159
108
  if (typeof pluginModules === 'function') {
160
109
  pluginInitializer = pluginModules
@@ -1,5 +0,0 @@
1
- export declare class SpaHtmlService {
2
- static updateIndexHtml(webroot: string): Promise<void>;
3
- private static normalizeWebroot;
4
- private static transformHtmlForWebroot;
5
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SpaHtmlService = void 0;
7
- const node_path_1 = require("node:path");
8
- const node_process_1 = __importDefault(require("node:process"));
9
- const fs_extra_1 = require("fs-extra");
10
- class SpaHtmlService {
11
- static async updateIndexHtml(webroot) {
12
- const indexPath = (0, node_path_1.resolve)(node_process_1.default.env.UIX_BASE_PATH, 'public/index.html');
13
- if (!(await (0, fs_extra_1.exists)(indexPath))) {
14
- return;
15
- }
16
- const originalHtml = await (0, fs_extra_1.readFile)(indexPath, 'utf-8');
17
- const normalizedWebroot = this.normalizeWebroot(webroot);
18
- const modifiedHtml = this.transformHtmlForWebroot(originalHtml, normalizedWebroot);
19
- await (0, fs_extra_1.writeFile)(indexPath, modifiedHtml);
20
- }
21
- static normalizeWebroot(webroot) {
22
- if (!webroot || webroot === '/') {
23
- return '';
24
- }
25
- return webroot.replace(/\/+/g, '/').replace(/^\/+|\/+$/g, '');
26
- }
27
- static transformHtmlForWebroot(html, webroot) {
28
- const baseHref = webroot ? `/${webroot}/` : '/';
29
- return html
30
- .replace(/<base href="[^"]*"(\s*)\/?>/g, `<base href="${baseHref}"$1/>`)
31
- .replace(/href="\/(?:.*?\/)?assets\//g, 'href="assets/')
32
- .replace(/href="\/(?:.*?\/)?favicon\.ico"/g, 'href="favicon.ico"')
33
- .replace(/href="\/(?:.*?\/)?([^"/]+\.(png|svg|webmanifest))"/g, 'href="$1"')
34
- .replace(/src="\/(?:.*?\/)?assets\//g, 'src="assets/');
35
- }
36
- }
37
- exports.SpaHtmlService = SpaHtmlService;
38
- //# sourceMappingURL=spa-html.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spa-html.service.js","sourceRoot":"","sources":["../../../src/core/spa/spa-html.service.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,gEAAkC;AAElC,uCAAsD;AAEtD,MAAa,cAAc;IAKzB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,OAAe;QAC1C,MAAM,SAAS,GAAG,IAAA,mBAAO,EAAC,sBAAO,CAAC,GAAG,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAA;QACzE,IAAI,CAAC,CAAC,MAAM,IAAA,iBAAM,EAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,IAAA,mBAAQ,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QACvD,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAA;QAClF,MAAM,IAAA,oBAAS,EAAC,SAAS,EAAE,YAAY,CAAC,CAAA;IAC1C,CAAC;IAOO,MAAM,CAAC,gBAAgB,CAAC,OAAe;QAC7C,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YAChC,OAAO,EAAE,CAAA;QACX,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;IAQO,MAAM,CAAC,uBAAuB,CAAC,IAAY,EAAE,OAAe;QAClE,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;QAE/C,OAAO,IAAI;aACR,OAAO,CAAC,8BAA8B,EAAE,eAAe,QAAQ,OAAO,CAAC;aACvE,OAAO,CAAC,6BAA6B,EAAE,eAAe,CAAC;aACvD,OAAO,CAAC,kCAAkC,EAAE,oBAAoB,CAAC;aACjE,OAAO,CAAC,qDAAqD,EAAE,WAAW,CAAC;aAC3E,OAAO,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAA;IAC1D,CAAC;CACF;AA7CD,wCA6CC"}
@@ -1,15 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- interface SslCertificateData {
3
- privateKey: Buffer;
4
- certificate: Buffer;
5
- }
6
- export declare class SslCertGeneratorService {
7
- private readonly logger;
8
- private readonly certDir;
9
- private readonly privateKeyPath;
10
- private readonly certificatePath;
11
- constructor();
12
- generateOrLoadCertificate(hostnames?: string[]): Promise<SslCertificateData>;
13
- private generateCertificate;
14
- }
15
- export {};
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- var SslCertGeneratorService_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.SslCertGeneratorService = void 0;
17
- const node_buffer_1 = require("node:buffer");
18
- const node_fs_1 = require("node:fs");
19
- const node_os_1 = require("node:os");
20
- const node_path_1 = require("node:path");
21
- const node_process_1 = __importDefault(require("node:process"));
22
- const common_1 = require("@nestjs/common");
23
- const fs_extra_1 = require("fs-extra");
24
- const node_forge_1 = __importDefault(require("node-forge"));
25
- const logger_service_1 = require("../logger/logger.service");
26
- let SslCertGeneratorService = SslCertGeneratorService_1 = class SslCertGeneratorService {
27
- constructor() {
28
- this.logger = new logger_service_1.Logger(SslCertGeneratorService_1.name);
29
- const storagePath = node_process_1.default.env.UIX_STORAGE_PATH || (0, node_path_1.resolve)((0, node_os_1.homedir)(), '.homebridge');
30
- this.certDir = (0, node_path_1.join)(storagePath, 'ssl-certs');
31
- this.privateKeyPath = (0, node_path_1.join)(this.certDir, 'private-key.pem');
32
- this.certificatePath = (0, node_path_1.join)(this.certDir, 'certificate.pem');
33
- }
34
- async generateOrLoadCertificate(hostnames = ['localhost']) {
35
- if ((0, node_fs_1.existsSync)(this.privateKeyPath) && (0, node_fs_1.existsSync)(this.certificatePath)) {
36
- try {
37
- const privateKey = await (0, fs_extra_1.readFile)(this.privateKeyPath);
38
- const certificate = await (0, fs_extra_1.readFile)(this.certificatePath);
39
- this.logger.log('Loaded existing self-signed certificate');
40
- return { privateKey, certificate };
41
- }
42
- catch (error) {
43
- this.logger.warn('Failed to load existing certificate, generating new one:', error.message);
44
- }
45
- }
46
- return this.generateCertificate(hostnames);
47
- }
48
- async generateCertificate(hostnames) {
49
- this.logger.log('Generating self-signed certificate...');
50
- try {
51
- await (0, fs_extra_1.ensureDir)(this.certDir);
52
- const keys = node_forge_1.default.pki.rsa.generateKeyPair(2048);
53
- const cert = node_forge_1.default.pki.createCertificate();
54
- cert.publicKey = keys.publicKey;
55
- cert.serialNumber = '01';
56
- cert.validity.notBefore = new Date();
57
- cert.validity.notAfter = new Date('2050-01-01T00:00:00Z');
58
- const attrs = [
59
- { name: 'commonName', value: hostnames[0] || 'localhost' },
60
- { name: 'countryName', value: 'US' },
61
- { shortName: 'ST', value: 'State' },
62
- { name: 'localityName', value: 'City' },
63
- { name: 'organizationName', value: 'Homebridge' },
64
- { shortName: 'OU', value: 'Homebridge UI' },
65
- ];
66
- cert.setSubject(attrs);
67
- cert.setIssuer(attrs);
68
- const extensions = [
69
- {
70
- name: 'basicConstraints',
71
- cA: true,
72
- },
73
- {
74
- name: 'keyUsage',
75
- keyCertSign: true,
76
- digitalSignature: true,
77
- nonRepudiation: true,
78
- keyEncipherment: true,
79
- dataEncipherment: true,
80
- },
81
- {
82
- name: 'extKeyUsage',
83
- serverAuth: true,
84
- clientAuth: true,
85
- },
86
- {
87
- name: 'subjectAltName',
88
- altNames: hostnames.map((hostname) => {
89
- if (/^(?:\d{1,3}\.){3}\d{1,3}$/.test(hostname) || /^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i.test(hostname)) {
90
- return {
91
- type: 7,
92
- ip: hostname,
93
- };
94
- }
95
- else {
96
- return {
97
- type: 2,
98
- value: hostname,
99
- };
100
- }
101
- }),
102
- },
103
- ];
104
- cert.setExtensions(extensions);
105
- cert.sign(keys.privateKey, node_forge_1.default.md.sha256.create());
106
- const privateKeyPem = node_forge_1.default.pki.privateKeyToPem(keys.privateKey);
107
- const certificatePem = node_forge_1.default.pki.certificateToPem(cert);
108
- await (0, fs_extra_1.writeFile)(this.privateKeyPath, privateKeyPem, 'utf8');
109
- await (0, fs_extra_1.writeFile)(this.certificatePath, certificatePem, 'utf8');
110
- this.logger.log(`Self-signed certificate generated successfully for: ${hostnames.join(', ')}`);
111
- return {
112
- privateKey: node_buffer_1.Buffer.from(privateKeyPem),
113
- certificate: node_buffer_1.Buffer.from(certificatePem),
114
- };
115
- }
116
- catch (error) {
117
- this.logger.error('Failed to generate self-signed certificate:', error);
118
- throw error;
119
- }
120
- }
121
- };
122
- exports.SslCertGeneratorService = SslCertGeneratorService;
123
- exports.SslCertGeneratorService = SslCertGeneratorService = SslCertGeneratorService_1 = __decorate([
124
- (0, common_1.Injectable)(),
125
- __metadata("design:paramtypes", [])
126
- ], SslCertGeneratorService);
127
- //# sourceMappingURL=ssl-cert-generator.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ssl-cert-generator.service.js","sourceRoot":"","sources":["../../../src/core/ssl/ssl-cert-generator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAAoC;AACpC,qCAAoC;AACpC,qCAAiC;AACjC,yCAAyC;AACzC,gEAAkC;AAElC,2CAA2C;AAC3C,uCAAyD;AACzD,4DAA8B;AAE9B,6DAAiD;AAW1C,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAMlC;QALiB,WAAM,GAAG,IAAI,uBAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAA;QAMhE,MAAM,WAAW,GAAG,sBAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAA,mBAAO,EAAC,IAAA,iBAAO,GAAE,EAAE,aAAa,CAAC,CAAA;QACrF,IAAI,CAAC,OAAO,GAAG,IAAA,gBAAI,EAAC,WAAW,EAAE,WAAW,CAAC,CAAA;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA;QAC3D,IAAI,CAAC,eAAe,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA;IAC9D,CAAC;IAMD,KAAK,CAAC,yBAAyB,CAAC,YAAsB,CAAC,WAAW,CAAC;QAEjE,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACxE,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,cAAc,CAAC,CAAA;gBACtD,MAAM,WAAW,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,eAAe,CAAC,CAAA;gBACxD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAA;gBAC1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;YACpC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0DAA0D,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7F,CAAC;QACH,CAAC;QAGD,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;IAC5C,CAAC;IAMO,KAAK,CAAC,mBAAmB,CAAC,SAAmB;QACnD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;QAExD,IAAI,CAAC;YAEH,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAG7B,MAAM,IAAI,GAAG,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAGhD,MAAM,IAAI,GAAG,oBAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAA;YAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAA;YAC/B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;YAGxB,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;YACpC,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAA;YAGzD,MAAM,KAAK,GAAG;gBACZ,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE;gBAC1D,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE;gBACpC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;gBACnC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE;gBACvC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE;gBACjD,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE;aAC5C,CAAA;YAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;YAGrB,MAAM,UAAU,GAAG;gBACjB;oBACE,IAAI,EAAE,kBAAkB;oBACxB,EAAE,EAAE,IAAI;iBACT;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,WAAW,EAAE,IAAI;oBACjB,gBAAgB,EAAE,IAAI;oBACtB,cAAc,EAAE,IAAI;oBACpB,eAAe,EAAE,IAAI;oBACrB,gBAAgB,EAAE,IAAI;iBACvB;gBACD;oBACE,IAAI,EAAE,aAAa;oBACnB,UAAU,EAAE,IAAI;oBAChB,UAAU,EAAE,IAAI;iBACjB;gBACD;oBACE,IAAI,EAAE,gBAAgB;oBACtB,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;wBAEnC,IAAI,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,yCAAyC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;4BAC3G,OAAO;gCACL,IAAI,EAAE,CAAC;gCACP,EAAE,EAAE,QAAQ;6BACb,CAAA;wBACH,CAAC;6BAAM,CAAC;4BACN,OAAO;gCACL,IAAI,EAAE,CAAC;gCACP,KAAK,EAAE,QAAQ;6BAChB,CAAA;wBACH,CAAC;oBACH,CAAC,CAAC;iBACH;aACF,CAAA;YAED,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;YAG9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;YAGpD,MAAM,aAAa,GAAG,oBAAK,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAChE,MAAM,cAAc,GAAG,oBAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YAGvD,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,CAAC,CAAA;YAC3D,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC,CAAA;YAE7D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uDAAuD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAE9F,OAAO;gBACL,UAAU,EAAE,oBAAM,CAAC,IAAI,CAAC,aAAa,CAAC;gBACtC,WAAW,EAAE,oBAAM,CAAC,IAAI,CAAC,cAAc,CAAC;aACzC,CAAA;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAA;YACvE,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA;AApIY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;;GACA,uBAAuB,CAoInC"}
@@ -1,8 +0,0 @@
1
- <svg height="512px" width="512px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2
- <g transform="translate(256, 280) scale(1.37) translate(-256, -256)">
3
- <path
4
- fill="currentColor"
5
- d="M256 212.26666666666665c-21.333333333333332 0 -41.421866666666666 -3.8218666666666667 -60.266666666666666 -11.466666666666665 -18.8448 -7.6448 -35.733333333333334 -18.0448 -50.666666666666664 -31.199999999999996l29.333333333333332 -17.599999999999998c8.533333333333333 6.3999999999999995 18.311466666666664 12 29.333333333333332 16.799999999999997 11.021866666666668 4.8 23.111466666666665 8.266666666666666 36.266666666666666 10.399999999999999V62.93333333333334L256 53.33333333333333l16 9.6v116.26666666666667c12.799999999999999 -2.1333333333333333 24.8 -5.6 36 -10.399999999999999 11.2 -4.8 21.066666666666666 -10.399999999999999 29.599999999999998 -16.799999999999997l29.333333333333332 17.599999999999998c-14.933333333333332 13.1552 -31.821866666666665 23.5552 -50.666666666666664 31.199999999999996C297.42186666666663 208.4448 277.3333333333333 212.26666666666665 256 212.26666666666665Zm-35.199999999999996 211.73333333333335 -29.866666666666664 -16c0.3552 -2.8447999999999998 0.6218666666666666 -5.511466666666667 0.7999999999999999 -8 0.1781333333333333 -2.4885333333333333 0.26666666666666666 -5.1552 0.26666666666666666 -8 0 -8.533333333333333 -0.9781333333333333 -17.511466666666664 -2.9333333333333336 -26.93333333333333 -1.9551999999999998 -9.421866666666666 -4.7114666666666665 -18.7552 -8.266666666666666 -28l-100.26666666666667 60.8L64 388.8V370.1333333333333l99.73333333333332 -60.266666666666666c-8.178133333333333 -9.6 -17.1552 -18.0448 -26.93333333333333 -25.333333333333332 -9.778133333333333 -7.2885333333333335 -19.821866666666665 -12.888533333333331 -30.133333333333333 -16.799999999999997v-34.13333333333333c34.13333333333333 10.311466666666666 62.22186666666667 29.955199999999998 84.26666666666667 58.93333333333334 22.0448 28.978133333333332 33.06666666666666 62.13333333333333 33.06666666666666 99.46666666666665 0 5.688533333333333 -0.26666666666666666 11.2 -0.7999999999999999 16.53333333333333 -0.5333333333333333 5.333333333333333 -1.3333333333333333 10.488533333333333 -2.4 15.466666666666665Zm70.39999999999999 0c-1.0666666666666667 -4.978133333333333 -1.8666666666666665 -10.133333333333333 -2.4 -15.466666666666665 -0.5333333333333333 -5.333333333333333 -0.7999999999999999 -10.8448 -0.7999999999999999 -16.53333333333333 0 -37.33333333333333 11.021866666666668 -70.48853333333332 33.06666666666666 -99.46666666666665 22.0448 -28.978133333333332 50.13333333333333 -48.62186666666666 84.26666666666667 -58.93333333333334v34.13333333333333c-10.311466666666666 3.9114666666666666 -20.3552 9.511466666666667 -30.133333333333333 16.799999999999997 -9.778133333333333 7.2885333333333335 -18.7552 15.733333333333334 -26.93333333333333 25.333333333333332L448 370.1333333333333v18.666666666666664l-16.53333333333333 9.066666666666666 -100.26666666666667 -60.8c-3.5551999999999997 9.2448 -6.311466666666666 18.578133333333334 -8.266666666666666 28 -1.9551999999999998 9.421866666666666 -2.9333333333333336 18.4 -2.9333333333333336 26.93333333333333 0 2.8447999999999998 0.08853333333333332 5.511466666666667 0.26666666666666666 8 0.1781333333333333 2.4885333333333333 0.4448 5.1552 0.7999999999999999 8l-29.866666666666664 16Z"
6
- />
7
- </g>
8
- </svg>
@@ -1 +0,0 @@
1
- import{k as tt,n as et,q as it}from"./chunk-MX4NRP2P.js";import{W as G,e as ut,g as ct,h as P,ia as R,n as Q,na as W,nd as X,x as B}from"./chunk-YYORCSG2.js";var st=ut((U,E)=>{(function(w,T){typeof U=="object"&&typeof E<"u"?E.exports=T():typeof define=="function"&&define.amd?define(T):(w=typeof globalThis<"u"?globalThis:w||self).dayjs=T()})(U,function(){"use strict";var w=1e3,T=6e4,s=36e5,h="millisecond",d="second",m="minute",M="hour",y="day",f="week",L="month",K="quarter",S="year",_="date",q="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 n=String(r);return!n||n.length>=i?r:""+Array(i+1-n.length).join(t)+r},at={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),n=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(n,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var n=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(n,L),o=t-e<0,a=i.clone().add(n+(o?-1:1),L);return+(-(n+(t-e)/(o?e-a:a-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:L,y:S,w:f,d:y,D:_,h:M,m,s:d,ms:h,Q:K}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},I="en",D={};D[I]=ot;var Z="$isDayjsObject",N=function(r){return r instanceof C||!(!r||!r[Z])},Y=function r(i,t,n){var e;if(!i)return I;if(typeof i=="string"){var o=i.toLowerCase();D[o]&&(e=o),t&&(D[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;D[c]=i,e=c}return!n&&e&&(I=e),e||!n&&I},g=function(r,i){if(N(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new C(t)},u=at;u.l=Y,u.i=N,u.w=function(r,i){return g(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var C=(function(){function r(t){this.$L=Y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Z]=!0}var i=r.prototype;return i.parse=function(t){this.$d=(function(n){var e=n.date,o=n.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(nt);if(a){var c=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(e)})(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==q},i.isSame=function(t,n){var e=g(t);return this.startOf(n)<=e&&e<=this.endOf(n)},i.isAfter=function(t,n){return g(t)<this.startOf(n)},i.isBefore=function(t,n){return this.endOf(n)<g(t)},i.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,n){var e=this,o=!!u.u(n)||n,a=u.p(t),c=function(x,v){var k=u.w(e.$u?Date.UTC(e.$y,v,x):new Date(e.$y,v,x),e);return o?k:k.endOf(y)},l=function(x,v){return u.w(e.toDate()[x].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(v)),e)},$=this.$W,p=this.$M,b=this.$D,H="set"+(this.$u?"UTC":"");switch(a){case S:return o?c(1,0):c(31,11);case L:return o?c(1,p):c(0,p+1);case f:var O=this.$locale().weekStart||0,j=($<O?$+7:$)-O;return c(o?b-j:b+(6-j),p);case y:case _:return l(H+"Hours",0);case M:return l(H+"Minutes",1);case m:return l(H+"Seconds",2);case d:return l(H+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,n){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[y]=a+"Date",e[_]=a+"Date",e[L]=a+"Month",e[S]=a+"FullYear",e[M]=a+"Hours",e[m]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],l=o===y?this.$D+(n-this.$W):n;if(o===L||o===S){var $=this.clone().set(_,1);$.$d[c](l),$.init(),this.$d=$.set(_,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](l);return this.init(),this},i.set=function(t,n){return this.clone().$set(t,n)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,n){var e,o=this;t=Number(t);var a=u.p(n),c=function(p){var b=g(o);return u.w(b.date(b.date()+Math.round(p*t)),o)};if(a===L)return this.set(L,this.$M+t);if(a===S)return this.set(S,this.$y+t);if(a===y)return c(1);if(a===f)return c(7);var l=(e={},e[m]=T,e[M]=s,e[d]=w,e)[a]||1,$=this.$d.getTime()+t*l;return u.w($,this)},i.subtract=function(t,n){return this.add(-1*t,n)},i.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||q;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,l=this.$m,$=this.$M,p=e.weekdays,b=e.months,H=e.meridiem,O=function(v,k,A,V){return v&&(v[k]||v(n,o))||A[k].slice(0,V)},j=function(v){return u.s(c%12||12,v,"0")},x=H||function(v,k,A){var V=v<12?"AM":"PM";return A?V.toLowerCase():V};return o.replace(rt,function(v,k){return k||(function(A){switch(A){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return $+1;case"MM":return u.s($+1,2,"0");case"MMM":return O(e.monthsShort,$,b,3);case"MMMM":return O(b,$);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return O(e.weekdaysMin,n.$W,p,2);case"ddd":return O(e.weekdaysShort,n.$W,p,3);case"dddd":return p[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return x(c,l,!0);case"A":return x(c,l,!1);case"m":return String(l);case"mm":return u.s(l,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return a}return null})(v)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,n,e){var o,a=this,c=u.p(n),l=g(t),$=(l.utcOffset()-this.utcOffset())*T,p=this-l,b=function(){return u.m(a,l)};switch(c){case S:o=b()/12;break;case L:o=b();break;case K:o=b()/3;break;case f:o=(p-$)/6048e5;break;case y:o=(p-$)/864e5;break;case M:o=p/s;break;case m:o=p/T;break;case d:o=p/w;break;default:o=p}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(L).$D},i.$locale=function(){return D[this.$L]},i.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),o=Y(t,n,!0);return o&&(e.$L=o),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r})(),z=C.prototype;return g.prototype=z,[["$ms",h],["$s",d],["$m",m],["$H",M],["$W",y],["$M",L],["$y",S],["$D",_]].forEach(function(r){z[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),g.extend=function(r,i){return r.$i||(r(i,C,g),r.$i=!0),g},g.locale=Y,g.isDayjs=N,g.unix=function(r){return g(1e3*r)},g.en=D[I],g.Ls=D,g.p={},g})});var J=ct(st(),1);var vt=(()=>{class w{$api=W(it);$title=W(X);$toastr=W(et);$translate=W(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};host;proxyHost;webroot;originalWebroot;formAuth=!0;sessionTimeout=28800;sessionTimeoutInactivityBased=!1;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;keepOrphans;wallpaper;serverTimeOffset=0;rtl=!1;browserLang;onSettingsLoaded=this.settingsLoadedSubject.pipe(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 s=yield B(this.$api.get("/auth/settings"));this.formAuth=s.formAuth,this.sessionTimeout=s.sessionTimeout,this.sessionTimeoutInactivityBased=s.sessionTimeoutInactivityBased,this.env=s.env,this.host=s.host,this.webroot=s.webroot,this.originalWebroot=s.originalWebroot,this.proxyHost=s.proxyHost,this.lightingMode=s.lightingMode,this.wallpaper=s.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(s.theme),this.setMenuMode(s.menuMode),this.setKeepOrphans(s.keepOrphans),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(s.serverTimestamp),this.setUiVersion(s.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0),this.browserLang=this.$translate.getBrowserCultureLang()})}setBrowserLightingMode(s){this.browserLightingMode=s,this.lightingMode==="auto"&&this.setLightingMode(s,"browser")}setLightingMode(s,h){h==="user"&&(this.lightingMode=s),this.currentLightingMode=s,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(s){(!s||!this.themeList.includes(s))&&(s=this.defaultTheme,B(this.$api.put("/config-editor/ui",{key:"theme",value:s})).catch(m=>console.error("Error saving setTheme:",m)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=s,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((m,M)=>{try{let y=m.contentDocument;if(y){let f=y.body;this.actualLightingMode==="dark"?(f.classList.contains(`config-ui-x-${this.theme}`)&&f.classList.remove(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)||f.classList.add(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")||f.classList.add("dark-mode"),f.style.backgroundColor="#242424 !important",f.style.color="#ffffff !important"):(f.classList.contains(`config-ui-x-${this.theme}`)||f.classList.add(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)&&f.classList.remove(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")&&f.classList.remove("dark-mode"),f.style.backgroundColor="#ffffff !important",f.style.color="#000000 !important"),m.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:s},window.location.origin)}}catch(y){console.warn(`Iframe ${M}: Access denied (cross-origin?)`,{error:y,src:m.src})}})}setMenuMode(s){this.menuMode=s}setKeepOrphans(s){this.keepOrphans=s}setLang(s){s?this.$translate.use(s):s="auto",this.env.lang=s}setItem(s,h){this[s]=h}setEnvItem(s,h){if(s.includes(".")){let d=s.split("."),m=this.env;for(let M=0;M<d.length-1;M+=1){if(this.forbiddenKeys.includes(d[M]))return;m[d[M]]||(m[d[M]]={}),m=m[d[M]]}this.forbiddenKeys.includes(d[d.length-1])||(m[d[d.length-1]]=h)}else this.env[s]=h}checkServerTime(s){let d=(0,J.default)(s).diff((0,J.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(s){this.uiVersion||(this.uiVersion=s)}setTitle(s){this.$title.setTitle(s||"Homebridge")}setPageTitle(s){let h=this.env.homebridgeInstanceName||"Homebridge";s?this.$title.setTitle(`${h} \u2014 ${s}`):this.$title.setTitle(h)}isFeatureEnabled(s){return this.env.featureFlags?.[s]??!1}static \u0275fac=function(h){return new(h||w)};static \u0275prov=R({token:w,factory:w.\u0275fac,providedIn:"root"})}return w})();export{st as a,vt as b};
@@ -1 +0,0 @@
1
- import{m as X}from"./chunk-PELXH4TO.js";import{B as Q,e as z,l as G,s as H,t as J,v as K}from"./chunk-YLFJH4ZN.js";import{e as te}from"./chunk-NKVA4YGF.js";import{b as ne}from"./chunk-4JJLG2LI.js";import{k as Y,l as Z,n as ee,q as ie}from"./chunk-MX4NRP2P.js";import{$b as f,Ib as E,Lb as B,Nb as m,Qa as s,Qc as W,_b as p,a as F,ac as w,b as V,bc as L,db as N,fc as P,gc as j,h as U,hc as q,mc as D,na as I,nc as O,pb as k,qb as g,rb as v,rc as u,sa as $,sc as _,ta as y,tb as M,ub as T,vb as R,wb as x,x as b,xb as a,yb as r,zb as S}from"./chunk-YYORCSG2.js";var oe=(t,c)=>({"fa-matter":t,"fa-hap":c}),ae=(t,c)=>({"btn-danger":t,"btn-elegant":c}),re=(t,c,e)=>({"fa-trash":t,"fa-undo":c,"fa-spinner fa-pulse":e});function le(t,c){t&1&&(a(0,"div",12),S(1,"i",13),r(),a(2,"p",14),p(3),u(4,"translate"),r()),t&2&&(s(3),f(_(4,1,"reset.no_accessories")))}function ce(t,c){if(t&1&&(a(0,"option",24),p(1),r()),t&2){let e=c.$implicit;x("value",e._id),s(),L("",e.name," (",e._username,")")}}function de(t,c){if(t&1){let e=E();a(0,"li",20),p(1),u(2,"translate"),r(),a(3,"li",18)(4,"label",21),p(5),u(6,"translate"),r(),a(7,"div",22)(8,"select",23),q("ngModelChange",function(i){$(e);let o=m(2);return j(o.selectedBridge,i)||(o.selectedBridge=i),y(i)}),B("change",function(i){$(e);let o=m(2);return y(o.onBridgeChange(i.target.value))}),T(9,ce,2,3,"option",24,M),r()()()}if(t&2){let e=m(2);s(),f(_(2,3,"form.label.changes_kept")),s(4),f(_(6,5,"reset.accessory_ind.bridge")),s(3),P("ngModel",e.selectedBridge),s(),R(e.pairings)}}function pe(t,c){if(t&1&&(a(0,"li",18)(1,"label",25),p(2),u(3,"translate"),r(),a(4,"div",26),p(5),r()()),t&2){let e=m(2);s(2),f(_(3,2,"reset.accessory_ind.bridge")),s(3),w(" ",e.getCurrentlySelectedBridge()," ")}}function me(t,c){if(t&1){let e=E();a(0,"li",19)(1,"span",27),S(2,"i",28),r(),a(3,"span",29),p(4),S(5,"br"),a(6,"small")(7,"span",30),p(8),r()()(),a(9,"button",31),u(10,"translate"),B("click",function(){let i=$(e).$implicit,o=m(2);return y(o.toggleList(i.UUID||i.uuid,i.$cacheFile,i.$protocol,i.$deviceId))}),S(11,"i",32),r()()}if(t&2){let e=c.$implicit,n=m(2);s(2),x("ngClass",D(9,oe,e.$protocol==="matter",e.$protocol!=="matter")),s(2),w(" ",e.displayName," "),s(4),f(e.UUID||e.uuid),s(),x("disabled",n.clicked)("ngClass",D(12,ae,!n.isInList(e.UUID||e.uuid,e.$cacheFile,e.$protocol),n.isInList(e.UUID||e.uuid,e.$cacheFile,e.$protocol))),k("aria-label",_(10,7,"form.button_delete")),s(2),x("ngClass",O(15,re,!n.isInList(e.UUID||e.uuid,e.$cacheFile,e.$protocol),n.isInList(e.UUID||e.uuid,e.$cacheFile,e.$protocol)&&!n.clicked,n.isInList(e.UUID||e.uuid,e.$cacheFile,e.$protocol)&&n.clicked))}}function ue(t,c){if(t&1&&(a(0,"div",12),S(1,"i",15),r(),a(2,"ul",16)(3,"li"),p(4),u(5,"translate"),r(),a(6,"li"),p(7),u(8,"translate"),r(),a(9,"li"),p(10),u(11,"translate"),r()(),a(12,"ul",17),g(13,de,11,7),g(14,pe,6,4,"li",18),T(15,me,12,19,"li",19,M),r()),t&2){let e=m();s(4),f(_(5,5,"reset.accessory_ind.list_1")),s(3),f(_(8,7,"reset.accessory_ind.list_2")),s(3),f(_(11,9,"reset.accessory_ind.list_3")),s(3),v(e.pairings.length>1?13:-1),s(),v(e.pairings.length===1?14:-1),s(),R(e.selectedBridgeAccessories)}}function _e(t,c){if(t&1){let e=E();a(0,"button",33),B("click",function(){$(e);let i=m();return y(i.dismissModal())}),p(1),u(2,"translate"),r()}if(t&2){let e=m();x("disabled",e.clicked),s(),w(" ",_(2,2,"form.button_close")," ")}}function ge(t,c){if(t&1){let e=E();a(0,"button",34),B("click",function(){$(e);let i=m();return y(i.dismissModal())}),p(1),u(2,"translate"),r()}t&2&&(s(),w(" ",_(2,1,"form.button_close")," "))}function ve(t,c){if(t&1&&p(0),t&2){let e=m(3);w(" (",e.toDelete.length,") ")}}function he(t,c){if(t&1&&(p(0),u(1,"translate"),g(2,ve,1,1)),t&2){let e=m(2);w(" ",_(1,2,"form.button_remove")," "),s(2),v(e.toDelete.length>0?2:-1)}}function fe(t,c){t&1&&S(0,"i",36)}function xe(t,c){if(t&1){let e=E();a(0,"button",35),B("click",function(){$(e);let i=m();return y(i.removeAccessories())}),g(1,he,3,4),g(2,fe,1,0,"i",36),r()}if(t&2){let e=m();x("disabled",!e.toDelete.length||e.clicked),s(),v(e.clicked?-1:1),s(),v(e.clicked?2:-1)}}var De=(()=>{class t{$activeModal=I(X);$api=I(ie);$router=I(te);$settings=I(ne);$toastr=I(ee);$translate=I(Y);isMatterSupported=this.$settings.isFeatureEnabled("matterSupport");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,i,o){this.toDelete.some(h=>h.uuid===e&&h.cacheFile===n&&h.protocol===i)?this.toDelete=this.toDelete.filter(h=>h.uuid!==e||h.cacheFile!==n||h.protocol!==i):this.toDelete.push({cacheFile:n,uuid:e,protocol:i,deviceId:o})}isInList(e,n,i){return this.toDelete.some(o=>o.uuid===e&&o.cacheFile===n&&o.protocol===i)}removeAccessories(){this.clicked=!0;let e=this.toDelete.filter(o=>o.protocol==="hap").map(o=>({uuid:o.uuid,cacheFile:o.cacheFile})),n=this.toDelete.filter(o=>o.protocol==="matter").map(o=>({uuid:o.uuid,deviceId:o.deviceId})),i=[];if(e.length>0&&i.push(this.$api.delete("/server/cached-accessories",{body:e})),this.isMatterSupported&&n.length>0&&i.push(this.$api.delete("/server/matter-accessories",{body:n})),i.length===0){this.clicked=!1;return}Promise.all(i.map(o=>b(o))).then(()=>{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}})}).catch(o=>{this.clicked=!1,console.error(o),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadCachedAccessories(){return U(this,null,function*(){try{let e=this.isMatterSupported?[b(this.$api.get("/server/cached-accessories")),b(this.$api.get("/server/matter-accessories")),b(this.$api.get("/server/pairings"))]:[b(this.$api.get("/server/cached-accessories")),b(this.$api.get("/server/pairings"))],n=yield Promise.all(e),i=n[0],o=this.isMatterSupported?n[1]:[],h=this.isMatterSupported?n[2]:n[1],C=new Map(h.map(l=>[l._id,V(F({},l),{accessories:[]})]));i.sort((l,d)=>l.displayName.localeCompare(d.displayName)).forEach(l=>{let d=h.find(se=>se._main),A=l.$cacheFile?.split(".")?.[1]||d._id;(!this.selectedBridge||this.selectedBridge===A)&&(C.has(A)||C.set(A,{_id:A,_username:A.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),l.$protocol="hap",C.get(A).accessories.push(l))}),this.isMatterSupported&&o.sort((l,d)=>l.displayName.localeCompare(d.displayName)).forEach(l=>{let d=l.$deviceId;(!this.selectedBridge||this.selectedBridge===d)&&(C.has(d)||C.set(d,{_id:d,_username:d.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),l.$protocol="matter",l.$cacheFile=d,C.get(d).accessories.push(l))}),this.pairings=Array.from(C.values()).filter(l=>l.accessories.length>0).sort((l,d)=>l._main&&!d._main?-1:!l._main&&d._main?1:l.name.localeCompare(d.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=N({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-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","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,"me-3"],[1,"fas","fa-lg",3,"ngClass"],[1,"flex-grow-1"],[1,"font-monospace","grey-text"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas",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-spinner","fa-pulse"]],template:function(n,i){n&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),p(3),u(4,"translate"),r(),a(5,"button",3),u(6,"translate"),B("click",function(){return i.dismissModal()}),r()(),a(7,"div",4),g(8,le,5,3),g(9,ue,17,11),r(),a(10,"div",5)(11,"div",6),g(12,_e,3,4,"button",7),r(),a(13,"div",8),g(14,ge,3,3,"button",9),r(),a(15,"div",10),g(16,xe,3,3,"button",11),r()()()),n&2&&(s(3),f(_(4,8,"reset.accessory_ind.title")),s(2),x("disabled",i.clicked),k("aria-label",_(6,10,"form.button_close")),s(3),v(i.accessoriesExist?-1:8),s(),v(i.accessoriesExist?9:-1),s(3),v(i.accessoriesExist?12:-1),s(2),v(i.accessoriesExist?-1:14),s(2),v(i.accessoriesExist?16:-1))},dependencies:[W,Q,J,K,H,z,G,Z],encapsulation:2})}return t})();export{De as a};
@@ -1,19 +0,0 @@
1
- import{a as xt}from"./chunk-RM3JSPOW.js";import{b as B,e as vt,f as $t,g as Rt,h as kt}from"./chunk-XAMKEFQQ.js";import{a as bt,b as _t}from"./chunk-CQLJRFML.js";import{a as Ct}from"./chunk-KYFLQ7R3.js";import{a as It}from"./chunk-BIXWXEEW.js";import{m as ut,n as ht,t as R}from"./chunk-PELXH4TO.js";import{B as mt,C as ft,c as ct,e as pt,l as gt}from"./chunk-YLFJH4ZN.js";import{c as yt,e as F}from"./chunk-NKVA4YGF.js";import{b as wt}from"./chunk-4JJLG2LI.js";import{k as O,l as H,n as N,q as U}from"./chunk-MX4NRP2P.js";import{$b as M,Ib as S,Lb as b,Nb as p,Qa as o,Qc as lt,Xc as dt,Yb as st,Za as tt,_b as y,a as j,ac as V,b as W,d as X,db as I,fc as ot,g as Z,gc as rt,h as $,hc as at,mc as K,na as m,pb as C,qb as k,rb as x,rc as r,sa as u,sc as l,ta as h,tb as et,tc as G,ub as it,vb as nt,wb as f,x as E,xb as a,yb as d,zb as g}from"./chunk-YYORCSG2.js";var Tt=Z(Rt(),1);var St=Z(It(),1);var Et=(s,w)=>({"fa-trash":s,"fa-cog fa-spin":w});function Ht(s,w){s&1&&(a(0,"div",13),g(1,"i",20),d())}function Nt(s,w){if(s&1){let t=S();a(0,"li",9)(1,"span"),y(2),r(3,"date"),g(4,"br"),a(5,"span",21),y(6),r(7,"date"),d()(),a(8,"span",22)(9,"button",25),r(10,"translate"),r(11,"translate"),b("click",function(){let i=u(t).$implicit,n=p(2);return h(n.restore(i.id))}),g(12,"i",26),d(),a(13,"button",27),r(14,"translate"),r(15,"translate"),b("click",function(){let i=u(t).$implicit,n=p(2);return h(n.download(i.id))}),g(16,"i",28),d(),a(17,"button",23),r(18,"translate"),r(19,"translate"),b("click",function(){let i=u(t).$implicit,n=p(2);return h(n.delete(i.id))}),g(20,"i",24),d()()()}if(s&2){let t=w.$implicit,e=p(2);o(2),V(" ",G(3,15,t.timestamp,"mediumDate")),o(4),M(G(7,18,t.timestamp,"shortTime")),o(3),f("disabled",e.clicked||e.deleting)("ngbTooltip",l(10,21,"config.restore.copy_to_editor"))("openDelay",150),C("aria-label",l(11,23,"config.restore.copy_to_editor")),o(4),f("disabled",e.clicked||e.deleting)("ngbTooltip",l(14,25,"form.button_download"))("openDelay",150),C("aria-label",l(15,27,"form.button_download")),o(4),f("disabled",e.clicked||e.deleting)("ngbTooltip",l(18,29,"form.button_delete"))("openDelay",150),C("aria-label",l(19,31,"form.button_delete")),o(3),f("ngClass",K(33,Et,t.id!==e.deleting,t.id===e.deleting))}}function Ft(s,w){if(s&1){let t=S();a(0,"ul",14),it(1,Nt,21,36,"li",9,et),a(3,"li",9)(4,"span"),y(5),r(6,"translate"),g(7,"br"),a(8,"span",21),y(9),r(10,"translate"),d()(),a(11,"span",22)(12,"button",23),r(13,"translate"),r(14,"translate"),b("click",function(){u(t);let i=p();return h(i.deleteAllBackups())}),g(15,"i",24),d()()()()}if(s&2){let t=p();o(),nt(t.backupList),o(4),V(" ",l(6,7,"form.button_delete_all")),o(4),V(" ",l(10,9,"common.labels.no_confirmation")," "),o(3),f("disabled",t.clicked||t.deleting)("ngbTooltip",l(13,11,"form.button_delete_all"))("openDelay",150),C("aria-label",l(14,13,"form.button_delete")),o(3),f("ngClass",K(15,Et,t.deleting!=="all",t.deleting==="all"))}}var Mt=(()=>{class s{$activeModal=m(ut);$api=m(U);$router=m(F);$toastr=m(N);$translate=m(O);currentConfig;fromSettings=!1;loading=!0;backupList=[];clicked=!1;deleting=null;ngOnInit(){this.getConfigBackups()}getConfigBackups(){return $(this,null,function*(){try{let t=yield E(this.$api.get("/config-editor/backups"));this.loading=!1,this.backupList=t}catch(t){this.loading=!1,console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.dismissModal()}})}restore(t){return this.$activeModal.close(t)}download(t){return $(this,null,function*(){this.clicked=!0;try{let e=yield E(this.$api.get(`/config-editor/backups/${t}`)),i=JSON.stringify(e,null,4),n=new Blob([i],{type:"application/json"}),v=`config-backup-${t}.json`;(0,St.saveAs)(n,v),this.clicked=!1}catch(e){this.clicked=!1,this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}downloadCurrentConfig(){let t=`data:text/json;charset=utf-8,${encodeURIComponent(this.currentConfig)}`,e=document.createElement("a");e.setAttribute("href",t),e.setAttribute("download","config.json"),document.body.appendChild(e),e.click(),e.remove()}delete(t){return $(this,null,function*(){this.deleting=t;try{yield E(this.$api.delete(`/config-editor/backups/${t}`)),yield this.getConfigBackups(),this.deleting=null}catch(e){this.deleting=null,this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}deleteAllBackups(){return $(this,null,function*(){this.deleting="all";try{yield E(this.$api.delete("/config-editor/backups")),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success")),this.backupList=[],this.deleting=null}catch(t){this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t),this.deleting=null}})}dismissModal(){this.fromSettings&&this.$router.navigate(["/settings"]),this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=I({type:s,selectors:[["ng-component"]],inputs:{currentConfig:"currentConfig",fromSettings:"fromSettings"},decls:40,vars:31,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,"text-center","mb-3"],[1,"fas","fa-history","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"btn","btn-primary","m-0","ms-3",3,"click","disabled"],[1,"fas","fa-arrow-right"],[1,"text-center","primary-text"],[1,"list-group","list-group-box","mt-3"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-end"],[1,"fa","fa-cog","fa-spin","mt-3",2,"font-size","75px"],[1,"grey-text","small"],[2,"display","flex","flex-wrap","nowrap"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas",3,"ngClass"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-3",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-history"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-download"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),y(3),r(4,"translate"),d(),a(5,"button",3),r(6,"translate"),b("click",function(){return i.dismissModal()}),d()(),a(7,"div",4)(8,"div",5),g(9,"i",6),d(),a(10,"ul",7)(11,"li"),y(12),r(13,"translate"),d(),a(14,"li"),y(15),r(16,"translate"),d()(),a(17,"ul",8)(18,"li",9)(19,"div")(20,"span"),y(21),r(22,"translate"),d(),g(23,"br"),a(24,"small",10),y(25),r(26,"translate"),d()(),a(27,"button",11),r(28,"translate"),b("click",function(){return i.downloadCurrentConfig()}),g(29,"i",12),d()()(),k(30,Ht,2,0,"div",13)(31,Ft,16,18,"ul",14),d(),a(32,"div",15),g(33,"div",16),a(34,"div",17)(35,"button",18),r(36,"translate"),b("click",function(){return i.dismissModal()}),y(37),r(38,"translate"),d()(),g(39,"div",19),d()()),e&2&&(o(3),M(l(4,13,"config.restore.title")),o(2),f("disabled",i.clicked||i.deleting),C("aria-label",l(6,15,"form.button_close")),o(7),M(l(13,17,"config.restore.help_1")),o(3),M(l(16,19,"config.restore.help_2")),o(6),M(l(22,21,"form.button_download")),o(4),M(l(26,23,"config.restore.download")),o(2),f("disabled",i.clicked||i.deleting),C("aria-label",l(28,25,"backup.backup_now")),o(3),x(i.loading?30:i.backupList.length?31:-1),o(5),f("disabled",i.clicked||i.deleting),C("aria-label",l(36,27,"form.button_close")),o(2),V(" ",l(38,29,"form.button_close")," "))},dependencies:[R,lt,ft,dt,H],encapsulation:2})}return s})();function Ut(s,w){if(s&1){let t=S();a(0,"button",13),r(1,"translate"),r(2,"translate"),b("click",function(){u(t);let i=p();return h(i.onCancelRestore())}),g(3,"i",14),d()}if(s&2){let t=p();f("disabled",t.saveInProgress)("openDelay",150)("ngbTooltip",l(1,4,"form.button_cancel")),C("aria-label",l(2,6,"form.button_cancel"))}}function qt(s,w){if(s&1){let t=S();a(0,"button",15),r(1,"translate"),r(2,"translate"),b("click",function(){u(t);let i=p();return h(i.onRestore())}),g(3,"i",16),d()}s&2&&(f("openDelay",150)("ngbTooltip",l(1,3,"form.button_restore")),C("aria-label",l(2,5,"form.button_restore")))}function zt(s,w){if(s&1){let t=S();a(0,"button",15),r(1,"translate"),r(2,"translate"),b("click",function(){u(t);let i=p();return h(i.toggleSideBySide())}),g(3,"i",17),d()}if(s&2){let t=p();f("openDelay",150)("ngbTooltip",l(1,7,t.renderSideBySide?"config.restore.view_inline":"config.restore.view_side_by_side")),C("aria-label",l(2,9,t.renderSideBySide?"config.restore.view_inline":"config.restore.view_side_by_side")),o(3),st("fa-columns",!t.renderSideBySide)("fa-bars",t.renderSideBySide)}}function Jt(s,w){s&1&&g(0,"i",8)}function Lt(s,w){s&1&&g(0,"i",9)}function Wt(s,w){if(s&1){let t=S();a(0,"ngx-monaco-editor",18),b("onInit",function(i){u(t);let n=p();return h(n.onEditorInit(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),h(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),h(n.onSave())}),d()}if(s&2){let t=p();f("options",t.editorOptions)("model",t.monacoEditorModel)}}function Kt(s,w){if(s&1){let t=S();a(0,"ngx-monaco-diff-editor",19),b("onInit",function(i){u(t);let n=p();return h(n.onInitDiffEditor(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),h(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),h(n.onSave())}),d()}if(s&2){let t=p();f("options",t.editorOptions)("originalModel",t.diffOriginalModel)("modifiedModel",t.diffModifiedModel)}}function Gt(s,w){if(s&1){let t=S();a(0,"textarea",20),at("ngModelChange",function(i){u(t);let n=p();return rt(n.homebridgeConfig,i)||(n.homebridgeConfig=i),h(i)}),y(1," "),d()}if(s&2){let t=p();ot("ngModel",t.homebridgeConfig)}}var Te=(()=>{class s{$api=m(U);$md=m(Ct);$modal=m(ht);$monacoEditor=m(xt);$renderer=m(tt);$route=m(yt);$router=m(F);$settings=m(wt);$toastr=m(N);$translate=m(O);editorDecorations=[];lastHeight;visualViewPortEventCallback;latestSavedConfig;childBridgesToRestart=[];hbPendingRestart=!1;isDebugModeEnabled=this.$settings.isFeatureEnabled("childBridgeDebugMode");isMatterSupported=this.$settings.isFeatureEnabled("matterSupport");homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;diffOriginalModel;diffModifiedModel;renderSideBySide=!1;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){let t=this.$translate.instant("menu.config_json_editor");this.$settings.setPageTitle(t),this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",renderSideBySide:this.renderSideBySide,renderIndicators:!0,ignoreTrimWhitespace:!1,glyphMargin:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(n=>{this.homebridgeConfig=n.config,this.latestSavedConfig=JSON.parse(n.config),this.diffModifiedModel&&this.updateDiffModels()}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},this.diffOriginalModel={code:"",language:"json"},this.diffModifiedModel={code:this.homebridgeConfig||"{}",language:"json"},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>this.setMonacoEditorModel()});let{action:i}=this.$router.parseUrl(this.$router.url).queryParams;if(i){switch(i){case"restore":{this.onRestore(!0);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}}onEditorInit(t){window.editor=t,this.monacoEditor=t,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(t){this.monacoEditor=t.getModifiedEditor(),this.updateDiffModels(),window.editor=t}updateDiffModels(){if(this.diffOriginalModel&&(this.diffOriginalModel.code=this.originalConfig||""),this.diffModifiedModel&&(this.diffModifiedModel.code=this.homebridgeConfig||"{}"),window.editor&&window.editor.getOriginalEditor){let t=window.editor.getOriginalEditor(),e=window.editor.getModifiedEditor();if(t&&e){let i=t.getModel(),n=e.getModel();i&&i.setValue(this.originalConfig||""),n&&n.setValue(this.homebridgeConfig||"{}")}}}onSave(){return $(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let e=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of e)if(i.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let t=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(t,null,4),typeof t.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(t.bridge.username)?t.accessories&&!Array.isArray(t.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&!Array.isArray(t.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&Array.isArray(t.platforms)&&!this.validateSection(t.platforms,"platform")||t.accessories&&Array.isArray(t.accessories)&&!this.validateSection(t.accessories,"accessory")||t.plugins&&Array.isArray(t.plugins)&&!this.validatePlugins(t.plugins,"plugins")||t.disabledPlugins&&Array.isArray(t.disabledPlugins)&&!this.validatePlugins(t.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(t),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}onRestore(t=!1){let e=this.$modal.open(Mt,{size:"lg",backdrop:"static"});e.componentInstance.currentConfig=this.homebridgeConfig,e.componentInstance.fromSettings=t,e.result.then(i=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig,this.updateDiffModels()),this.$api.get(`/config-editor/backups/${i}`).subscribe({next:n=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(n,null,4),this.updateDiffModels(),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:n=>{console.error(n),this.$toastr.error(n.error?.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onCancelRestore(){if(window.editor&&window.editor.dispose)try{window.editor.dispose(),window.editor=void 0}catch{}this.homebridgeConfig=this.originalConfig,this.originalConfig="",this.renderSideBySide&&this.toggleSideBySide(),this.updateDiffModels(),this.onRestore()}toggleSideBySide(){this.renderSideBySide=!this.renderSideBySide,this.editorOptions=W(j({},this.editorOptions),{renderSideBySide:this.renderSideBySide})}ngOnDestroy(){let t=document.querySelector(".content");this.$renderer.removeStyle(t,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove());try{if(window.editor&&window.editor.dispose&&(window.editor.dispose(),window.editor=void 0),window.monaco){let e=window.monaco.Uri.parse("file:///original.json"),i=window.monaco.Uri.parse("file:///modified.json"),n=window.monaco.editor.getModel(e);n&&n.dispose();let v=window.monaco.editor.getModel(i);v&&v.dispose();let T=(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas||[]).filter(A=>A.uri!=="http://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:T})}this.monacoEditor&&this.monacoEditor.dispose()}catch{}}validateSection(t,e){for(let i of t){if(typeof i!="object"||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(!i[e])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(typeof i[e]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1}return!0}validatePlugins(t,e){for(let i of t)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:e}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(t){this.monacoEditor&&(t=JSON.stringify(t,null,4).split(`
2
- `).map(e=>` ${e}`).join(`
3
- `),setTimeout(()=>{let e=this.monacoEditor.getModel().findMatches(t);if(e.length){let i=e[0].range,n=new monaco.Range(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:n,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}},200))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(i=>i.uri==="http://homebridge/config.json"))return;let t=monaco.Uri.parse("a://homebridge/config.json"),e=kt(this.$translate,{isDebugModeEnabled:this.isDebugModeEnabled,isMatterSupported:this.isMatterSupported});window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[t.toString()],schema:{type:"object",required:["bridge"],properties:{bridge:{type:"object",required:["name","username","port","pin"],properties:j({name:{type:"string",title:this.$translate.instant("settings.name"),description:`The Homebridge instance name.
4
- This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",title:this.$translate.instant("users.label_username"),description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
5
- You should change this pin if you need to re-pair your instance with HomeKit.
6
- Example: 0E:89:49:64:91:86.`,default:"0E:89:49:64:91:86",pattern:"^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$"},port:{type:"number",title:this.$translate.instant("settings.network.port_hb"),description:`The port Homebridge listens on.
7
- If running more than one instance of Homebridge on the same server make sure each instance is given a unique port.`,default:51173,minimum:1025,maximum:65534},pin:{type:"string",description:`The Homebridge instance pin.
8
- This is used when pairing Homebridge to HomeKit.
9
- Example: 630-27-655.`,default:"630-27-655",pattern:"^([0-9]{3}-[0-9]{2}-[0-9]{3})$"},manufacturer:{type:"string",title:this.$translate.instant("child_bridge.config.manufacturer"),description:"The bridge manufacturer to be displayed in HomeKit."},firmwareRevision:{type:"string",title:this.$translate.instant("child_bridge.config.firmware"),description:"The bridge firmware version to be displayed in HomeKit."},model:{type:"string",title:this.$translate.instant("child_bridge.config.model"),description:"The bridge model to be displayed in HomeKit."},bind:{title:this.$translate.instant("settings.network.title_network_interfaces"),description:`A string or an array of strings with the name(s) of the network interface(s) Homebridge should bind to.
10
- Requires Homebridge v1.3 or later.`,type:["string","array"],items:{type:"string",description:this.$translate.instant("status.widget.network.network_interface")}}},this.isMatterSupported?{matter:{type:"object",additionalProperties:!1,title:this.$translate.instant("settings.matter.title"),description:"Matter-specific configuration for the main bridge.",properties:{port:{type:"number",title:this.$translate.instant("settings.matter.port"),description:this.$translate.instant("settings.matter.port_desc"),minimum:1025,maximum:65534}}}}:{}),default:{name:"Homebridge",username:"0E:89:49:64:91:86",port:51173,pin:"6302-7655"}},mdns:{type:"object",properties:{interface:{type:"string",title:this.$translate.instant("status.widget.network.network_interface"),description:`The interface or IP address of the interface you want Homebridge to listen on.
11
- This is useful if your server has multiple interfaces.
12
- Deprecated as of Homebridge v1.3.0 - use bridge.bind instead.`},legacyAdvertiser:{type:"boolean",title:"Legacy mDNS Advertiser",description:"Set to false to use the new mdns library, ciao."}},default:{legacyAdvertiser:!1}},ports:{type:"object",title:"Port Range",description:"The range of ports that should be used for external accessories like cameras and TVs.",required:["start","end"],properties:{start:{type:"number",default:52100,minimum:1025,maximum:65534,title:this.$translate.instant("settings.network.port_start"),description:this.$translate.instant("settings.network.port_start_desc")},end:{type:"number",default:52150,minimum:1025,maximum:65534,title:this.$translate.instant("settings.network.port_end"),description:this.$translate.instant("settings.network.port_end_desc")}},default:{start:52100,end:52150}},platforms:{type:"array",title:"Platforms",description:`Any plugin that exposes a platform should have its config entered in this array.
13
- Separate each plugin config block using a comma.`,items:{type:"object",required:["platform"],anyOf:[{type:"object",required:["platform"],title:this.$translate.instant("plugins.button_settings"),properties:{platform:{type:"string",title:"Platform Name",description:"This is used by Homebridge to identify which plugin this platform belongs to.",not:{enum:["config"]}},name:{type:"string",title:this.$translate.instant("accessories.name"),description:"The name of the platform."},_bridge:e}},{type:"object",properties:W(j({platform:{type:"string",title:"Platform Name",description:`Homebridge UI platform name must be set to "config".
14
- Do not change!`,const:"config"},name:{title:this.$translate.instant("accessories.name"),type:"string",default:"Homebridge UI",minLength:1,description:"The name of the Homebridge instance."},port:{title:this.$translate.instant("settings.network.port_ui"),type:"integer",default:8080,minimum:1025,maximum:65535,description:this.$translate.instant("settings.network.port_ui_desc")},auth:{type:"string",default:"form",title:this.$translate.instant("settings.security.auth"),description:this.$translate.instant("settings.security.auth_desc"),oneOf:[{title:"Require Authentication",enum:["form"]},{title:"None",enum:["none"]}]},theme:{title:this.$translate.instant("settings.display.theme"),description:"The theme used for the UI.",type:"string",default:"orange",oneOf:[{title:this.$translate.instant("settings.display.orange"),enum:["orange"]},{title:this.$translate.instant("settings.display.red"),enum:["red"]},{title:this.$translate.instant("settings.display.pink"),enum:["pink"]},{title:this.$translate.instant("settings.display.purple"),enum:["purple"]},{title:this.$translate.instant("settings.display.deep_purple"),enum:["deep-purple"]},{title:this.$translate.instant("settings.display.indigo"),enum:["indigo"]},{title:this.$translate.instant("settings.display.blue"),enum:["blue"]},{title:this.$translate.instant("settings.display.bluegrey"),enum:["blue-grey"]},{title:this.$translate.instant("settings.display.cyan"),enum:["cyan"]},{title:this.$translate.instant("settings.display.green"),enum:["green"]},{title:this.$translate.instant("settings.display.teal"),enum:["teal"]},{title:this.$translate.instant("settings.display.grey"),enum:["grey"]},{title:this.$translate.instant("settings.display.brown"),enum:["brown"]}]},lightingMode:{title:this.$translate.instant("settings.display.lighting_mode"),description:"The lighting mode used for the UI.",type:"string",default:"auto",oneOf:[{title:this.$translate.instant("accessories.control.auto"),enum:["auto"]},{title:this.$translate.instant("settings.display.light"),enum:["light"]},{title:this.$translate.instant("settings.display.dark"),enum:["dark"]}]},menuMode:{title:this.$translate.instant("settings.display.menu_mode"),description:"Modes for the UI side menu.",type:"string",default:"default",oneOf:[{title:this.$translate.instant("settings.display.menu_default"),enum:["default"]},{title:this.$translate.instant("settings.display.menu_freeze"),enum:["freeze"]}]},temp:{title:this.$translate.instant("settings.linux.temp"),type:"string",description:this.$translate.instant("settings.linux.temp_desc")},tempUnits:{title:this.$translate.instant("settings.display.temp_units"),description:"The units used to display the temperature.",type:"string",default:"c",oneOf:[{title:this.$translate.instant("settings.display.temp_units.c"),enum:["c"]},{title:this.$translate.instant("settings.display.temp_units.f"),enum:["f"]}]},lang:{title:this.$translate.instant("settings.display.lang"),type:"string",default:"auto",description:"The language used for the UI.",oneOf:[{title:this.$translate.instant("form.select.auto"),enum:["auto"]},{title:"Bulgarian (bg)",enum:["bg"]},{title:"Catalan (ca)",enum:["ca"]},{title:"Chinese - Simplified (zh-CN)",enum:["zh-CN"]},{title:"Chinese - Traditional (zh-TW)",enum:["zh-TW"]},{title:"Czech (cs)",enum:["cs"]},{title:"Dutch (nl)",enum:["nl"]},{title:"English (en)",enum:["en"]},{title:"Finnish (fi)",enum:["fi"]},{title:"French (fr)",enum:["fr"]},{title:"German (de)",enum:["de"]},{title:"Hebrew (he)",enum:["he"]},{title:"Hungarian (hu)",enum:["hu"]},{title:"Indonesian (id)",enum:["id"]},{title:"Italian (it)",enum:["it"]},{title:"Japanese (ja)",enum:["ja"]},{title:"Korean (ko)",enum:["ko"]},{title:"Macedonian (mk)",enum:["mk"]},{title:"Norwegian (no)",enum:["no"]},{title:"Polish (pl)",enum:["pl"]},{title:"Portuguese (Brazil)",enum:["pt-BR"]},{title:"Portuguese (Portugal)",enum:["pt"]},{title:"Russian (ru)",enum:["ru"]},{title:"Slovenian (sl)",enum:["sl"]},{title:"Spanish (es)",enum:["es"]},{title:"Swedish (sv)",enum:["sv"]},{title:"Thai (th)",enum:["th"]},{title:"Turkish (tr)",enum:["tr"]},{title:"Ukrainian (uk)",enum:["uk"]}]},wallpaper:{title:this.$translate.instant("settings.display.wallpaper"),description:"The full path to the .jpg file.",type:"string"},homebridgePackagePath:{title:this.$translate.instant("settings.network.hb_package"),type:"string",description:this.$translate.instant("settings.network.hb_package_desc")},host:{type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",title:this.$translate.instant("settings.network.host"),description:this.$translate.instant("settings.network.host_desc")},sessionTimeoutInactivityBased:{type:"boolean",title:this.$translate.instant("settings.startup.session_inactivity_based"),description:this.$translate.instant("settings.startup.session_inactivity_based_desc")},sessionTimeout:{type:"integer",minimum:600,maximum:864e5,title:this.$translate.instant("settings.startup.session"),description:this.$translate.instant("settings.startup.session_desc")},log:{type:"object",title:"Log Settings",description:"The log settings for the Homebridge UI.",properties:{maxSize:{type:"integer",title:this.$translate.instant("settings.terminal.log_max"),description:this.$translate.instant("settings.terminal.log_max_desc"),minimum:-1},truncateSize:{type:"integer",title:this.$translate.instant("settings.terminal.log_truncate"),description:this.$translate.instant("settings.terminal.log_truncate_desc"),minimum:0}}},ssl:{type:"object",title:this.$translate.instant("settings.security.https"),description:this.$translate.instant("settings.security.https_desc"),properties:{key:{type:"string",title:this.$translate.instant("settings.security.key"),description:"The full path to the private key file."},cert:{type:"string",title:this.$translate.instant("settings.security.cert"),description:"The full path to the certificate file."},pfx:{title:this.$translate.instant("settings.security.pfx"),type:"string",description:"The full path to the PKCS#12 certificate file."},passphrase:{title:this.$translate.instant("settings.security.pass"),type:"string",description:"The passphrase for the PKCS#12 certificate file."}}},accessoryControl:{title:"Accessory Control Setup",type:"object",description:"The accessory control settings for the Homebridge UI.",properties:{debug:{title:this.$translate.instant("settings.accessory.debug"),type:"boolean",description:this.$translate.instant("settings.accessory.debug_desc")},instanceBlacklist:{title:this.$translate.instant("settings.security.ui_control"),type:"array",description:this.$translate.instant("settings.security.ui_control_desc"),items:{title:this.$translate.instant("users.label_username"),type:"string",pattern:"^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$"}}}},linux:{title:"Linux Server Commands",type:"object",description:"The Linux server commands for the Homebridge UI.",properties:{shutdown:{title:this.$translate.instant("settings.linux.shutdown"),type:"string",description:this.$translate.instant("settings.linux.shutdown_desc")},restart:{title:this.$translate.instant("settings.linux.restart"),type:"string",description:this.$translate.instant("settings.linux.restart_desc")}}}},this.$settings.originalWebroot!==globalThis.webroot.errorCode?{webroot:{title:this.$translate.instant("settings.network.webroot"),type:"string",description:this.$translate.instant("settings.network.webroot_desc")}}:{}),{proxyHost:{title:this.$translate.instant("settings.network.proxy"),type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",description:this.$translate.instant("settings.network.proxy_desc")},scheduledBackupPath:{title:this.$translate.instant("backup.settings_path"),description:"The full path to where the service should save daily scheduled backups archives.",type:"string"},scheduledBackupDisable:{title:"Disable Scheduled Backups",type:"boolean",description:"When enabled, the Homebridge UI will not create daily scheduled backups."},disableServerMetricsMonitoring:{title:"Disable Server Metrics Monitoring",type:"boolean",description:"When enabled, the Homebridge UI will not collect or report CPU or memory stats."},enableMdnsAdvertise:{title:this.$translate.instant("settings.network.mdns_advertise"),type:"boolean",description:this.$translate.instant("settings.network.mdns_advertise_help")},plugins:{title:this.$translate.instant("menu.label_plugins"),type:"object",description:"Settings surrounding plugins used by the Homebridge UI.",properties:{hideUpdatesFor:{type:"array",title:"Hide Plugin Updates For",description:"A list of plugin names for which frontend update notifications will be hidden.",items:{type:"string",title:this.$translate.instant("accessories.plugin"),pattern:"^(?:@[\\w-]+(?:\\.[\\w-]+)*/)?homebridge-[\\w-]+$"}},hidePairingAlerts:{type:"array",title:"Hide Pairing Alerts",description:'A list of bridge identifiers (e.g., "0E:02:9A:9D:44:45-HAP" or "0E:02:9A:9D:44:45-MATTER") for which pairing alerts will be hidden in the UI.',items:{type:"string",title:"Bridge Identifier",pattern:"^[0-9A-F]{2}(?::[0-9A-F]{2}){5}-(HAP|MATTER)$"}},alwaysShowBetas:{type:"boolean",title:this.$translate.instant("settings.display.show_betas"),description:"When enabled, beta releases will be shown as available for Homebridge, the UI and plugins."}}},terminal:{type:"object",title:"Terminal Settings",description:"The terminal settings for the Homebridge UI.",properties:{persistence:{title:this.$translate.instant("settings.terminal.persistence"),type:"boolean",description:this.$translate.instant("settings.terminal.persistence_help"),default:!1},hideWarning:{title:this.$translate.instant("settings.terminal.warning"),type:"boolean",description:this.$translate.instant("settings.terminal.warning_help"),default:!1},bufferSize:{title:this.$translate.instant("settings.terminal.buffer_size"),type:"integer",description:this.$translate.instant("settings.terminal.buffer_size_help"),default:5e4,minimum:0}}}})}]}},accessories:{type:"array",title:this.$translate.instant("menu.label_accessories"),description:`Any plugin that exposes an accessory should have its config entered in this array.
15
- Separate each plugin config block using a comma.`,items:{type:"object",required:["accessory","name"],title:this.$translate.instant("plugins.button_settings"),properties:{accessory:{type:"string",title:this.$translate.instant("child_bridge.config.accessory"),description:"This is used by Homebridge to identify which plugin this accessory belongs to."},name:{type:"string",title:this.$translate.instant("accessories.name"),description:"The name of the accessory."},_bridge:e}}},plugins:{type:"array",title:this.$translate.instant("menu.label_plugins"),description:`An array of plugins that should be selectively enabled.
16
- Remove this array to enable all plugins.`,items:{type:"string",title:this.$translate.instant("accessories.plugin"),description:`The full plugin npm package name.
17
- Example: homebridge-dummy.`},default:["homebridge-config-ui-x"]},disabledPlugins:{type:"array",description:`An array of plugins that should be disabled.
18
- Requires Homebridge v1.3 or later.`,items:{type:"string",title:this.$translate.instant("accessories.plugin"),description:`The full plugin npm package name.
19
- Example: homebridge-dummy.`},default:[]}}}}]}),this.monacoEditorModel.uri=monaco.Uri.parse("a://homebridge/config.json")}visualViewPortChanged(){this.lastHeight<window.visualViewport.height&&document.activeElement.blur(),window.visualViewport.height<window.innerHeight?(this.$md.enableTouchMove(),this.lastHeight=window.visualViewport.height):window.visualViewport.height===window.innerHeight&&(this.$md.disableTouchMove(),this.lastHeight=window.visualViewport.height)}saveConfig(t){return $(this,null,function*(){try{let e=yield E(this.$api.post("/config-editor",t));this.homebridgeConfig=JSON.stringify(e,null,4),yield this.detectSavesChangesForRestart()}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}validateArraysEqual(t,e){if(t.length!==e.length)return!1;let i=[...t].sort(),n=[...e].sort();return i.every((v,_)=>v===n[_])}removePlatformsAndAccessories(t){let v=t,{accessories:e,platforms:i}=v;return X(v,["accessories","platforms"])}removeEmptyBridges(t){return t.filter(e=>e._bridge&&Object.keys(e._bridge).length>0).map(e=>e._bridge)}validateBridgesEqual(t,e){return t.length!==e.length?!1:t.every(i=>e.some(n=>B(i,n)))}detectConfigPlatformChanges(){try{let t=this.latestSavedConfig,e=JSON.parse(this.homebridgeConfig),i=(t.platforms||[]).find(T=>T.platform==="config"),n=(e.platforms||[]).find(T=>T.platform==="config"),v=i?.webroot||"",_=n?.webroot||"";return v!==_&&(_=_?`/${_}`.replace(/\/+/g,"/").replace(/\/$/,""):"",_==="/"&&(_=""),this.$settings.setItem("webroot",_),n&&(_&&this.$settings.originalWebroot!==globalThis.webroot.errorCode?n.webroot=_:delete n.webroot,this.homebridgeConfig=JSON.stringify(e,null,4),this.monacoEditor&&this.monacoEditor.getModel().setValue(this.homebridgeConfig))),!i&&n||i&&!n?!0:!i&&!n?!1:!B(i,n)}catch(t){return console.error("Error detecting config platform changes:",t),!1}}detectSavesChangesForRestart(){return $(this,null,function*(){let t=yield this.determineRestartType();if(t==="full"){let e=this.detectConfigPlatformChanges();yield this.performFullRestart(e)}else t==="child"&&(yield this.performChildBridgeRestart());this.latestSavedConfig=JSON.parse(this.homebridgeConfig)})}determineRestartType(){return $(this,null,function*(){if(this.hbPendingRestart)return"full";let t=this.latestSavedConfig,e=JSON.stringify(t,null,4),i=JSON.parse(this.homebridgeConfig),n=this.homebridgeConfig;if(e===n&&!this.childBridgesToRestart.length)return this.$toastr.info(this.$translate.instant("config.no_restart"),this.$translate.instant("config.config_saved")),"none";if(!this.validateArraysEqual(Object.keys(t),Object.keys(i))||[...i.platforms||[],...i.accessories||[]].every(c=>!c._bridge||!Object.keys(c._bridge).length))return"full";let _=this.removePlatformsAndAccessories(t),T=this.removePlatformsAndAccessories(i);if(!B(_,T))return"full";let A=t.platforms||[],q=i.platforms||[],Bt=A.map(c=>c.platform),At=q.map(c=>c.platform);if(!this.validateArraysEqual(Bt,At))return"full";let z=t.accessories||[],J=i.accessories||[],Pt=z.map(c=>c.accessory),Dt=J.map(c=>c.accessory);if(!this.validateArraysEqual(Pt,Dt)||!this.validateBridgesEqual(this.removeEmptyBridges(A),this.removeEmptyBridges(q))||!this.validateBridgesEqual(this.removeEmptyBridges(z),this.removeEmptyBridges(J)))return"full";let Y=A.filter(c=>!B(c,q.find(P=>P.platform===c.platform))),Vt=z.filter(c=>!B(c,J.find(P=>P.accessory===c.accessory))),Q=[...Y,...Vt];if(Y.some(c=>c.platform==="config")||Q.some(c=>c.platform==="config"?!1:!c._bridge||Object.keys(c._bridge).length===0))return"full";try{let c=yield E(this.$api.get("/status/homebridge/child-bridges"));return Q.forEach(P=>{let jt=P._bridge.username.toUpperCase(),D=c.find(({username:L})=>L===jt);if(D)this.childBridgesToRestart.some(L=>L.username===D.username)||this.childBridgesToRestart.push({name:D.name,username:D.username,matterSerialNumber:D.matterSerialNumber});else return"full"}),"child"}catch(c){return console.error("Error fetching child bridges:",c),"full"}})}performChildBridgeRestart(){return $(this,null,function*(){let t=this.$modal.open(vt,{size:"lg",backdrop:"static"});t.componentInstance.bridges=this.childBridgesToRestart;try{yield t.result,this.childBridgesToRestart=[]}catch{}})}performFullRestart(t){return $(this,null,function*(){t&&(yield E(this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{})));let e=this.$modal.open($t,{size:"lg",backdrop:"static"});try{yield e.result,this.hbPendingRestart=!1,this.childBridgesToRestart=[]}catch{this.hbPendingRestart=!0}})}parseConfigFromEditor(){try{return JSON.parse(this.homebridgeConfig)}catch{let e=Tt.default.parse(this.homebridgeConfig);return this.homebridgeConfig=JSON.stringify(e,null,4),this.monacoEditor&&this.monacoEditor.getModel().setValue(this.homebridgeConfig),e}}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=I({type:s,selectors:[["ng-component"]],decls:18,vars:19,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100"],[1,"row"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-danger","waves-effect","my-0","me-2",3,"disabled","openDelay","ngbTooltip"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","waves-effect","my-0","me-2",3,"openDelay","ngbTooltip"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","waves-effect","my-0","me-0",3,"click","disabled","openDelay","ngbTooltip"],[1,"fas","fa-floppy-disk"],[1,"fas","fa-spinner","fa-pulse"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"options","model"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"options","originalModel","modifiedModel"],["wrap","off","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",1,"hb-plain-text-editor","align-self-end","h-100","w-100","my-3",3,"ngModel"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-danger","waves-effect","my-0","me-2",3,"click","disabled","openDelay","ngbTooltip"],[1,"fas","fa-times"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","waves-effect","my-0","me-2",3,"click","openDelay","ngbTooltip"],[1,"fas","fa-history"],[1,"fas"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"onInit","keydown.control.s","keydown.meta.s","options","model"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"onInit","keydown.control.s","keydown.meta.s","options","originalModel","modifiedModel"],["wrap","off","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",1,"hb-plain-text-editor","align-self-end","h-100","w-100","my-3",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),y(4),r(5,"translate"),d()(),a(6,"div",4),k(7,Ut,4,8,"button",5),k(8,qt,4,7,"button",6),k(9,zt,4,11,"button",6),a(10,"button",7),r(11,"translate"),r(12,"translate"),b("click",function(){return i.onSave()}),k(13,Jt,1,0,"i",8),k(14,Lt,1,0,"i",9),d()()(),k(15,Wt,1,2,"ngx-monaco-editor",10),k(16,Kt,1,3,"ngx-monaco-diff-editor",11),k(17,Gt,2,1,"textarea",12),d()),e&2&&(o(4),M(l(5,13,"menu.config_json_editor")),o(3),x(i.originalConfig?7:-1),o(),x(i.originalConfig?-1:8),o(),x(!i.isMobile&&i.originalConfig?9:-1),o(),f("disabled",i.saveInProgress)("openDelay",150)("ngbTooltip",l(11,15,"form.button_save")),C("aria-label",l(12,17,"form.button_save")),o(3),x(i.saveInProgress?-1:13),o(),x(i.saveInProgress?14:-1),o(),x(!i.isMobile&&!i.originalConfig?15:-1),o(),x(!i.isMobile&&i.originalConfig?16:-1),o(),x(i.isMobile?17:-1))},dependencies:[R,bt,_t,mt,ct,pt,gt,H],encapsulation:2})}return s})();export{Te as ConfigEditorComponent};
@@ -1 +0,0 @@
1
- import{a as B}from"./chunk-NAQHC4AS.js";import{n as $,t as k}from"./chunk-PELXH4TO.js";import"./chunk-YLFJH4ZN.js";import{e as P}from"./chunk-NKVA4YGF.js";import{b as V}from"./chunk-4JJLG2LI.js";import{k as y,l as T,n as I,q as O}from"./chunk-MX4NRP2P.js";import{$b as S,Ib as b,Lb as m,Nb as h,Qa as i,_b as c,ac as d,db as x,na as p,qb as f,rb as v,rc as a,sa as u,sc as s,ta as _,wb as g,xb as o,yb as r,zb as C}from"./chunk-YYORCSG2.js";function H(e,w){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=h();return _(n.restartServer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.linux.label_restart_server")," "))}function D(e,w){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=h();return _(n.shutdownServer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.linux.label_shutdown_server")," "))}function R(e,w){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=h();return _(n.dockerRestartContainer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.docker.restart_container")," "))}var K=(()=>{class e{$api=p(O);$modal=p($);$router=p(P);$settings=p(V);$toastr=p(I);$translate=p(y);canShutdownRestartHost=this.$settings.env.canShutdownRestartHost;runningInDocker=this.$settings.env.runningInDocker;ngOnInit(){let t=this.$translate.instant("menu.restart.title");this.$settings.setPageTitle(t)}restartHomebridge(){this.$router.navigate(["/restart"])}restartHomebridgeService(){this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$router.navigate(["/restart"])},error:t=>{console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}restartServer(){this.$router.navigate(["/platform-tools/linux/restart-server"])}shutdownServer(){let t=this.$modal.open(B,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("menu.linux.label_shutdown_server"),t.componentInstance.message=this.$translate.instant("menu.linux.label_shutdown_modal"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_continue"),t.componentInstance.faIconClass="fa fa-power-off primary-text",t.result.then(()=>{this.$router.navigate(["/platform-tools/linux/shutdown-server"])}).catch(()=>{})}dockerRestartContainer(){this.$router.navigate(["/platform-tools/docker/restart-container"])}static \u0275fac=function(l){return new(l||e)};static \u0275cmp=x({type:e,selectors:[["ng-component"]],decls:19,vars:16,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-power-off",2,"font-size","75px"],[1,"w-100","text-center","my-5"],["type","button",1,"btn","btn-primary","p-3","my-0",2,"width","85%",3,"click"],["type","button","container","body","triggers","hover",1,"btn","btn-primary","p-3","my-0",2,"width","85%",3,"click","openDelay","ngbTooltip"]],template:function(l,n){l&1&&(o(0,"div",0)(1,"h3",1),c(2),a(3,"translate"),r()(),o(4,"div",2)(5,"div",3),C(6,"i",4),r(),o(7,"p",5)(8,"button",6),m("click",function(){return n.restartHomebridge()}),c(9),a(10,"translate"),r()(),o(11,"p",5)(12,"button",7),a(13,"translate"),m("click",function(){return n.restartHomebridgeService()}),c(14),a(15,"translate"),r()(),f(16,H,4,3,"p",5),f(17,D,4,3,"p",5),f(18,R,4,3,"p",5),r()),l&2&&(i(2),S(s(3,8,"menu.restart.title")),i(7),d(" ",s(10,10,"menu.hbrestart.confirm_hb")," "),i(3),g("openDelay",150)("ngbTooltip",s(13,12,"reset.force_restart_hb_help_text")),i(2),d(" ",s(15,14,"menu.hbrestart.confirm_ui")," "),i(2),v(n.canShutdownRestartHost?16:-1),i(),v(n.canShutdownRestartHost?17:-1),i(),v(n.runningInDocker?18:-1))},dependencies:[k,T],encapsulation:2})}return e})();export{K as PowerOptionsComponent};