Skip to content

Commit

Permalink
Merge pull request #82 from Adamant-im/chore/update-depends
Browse files Browse the repository at this point in the history
Chore/update depends
  • Loading branch information
yoxira authored Dec 1, 2024
2 parents fb3f0d7 + 4164a3a commit 57cdae1
Show file tree
Hide file tree
Showing 57 changed files with 12,141 additions and 6,191 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"jsdoc/sort-tags": [
"warn",
{
"tagSequence": [
"tagSequence": [{ "tags": [
"global",
"typedef",
"var",
Expand All @@ -93,7 +93,7 @@
"see",
"todo",
"ignore"
]
]}]
}
]
},
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ tmp

# npm
node_modules
package-lock.json
npm-debug.log
nodejs
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var https = require('https');
var Logger = require('./logger.js');
var packageJson = require('./package.json');
var path = require('path');
var program = require('commander');
var Command = require('commander').Command;
var httpApi = require('./helpers/httpApi.js');
var Sequence = require('./helpers/sequence.js');
var util = require('util');
Expand All @@ -54,6 +54,8 @@ if (typeof gc !== 'undefined') {
}, 60000);
}

const program = new Command();

program
.version(packageJson.version)
.option('-c, --config <path>', 'config.json file path')
Expand Down
2 changes: 1 addition & 1 deletion helpers/checkIpInList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var _ = require('lodash');
var ip = require('ip');
var ip = require('neoip');

/**
* Checks if ip address is in list (e.g. whitelist, blacklist).
Expand Down
3 changes: 3 additions & 0 deletions helpers/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ module.exports.connect = function (config, logger, cb) {
});

config.user = config.user || process.env.USER;
config.max = config.poolSize;

delete config.poolSize;

var db = pgp(config);
var migrator = new Migrator(pgp, db, logger);
Expand Down
22 changes: 19 additions & 3 deletions helpers/request-limiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
var rateLimit = require('express-rate-limit');
var slowDown = require('express-slow-down');

/**
* Allow all requests through
* @returns {true}
*/
function skip() {
return true;
}

var defaults = {
max: 0, // Disabled
skip: skip, // Disabled
delayMs: 0, // Disabled
delayAfter: 0, // Disabled
windowMs: 60000 // 1 minute window
Expand All @@ -18,12 +26,20 @@ var defaults = {
*/
function applyLimits (limits) {
if (typeof limits === 'object') {
return {
const settings = {
max: Math.floor(limits.max) || defaults.max,
delayMs: Math.floor(limits.delayMs) || defaults.delayMs,
delayMs: function(used) {
return (used - this.delayAfter) * (Math.floor(limits.delayMs) || defaults.delayMs);
},
delayAfter: Math.floor(limits.delayAfter) || defaults.delayAfter,
windowMs: Math.floor(limits.windowMs) || defaults.windowMs
};

if (!limits.max) {
settings.skip = skip;
}

return settings;
} else {
return defaults;
}
Expand Down
2 changes: 1 addition & 1 deletion helpers/z_schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var ip = require('ip');
var ip = require('neoip');
/**
* Uses JSON Schema validator z_schema to register custom formats.
* - id
Expand Down
1 change: 0 additions & 1 deletion legacy/json-sql/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions legacy/json-sql/.jshintrc

This file was deleted.

2 changes: 0 additions & 2 deletions legacy/json-sql/.npmignore

This file was deleted.

22 changes: 0 additions & 22 deletions legacy/json-sql/LICENSE

This file was deleted.

145 changes: 0 additions & 145 deletions legacy/json-sql/README.md

This file was deleted.

Loading

0 comments on commit 57cdae1

Please sign in to comment.