mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
parent
6da8e92f20
commit
cd3aba2b89
@ -129,6 +129,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
themeContext.page.title = theme.page.title || themeContext.page.title;
|
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) {
|
if (theme.header) {
|
||||||
@ -223,6 +231,7 @@ module.exports = {
|
|||||||
themePlugin.path
|
themePlugin.path
|
||||||
);
|
);
|
||||||
themeContext.page.css = cssFiles.concat(themeContext.page.css || [])
|
themeContext.page.css = cssFiles.concat(themeContext.page.css || [])
|
||||||
|
theme.page._.css = cssFiles.concat(theme.page._.css || [])
|
||||||
}
|
}
|
||||||
if (themePlugin.scripts) {
|
if (themePlugin.scripts) {
|
||||||
const scriptFiles = serveFilesFromTheme(
|
const scriptFiles = serveFilesFromTheme(
|
||||||
@ -232,6 +241,7 @@ module.exports = {
|
|||||||
themePlugin.path
|
themePlugin.path
|
||||||
)
|
)
|
||||||
themeContext.page.scripts = scriptFiles.concat(themeContext.page.scripts || [])
|
themeContext.page.scripts = scriptFiles.concat(themeContext.page.scripts || [])
|
||||||
|
theme.page._.scripts = cssFiles.concat(theme.page._.scripts || [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activeThemeInitialised = true;
|
activeThemeInitialised = true;
|
||||||
|
@ -2,7 +2,8 @@ module.exports = function(RED) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
var events = require("events");
|
var events = require("events");
|
||||||
//var path = require("path");
|
const fs = require("fs-extra");
|
||||||
|
const path = require("path");
|
||||||
var debuglength = RED.settings.debugMaxLength || 1000;
|
var debuglength = RED.settings.debugMaxLength || 1000;
|
||||||
var useColors = RED.settings.debugUseColors || false;
|
var useColors = RED.settings.debugUseColors || false;
|
||||||
util.inspect.styles.boolean = "red";
|
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 += `<link rel="stylesheet" href="../../${style}">\n`
|
||||||
|
})
|
||||||
|
} catch(err) {}
|
||||||
|
cachedDebugView = data.toString().replace("<!-- INSERT-THEME-CSS -->",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 <script> tag, it won't get
|
// As debug/view/debug-utils.js is loaded via <script> tag, it won't get
|
||||||
// the auth header attached. So do not use RED.auth.needsPermission here.
|
// the auth header attached. So do not use RED.auth.needsPermission here.
|
||||||
RED.httpAdmin.get("/debug/view/*",function(req,res) {
|
RED.httpAdmin.get("/debug/view/*",function(req,res) {
|
||||||
var options = {
|
var options = {
|
||||||
root: __dirname + '/lib/debug/',
|
root: path.join(__dirname,"lib","debug"),
|
||||||
dotfiles: 'deny'
|
dotfiles: 'deny'
|
||||||
};
|
};
|
||||||
res.sendFile(req.params[0], options);
|
res.sendFile(req.params[0], options);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="../../red/style.min.css">
|
<link rel="stylesheet" href="../../red/style.min.css">
|
||||||
<link rel="stylesheet" href="../../vendor/font-awesome/css/font-awesome.min.css">
|
<link rel="stylesheet" href="../../vendor/font-awesome/css/font-awesome.min.css">
|
||||||
|
<!-- INSERT-THEME-CSS -->
|
||||||
<title>Node-RED Debug Tools</title>
|
<title>Node-RED Debug Tools</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="red-ui-editor red-ui-debug-window">
|
<body class="red-ui-editor red-ui-debug-window">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user