Siegfried Dorn 5 anni fa
parent
commit
d96675ab6a
6 ha cambiato i file con 95 aggiunte e 0 eliminazioni
  1. +12
    -0
      uibuilder/.config/masterPackageList.json
  2. +7
    -0
      uibuilder/.config/packageList.json
  3. +31
    -0
      uibuilder/.config/sioMiddleware.js
  4. +27
    -0
      uibuilder/.config/sioUse.js
  5. +18
    -0
      uibuilder/.config/uibMiddleware.js
  6. BIN
      uibuilder/common/images/node-blue.ico

+ 12
- 0
uibuilder/.config/masterPackageList.json Vedi File

@@ -0,0 +1,12 @@
[
"vue",
"bootstrap",
"bootstrap-vue",
"jquery",
"moonjs",
"reactjs",
"riot",
"angular",
"picnic",
"umbrellajs"
]

+ 7
- 0
uibuilder/.config/packageList.json Vedi File

@@ -0,0 +1,7 @@
[
"vue",
"bootstrap",
"bootstrap-vue",
"jquery",
"socket.io"
]

+ 31
- 0
uibuilder/.config/sioMiddleware.js Vedi File

@@ -0,0 +1,31 @@
/* globals module, log */
/**
* Template Socket.IO Connection Middleware for uibuilder.
*
* NOTES & WARNINGS:
* 1) This function is only called ONCE - when a new client connects. So any authentication/security processing is limited
* because you cannot use this to, for example, timeout/extend a session without further server processing of incoming messages.
* 2) Failing to either return or call `next()` will mean that your clients will never connect.
* 3) An error in this function will probably cause Node-RED to fail to start at all.
* 4) You have to restart Node-RED if you change this file.
*
* Allows custom processing for authentication, session management, connection validation, logging, rate limiting, etc.
*/

//module.exports = function(socket, next) {
/* Some SIO related info that might be useful in security checks
* console.log('--socket.request.connection.remoteAddress--')
* console.dir(socket.request.connection.remoteAddress)
* console.log('--socket.handshake.address--')
* console.dir(socket.handshake.address)
* console.dir(io.sockets.connected)
*/
/*
if ( socket.request.headers.cookie) {
log.info('[uibuilder:Module] io.use - Authentication OK - ID: ' + socket.id)
log.info('[uibuilder:Module] Cookie', socket.request.headers.cookie) // socket.handshake.headers.cookie
return next()
}
next (new Error('UIbuilder:io.use - Authentication error - ID: ' + socket.id ))
*/
//}

+ 27
- 0
uibuilder/.config/sioUse.js Vedi File

@@ -0,0 +1,27 @@
/* globals module, log */
/**
* Template Socket.IO Use Middleware for uibuilder.
*
* NOTES & WARNINGS:
* 1) This function is called when a client sends a "packet" if data to the server.
* 2) Failing to either return or call `next()` will mean that your clients will never be able to get responses.
* 3) An error in this function will probably cause Node-RED to fail to start at all.
* 4) You have to restart Node-RED if you change this file.
* 5) If you call `next( new Error('blah') )` The error is sent back to the client and further proessing of the incoming msg stops.
*
* Allows you to process incoming data from clients.
*
* @see also https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html#websocket-implementation-hints
*
* @param {*} msg The msg send by a client (Socket.IO calls it a "packet")
* @param {function} next The callback to hand off to the next middleware
*/
// module.exports = function(msg, next) {
// //if (not some kind of error) {
// console.log('Socket.IO:sioUse.js - msg from client: ', msg)
// return next()
// //} else {
// // The error is sent back to the client and further processing of the msg stops
// // next(new Error('Oops! Some kind of error happened'))
// //}
// }

+ 18
- 0
uibuilder/.config/uibMiddleware.js Vedi File

@@ -0,0 +1,18 @@
/* globals module */
/**
* Template ExpressJS Middleware for uibuilder.
*
* NOTES & WARNINGS:
* 1) This function is called EVERY TIME any web call is made to the URL defined by your uib instance.
* So it should be kept short and efficient.
* 2) Failing to either return or call `next()` will cause an ExpressJS error.
* 3) An error in this function will probably cause Node-RED to fail to start at all.
* 4) You have to restart Node-RED if you change this file.
*
* Allows custom processing for authentication, session management, custom logging, etc.
*/

// module.exports = function(req,res,next) {
// console.log('[uibuilder:uibMiddleware] Custom ExpressJS middleware called.')
// next()
// }

BIN
uibuilder/common/images/node-blue.ico Vedi File

Before After

Loading…
Annulla
Salva