Updated Local Node Unblocker

This commit is contained in:
TheEmeraldStarr 2020-10-06 14:10:50 -07:00
parent f02f8b0e74
commit 68158a086e
2 changed files with 7 additions and 4 deletions

View file

@ -32,7 +32,7 @@ function addGa(html) {
" var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);", " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);",
"})();", "})();",
"</script>" "</script>"
].join("\n"); ].join("\n");
html = html.replace("</body>", ga + "\n\n</body>"); html = html.replace("</body>", ga + "\n\n</body>");
} }
return html; return html;
@ -53,7 +53,7 @@ function googleAnalyticsMiddleware(data) {
} }
var unblockerConfig = { var unblockerConfig = {
prefix: '/proxy/', prefix: '/run/',
responseMiddleware: [ responseMiddleware: [
googleAnalyticsMiddleware googleAnalyticsMiddleware
] ]
@ -65,7 +65,7 @@ var unblockerConfig = {
app.use(unblocker(unblockerConfig)); app.use(unblocker(unblockerConfig));
// serve up static files *after* the proxy is run // serve up static files *after* the proxy is run
app.use('/', express.static(__dirname + '/public')); app.use('/', express.static(__dirname + '/nodeub'));
// this is for users who's form actually submitted due to JS being disabled or whatever // this is for users who's form actually submitted due to JS being disabled or whatever
app.get("/no-js", function(req, res) { app.get("/no-js", function(req, res) {
@ -76,4 +76,4 @@ app.get("/no-js", function(req, res) {
}); });
// for compatibility with gatlin and other servers, export the app rather than passing it directly to http.createServer // for compatibility with gatlin and other servers, export the app rather than passing it directly to http.createServer
module.exports = app; module.exports = app;

View file

@ -26,5 +26,8 @@
"newrelic": "^1.20.2", "newrelic": "^1.20.2",
"through": "^2.3.8", "through": "^2.3.8",
"unblocker": "*" "unblocker": "*"
},
"engines": {
"node": ">=6"
} }
} }