From d96675ab6a41b69f517e4a6cf5ab5de05ddc82d0 Mon Sep 17 00:00:00 2001 From: sdorn Date: Fri, 15 May 2020 12:28:11 +0000 Subject: [PATCH] Init --- uibuilder/.config/masterPackageList.json | 12 +++++++++ uibuilder/.config/packageList.json | 7 +++++ uibuilder/.config/sioMiddleware.js | 31 +++++++++++++++++++++++ uibuilder/.config/sioUse.js | 27 ++++++++++++++++++++ uibuilder/.config/uibMiddleware.js | 18 +++++++++++++ uibuilder/common/images/node-blue.ico | Bin 0 -> 1150 bytes 6 files changed, 95 insertions(+) create mode 100644 uibuilder/.config/masterPackageList.json create mode 100644 uibuilder/.config/packageList.json create mode 100644 uibuilder/.config/sioMiddleware.js create mode 100644 uibuilder/.config/sioUse.js create mode 100644 uibuilder/.config/uibMiddleware.js create mode 100644 uibuilder/common/images/node-blue.ico diff --git a/uibuilder/.config/masterPackageList.json b/uibuilder/.config/masterPackageList.json new file mode 100644 index 0000000..bd56029 --- /dev/null +++ b/uibuilder/.config/masterPackageList.json @@ -0,0 +1,12 @@ +[ + "vue", + "bootstrap", + "bootstrap-vue", + "jquery", + "moonjs", + "reactjs", + "riot", + "angular", + "picnic", + "umbrellajs" +] \ No newline at end of file diff --git a/uibuilder/.config/packageList.json b/uibuilder/.config/packageList.json new file mode 100644 index 0000000..445d267 --- /dev/null +++ b/uibuilder/.config/packageList.json @@ -0,0 +1,7 @@ +[ + "vue", + "bootstrap", + "bootstrap-vue", + "jquery", + "socket.io" +] diff --git a/uibuilder/.config/sioMiddleware.js b/uibuilder/.config/sioMiddleware.js new file mode 100644 index 0000000..fa954fe --- /dev/null +++ b/uibuilder/.config/sioMiddleware.js @@ -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 )) + */ +//} diff --git a/uibuilder/.config/sioUse.js b/uibuilder/.config/sioUse.js new file mode 100644 index 0000000..608e977 --- /dev/null +++ b/uibuilder/.config/sioUse.js @@ -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')) +// //} +// } diff --git a/uibuilder/.config/uibMiddleware.js b/uibuilder/.config/uibMiddleware.js new file mode 100644 index 0000000..fbe3f4d --- /dev/null +++ b/uibuilder/.config/uibMiddleware.js @@ -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() +// } diff --git a/uibuilder/common/images/node-blue.ico b/uibuilder/common/images/node-blue.ico new file mode 100644 index 0000000000000000000000000000000000000000..0b592031a040a9e8320f5ff0cca5f5a99cd37886 GIT binary patch literal 1150 zcmc&!F%H5o47^G_pc6AAKVW6z6MO*iivFN0I}hP4OiV~!SQ~t)uChXkqA=jfwR85_ zaij!j>}y-te}mHsSOeIa8f3_Xn*l7AO25ak-yzf}Yt``n%?T#2;Tg4bFUprK<*^rq zyzBW8mA?2>G|X$^w3OSW`-q7{%RFCCYsGxMC7=9poT?6wd)(tvZi!de_ty%J2B1gb8Gyc?x5ZMu1Q~n@-?|{;bAog literal 0 HcmV?d00001