@manny-est/node-red-flowpilot 0.4.0 → 0.4.1
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 +6 -0
- package/flowpilot-core.js +16 -5
- package/flowpilot.js +18 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to FlowPilot are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.4.1] - 2026-06-29
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Critical**: the editor hung at "Loading plugins" on any Node-RED instance with `adminAuth` enabled, due to a 401 on `/flowpilot/core.js`. 0.4.0's pop-out refactor moved FlowPilot's frontend into a separately-served script, but the route serving it (along with `core.css` and the pop-out's `view.html`) was gated behind `RED.auth.needsPermission(...)` — a check that requires an `Authorization` header, which a plain `<script src>`/`<link>`/`window.open` request can never carry. These three static client-asset routes are no longer gated (they contain no secrets); every data/action route is unaffected and still requires authentication exactly as before.
|
|
9
|
+
- **Critical**, found while verifying the fix above: every settings/chat/generate/document/modify/build request (anything going through the shared `ajaxJson` helper) also failed with "Unauthorized" on `adminAuth` instances, for the same root cause — these requests use an absolute URL (needed for the pop-out to resolve correctly), and Node-RED's editor only auto-attaches the admin auth token to relative URLs. The SSE-streaming `fetch()` calls already worked around this (`fetchHeaders()`); `ajaxJson` now attaches the same bearer token itself.
|
|
10
|
+
|
|
5
11
|
## [0.4.0] - 2026-06-27
|
|
6
12
|
|
|
7
13
|
### Added
|
package/flowpilot-core.js
CHANGED
|
@@ -1273,11 +1273,16 @@
|
|
|
1273
1273
|
// Note: no leading slash. Node-RED serves admin endpoints under a base
|
|
1274
1274
|
// path (httpAdminRoot) that may not be "/". A relative URL respects it.
|
|
1275
1275
|
|
|
1276
|
-
//
|
|
1277
|
-
//
|
|
1278
|
-
//
|
|
1279
|
-
//
|
|
1280
|
-
//
|
|
1276
|
+
// Node-RED's editor auto-attaches the admin-API auth token to $.ajax
|
|
1277
|
+
// calls via a global $.ajaxSetup beforeSend (red.js) — but ONLY for a
|
|
1278
|
+
// bare relative URL ("flowpilot/settings"); it explicitly skips any
|
|
1279
|
+
// URL starting with "/", "http(s):", or ".". flowpilotUrl() below
|
|
1280
|
+
// always returns a leading-slash absolute path (needed so the pop-out's
|
|
1281
|
+
// nested route still resolves correctly), which means neither $.ajax
|
|
1282
|
+
// (ajaxJson, below) nor raw fetch() (SSE streaming) ever got the token
|
|
1283
|
+
// attached automatically — confirmed live as "Unable to load FlowPilot
|
|
1284
|
+
// settings: Unauthorized" on an adminAuth-enabled instance (v0.4.1).
|
|
1285
|
+
// Both attach it themselves instead, via this same lookup.
|
|
1281
1286
|
function fetchHeaders() {
|
|
1282
1287
|
var headers = { "Content-Type": "application/json" };
|
|
1283
1288
|
var tokens = RED.settings.get("auth-tokens");
|
|
@@ -1308,6 +1313,12 @@
|
|
|
1308
1313
|
method: method,
|
|
1309
1314
|
contentType: "application/json",
|
|
1310
1315
|
data: payload ? JSON.stringify(payload) : undefined,
|
|
1316
|
+
beforeSend: function (jqXHR) {
|
|
1317
|
+
var tokens = RED.settings.get("auth-tokens");
|
|
1318
|
+
if (tokens && tokens.access_token) {
|
|
1319
|
+
jqXHR.setRequestHeader("Authorization", "Bearer " + tokens.access_token);
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1311
1322
|
success: onSuccess,
|
|
1312
1323
|
error: function (xhr) {
|
|
1313
1324
|
var msg = (xhr.responseJSON && xhr.responseJSON.error) ||
|
package/flowpilot.js
CHANGED
|
@@ -623,18 +623,30 @@ module.exports = function flowPilotRuntime(RED) {
|
|
|
623
623
|
// pop-out's own minimal page — mirroring core Node-RED's debug-node
|
|
624
624
|
// pattern (RED.httpAdmin.get("/debug/view/view.html", ...) serving a
|
|
625
625
|
// static lib/debug/view.html that loads the SAME debug-utils.js the
|
|
626
|
-
// sidebar uses).
|
|
627
|
-
//
|
|
628
|
-
|
|
629
|
-
|
|
626
|
+
// sidebar uses).
|
|
627
|
+
//
|
|
628
|
+
// INTENTIONALLY UNGATED (fixed in 0.4.1 — was needsPermission("settings.
|
|
629
|
+
// read") in 0.4.0, which broke the editor on every adminAuth-enabled
|
|
630
|
+
// instance): these are static client assets, fetched via plain <script
|
|
631
|
+
// src>/<link>/window.open — none of which can carry the admin auth
|
|
632
|
+
// bearer token (that only gets attached to FlowPilot's own ajax/fetch
|
|
633
|
+
// calls, via Node-RED's editor-side request wrapper). needsPermission's
|
|
634
|
+
// bearer/tokens/anon strategies have no fallback for a request with no
|
|
635
|
+
// Authorization header, so the gate 401's unconditionally for this kind
|
|
636
|
+
// of request — confirmed against @node-red/editor-api's auth middleware.
|
|
637
|
+
// This is the same reason NR5's own debug-view route has no permission
|
|
638
|
+
// check either. No secrets live in these files; the real data/action
|
|
639
|
+
// routes (settings, chat, generate, modify, etc. below) stay gated.
|
|
640
|
+
|
|
641
|
+
RED.httpAdmin.get("/flowpilot/core.js", function (req, res) {
|
|
630
642
|
res.sendFile(path.join(__dirname, "flowpilot-core.js"));
|
|
631
643
|
});
|
|
632
644
|
|
|
633
|
-
RED.httpAdmin.get("/flowpilot/core.css",
|
|
645
|
+
RED.httpAdmin.get("/flowpilot/core.css", function (req, res) {
|
|
634
646
|
res.sendFile(path.join(__dirname, "flowpilot-core.css"));
|
|
635
647
|
});
|
|
636
648
|
|
|
637
|
-
RED.httpAdmin.get("/flowpilot/popout/view.html",
|
|
649
|
+
RED.httpAdmin.get("/flowpilot/popout/view.html", function (req, res) {
|
|
638
650
|
res.sendFile(path.join(__dirname, "lib", "popout", "view.html"));
|
|
639
651
|
});
|
|
640
652
|
|