mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	| @@ -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; | ||||
|   | ||||
| @@ -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 += `<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 | ||||
|     // the auth header attached. So do not use RED.auth.needsPermission here. | ||||
|     RED.httpAdmin.get("/debug/view/*",function(req,res) { | ||||
|         var options = { | ||||
|             root: __dirname + '/lib/debug/', | ||||
|             root: path.join(__dirname,"lib","debug"), | ||||
|             dotfiles: 'deny' | ||||
|         }; | ||||
|         res.sendFile(req.params[0], options); | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| <head> | ||||
|     <link rel="stylesheet" href="../../red/style.min.css"> | ||||
|     <link rel="stylesheet" href="../../vendor/font-awesome/css/font-awesome.min.css"> | ||||
|     <!-- INSERT-THEME-CSS --> | ||||
|     <title>Node-RED Debug Tools</title> | ||||
| </head> | ||||
| <body class="red-ui-editor red-ui-debug-window"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user