diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/theme.js b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js
index 3ea4ede73..fc65753bf 100644
--- a/packages/node_modules/@node-red/editor-api/lib/editor/theme.js
+++ b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js
@@ -129,6 +129,14 @@ module.exports = {
}
themeContext.page.title = theme.page.title || themeContext.page.title;
+
+ // Store the resolved urls to these resources so nodes (such as Debug)
+ // can access them
+ theme.page._ = {
+ css: themeContext.page.css,
+ scripts: themeContext.page.scripts,
+ favicon: themeContext.page.favicon
+ }
}
if (theme.header) {
@@ -223,6 +231,7 @@ module.exports = {
themePlugin.path
);
themeContext.page.css = cssFiles.concat(themeContext.page.css || [])
+ theme.page._.css = cssFiles.concat(theme.page._.css || [])
}
if (themePlugin.scripts) {
const scriptFiles = serveFilesFromTheme(
@@ -232,6 +241,7 @@ module.exports = {
themePlugin.path
)
themeContext.page.scripts = scriptFiles.concat(themeContext.page.scripts || [])
+ theme.page._.scripts = cssFiles.concat(theme.page._.scripts || [])
}
}
activeThemeInitialised = true;
diff --git a/packages/node_modules/@node-red/nodes/core/common/21-debug.js b/packages/node_modules/@node-red/nodes/core/common/21-debug.js
index 0e00a8fff..8d2121580 100644
--- a/packages/node_modules/@node-red/nodes/core/common/21-debug.js
+++ b/packages/node_modules/@node-red/nodes/core/common/21-debug.js
@@ -2,7 +2,8 @@ module.exports = function(RED) {
"use strict";
var util = require("util");
var events = require("events");
- //var path = require("path");
+ const fs = require("fs-extra");
+ const path = require("path");
var debuglength = RED.settings.debugMaxLength || 1000;
var useColors = RED.settings.debugUseColors || false;
util.inspect.styles.boolean = "red";
@@ -249,11 +250,34 @@ module.exports = function(RED) {
}
});
+ let cachedDebugView;
+ RED.httpAdmin.get("/debug/view/view.html", function(req,res) {
+ if (!cachedDebugView) {
+ fs.readFile(path.join(__dirname,"lib","debug","view.html")).then(data => {
+ let customStyles = "";
+ try {
+ let customStyleList = RED.settings.editorTheme.page._.css || [];
+ customStyleList.forEach(style => {
+ customStyles += `\n`
+ })
+ } catch(err) {}
+ cachedDebugView = data.toString().replace("",customStyles)
+ res.set('Content-Type', 'text/html');
+ res.send(cachedDebugView).end();
+ }).catch(err => {
+ res.sendStatus(404);
+ })
+ } else {
+ res.send(cachedDebugView).end();
+ }
+
+ });
+
// As debug/view/debug-utils.js is loaded via