homebridge-config-ui-x 5.30.2-beta.9 → 5.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -3
- package/dist/core/auth/auth.controller.js +3 -3
- package/dist/core/auth/auth.module.js +5 -0
- package/dist/core/auth/guards/ws-admin-guard.js +4 -1
- package/dist/core/auth/guards/ws-log.guard.js +4 -1
- package/dist/core/auth/guards/ws.guard.js +4 -1
- package/dist/core/auth/jwt.constants.js +1 -0
- package/dist/core/auth/jwt.strategy.js +2 -0
- package/dist/core/config/config.service.js +4 -0
- package/dist/core/config/config.startup.js +6 -0
- package/dist/core/regex.constants.js +1 -0
- package/dist/core/spa/spa.filter.js +11 -2
- package/dist/core/web-root.js +63 -0
- package/dist/main.js +12 -5
- package/dist/modules/accessories/accessories.service.js +12 -2
- package/dist/modules/backup/backup.service.js +6 -7
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js +8 -3
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +1 -1
- package/dist/modules/plugins/plugins.service.js +25 -7
- package/dist/modules/server/server.module.js +2 -0
- package/dist/modules/server/server.service.js +133 -18
- package/package.json +18 -17
- package/public/3rdpartylicenses.txt +195 -195
- package/public/assets/manifest.webmanifest +1 -1
- package/public/assets/monaco/min/vs/assets/editor.worker-Dpo8bqBT.js +45 -0
- package/public/assets/monaco/min/vs/assets/json.worker-BJDtq78O.js +77 -0
- package/public/assets/monaco/min/vs/basic-languages/monaco.contribution.js +1 -1
- package/public/assets/monaco/min/vs/css.worker-C7XcYe5x.js +1 -0
- package/public/assets/monaco/min/vs/editor/editor.main.css +1 -1
- package/public/assets/monaco/min/vs/editor/editor.main.js +1 -1
- package/public/assets/monaco/min/vs/editor-CG9c2pE-.js +1094 -0
- package/public/assets/monaco/min/vs/html.worker-VIR_LTyv.js +1 -0
- package/public/assets/monaco/min/vs/index-BVflv2uG.js +5 -0
- package/public/assets/monaco/min/vs/json.worker-DzWXGkG8.js +1 -0
- package/public/assets/monaco/min/vs/jsonMode-Dz4r0pwo.js +7 -0
- package/public/assets/monaco/min/vs/lspLanguageFeatures-IeRAvoKK.js +4 -0
- package/public/assets/monaco/min/vs/{monaco.contribution-C7tY_xnl.js → monaco.contribution-BRs4bdz5.js} +1 -1
- package/public/assets/monaco/min/vs/{monaco.contribution-BuX2NvO2.js → monaco.contribution-ChoOM5Gg.js} +1 -1
- package/public/assets/monaco/min/vs/{monaco.contribution-D1-wBxcq.js → monaco.contribution-DKFaWvum.js} +1 -1
- package/public/assets/monaco/min/vs/{monaco.contribution-CY2lwFI8.js → monaco.contribution-DbKqsbmO.js} +1 -1
- package/public/assets/monaco/min/vs/toggleHighContrast-CmI6H2gJ.js +65 -0
- package/public/assets/monaco/min/vs/ts.worker-Dp2_QI6H.js +1 -0
- package/public/assets/monaco/min/vs/{workers-BeMslOxK.js → workers-B_Zs9c54.js} +1 -1
- package/public/chunk-1WkwqzBe.js +1 -0
- package/public/{chunk-BGW-rl_H.js → chunk-4LczDlm4.js} +1 -1
- package/public/chunk-6Ygb1PKs.js +67 -0
- package/public/chunk-AO-xCn2s.js +1 -0
- package/public/chunk-B-0IqJpV.js +1 -0
- package/public/{chunk--P4Vl8Ds.js → chunk-B-LjENSb.js} +1 -1
- package/public/chunk-B4r2O1Kh.js +1 -0
- package/public/{chunk-C4CnBhSh.js → chunk-B5MPqJcE.js} +1 -1
- package/public/chunk-B7tP3vD8.js +1 -0
- package/public/chunk-B9tooKpD.js +1 -0
- package/public/chunk-BA7JbcNh.js +1 -0
- package/public/chunk-BAsEJ-Lj.js +1 -0
- package/public/chunk-BCzLimp6.js +1 -0
- package/public/{chunk-DzdG4WBv.js → chunk-BEbOe4T9.js} +4 -4
- package/public/{chunk-C6IJ4pwA.js → chunk-BGJX8h_m.js} +1 -1
- package/public/chunk-BMXrmFqD.js +1 -0
- package/public/{chunk-CJ2G7dZ1.js → chunk-BPTs8QY0.js} +1 -1
- package/public/chunk-BQ_oyvEZ.js +1 -0
- package/public/{chunk-Claxqsw0.js → chunk-BUGCHLWr.js} +2 -2
- package/public/chunk-BW5huvPA.js +1 -0
- package/public/chunk-BW9DGXgV.js +1 -0
- package/public/chunk-BZkhFNMI.js +1 -0
- package/public/{chunk-DXnpGbw_.js → chunk-B_WM1X73.js} +3 -3
- package/public/chunk-BaIKXH7O.js +1 -0
- package/public/chunk-Ba_CB5_Z.js +1 -0
- package/public/chunk-BaxVxTHg.js +1 -0
- package/public/chunk-Bc2wcZxc.js +1 -0
- package/public/chunk-Bebk2wgB.js +1 -0
- package/public/chunk-Bhs0CkM4.js +1 -0
- package/public/chunk-BieyEDGI.js +1 -0
- package/public/chunk-BkadXUDl.js +1 -0
- package/public/chunk-BvXiQqjU.js +1 -0
- package/public/{chunk-BGQjpQcW.js → chunk-ByV1FXZb.js} +1 -1
- package/public/chunk-C-N6hBpt.js +1 -0
- package/public/chunk-C6eYPKvQ.js +1 -0
- package/public/chunk-C76Qq0KH.js +1 -0
- package/public/chunk-C7IwQ3Tm.js +1 -0
- package/public/chunk-C8WFoQPb.js +1 -0
- package/public/chunk-CGBW8wgK.js +1 -0
- package/public/{chunk-C7aqALNp.js → chunk-CMZ3GvNS.js} +1 -1
- package/public/{chunk-RIzVhv2m.js → chunk-CNOp3s3R.js} +1 -1
- package/public/chunk-CNVCN5iu.js +1 -0
- package/public/{chunk-CUBEGvp7.js → chunk-CO9KmPmd.js} +2 -2
- package/public/{chunk-BofKJVLp.js → chunk-CRj-0QOB.js} +1 -1
- package/public/chunk-CSBbBaXy.js +1 -0
- package/public/chunk-CSsNumKS.js +1 -0
- package/public/chunk-CUteJXBV.js +1 -0
- package/public/chunk-CZWkH84c.js +1 -0
- package/public/chunk-CZilrbfp.js +1 -0
- package/public/chunk-CZvMVs90.js +1 -0
- package/public/chunk-CfT1rW6R.js +1 -0
- package/public/chunk-Cg61wOsH.js +1 -0
- package/public/chunk-ChSbreXw.js +1 -0
- package/public/{chunk-Cllvdu6Y.js → chunk-CkW4dsXP.js} +3 -3
- package/public/chunk-CoNGwErw.js +1 -0
- package/public/chunk-Csa-xwld.js +1 -0
- package/public/chunk-D0FJzL89.js +1 -0
- package/public/{chunk-COOVD7pV.js → chunk-D0FLYngR.js} +1 -1
- package/public/chunk-D6ItVSST.js +1 -0
- package/public/{chunk-BvbBGNOr.js → chunk-D7tckDgv.js} +1 -1
- package/public/{chunk-CMdj6o2y.js → chunk-D9s5gnbM.js} +1 -1
- package/public/chunk-DDr4YmiH.js +1 -0
- package/public/{chunk-C235Cb9w.js → chunk-DJCf7jnu.js} +1 -1
- package/public/chunk-DJztzb2k.js +1 -0
- package/public/chunk-DKEN80Iw.js +1 -0
- package/public/chunk-DLwz8QBS.js +17 -0
- package/public/chunk-DM6ld8FR.js +1 -0
- package/public/chunk-DNfJNGg8.js +1 -0
- package/public/chunk-DNjp4uBY.js +1 -0
- package/public/{chunk-DaIKOMKS.js → chunk-DP-WozsC.js} +2 -2
- package/public/chunk-DPjgwa7R.js +1 -0
- package/public/{chunk-Bc5GjisF.js → chunk-DR-A-GPt.js} +3 -3
- package/public/{chunk-Cus8XUsV.js → chunk-DVxtU9qu.js} +1 -1
- package/public/{chunk-CM_UzKwA.js → chunk-DWSTLIDw.js} +1 -1
- package/public/chunk-DYmTOPYc.js +1 -0
- package/public/{chunk-CNph9BLC.js → chunk-DaDGnDJ4.js} +1 -1
- package/public/{chunk-F_BwPQJN.js → chunk-DaalzZ9-.js} +1 -1
- package/public/chunk-Dar47uj7.js +1 -0
- package/public/chunk-DdFpuuio.js +1 -0
- package/public/{chunk-m-yEjYHl.js → chunk-DgGyszJT.js} +1 -1
- package/public/{chunk-35i7MGnS.js → chunk-DieoRkze.js} +1 -1
- package/public/chunk-DtwtUN5q.js +1 -0
- package/public/chunk-DvqaMAHM.js +1 -0
- package/public/{chunk-UcQyY34n.js → chunk-FNSjP-XL.js} +1 -1
- package/public/chunk-FqZqIV0m.js +1 -0
- package/public/chunk-HCTmZN8L.js +1 -0
- package/public/chunk-HJtyYLAh.js +1 -0
- package/public/chunk-KRGb3eQr.js +1 -0
- package/public/chunk-UWTUqpIO.js +77 -0
- package/public/{chunk-M5E1mUWb.js → chunk-V7PYrKYD.js} +1 -1
- package/public/{chunk-BcvKKM8h.js → chunk-Z1otnM8d.js} +1 -1
- package/public/{chunk-Bw-4YMDW.js → chunk-cbdWvq8Q.js} +1 -1
- package/public/{chunk-CvVCzBGX.js → chunk-h4Xkqcg2.js} +1 -1
- package/public/chunk-haqzH7Sj.js +1 -0
- package/public/chunk-ngV4F8an.js +1 -0
- package/public/chunk-oHuQiA9s.js +1 -0
- package/public/chunk-q7UtUZuy.js +1 -0
- package/public/chunk-uJPFzwFL.js +1 -0
- package/public/{chunk-Dy3D8OuX.js → chunk-wfriCale.js} +3 -3
- package/public/index.html +7 -7
- package/public/main-GAGFY22W.js +102 -0
- package/public/media/fa-solid-900-NLV2OPZH.woff2 +0 -0
- package/public/{styles-BRWZJBNA.css → styles-GMIQGX5I.css} +1 -1
- package/public/assets/monaco/min/vs/assets/editor.worker-_vAIFJDs.js +0 -30
- package/public/assets/monaco/min/vs/assets/json.worker-Csf_TLih.js +0 -62
- package/public/assets/monaco/min/vs/css.worker-BInK4lsP.js +0 -1
- package/public/assets/monaco/min/vs/editor/editor.worker.js +0 -1
- package/public/assets/monaco/min/vs/editor-BdtEMBbM.js +0 -892
- package/public/assets/monaco/min/vs/editorWorkerHost-B_VpI68A.js +0 -35
- package/public/assets/monaco/min/vs/html.worker-C1TNvQ72.js +0 -1
- package/public/assets/monaco/min/vs/index-049xrXrp.js +0 -1
- package/public/assets/monaco/min/vs/index-DZH_zysX.js +0 -5
- package/public/assets/monaco/min/vs/json.worker-Bp7U0-9w.js +0 -1
- package/public/assets/monaco/min/vs/jsonMode-w7Q_ZLTt.js +0 -1
- package/public/assets/monaco/min/vs/lspLanguageFeatures-Cog3rVVE.js +0 -2
- package/public/assets/monaco/min/vs/main-BEx-Fmlo.js +0 -15
- package/public/assets/monaco/min/vs/main-DsK8pnKg.js +0 -3
- package/public/assets/monaco/min/vs/toggleHighContrast-DuqAmExZ.js +0 -65
- package/public/assets/monaco/min/vs/ts.worker-BLYAhMkX.js +0 -1
- package/public/chunk-4CKEWIDf.js +0 -1
- package/public/chunk-6BbeS0y4.js +0 -1
- package/public/chunk-7tfYJ-md.js +0 -1
- package/public/chunk-AboQwH8o.js +0 -67
- package/public/chunk-B0l40kqK.js +0 -1
- package/public/chunk-B1gSDyVF.js +0 -1
- package/public/chunk-B2Jx1wD7.js +0 -1
- package/public/chunk-B4CbOdVo.js +0 -1
- package/public/chunk-B6-SLmWv.js +0 -1
- package/public/chunk-B69Scb30.js +0 -1
- package/public/chunk-BA-6s0dq.js +0 -1
- package/public/chunk-BBpnMV-c.js +0 -1
- package/public/chunk-BFRfhB9J.js +0 -1
- package/public/chunk-BGAj3n4e.js +0 -76
- package/public/chunk-BGndSVji.js +0 -1
- package/public/chunk-BKQMBtYJ.js +0 -1
- package/public/chunk-BOypSo2u.js +0 -1
- package/public/chunk-BWaG7cZj.js +0 -1
- package/public/chunk-Bf03ZX_t.js +0 -1
- package/public/chunk-BftikvBu.js +0 -1
- package/public/chunk-BjuuyfoK.js +0 -1
- package/public/chunk-Bmg9tbWh.js +0 -1
- package/public/chunk-BoX7UpmA.js +0 -1
- package/public/chunk-BpRjwWHm.js +0 -1
- package/public/chunk-Btl3fXaG.js +0 -1
- package/public/chunk-BykEKRPf.js +0 -1
- package/public/chunk-C2sbhEi5.js +0 -1
- package/public/chunk-C3Pi7dYb.js +0 -17
- package/public/chunk-C66kOytP.js +0 -1
- package/public/chunk-C6tkhSLn.js +0 -1
- package/public/chunk-CKVd94SF.js +0 -1
- package/public/chunk-CXYk6g8A.js +0 -1
- package/public/chunk-CZJ4GIVe.js +0 -1
- package/public/chunk-CZO4t6Sv.js +0 -1
- package/public/chunk-CdIGsjC8.js +0 -1
- package/public/chunk-CjGuDTRt.js +0 -1
- package/public/chunk-Cp6jR52l.js +0 -1
- package/public/chunk-CvX2i87v.js +0 -1
- package/public/chunk-D0ha01LZ.js +0 -1
- package/public/chunk-D7AFXLpU.js +0 -1
- package/public/chunk-D8KsZnYG.js +0 -1
- package/public/chunk-D9NVjkjP.js +0 -1
- package/public/chunk-DQxC-e40.js +0 -1
- package/public/chunk-DW8apxAi.js +0 -1
- package/public/chunk-DWq0Ppax.js +0 -1
- package/public/chunk-DXbLOzEg.js +0 -1
- package/public/chunk-Db1Txbpv.js +0 -1
- package/public/chunk-DdEWPBJx.js +0 -1
- package/public/chunk-DjQ9K_nQ.js +0 -1
- package/public/chunk-DjXbndIp.js +0 -1
- package/public/chunk-Dl7kUzh-.js +0 -1
- package/public/chunk-DrBh9Ea9.js +0 -1
- package/public/chunk-DvHTpLzx.js +0 -1
- package/public/chunk-Dxs7n6r5.js +0 -1
- package/public/chunk-GgHHcSOl.js +0 -1
- package/public/chunk-GrJQ-2zJ.js +0 -1
- package/public/chunk-I6vH2QYI.js +0 -1
- package/public/chunk-JHB5h8n5.js +0 -1
- package/public/chunk-Laoao5d6.js +0 -1
- package/public/chunk-OXils2-W.js +0 -1
- package/public/chunk-UYwZ2si3.js +0 -1
- package/public/chunk-lCLJNKFQ.js +0 -1
- package/public/chunk-mH2J9Ii7.js +0 -1
- package/public/chunk-mmnqzCF7.js +0 -1
- package/public/chunk-wahplOuM.js +0 -1
- package/public/chunk-yqnqIPzb.js +0 -1
- package/public/chunk-zbcZ1JCG.js +0 -1
- package/public/main-5BYBMMWR.js +0 -102
- package/public/media/fa-solid-900-XXVZE3K6.woff2 +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `homebridge-config-ui-x` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
|
5
|
-
## v5.30.2 (
|
|
5
|
+
## v5.30.2 (2026-11-29)
|
|
6
6
|
|
|
7
7
|
### Highlights
|
|
8
8
|
|
|
9
|
+
- 📡 The accessories tab shows accessories that are not responding, with their HomeKit status
|
|
10
|
+
- 🪫 Accessory tiles show a low battery icon
|
|
11
|
+
- 📷 A camera shows as one tile, with its sound, motion sensor and doorbell, and its recording, operating mode and data stream services are hidden
|
|
12
|
+
- 🌀 Matter fans show on and off by their mode and speed, and write the two together
|
|
13
|
+
- 🧹 Matter controls are sent once and show on the part of the device they belong to, the room layout is saved for the signed-in user, and the page no longer adds another set of socket handlers on each visit
|
|
14
|
+
|
|
9
15
|
### UI Changes
|
|
10
16
|
|
|
11
17
|
- feat(accessories): show accessories that are not responding, with their HomeKit status (#3124, #3127)
|
|
@@ -117,6 +123,8 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
|
|
|
117
123
|
- feat(config): show the secrets toggle as a lock icon, with the masking notice in its tooltip
|
|
118
124
|
- fix(logs): make the log and terminal scrollbar always visible and easy to grab on touch screens
|
|
119
125
|
- feat(settings): bind homebridge to a network interface by its ip address, not only its name (#3126) (@stalinCCCP415)
|
|
126
|
+
- feat(accessories): show a low battery icon on accessory tiles (#3149)
|
|
127
|
+
- fix(auth): accept only HS256 tokens (#3154) (@ofri-peretz)
|
|
120
128
|
|
|
121
129
|
### Other Changes
|
|
122
130
|
|
|
@@ -158,13 +166,22 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
|
|
|
158
166
|
- ci: set release concurrency per job and branch, so a publish is never cancelled part-way (#3128)
|
|
159
167
|
- fix(auth): close a user's open sockets when the user is deleted or the session is revoked
|
|
160
168
|
- fix(terminal): leave a swipe past the first or last line to the phone, to scroll the page
|
|
169
|
+
- fix(plugins): match the start of words in the plugin search (#3138) (@emreocell)
|
|
170
|
+
- fix(plugins): show a plugin's first maintainer in the search, not github actions (#3146)
|
|
171
|
+
- test(ui): stop loading the app polyfills in the ui tests, which left them unchecked
|
|
172
|
+
- fix(accessories): hide a camera's recording, operating mode and data stream services
|
|
173
|
+
- feat(accessories): show a camera as one tile, with its sound, motion sensor and doorbell
|
|
174
|
+
- fix(accessories): accept an id saved before hap-client 5.4.1 in the accessory api (#3125)
|
|
175
|
+
- feat(server): add a web root setting, to serve the ui under a path behind a reverse proxy (#746)
|
|
176
|
+
- feat(matter): show left-over matter storage as stale bridges, and remove it with its plugin
|
|
177
|
+
- fix(server): return an empty list, not a 500, when the accessories or persist folder is missing
|
|
161
178
|
- chore(deps): dependency updates
|
|
162
179
|
|
|
163
180
|
### Homebridge Dependencies
|
|
164
181
|
|
|
165
|
-
- `@homebridge/hap-client` @ `v5.
|
|
182
|
+
- `@homebridge/hap-client` @ `v5.5.0`
|
|
166
183
|
- `@homebridge/node-pty-prebuilt-multiarch` @ `v0.15.0`
|
|
167
|
-
- `@homebridge/plugin-ui-utils` @ `v2.3.1
|
|
184
|
+
- `@homebridge/plugin-ui-utils` @ `v2.3.1`
|
|
168
185
|
|
|
169
186
|
## v5.30.1 (2026-11-13)
|
|
170
187
|
|
|
@@ -167,13 +167,13 @@ let AuthController = class AuthController {
|
|
|
167
167
|
buildRefreshCookie(token, secure) {
|
|
168
168
|
const maxAge = this.configService.ui.sessionTimeout || 28800;
|
|
169
169
|
const secureFlag = secure ? '; Secure' : '';
|
|
170
|
-
return `hb-refresh=${token}; HttpOnly; SameSite=Strict; Path=${API_PREFIX}/auth/session; Max-Age=${maxAge}${secureFlag}`;
|
|
170
|
+
return `hb-refresh=${token}; HttpOnly; SameSite=Strict; Path=${this.configService.webRoot}${API_PREFIX}/auth/session; Max-Age=${maxAge}${secureFlag}`;
|
|
171
171
|
}
|
|
172
172
|
buildClearedCookies(secure, pluginNames = []) {
|
|
173
173
|
const secureFlag = secure ? '; Secure' : '';
|
|
174
174
|
return [
|
|
175
|
-
`hb-refresh=; HttpOnly; SameSite=Strict; Path=${API_PREFIX}/auth/session; Max-Age=0${secureFlag}`,
|
|
176
|
-
...pluginNames.map(pluginName => `hb-plugin-ui=; HttpOnly; SameSite=Strict; Path=${API_PREFIX}/plugins/settings-ui/${encodeURIComponent(pluginName)}/; Max-Age=0${secureFlag}`),
|
|
175
|
+
`hb-refresh=; HttpOnly; SameSite=Strict; Path=${this.configService.webRoot}${API_PREFIX}/auth/session; Max-Age=0${secureFlag}`,
|
|
176
|
+
...pluginNames.map(pluginName => `hb-plugin-ui=; HttpOnly; SameSite=Strict; Path=${this.configService.webRoot}${API_PREFIX}/plugins/settings-ui/${encodeURIComponent(pluginName)}/; Max-Age=0${secureFlag}`),
|
|
177
177
|
];
|
|
178
178
|
}
|
|
179
179
|
};
|
|
@@ -19,6 +19,7 @@ import { AdminGuard } from './guards/admin.guard.js';
|
|
|
19
19
|
import { WsAdminGuard } from './guards/ws-admin-guard.js';
|
|
20
20
|
import { WsLogGuard } from './guards/ws-log.guard.js';
|
|
21
21
|
import { WsGuard } from './guards/ws.guard.js';
|
|
22
|
+
import { JWT_ALGORITHM } from './jwt.constants.js';
|
|
22
23
|
import { JwtStrategy } from './jwt.strategy.js';
|
|
23
24
|
let AuthModule = class AuthModule {
|
|
24
25
|
};
|
|
@@ -31,8 +32,12 @@ AuthModule = __decorate([
|
|
|
31
32
|
useFactory: async (configService) => ({
|
|
32
33
|
secret: configService.secrets.secretKey,
|
|
33
34
|
signOptions: {
|
|
35
|
+
algorithm: JWT_ALGORITHM,
|
|
34
36
|
expiresIn: configService.ui.sessionTimeout,
|
|
35
37
|
},
|
|
38
|
+
verifyOptions: {
|
|
39
|
+
algorithms: [JWT_ALGORITHM],
|
|
40
|
+
},
|
|
36
41
|
}),
|
|
37
42
|
inject: [ConfigService],
|
|
38
43
|
}),
|
|
@@ -16,6 +16,7 @@ import { WsException } from '@nestjs/websockets';
|
|
|
16
16
|
import jwt from 'jsonwebtoken';
|
|
17
17
|
import { ConfigService } from '../../config/config.service.js';
|
|
18
18
|
import { AuthService } from '../auth.service.js';
|
|
19
|
+
import { JWT_ALGORITHM } from '../jwt.constants.js';
|
|
19
20
|
import { extractWsToken } from './ws-token.js';
|
|
20
21
|
let WsAdminGuard = class WsAdminGuard {
|
|
21
22
|
configService;
|
|
@@ -30,7 +31,9 @@ let WsAdminGuard = class WsAdminGuard {
|
|
|
30
31
|
async canActivate(context) {
|
|
31
32
|
const client = context.switchToWs().getClient();
|
|
32
33
|
try {
|
|
33
|
-
const user = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey
|
|
34
|
+
const user = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey, {
|
|
35
|
+
algorithms: [JWT_ALGORITHM],
|
|
36
|
+
});
|
|
34
37
|
if (user?.instanceId !== this.configService.instanceId) {
|
|
35
38
|
const isLiveWizardToken = user?.username === 'setup-wizard'
|
|
36
39
|
&& this.configService.setupWizardComplete === false;
|
|
@@ -16,6 +16,7 @@ import { WsException } from '@nestjs/websockets';
|
|
|
16
16
|
import jwt from 'jsonwebtoken';
|
|
17
17
|
import { ConfigService } from '../../config/config.service.js';
|
|
18
18
|
import { AuthService } from '../auth.service.js';
|
|
19
|
+
import { JWT_ALGORITHM } from '../jwt.constants.js';
|
|
19
20
|
import { extractWsToken } from './ws-token.js';
|
|
20
21
|
let WsLogGuard = class WsLogGuard {
|
|
21
22
|
configService;
|
|
@@ -30,7 +31,9 @@ let WsLogGuard = class WsLogGuard {
|
|
|
30
31
|
async canActivate(context) {
|
|
31
32
|
const client = context.switchToWs().getClient();
|
|
32
33
|
try {
|
|
33
|
-
const payload = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey
|
|
34
|
+
const payload = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey, {
|
|
35
|
+
algorithms: [JWT_ALGORITHM],
|
|
36
|
+
});
|
|
34
37
|
if (payload?.instanceId !== this.configService.instanceId) {
|
|
35
38
|
const isLiveWizardToken = payload?.username === 'setup-wizard'
|
|
36
39
|
&& this.configService.setupWizardComplete === false;
|
|
@@ -16,6 +16,7 @@ import { WsException } from '@nestjs/websockets';
|
|
|
16
16
|
import jwt from 'jsonwebtoken';
|
|
17
17
|
import { ConfigService } from '../../config/config.service.js';
|
|
18
18
|
import { AuthService } from '../auth.service.js';
|
|
19
|
+
import { JWT_ALGORITHM } from '../jwt.constants.js';
|
|
19
20
|
import { extractWsToken, setWsUser } from './ws-token.js';
|
|
20
21
|
let WsGuard = class WsGuard {
|
|
21
22
|
configService;
|
|
@@ -30,7 +31,9 @@ let WsGuard = class WsGuard {
|
|
|
30
31
|
async canActivate(context) {
|
|
31
32
|
const client = context.switchToWs().getClient();
|
|
32
33
|
try {
|
|
33
|
-
const payload = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey
|
|
34
|
+
const payload = jwt.verify(extractWsToken(client.handshake), this.configService.secrets.secretKey, {
|
|
35
|
+
algorithms: [JWT_ALGORITHM],
|
|
36
|
+
});
|
|
34
37
|
if (payload?.instanceId !== this.configService.instanceId) {
|
|
35
38
|
const isLiveWizardToken = payload?.username === 'setup-wizard'
|
|
36
39
|
&& this.configService.setupWizardComplete === false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const JWT_ALGORITHM = 'HS256';
|
|
@@ -15,6 +15,7 @@ import { PassportStrategy } from '@nestjs/passport';
|
|
|
15
15
|
import { ExtractJwt, Strategy } from 'passport-jwt';
|
|
16
16
|
import { ConfigService } from '../config/config.service.js';
|
|
17
17
|
import { AuthService } from './auth.service.js';
|
|
18
|
+
import { JWT_ALGORITHM } from './jwt.constants.js';
|
|
18
19
|
export const extractBearerToken = ExtractJwt.fromAuthHeaderAsBearerToken();
|
|
19
20
|
let JwtStrategy = class JwtStrategy extends PassportStrategy(Strategy) {
|
|
20
21
|
configService;
|
|
@@ -23,6 +24,7 @@ let JwtStrategy = class JwtStrategy extends PassportStrategy(Strategy) {
|
|
|
23
24
|
super({
|
|
24
25
|
jwtFromRequest: extractBearerToken,
|
|
25
26
|
secretOrKey: configService.secrets.secretKey,
|
|
27
|
+
algorithms: [JWT_ALGORITHM],
|
|
26
28
|
});
|
|
27
29
|
this.configService = configService;
|
|
28
30
|
this.authService = authService;
|
|
@@ -18,6 +18,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
18
18
|
import { pathExists, pathExistsSync, readJson, readJSONSync, readJsonSync } from 'fs-extra/esm';
|
|
19
19
|
import { satisfies } from 'semver';
|
|
20
20
|
import { FEATURE_FLAGS } from '../feature-flags/feature-flags.registry.js';
|
|
21
|
+
import { activeWebRoot } from '../web-root.js';
|
|
21
22
|
const WALLPAPER_EXTENSIONS = new Set([
|
|
22
23
|
'.avif',
|
|
23
24
|
'.bmp',
|
|
@@ -80,9 +81,11 @@ let ConfigService = class ConfigService {
|
|
|
80
81
|
secrets;
|
|
81
82
|
instanceId;
|
|
82
83
|
savedUiRestart;
|
|
84
|
+
webRoot;
|
|
83
85
|
constructor() {
|
|
84
86
|
const homebridgeConfig = readJSONSync(this.configPath);
|
|
85
87
|
this.parseConfig(homebridgeConfig);
|
|
88
|
+
this.webRoot = activeWebRoot(this.ui.webRoot);
|
|
86
89
|
this.checkIfRunningOnRaspberryPi();
|
|
87
90
|
this.checkIfRunningOnRaspbianImage();
|
|
88
91
|
}
|
|
@@ -227,6 +230,7 @@ let ConfigService = class ConfigService {
|
|
|
227
230
|
wallpaper: this.ui.wallpaper,
|
|
228
231
|
host: this.ui.host || '',
|
|
229
232
|
proxyHost: this.ui.proxyHost || '',
|
|
233
|
+
webRoot: this.ui.webRoot || '',
|
|
230
234
|
keepOrphans: this.hbStartupSettings?.keepOrphans || false,
|
|
231
235
|
};
|
|
232
236
|
}
|
|
@@ -5,6 +5,7 @@ import process from 'node:process';
|
|
|
5
5
|
import { readJson } from 'fs-extra/esm';
|
|
6
6
|
import { Logger } from '../logger/logger.service.js';
|
|
7
7
|
import { SslCertGeneratorService } from '../ssl/ssl-cert-generator.service.js';
|
|
8
|
+
import { activeWebRoot } from '../web-root.js';
|
|
8
9
|
export async function getStartupConfig() {
|
|
9
10
|
const logger = new Logger();
|
|
10
11
|
const configPath = process.env.UIX_CONFIG_PATH || resolve(homedir(), '.homebridge/config.json');
|
|
@@ -17,6 +18,7 @@ export async function getStartupConfig() {
|
|
|
17
18
|
return addresses.find(x => x.family === 'IPv6');
|
|
18
19
|
}).length;
|
|
19
20
|
config.host = ipv6 ? '::' : '0.0.0.0';
|
|
21
|
+
config.webRoot = '';
|
|
20
22
|
if (!ui) {
|
|
21
23
|
return config;
|
|
22
24
|
}
|
|
@@ -72,6 +74,10 @@ export async function getStartupConfig() {
|
|
|
72
74
|
if (ui.proxyHost && process.env.UIX_DEVELOPMENT !== '1') {
|
|
73
75
|
config.cspWsOverride = `wss://${ui.proxyHost} ws://${ui.proxyHost}`;
|
|
74
76
|
}
|
|
77
|
+
config.webRoot = activeWebRoot(ui.webRoot);
|
|
78
|
+
if (ui.webRoot && !config.webRoot && process.env.UIX_DEVELOPMENT !== '1') {
|
|
79
|
+
logger.error(`Web root config error: ui.webRoot: ${JSON.stringify(ui.webRoot)} is not a valid path, so the UI is at the root.`);
|
|
80
|
+
}
|
|
75
81
|
if (ui.allowFrameAncestors) {
|
|
76
82
|
const raw = Array.isArray(ui.allowFrameAncestors)
|
|
77
83
|
? ui.allowFrameAncestors
|
|
@@ -4,6 +4,7 @@ export const RE_CHAR_PAIRS = /.{1,2}/g;
|
|
|
4
4
|
export const RE_HYPHEN = /-/;
|
|
5
5
|
export const RE_HYPHEN_GLOBAL = /-/g;
|
|
6
6
|
export const RE_WHITESPACE = /\s+/;
|
|
7
|
+
export const RE_NON_WORD = /[^\p{L}\p{N}]+/u;
|
|
7
8
|
export const RE_URL_WITH_OPTIONAL_PAREN = /\(?(?:https?|ftp):\/\/[\n\S]+/g;
|
|
8
9
|
export const RE_URL = /(?:https?|ftp):\/\/[\n\S]+/g;
|
|
9
10
|
export const RE_GITHUB_REPO = /https:\/\/github.com\/([^/]+)\/([^/#]+)/;
|
|
@@ -4,11 +4,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
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;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
7
10
|
import { readFileSync } from 'node:fs';
|
|
8
11
|
import { resolve } from 'node:path';
|
|
9
12
|
import process from 'node:process';
|
|
10
13
|
import { Catch, NotFoundException } from '@nestjs/common';
|
|
14
|
+
import { setBaseHref } from '../web-root.js';
|
|
11
15
|
let SpaFilter = class SpaFilter {
|
|
16
|
+
webRoot;
|
|
17
|
+
constructor(webRoot = '') {
|
|
18
|
+
this.webRoot = webRoot;
|
|
19
|
+
}
|
|
12
20
|
catch(exception, host) {
|
|
13
21
|
const ctx = host.switchToHttp();
|
|
14
22
|
const req = ctx.getRequest();
|
|
@@ -24,10 +32,11 @@ let SpaFilter = class SpaFilter {
|
|
|
24
32
|
res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
25
33
|
res.header('Pragma', 'no-cache');
|
|
26
34
|
res.header('Expires', '0');
|
|
27
|
-
res.send(indexHtml);
|
|
35
|
+
res.send(setBaseHref(indexHtml, this.webRoot));
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
SpaFilter = __decorate([
|
|
31
|
-
Catch(NotFoundException)
|
|
39
|
+
Catch(NotFoundException),
|
|
40
|
+
__metadata("design:paramtypes", [Object])
|
|
32
41
|
], SpaFilter);
|
|
33
42
|
export { SpaFilter };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
const RESERVED = new Set([
|
|
3
|
+
'api',
|
|
4
|
+
'assets',
|
|
5
|
+
'media',
|
|
6
|
+
'socket.io',
|
|
7
|
+
'swagger',
|
|
8
|
+
]);
|
|
9
|
+
const RE_PART = /^[\w.~-]+$/;
|
|
10
|
+
const RE_ONLY_DOTS = /^\.+$/;
|
|
11
|
+
const RE_OUTER_SLASHES = /^\/|\/$/g;
|
|
12
|
+
const RE_BASE_TAG = /<base href="\/"/;
|
|
13
|
+
const MAX_LENGTH = 100;
|
|
14
|
+
export function normalizeWebRoot(value) {
|
|
15
|
+
if (typeof value !== 'string') {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
const path = value.trim().replace(RE_OUTER_SLASHES, '');
|
|
19
|
+
if (!path || path.length >= MAX_LENGTH) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
const parts = path.split('/');
|
|
23
|
+
if (parts.some(part => !RE_PART.test(part) || RE_ONLY_DOTS.test(part)) || RESERVED.has(parts[0].toLowerCase())) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
return `/${path}`;
|
|
27
|
+
}
|
|
28
|
+
export function activeWebRoot(value) {
|
|
29
|
+
return process.env.UIX_DEVELOPMENT === '1'
|
|
30
|
+
? ''
|
|
31
|
+
: normalizeWebRoot(value);
|
|
32
|
+
}
|
|
33
|
+
export function stripWebRoot(url, webRoot) {
|
|
34
|
+
if (!webRoot || !url.startsWith(webRoot)) {
|
|
35
|
+
return url;
|
|
36
|
+
}
|
|
37
|
+
const rest = url.slice(webRoot.length);
|
|
38
|
+
if (rest === '') {
|
|
39
|
+
return '/';
|
|
40
|
+
}
|
|
41
|
+
if (rest.startsWith('/')) {
|
|
42
|
+
return rest;
|
|
43
|
+
}
|
|
44
|
+
if (rest.startsWith('?')) {
|
|
45
|
+
return `/${rest}`;
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
export function setBaseHref(indexHtml, webRoot) {
|
|
50
|
+
return webRoot
|
|
51
|
+
? indexHtml.replace(RE_BASE_TAG, `<base href="${webRoot}/"`)
|
|
52
|
+
: indexHtml;
|
|
53
|
+
}
|
|
54
|
+
export function serveUnderWebRoot(server, webRoot) {
|
|
55
|
+
if (!webRoot) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const strip = (req) => {
|
|
59
|
+
req.url = stripWebRoot(req.url ?? '/', webRoot);
|
|
60
|
+
};
|
|
61
|
+
server.prependListener('request', strip);
|
|
62
|
+
server.prependListener('upgrade', strip);
|
|
63
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -16,6 +16,7 @@ import { devServerCorsConfig } from './core/cors.config.js';
|
|
|
16
16
|
import { Logger } from './core/logger/logger.service.js';
|
|
17
17
|
import { SpaFilter } from './core/spa/spa.filter.js';
|
|
18
18
|
import { setStaticAssetCacheHeaders } from './core/static-assets.js';
|
|
19
|
+
import { serveUnderWebRoot, setBaseHref } from './core/web-root.js';
|
|
19
20
|
import './env-setup.js';
|
|
20
21
|
import 'reflect-metadata';
|
|
21
22
|
import './self-check.js';
|
|
@@ -92,7 +93,7 @@ async function bootstrap() {
|
|
|
92
93
|
res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
93
94
|
res.header('Pragma', 'no-cache');
|
|
94
95
|
res.header('Expires', '0');
|
|
95
|
-
res.send(await readFile(resolve(process.env.UIX_BASE_PATH, 'public/index.html')));
|
|
96
|
+
res.send(setBaseHref(await readFile(resolve(process.env.UIX_BASE_PATH, 'public/index.html'), 'utf-8'), startupConfig.webRoot));
|
|
96
97
|
});
|
|
97
98
|
app.useStaticAssets({
|
|
98
99
|
root: resolve(process.env.UIX_BASE_PATH, 'public'),
|
|
@@ -122,16 +123,22 @@ async function bootstrap() {
|
|
|
122
123
|
type: 'oauth2',
|
|
123
124
|
flows: {
|
|
124
125
|
password: {
|
|
125
|
-
tokenUrl:
|
|
126
|
+
tokenUrl: `${startupConfig.webRoot}${API_PREFIX}/auth/login`,
|
|
126
127
|
scopes: null,
|
|
127
128
|
},
|
|
128
129
|
},
|
|
129
130
|
})
|
|
131
|
+
.addServer(startupConfig.webRoot || '/')
|
|
130
132
|
.build();
|
|
131
133
|
const document = SwaggerModule.createDocument(app, options);
|
|
132
134
|
SwaggerModule.setup('swagger', app, document);
|
|
133
|
-
app.useGlobalFilters(new SpaFilter());
|
|
134
|
-
|
|
135
|
+
app.useGlobalFilters(new SpaFilter(startupConfig.webRoot));
|
|
136
|
+
await app.init();
|
|
137
|
+
serveUnderWebRoot(app.getHttpServer(), startupConfig.webRoot);
|
|
138
|
+
const underWebRoot = startupConfig.webRoot
|
|
139
|
+
? `, under ${startupConfig.webRoot}`
|
|
140
|
+
: '';
|
|
141
|
+
logger.success(`Homebridge UI v${configService.package.version} is listening on ${startupConfig.host} port ${configService.ui.port}${underWebRoot}.`);
|
|
135
142
|
await app.listen(configService.ui.port, startupConfig.host);
|
|
136
143
|
let bonjour = null;
|
|
137
144
|
if (configService.ui.enableMdnsAdvertise) {
|
|
@@ -148,7 +155,7 @@ async function bootstrap() {
|
|
|
148
155
|
? undefined
|
|
149
156
|
: startupConfig.host,
|
|
150
157
|
txt: {
|
|
151
|
-
path:
|
|
158
|
+
path: `${startupConfig.webRoot}/`,
|
|
152
159
|
version: configService.package.version,
|
|
153
160
|
https: startupConfig.httpsOptions ? 'true' : 'false',
|
|
154
161
|
},
|
|
@@ -288,12 +288,22 @@ let AccessoriesService = class AccessoriesService {
|
|
|
288
288
|
return [];
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
+
findService(services, uniqueId) {
|
|
292
|
+
const service = services.find(x => x.uniqueId === uniqueId);
|
|
293
|
+
if (service) {
|
|
294
|
+
return service;
|
|
295
|
+
}
|
|
296
|
+
const legacy = services.filter(x => x.legacyUniqueId === uniqueId);
|
|
297
|
+
return legacy.length === 1
|
|
298
|
+
? legacy[0]
|
|
299
|
+
: undefined;
|
|
300
|
+
}
|
|
291
301
|
async getAccessory(uniqueId) {
|
|
292
302
|
if (uniqueId.startsWith('matter:')) {
|
|
293
303
|
return this.getMatterAccessory(uniqueId);
|
|
294
304
|
}
|
|
295
305
|
const services = await this.loadAccessories();
|
|
296
|
-
const service =
|
|
306
|
+
const service = this.findService(services, uniqueId);
|
|
297
307
|
if (!service) {
|
|
298
308
|
throw new BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
|
|
299
309
|
}
|
|
@@ -333,7 +343,7 @@ let AccessoriesService = class AccessoriesService {
|
|
|
333
343
|
}
|
|
334
344
|
async setAccessoryCharacteristic(uniqueId, characteristicType, value) {
|
|
335
345
|
const services = await this.loadAccessories();
|
|
336
|
-
const service =
|
|
346
|
+
const service = this.findService(services, uniqueId);
|
|
337
347
|
if (!service) {
|
|
338
348
|
throw new BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
|
|
339
349
|
}
|
|
@@ -16,8 +16,6 @@ import { access, lstat, mkdir, mkdtemp, readdir, realpath } from 'node:fs/promis
|
|
|
16
16
|
import { platform, tmpdir } from 'node:os';
|
|
17
17
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
18
18
|
import process from 'node:process';
|
|
19
|
-
import { pipeline } from 'node:stream';
|
|
20
|
-
import { promisify } from 'node:util';
|
|
21
19
|
import { BadRequestException, ConflictException, Inject, Injectable, InternalServerErrorException, NotFoundException, StreamableFile, } from '@nestjs/common';
|
|
22
20
|
import { cyan, green, red, yellow } from 'bash-color';
|
|
23
21
|
import dayjs from 'dayjs';
|
|
@@ -33,7 +31,6 @@ import { Logger } from '../../core/logger/logger.service.js';
|
|
|
33
31
|
import { RE_BACKUP_FILENAME, RE_BACKUP_ID, RE_COLON, RE_NPM_VERSION, RE_PLUGIN_NAME } from '../../core/regex.constants.js';
|
|
34
32
|
import { SchedulerService } from '../../core/scheduler/scheduler.service.js';
|
|
35
33
|
import { PluginsService } from '../plugins/plugins.service.js';
|
|
36
|
-
const pump = promisify(pipeline);
|
|
37
34
|
const RESTORE_PENDING = '__pending__';
|
|
38
35
|
function isInstallablePlugin(name, version) {
|
|
39
36
|
return typeof name === 'string' && RE_PLUGIN_NAME.test(name)
|
|
@@ -399,12 +396,13 @@ let BackupService = class BackupService {
|
|
|
399
396
|
let restoreDir;
|
|
400
397
|
try {
|
|
401
398
|
restoreDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
402
|
-
await
|
|
399
|
+
await extract({
|
|
400
|
+
file: backupPath,
|
|
403
401
|
cwd: restoreDir,
|
|
404
402
|
strict: true,
|
|
405
403
|
preservePaths: false,
|
|
406
404
|
filter: this.tarSafeFilter,
|
|
407
|
-
})
|
|
405
|
+
});
|
|
408
406
|
this.restoreDirectory = restoreDir;
|
|
409
407
|
}
|
|
410
408
|
catch (err) {
|
|
@@ -448,12 +446,13 @@ let BackupService = class BackupService {
|
|
|
448
446
|
let backupDir;
|
|
449
447
|
try {
|
|
450
448
|
backupDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
451
|
-
await
|
|
449
|
+
await extract({
|
|
450
|
+
input: data.file,
|
|
452
451
|
cwd: backupDir,
|
|
453
452
|
strict: true,
|
|
454
453
|
preservePaths: false,
|
|
455
454
|
filter: this.tarSafeFilter,
|
|
456
|
-
})
|
|
455
|
+
});
|
|
457
456
|
this.restoreDirectory = backupDir;
|
|
458
457
|
}
|
|
459
458
|
catch (err) {
|
|
@@ -16,14 +16,17 @@ import { ApiBearerAuth, ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger'
|
|
|
16
16
|
import { API_PREFIX } from '../../../core/api.constants.js';
|
|
17
17
|
import { AdminGuard } from '../../../core/auth/guards/admin.guard.js';
|
|
18
18
|
import { JwtAuthGuard } from '../../../core/auth/guards/jwt-auth.guard.js';
|
|
19
|
+
import { ConfigService } from '../../../core/config/config.service.js';
|
|
19
20
|
import { PluginsSettingsUiTicketService } from './plugins-settings-ui-ticket.service.js';
|
|
20
21
|
import { PluginsSettingsUiService } from './plugins-settings-ui.service.js';
|
|
21
22
|
let PluginsSettingsUiController = class PluginsSettingsUiController {
|
|
22
23
|
pluginSettingsUiService;
|
|
23
24
|
ticketService;
|
|
24
|
-
|
|
25
|
+
configService;
|
|
26
|
+
constructor(pluginSettingsUiService, ticketService, configService) {
|
|
25
27
|
this.pluginSettingsUiService = pluginSettingsUiService;
|
|
26
28
|
this.ticketService = ticketService;
|
|
29
|
+
this.configService = configService;
|
|
27
30
|
}
|
|
28
31
|
async issueTicket(request, pluginName) {
|
|
29
32
|
await this.pluginSettingsUiService.getPluginUiMetadata(pluginName);
|
|
@@ -68,7 +71,7 @@ let PluginsSettingsUiController = class PluginsSettingsUiController {
|
|
|
68
71
|
return await this.pluginSettingsUiService.serveCustomUiAsset(reply, pluginName, file, '', v);
|
|
69
72
|
}
|
|
70
73
|
setAssetSessionCookie(request, reply, token, maxAge = PluginsSettingsUiTicketService.assetSessionTtl) {
|
|
71
|
-
const cookiePath = `${API_PREFIX}/plugins/settings-ui/${encodeURIComponent(request.params.pluginName)}/`;
|
|
74
|
+
const cookiePath = `${this.configService.webRoot}${API_PREFIX}/plugins/settings-ui/${encodeURIComponent(request.params.pluginName)}/`;
|
|
72
75
|
const secure = request.protocol === 'https'
|
|
73
76
|
? '; Secure'
|
|
74
77
|
: '';
|
|
@@ -128,7 +131,9 @@ PluginsSettingsUiController = __decorate([
|
|
|
128
131
|
Controller('plugins/settings-ui'),
|
|
129
132
|
__param(0, Inject(PluginsSettingsUiService)),
|
|
130
133
|
__param(1, Inject(PluginsSettingsUiTicketService)),
|
|
134
|
+
__param(2, Inject(ConfigService)),
|
|
131
135
|
__metadata("design:paramtypes", [PluginsSettingsUiService,
|
|
132
|
-
PluginsSettingsUiTicketService
|
|
136
|
+
PluginsSettingsUiTicketService,
|
|
137
|
+
ConfigService])
|
|
133
138
|
], PluginsSettingsUiController);
|
|
134
139
|
export { PluginsSettingsUiController };
|
|
@@ -154,7 +154,7 @@ let PluginsSettingsUiService = class PluginsSettingsUiService {
|
|
|
154
154
|
serverEnv: ${JSON.stringify(this.configService.uiSettings(true)).replace(/</g, '\\u003c')},
|
|
155
155
|
};
|
|
156
156
|
</script>
|
|
157
|
-
<script src="${safeOrigin}/assets/plugin-ui-utils/ui.js?v=${this.configService.package.version}"></script>
|
|
157
|
+
<script src="${safeOrigin}${this.configService.webRoot}/assets/plugin-ui-utils/ui.js?v=${this.configService.package.version}"></script>
|
|
158
158
|
<script>
|
|
159
159
|
window.addEventListener('load', () => {
|
|
160
160
|
window.parent.postMessage({action: 'loaded'}, '*');
|
|
@@ -33,7 +33,7 @@ import { ConfigService } from '../../core/config/config.service.js';
|
|
|
33
33
|
import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
|
|
34
34
|
import { Logger } from '../../core/logger/logger.service.js';
|
|
35
35
|
import { NodePtyService } from '../../core/node-pty/node-pty.service.js';
|
|
36
|
-
import { RE_CMD_METACHARACTERS, RE_ENCODED_AT, RE_GITHUB_REPO, RE_HYPHEN, RE_HYPHEN_GLOBAL, RE_NPM_VERSION, RE_PLUGIN_NAME, RE_PRERELEASE_TYPE, RE_URL, RE_URL_WITH_OPTIONAL_PAREN, RE_WHITESPACE, RE_WORD_SEQUENCE, } from '../../core/regex.constants.js';
|
|
36
|
+
import { RE_CMD_METACHARACTERS, RE_ENCODED_AT, RE_GITHUB_REPO, RE_HYPHEN, RE_HYPHEN_GLOBAL, RE_NON_WORD, RE_NPM_VERSION, RE_PLUGIN_NAME, RE_PRERELEASE_TYPE, RE_URL, RE_URL_WITH_OPTIONAL_PAREN, RE_WHITESPACE, RE_WORD_SEQUENCE, } from '../../core/regex.constants.js';
|
|
37
37
|
import { ChildBridgesService } from '../child-bridges/child-bridges.service.js';
|
|
38
38
|
const require = createRequire(import.meta.url);
|
|
39
39
|
const module = require('node:module');
|
|
@@ -310,15 +310,22 @@ let PluginsService = class PluginsService {
|
|
|
310
310
|
const searchTermsSet = new Set(searchTerms);
|
|
311
311
|
const keywordsSet = new Set(pluginKeywords);
|
|
312
312
|
const nameTermsSet = new Set(nameTerms);
|
|
313
|
-
if (nameTerms.every(term => searchTermsSet.has(term))) {
|
|
313
|
+
if (nameTerms.length > 0 && nameTerms.every(term => searchTermsSet.has(term))) {
|
|
314
314
|
return 'exactName';
|
|
315
315
|
}
|
|
316
316
|
if (searchTerms.every(term => keywordsSet.has(term)) || searchTerms.every(term => nameTermsSet.has(term))) {
|
|
317
317
|
return 'exactKeyword';
|
|
318
318
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
const words = [
|
|
320
|
+
...nameTerms,
|
|
321
|
+
...pluginKeywords,
|
|
322
|
+
...pluginKeywords.flatMap(k => k.split(RE_NON_WORD)),
|
|
323
|
+
...pluginDescription.split(RE_NON_WORD),
|
|
324
|
+
];
|
|
325
|
+
if (searchTerms.every((term) => {
|
|
326
|
+
const termWords = term.split(RE_NON_WORD).filter(Boolean);
|
|
327
|
+
return termWords.length > 0 && termWords.every(termWord => words.some(word => word.startsWith(termWord)));
|
|
328
|
+
})) {
|
|
322
329
|
return 'partial';
|
|
323
330
|
}
|
|
324
331
|
return null;
|
|
@@ -371,7 +378,10 @@ let PluginsService = class PluginsService {
|
|
|
371
378
|
description: (pkg.package.description || pkg.package.name).replace(RE_URL_WITH_OPTIONAL_PAREN, '').trim(),
|
|
372
379
|
keywords: pkg.package.keywords || [],
|
|
373
380
|
links: pkg.package.links,
|
|
374
|
-
author: this.pluginAuthors[pkg.package.name]
|
|
381
|
+
author: this.pluginAuthors[pkg.package.name]
|
|
382
|
+
|| pkg.package.maintainers?.[0]?.username
|
|
383
|
+
|| pkg.package.publisher?.username
|
|
384
|
+
|| null,
|
|
375
385
|
verifiedPlugin: this.verifiedPlugins.includes(pkg.package.name),
|
|
376
386
|
verifiedPlusPlugin: this.verifiedPlusPlugins.includes(pkg.package.name),
|
|
377
387
|
supportsMatter: this.supportsMatter(pkg.package.keywords),
|
|
@@ -389,11 +399,16 @@ let PluginsService = class PluginsService {
|
|
|
389
399
|
for (const name of this.scopedPluginNames) {
|
|
390
400
|
if (!resultNames.has(name) && !this.isHiddenPlugin(name)) {
|
|
391
401
|
const unscopedName = name.substring(name.lastIndexOf('/') + 1).toLowerCase();
|
|
392
|
-
|
|
402
|
+
const unscopedNameTerms = this.extractTerms(unscopedName, RE_HYPHEN);
|
|
403
|
+
if (searchTerms.some(term => unscopedNameTerms.some(nameTerm => nameTerm.startsWith(term)))) {
|
|
393
404
|
scopedLookups.push(this.searchNpmRegistrySingle(name).catch(() => []));
|
|
394
405
|
}
|
|
395
406
|
}
|
|
396
407
|
}
|
|
408
|
+
const guessedName = `homebridge-${searchTerms.join('-')}`;
|
|
409
|
+
if (searchTerms.length > 0 && RE_PLUGIN_NAME.test(guessedName) && !resultNames.has(guessedName) && !this.isHiddenPlugin(guessedName)) {
|
|
410
|
+
scopedLookups.push(this.searchNpmRegistrySingle(guessedName).catch(() => []));
|
|
411
|
+
}
|
|
397
412
|
if (scopedLookups.length > 0) {
|
|
398
413
|
const scopedResults = await Promise.all(scopedLookups);
|
|
399
414
|
for (const results of scopedResults) {
|
|
@@ -1624,6 +1639,9 @@ let PluginsService = class PluginsService {
|
|
|
1624
1639
|
return [];
|
|
1625
1640
|
}
|
|
1626
1641
|
}
|
|
1642
|
+
async getInstalledModuleNames() {
|
|
1643
|
+
return new Set((await this.getInstalledModules()).map(module => module.name));
|
|
1644
|
+
}
|
|
1627
1645
|
async getInstalledModules() {
|
|
1628
1646
|
const allModules = [];
|
|
1629
1647
|
for (const requiredPath of this.paths) {
|
|
@@ -13,6 +13,7 @@ import { LoggerModule } from '../../core/logger/logger.module.js';
|
|
|
13
13
|
import { AccessoriesModule } from '../accessories/accessories.module.js';
|
|
14
14
|
import { ChildBridgesModule } from '../child-bridges/child-bridges.module.js';
|
|
15
15
|
import { ConfigEditorModule } from '../config-editor/config-editor.module.js';
|
|
16
|
+
import { PluginsModule } from '../plugins/plugins.module.js';
|
|
16
17
|
import { ServerController } from './server.controller.js';
|
|
17
18
|
import { ServerService } from './server.service.js';
|
|
18
19
|
let ServerModule = class ServerModule {
|
|
@@ -28,6 +29,7 @@ ServerModule = __decorate([
|
|
|
28
29
|
ChildBridgesModule,
|
|
29
30
|
HomebridgeIpcModule,
|
|
30
31
|
FsModule,
|
|
32
|
+
PluginsModule,
|
|
31
33
|
],
|
|
32
34
|
providers: [
|
|
33
35
|
ServerService,
|