mb-run 1.1.3 → 1.1.4-dev-20261026-c73389e

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 CHANGED
@@ -22,6 +22,14 @@ If you like this project and find it useful, please consider giving it a star on
22
22
 
23
23
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
24
24
 
25
+ ## [1.1.4] - Dev branch
26
+
27
+ ### Changed
28
+
29
+ - [template]: Update the plugin frontend guide to v.1.0.1: build API URLs from Vite's base URL to preserve Home Assistant Ingress paths.
30
+
31
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
32
+
25
33
  ## [1.1.3] - 2026-10-24
26
34
 
27
35
  ### Added
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "mb-run",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-dev-20261026-c73389e",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "mb-run",
9
- "version": "1.1.3",
9
+ "version": "1.1.4-dev-20261026-c73389e",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@typescript/typescript6": "6.0.2",
@@ -1496,6 +1496,24 @@
1496
1496
  "util": "^0.12.5"
1497
1497
  }
1498
1498
  },
1499
+ "node_modules/async-function": {
1500
+ "version": "1.0.0",
1501
+ "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz",
1502
+ "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==",
1503
+ "license": "MIT",
1504
+ "engines": {
1505
+ "node": ">= 0.4"
1506
+ }
1507
+ },
1508
+ "node_modules/async-generator-function": {
1509
+ "version": "1.0.0",
1510
+ "resolved": "https://registry.npmjs.org/async-generator-function/-/async-generator-function-1.0.0.tgz",
1511
+ "integrity": "sha512-+NAXNqgCrB95ya4Sr66i1CL2hqLVckAk7xwRYWdcm39/ELQ6YNn1aw5r0bdQtqNZgQpEWzc5yc/igXc7aL5SLA==",
1512
+ "license": "MIT",
1513
+ "engines": {
1514
+ "node": ">= 0.4"
1515
+ }
1516
+ },
1499
1517
  "node_modules/async-retry": {
1500
1518
  "version": "1.3.3",
1501
1519
  "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz",
@@ -1990,16 +2008,19 @@
1990
2008
  }
1991
2009
  },
1992
2010
  "node_modules/get-intrinsic": {
1993
- "version": "1.3.0",
1994
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
1995
- "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
2011
+ "version": "1.3.1",
2012
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.1.tgz",
2013
+ "integrity": "sha512-fk1ZVEeOX9hVZ6QzoBNEC55+Ucqg4sTVwrVuigZhuRPESVFpMyXnd3sbXvPOwp7Y9riVyANiqhEuRF0G1aVSeQ==",
1996
2014
  "license": "MIT",
1997
2015
  "dependencies": {
2016
+ "async-function": "^1.0.0",
2017
+ "async-generator-function": "^1.0.0",
1998
2018
  "call-bind-apply-helpers": "^1.0.2",
1999
2019
  "es-define-property": "^1.0.1",
2000
2020
  "es-errors": "^1.3.0",
2001
2021
  "es-object-atoms": "^1.1.1",
2002
2022
  "function-bind": "^1.1.2",
2023
+ "generator-function": "^2.0.0",
2003
2024
  "get-proto": "^1.0.1",
2004
2025
  "gopd": "^1.2.0",
2005
2026
  "has-symbols": "^1.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mb-run",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-dev-20261026-c73389e",
4
4
  "description": "Matterbridge command line executor",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch v.1.0.0'
2
+ description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch v.1.0.1'
3
3
  ---
4
4
 
5
5
  # Matterbridge Plugin Frontend Guide
@@ -18,6 +18,27 @@ When a plugin package contains a built SPA at `apps/frontend/build/index.html`,
18
18
 
19
19
  A plugin frontend must call its own `/plugins/<pluginName>/api/...` namespace rather than the core `/api/...` endpoints.
20
20
 
21
+ ## Preserve the base path through Home Assistant Ingress
22
+
23
+ Build plugin API URLs from Vite's `import.meta.env.BASE_URL`, without a leading slash on the appended path:
24
+
25
+ ```ts
26
+ const response = await fetch(`${import.meta.env.BASE_URL}api/events`, {
27
+ signal,
28
+ headers: { Accept: 'application/json' },
29
+ });
30
+ ```
31
+
32
+ The frontend template's `vite.config.ts` uses `/plugins/<pluginName>/` as its development base and `./` as its production base. Keep this arrangement and the development proxy for `${base}api`:
33
+
34
+ - In development, the request goes to `/plugins/<pluginName>/api/events` and Vite proxies it to Matterbridge.
35
+ - In production, `./api/events` resolves relative to the plugin frontend document, retaining any reverse proxy prefix.
36
+ - Through Home Assistant Ingress, `/api/hassio_ingress/<token>/plugins/<pluginName>/` therefore requests `/api/hassio_ingress/<token>/plugins/<pluginName>/api/events`.
37
+
38
+ Do not hardcode `fetch('/plugins/<pluginName>/api/events')`, a core `/api/...` URL or the Matterbridge host/port in frontend code. A root-relative URL discards the Ingress prefix and sends the request outside the addon route. The absolute plugin paths listed above describe server routes, not URLs to hardcode in browser requests.
39
+
40
+ Open the plugin frontend at its directory URL with a trailing slash, as Matterbridge does. Relative production URLs resolve against the document URL; if adding nested history-based SPA routes, ensure requests still resolve from the plugin root. Verify API requests during Vite development, direct Matterbridge access and Home Assistant Ingress access.
41
+
21
42
  ## Use `onFetch` for a plugin's custom API
22
43
 
23
44
  The frontend WebSocket RPC protocol dispatches a fixed set of built-in `/api/...` methods and does not provide a plugin extension point. Override `onFetch` in the platform class when the plugin's frontend needs to communicate with plugin code.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch v.1.0.0'
2
+ description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch v.1.0.1'
3
3
  paths:
4
4
  - 'apps/frontend/**'
5
5
  - 'src/*.ts'
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: 'Matterbridge Plugin Frontend Guide v.1.0.0'
2
+ name: 'Matterbridge Plugin Frontend Guide v.1.0.1'
3
3
  description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch'
4
4
  applyTo: 'apps/frontend/**, src/*.ts'
5
5
  ---