mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-17 15:29:30 +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>
24 lines
803 B
TypeScript
24 lines
803 B
TypeScript
import csurf from 'csurf/index.js';
|
|
import { Application } from 'express';
|
|
import { Logger, LoggerService } from './logger.js';
|
|
import { Common, CommonService } from './common.js';
|
|
|
|
class CSRF {
|
|
|
|
public csrfProtection = csurf({ cookie: true });
|
|
public logger: LoggerService = Logger;
|
|
public common: CommonService = Common;
|
|
|
|
public mount(app: Application): Application {
|
|
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;
|