minor tweaks

This commit is contained in:
Dan Janosik 2021-09-27 15:41:22 -04:00
parent 681b531b42
commit a88cea557e
No known key found for this signature in database
GPG key ID: 846311D3D259BFF1
4 changed files with 31 additions and 2 deletions

8
app.js
View file

@ -843,8 +843,14 @@ if (expressApp.get("env") === "local") {
expressApp.use(function(req, res, next) {
var time = Date.now() - req.startTime;
var userAgent = req.headers['user-agent'];
var crawler = utils.getCrawlerFromUserAgentString(userAgent);
if (crawler) {
debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for crawler '${crawler}' / '${userAgent}'`);
debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for UA '${userAgent}'`);
} else {
debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for UA '${userAgent}'`);
}
if (!res.headersSent) {
next();

View file

@ -48,7 +48,8 @@ const crawlerBotUserAgentStrings = {
"facebook": new RegExp("facebot", "i"),
"alexa": new RegExp("ia_archiver", "i"),
"aol": new RegExp("aolbuild", "i"),
"moz.com": new RegExp("dotbot", "i"),
"moz": new RegExp("dotbot", "i"),
"semrush": new RegExp("SemrushBot", "i")
};
const ipMemoryCache = {};

21
bin/test.js Normal file
View file

@ -0,0 +1,21 @@
const utils = require("../app/utils.js");
console.log("test");
global.activeBlockchain = "main";
(async () => {
const perfResults = {};
await utils.timePromise("abc", async () => {
const x = utils.estimatedSupply(4802177);
console.log("xxx: " + x);
}, perfResults);
console.log("perfResults: " + JSON.stringify(perfResults));
process.exit(0);
})();

View file

@ -6,6 +6,7 @@
"bin": "bin/cli.js",
"scripts": {
"start": "node ./bin/www",
"test": "node ./bin/test.js",
"miners": "node ./bin/refresh-mining-pool-configs.js",
"integrity": "node ./bin/frontend-resource-integrity.js",
"css-light-debug": "node-sass --output-style expanded --source-map scss --precision 6 ./public/scss/light.scss ./public/style/light.css",