homebridge-config-ui-x 5.30.2-beta.8 → 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 +22 -3
- package/dist/core/auth/auth.controller.js +3 -3
- package/dist/core/auth/auth.module.js +5 -0
- package/dist/core/auth/auth.service.js +29 -0
- package/dist/core/auth/guards/ws-admin-guard.js +5 -1
- package/dist/core/auth/guards/ws-log.guard.js +5 -1
- package/dist/core/auth/guards/ws.guard.js +5 -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 +24 -23
- package/public/3rdpartylicenses.txt +781 -781
- 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-4LczDlm4.js +1 -0
- 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-B-LjENSb.js +1 -0
- package/public/chunk-B4r2O1Kh.js +1 -0
- package/public/chunk-B5MPqJcE.js +1 -0
- 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-BEbOe4T9.js +4 -0
- package/public/chunk-BGJX8h_m.js +1 -0
- package/public/chunk-BMXrmFqD.js +1 -0
- package/public/chunk-BPTs8QY0.js +1 -0
- package/public/chunk-BQ_oyvEZ.js +1 -0
- package/public/chunk-BUGCHLWr.js +16 -0
- package/public/chunk-BW5huvPA.js +1 -0
- package/public/chunk-BW9DGXgV.js +1 -0
- package/public/chunk-BZkhFNMI.js +1 -0
- package/public/{chunk-CR38IvpE.js → chunk-B_WM1X73.js} +5 -5
- 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-ByV1FXZb.js +1 -0
- 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-CMZ3GvNS.js +1 -0
- package/public/chunk-CNOp3s3R.js +1 -0
- package/public/chunk-CNVCN5iu.js +1 -0
- package/public/{chunk-De2ccIow.js → chunk-CO9KmPmd.js} +2 -2
- package/public/chunk-CRj-0QOB.js +1 -0
- 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-BwJ_Ketf.js → chunk-CkW4dsXP.js} +8 -8
- 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-D0FLYngR.js +1 -0
- package/public/chunk-D6ItVSST.js +1 -0
- package/public/chunk-D7tckDgv.js +1 -0
- package/public/chunk-D9s5gnbM.js +1 -0
- package/public/chunk-DDr4YmiH.js +1 -0
- package/public/chunk-DJCf7jnu.js +1 -0
- 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-DP-WozsC.js +4 -0
- package/public/chunk-DPjgwa7R.js +1 -0
- package/public/chunk-DR-A-GPt.js +19 -0
- package/public/chunk-DVxtU9qu.js +1 -0
- package/public/chunk-DWSTLIDw.js +1 -0
- package/public/chunk-DYmTOPYc.js +1 -0
- package/public/chunk-DaDGnDJ4.js +1 -0
- package/public/chunk-DaalzZ9-.js +1 -0
- package/public/chunk-Dar47uj7.js +1 -0
- package/public/chunk-DdFpuuio.js +1 -0
- package/public/chunk-DgGyszJT.js +1 -0
- package/public/chunk-DieoRkze.js +1 -0
- package/public/chunk-DtwtUN5q.js +1 -0
- package/public/chunk-DvqaMAHM.js +1 -0
- package/public/chunk-FNSjP-XL.js +1 -0
- 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-V7PYrKYD.js +1 -0
- package/public/chunk-Z1otnM8d.js +1 -0
- package/public/{chunk-DvGoAPnR.js → chunk-cbdWvq8Q.js} +1 -1
- package/public/chunk-h4Xkqcg2.js +1 -0
- 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-wfriCale.js +9 -0
- 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--ljXZt8K.js +0 -1
- package/public/chunk-4tndJaWm.js +0 -1
- package/public/chunk-6SepCqnp.js +0 -1
- package/public/chunk-74itTK1W.js +0 -1
- package/public/chunk-8NrD8Vuq.js +0 -1
- package/public/chunk-B0ZmxZ1u.js +0 -1
- package/public/chunk-B5-o8Zu4.js +0 -1
- package/public/chunk-B7UeRW2e.js +0 -1
- package/public/chunk-B8EUkU-I.js +0 -1
- package/public/chunk-B8xiRjgm.js +0 -1
- package/public/chunk-BDVYHBoL.js +0 -1
- package/public/chunk-BLHJ8Kt-.js +0 -1
- package/public/chunk-BMtYY2vD.js +0 -1
- package/public/chunk-BNYPGEUS.js +0 -1
- package/public/chunk-BNxEDQwB.js +0 -1
- package/public/chunk-BP0E6TVX.js +0 -1
- package/public/chunk-BQm-VqAo.js +0 -1
- package/public/chunk-BT8g1nrC.js +0 -1
- package/public/chunk-BVBI4iq6.js +0 -1
- package/public/chunk-B_QdvOQ5.js +0 -1
- package/public/chunk-BaMj4Qiv.js +0 -1
- package/public/chunk-Bf5dzArW.js +0 -1
- package/public/chunk-BkHNkftW.js +0 -16
- package/public/chunk-BkbgBaa3.js +0 -4
- package/public/chunk-Bpja3D5h.js +0 -1
- package/public/chunk-Bq8cGPwG.js +0 -1
- package/public/chunk-Bqjw9L-Y.js +0 -5
- package/public/chunk-Bv7FAcTY.js +0 -1
- package/public/chunk-Bwk5SCbV.js +0 -1
- package/public/chunk-BxMeNQB3.js +0 -1
- package/public/chunk-BxZa0zL6.js +0 -1
- package/public/chunk-By_c-s6M.js +0 -1
- package/public/chunk-BzltBE4C.js +0 -1
- package/public/chunk-C3GG0q7T.js +0 -1
- package/public/chunk-C7rR63FI.js +0 -1
- package/public/chunk-C8m6k3jm.js +0 -1
- package/public/chunk-C9NJu330.js +0 -1
- package/public/chunk-CBqXcrqy.js +0 -67
- package/public/chunk-CBuKXH0f.js +0 -1
- package/public/chunk-CIPRVTUi.js +0 -1
- package/public/chunk-CLPqUb1Q.js +0 -1
- package/public/chunk-CMhINY4Q.js +0 -1
- package/public/chunk-CNTnesXB.js +0 -1
- package/public/chunk-CNv9wOlp.js +0 -1
- package/public/chunk-CNvvTNEY.js +0 -1
- package/public/chunk-CPjBYUzR.js +0 -1
- package/public/chunk-CT17AHNt.js +0 -1
- package/public/chunk-CUZQjW3p.js +0 -1
- package/public/chunk-CVfhurLg.js +0 -1
- package/public/chunk-CWHHVbZ9.js +0 -1
- package/public/chunk-CZd7ZBN8.js +0 -1
- package/public/chunk-Cdq_tt3F.js +0 -1
- package/public/chunk-CgkOV0W8.js +0 -1
- package/public/chunk-CirFaasQ.js +0 -19
- package/public/chunk-Cp4ixF8z.js +0 -1
- package/public/chunk-Cu_wk_qx.js +0 -1
- package/public/chunk-CwYU3v03.js +0 -1
- package/public/chunk-Czau2_DY.js +0 -1
- package/public/chunk-D05XSZBV.js +0 -4
- package/public/chunk-D2pkFKVy.js +0 -1
- package/public/chunk-D39XL-zh.js +0 -1
- package/public/chunk-D4P3TN1p.js +0 -1
- package/public/chunk-D5ReQM9y.js +0 -1
- package/public/chunk-D83XuVbF.js +0 -1
- package/public/chunk-D8sNjfFe.js +0 -1
- package/public/chunk-DB3dqQL1.js +0 -1
- package/public/chunk-DBptXNSG.js +0 -1
- package/public/chunk-DGs6tE-i.js +0 -1
- package/public/chunk-DHKMhpJT.js +0 -9
- package/public/chunk-DHU30Tsz.js +0 -1
- package/public/chunk-DLFjuc1M.js +0 -17
- package/public/chunk-DMXNULMY.js +0 -1
- package/public/chunk-DRcclMLL.js +0 -1
- package/public/chunk-DSHSGmd2.js +0 -1
- package/public/chunk-DXSzivZu.js +0 -1
- package/public/chunk-DdIl8Ewy.js +0 -1
- package/public/chunk-DfLdkasJ.js +0 -1
- package/public/chunk-Dgps3b57.js +0 -1
- package/public/chunk-Di0g8sxN.js +0 -1
- package/public/chunk-DiY5Zk6X.js +0 -1
- package/public/chunk-DmK8TtbX.js +0 -1
- package/public/chunk-Dr8lL24Z.js +0 -1
- package/public/chunk-DsbPRF-B.js +0 -1
- package/public/chunk-Dt8qy4FJ.js +0 -1
- package/public/chunk-Dwdt25YV.js +0 -1
- package/public/chunk-GL0BCnxd.js +0 -1
- package/public/chunk-O-uUM__V.js +0 -1
- package/public/chunk-Od8GO-6X.js +0 -1
- package/public/chunk-S2b5qzcX.js +0 -1
- package/public/chunk-SLSWFxIU.js +0 -76
- package/public/chunk-YDjduqLv.js +0 -1
- package/public/chunk-f_rnfM21.js +0 -1
- package/public/chunk-g3fEW4rZ.js +0 -1
- package/public/chunk-gI0iz4BQ.js +0 -1
- package/public/chunk-gQMy1gzV.js +0 -1
- package/public/chunk-satKv0T8.js +0 -1
- package/public/chunk-smqBj2xz.js +0 -1
- package/public/chunk-z6kHMmMU.js +0 -1
- package/public/main-J6IMRWWJ.js +0 -98
- 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
|
|
|
@@ -156,13 +164,24 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
|
|
|
156
164
|
- fix: import types with import type, so each server file builds on its own as the swc dev server needs
|
|
157
165
|
- chore(dev): run the dev server through swc, so nest checks api data in dev as a release does
|
|
158
166
|
- ci: set release concurrency per job and branch, so a publish is never cancelled part-way (#3128)
|
|
167
|
+
- fix(auth): close a user's open sockets when the user is deleted or the session is revoked
|
|
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
|
|
159
178
|
- chore(deps): dependency updates
|
|
160
179
|
|
|
161
180
|
### Homebridge Dependencies
|
|
162
181
|
|
|
163
|
-
- `@homebridge/hap-client` @ `v5.
|
|
182
|
+
- `@homebridge/hap-client` @ `v5.5.0`
|
|
164
183
|
- `@homebridge/node-pty-prebuilt-multiarch` @ `v0.15.0`
|
|
165
|
-
- `@homebridge/plugin-ui-utils` @ `v2.3.1
|
|
184
|
+
- `@homebridge/plugin-ui-utils` @ `v2.3.1`
|
|
166
185
|
|
|
167
186
|
## v5.30.1 (2026-11-13)
|
|
168
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
|
}),
|
|
@@ -42,6 +42,7 @@ let AuthService = class AuthService {
|
|
|
42
42
|
passwordChecksRunning = 0;
|
|
43
43
|
passwordCheckQueue = [];
|
|
44
44
|
userCache = new NodeCache({ stdTTL: USER_CACHE_TTL_SECONDS });
|
|
45
|
+
trackedSockets = new Map();
|
|
45
46
|
firstUserSetupInProgress = false;
|
|
46
47
|
legacyOtpGuardrails = createGuardrails({
|
|
47
48
|
MIN_SECRET_BYTES: 10,
|
|
@@ -424,8 +425,36 @@ let AuthService = class AuthService {
|
|
|
424
425
|
return users;
|
|
425
426
|
}, AUTH_FILE_WRITE_OPTIONS);
|
|
426
427
|
this.invalidateUserCache();
|
|
428
|
+
await this.disconnectRevokedSockets();
|
|
427
429
|
return result;
|
|
428
430
|
}
|
|
431
|
+
trackSocket(client, payload) {
|
|
432
|
+
if (!client || this.trackedSockets.has(client)) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
this.trackedSockets.set(client, payload);
|
|
436
|
+
client.once?.('disconnect', () => this.trackedSockets.delete(client));
|
|
437
|
+
}
|
|
438
|
+
async disconnectRevokedSockets() {
|
|
439
|
+
for (const [client, payload] of this.trackedSockets) {
|
|
440
|
+
let valid = false;
|
|
441
|
+
try {
|
|
442
|
+
valid = !!await this.validateUser(payload);
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
}
|
|
446
|
+
if (valid) {
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
this.trackedSockets.delete(client);
|
|
450
|
+
try {
|
|
451
|
+
client.disconnect(true);
|
|
452
|
+
}
|
|
453
|
+
catch (e) {
|
|
454
|
+
this.logger.warn(`Failed to close a socket of '${payload?.username}' after its session ended: ${e.message}`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
429
458
|
async addUser(user) {
|
|
430
459
|
if (typeof user.password !== 'string' || !user.password) {
|
|
431
460
|
throw new BadRequestException('A password is required.');
|
|
@@ -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;
|
|
@@ -41,6 +44,7 @@ let WsAdminGuard = class WsAdminGuard {
|
|
|
41
44
|
if (!await this.authService.validateUser(user)) {
|
|
42
45
|
throw new Error('User no longer valid');
|
|
43
46
|
}
|
|
47
|
+
this.authService.trackSocket(client, user);
|
|
44
48
|
return user.admin;
|
|
45
49
|
}
|
|
46
50
|
catch (e) {
|
|
@@ -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;
|
|
@@ -41,6 +44,7 @@ let WsLogGuard = class WsLogGuard {
|
|
|
41
44
|
if (!await this.authService.validateUser(payload)) {
|
|
42
45
|
throw new Error('User no longer valid');
|
|
43
46
|
}
|
|
47
|
+
this.authService.trackSocket(client, payload);
|
|
44
48
|
return this.configService.restrictLogsToAdmins
|
|
45
49
|
? Boolean(payload.admin)
|
|
46
50
|
: true;
|
|
@@ -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;
|
|
@@ -42,6 +45,7 @@ let WsGuard = class WsGuard {
|
|
|
42
45
|
throw new Error('User no longer valid');
|
|
43
46
|
}
|
|
44
47
|
setWsUser(client, payload);
|
|
48
|
+
this.authService.trackSocket(client, payload);
|
|
45
49
|
return true;
|
|
46
50
|
}
|
|
47
51
|
catch (e) {
|
|
@@ -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'}, '*');
|