@ -3071,7 +3071,7 @@
|
||||
"z": "379c65a27117b46c",
|
||||
"g": "ec8733df4e619869",
|
||||
"name": "Valid Path?",
|
||||
"func": "var validPath = null;\nvar http_404 = null;\n\nmsg.http = {};\n\n// node.warn(String(msg.req.originalUrl).indexOf('.'));\n// node.warn(String(msg.req.originalUrl).indexOf('?'))\n// node.warn(String(msg.req.originalUrl).split('?')[0].split('/'));\n\nif ( String(msg.req.originalUrl).indexOf('?') > 0 ) {\n\n msg.http.path = String(msg.req.originalUrl).split('?')[0].split('/');\n\n}else{\n msg.http.path = String(msg.req.originalUrl).split('/');\n}\n\n// if ('/' in msg.req.params[\"0\"] && msg.req.params[\"0\"] != \"\" ) {\n\n// msg.checkpath = String(msg.req.params[\"0\"]).split('/')[0];\n\n// } else if ( msg.req.params[\"0\"] == \"\" ) {\n\n// msg.checkpath = \"\";\n\n// }\n\n// node.warn(msg.http.path[0]);\n// node.warn(global.get('config.http_path'));\n\n\nif ( msg.http.path[0] == global.get('config.http_path') ) {\n\n validPath = msg;\n node.warn(\"here1\");\n\n} else if (String(msg.req.originalUrl).indexOf('.') > 0 ) {\n\n validPath = msg;\n node.warn(\"here2\");\n \n} else {\n\n http_404 = msg;\n node.warn(\"here2\");\n\n}\n\nnode.send([validPath, http_404])\n",
|
||||
"func": "var validPath = null;\nvar http_404 = null;\n\nmsg.http = {};\n\n// node.warn(String(msg.req.originalUrl).indexOf('.'));\n// node.warn(String(msg.req.originalUrl).indexOf('?'))\n// node.warn(String(msg.req.originalUrl).split('?')[0].split('/'));\n\nif ( String(msg.req.originalUrl).indexOf('?') > 0 ) {\n\n msg.http.path = String(msg.req.originalUrl).split('?')[0].split('/');\n node.warn('boo1');\n\n}else{\n msg.http.path = String(msg.req.originalUrl).split('/');\n node.warn('boo2');\n}\n\n// if ('/' in msg.req.params[\"0\"] && msg.req.params[\"0\"] != \"\" ) {\n\n// msg.checkpath = String(msg.req.params[\"0\"]).split('/')[0];\n\n// } else if ( msg.req.params[\"0\"] == \"\" ) {\n\n// msg.checkpath = \"\";\n\n// }\n\n// node.warn(msg.http.path[0]);\n// node.warn(global.get('config.http_path'));\n// node.warn(String(msg.req.originalUrl).indexOf('.'));\n\nif (\n msg.http.path[0] == global.get('config.http_path') ||\n msg.http.path[0] + '/' == global.get('config.http_path')\n) {\n\n validPath = msg;\n // node.warn(\"here1\");\n\n} else if (String(msg.req.originalUrl).indexOf('.') > 0 ) {\n\n validPath = msg;\n // node.warn(\"here2\");\n \n} else {\n\n http_404 = msg;\n // node.warn(\"here3\");\n\n}\n\nnode.send([validPath, http_404])\n",
|
||||
"outputs": 2,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
@ -4286,7 +4286,7 @@
|
||||
"fieldType": "msg",
|
||||
"format": "handlebars",
|
||||
"syntax": "mustache",
|
||||
"template": "<html>\n <head>\n <title>No Fuss Computing</title>\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">\n <meta charset=\"utf-8\">\n <meta name=\"robots\" content=\"noindex,nofollow\">\n <script src=\"http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js\"></script>\n <script src=\"/{{{ global.config.http_path }}}common.js\"></script>\n <link rel=\"stylesheet\" href=\"/{{{ global.config.http_path }}}style.css\">\n </head>\n \n<body>\n <div>\n\n <div style=\"background: url({{{ global.config.html.logo }}}) no-repeat center top; background-size: {{ global.config.html.logo_width }}px {{ global.config.html.logo_height }}px; width: 100%; height: 120px; display: flex;\"></div>\n\n {{{ html.body }}}\n\n </div>\n</body>\n</html>\n",
|
||||
"template": "<html>\n <head>\n <title>No Fuss Computing</title>\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">\n <meta charset=\"utf-8\">\n <meta name=\"robots\" content=\"noindex,nofollow\">\n <script src=\"http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js\"></script>\n <script src=\"{{{ global.config.http_path }}}common.js\"></script>\n <link rel=\"stylesheet\" href=\"{{{ global.config.http_path }}}style.css\">\n </head>\n \n<body>\n <div>\n\n <div style=\"background: url({{{ global.config.html.logo }}}) no-repeat center top; background-size: {{ global.config.html.logo_width }}px {{ global.config.html.logo_height }}px; width: 100%; height: 120px; display: flex;\"></div>\n\n {{{ html.body }}}\n\n </div>\n</body>\n</html>\n",
|
||||
"x": 510,
|
||||
"y": 60,
|
||||
"wires": [
|
||||
@ -7481,7 +7481,7 @@
|
||||
"z": "8179bf22c4c31682",
|
||||
"g": "bbd929c437c592ea",
|
||||
"name": "Auth Type",
|
||||
"func": "var token = null;\nvar auth = null;\n\nvar use_cookie = false;\nvar use_token = false;\n\nmsg.auth = {\n \"access\": false\n};\n\n\nif (Object.keys(msg.req.query || {}).length > 0) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n if (msg.req.query.hasOwnProperty(\"token\")) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie has token\" });\n\n use_token = true;\n\n }\n} else if( Object.keys(msg.req.cookies || {}).length > 0 ) {\n \n if (msg.req.cookies.hasOwnProperty(\"token\")) {\n\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n use_cookie = true;\n\n}\n}\n\nif (use_cookie) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use cookie token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.cookies.token + '.json';\n msg.cookie_exists = true;\n msg.token = msg.req.cookies.token;\n token = msg;\n\n} else if (use_token) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use query string token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.query.token + '.json';\n msg.cookie_exists = false;\n msg.token = msg.req.query.token;\n token = msg;\n\n} else {\n node.status({ fill: \"blue\", shape: \"ring\", text: \"Use other auth method\" });\n\n auth = msg;\n}\n\nnode.send([token, auth]);\n",
|
||||
"func": "var token = null;\nvar auth = null;\n\nvar use_cookie = false;\nvar use_token = false;\n\nmsg.auth = {\n \"access\": false\n};\n\n//node.warn(Object.keys(msg.req.cookies || {}).length);\n\nif (Object.keys(msg.req.query || {}).length > 0) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n if (msg.req.query.hasOwnProperty(\"token\")) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie has token\" });\n\n use_token = true;\n\n }\n} else if( Object.keys(msg.req.cookies || {}).length > 0 ) {\n \n if (msg.req.cookies.hasOwnProperty(\"token\")) {\n\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n use_cookie = true;\n\n}\n}\n\nif (use_cookie) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use cookie token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.cookies.token + '.json';\n msg.cookie_exists = true;\n msg.token = msg.req.cookies.token;\n token = msg;\n\n} else if (use_token) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use query string token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.query.token + '.json';\n msg.cookie_exists = false;\n msg.token = msg.req.query.token;\n token = msg;\n\n} else {\n node.status({ fill: \"blue\", shape: \"ring\", text: \"Use other auth method\" });\n\n auth = msg;\n}\n\nnode.send([token, auth]);\n",
|
||||
"outputs": 2,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
|
Reference in New Issue
Block a user