mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-10-31 09:20:27 +00:00
9c59954205
Offers QR Code bug fix Websocket Authcheck csrf cookie validation Bug Fix: Wrong year in Date #918 Improved INFO & DEBUG Logging LND: Bug fix Color Setting in Config #925 2FA button toggle #906 Bug Fix: HTLC viewing #924 All Tooltips on form controls are updated with mat-icon:info Co-authored-by: saiy2k <saiy2k@gmail.com>
21 lines
739 B
JavaScript
21 lines
739 B
JavaScript
import csurf from 'csurf/index.js';
|
|
import { Logger } from './logger.js';
|
|
import { Common } from './common.js';
|
|
class CSRF {
|
|
constructor() {
|
|
this.csrfProtection = csurf({ cookie: true });
|
|
this.logger = Logger;
|
|
this.common = Common;
|
|
}
|
|
mount(app) {
|
|
this.logger.log({ selectedNode: this.common.initSelectedNode, level: 'INFO', fileName: 'CSRF', msg: 'Setting up CSRF..' });
|
|
if (process.env.NODE_ENV !== 'development') {
|
|
app.use((req, res, next) => this.csrfProtection(req, res, next));
|
|
}
|
|
this.logger.log({ selectedNode: this.common.initSelectedNode, level: 'INFO', fileName: 'CSRF', msg: 'CSRF Set' });
|
|
return app;
|
|
}
|
|
;
|
|
}
|
|
export default new CSRF;
|