Skip to content

Commit

Permalink
update dependencies (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson-numerical-software authored Nov 18, 2022
1 parent 82b4199 commit b82329b
Show file tree
Hide file tree
Showing 7 changed files with 7,388 additions and 4,225 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.17.6]
node-version: [18.12.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.6
18.12.1
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.4.2 (2022-11-18)

- Update packages dependencies

- Tested with Nelson 0.6.10

- Requires Nodejs 18.12.1

## 1.4.1 (2021-09-26)

- fix test with Nelson >=v0.5.8
Expand Down
7 changes: 1 addition & 6 deletions lib/nelsonSocketIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,14 @@ const app = express();
const child_process = require('child_process');
const findFreePort = require('find-free-port');
const nelsonProcess = require('./nelsonProcess');
const RateLimit = require('express-rate-limit');
const limiter = require('./rate-limiter.js');
//=============================================================================
function nelsonSocketIO() {
const server = http.Server(app);
const io = socketio(server);
//=============================================================================
server.listen(CONFIGURATION.PORT);
//=============================================================================
const limiter = new RateLimit({
windowMs: 1 * 60 * 1000, // 1 minute
max: 50,
});
//=============================================================================
app.use(express.static(__dirname + '/../resources'));
app.use(limiter);
app.get('/', function (req, res) {
Expand Down
30 changes: 30 additions & 0 deletions lib/rate-limiter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//=============================================================================
// Copyright (c) 2016-present Allan CORNET (Nelson)
//=============================================================================
// LICENCE_BLOCK_BEGIN
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// LICENCE_BLOCK_END
//=============================================================================
'use strict';
//=============================================================================
const rateLimiter = require('express-rate-limit');
//=============================================================================
const limiter = rateLimiter({
max: 50,
windowMs: 1 * 60 * 1000, // 1 minute
message: "You can't make any more requests at the moment. Try again later",
});
//=============================================================================
module.exports = limiter;
//=============================================================================
Loading

0 comments on commit b82329b

Please sign in to comment.