Finished up with remember me middleware.
This commit is contained in:
parent
e00e5a608b
commit
61ec3ffc52
4 changed files with 107 additions and 11 deletions
|
|
@ -39,6 +39,7 @@ const pmHandler = require('./app/pm/pmHandler');
|
|||
const configCheck = require('./utils/configCheck');
|
||||
const scheduler = require('./utils/scheduler');
|
||||
const {errorMiddleware} = require('./utils/loggerUtils');
|
||||
const sessionUtils = require('./utils/sessionUtils');
|
||||
//Validator
|
||||
const accountValidator = require('./validators/accountValidator');
|
||||
//DB Model
|
||||
|
|
@ -143,6 +144,14 @@ mongoose.set("sanitizeFilter", true).connect(dbUrl).then(() => {
|
|||
process.exit();
|
||||
});
|
||||
|
||||
//Static File Server, set this up first to avoid middleware running on top of it
|
||||
//Serve client-side libraries
|
||||
app.use('/lib/bootstrap-icons',express.static(path.join(__dirname, '../node_modules/bootstrap-icons'))); //Icon set
|
||||
app.use('/lib/altcha',express.static(path.join(__dirname, '../node_modules/altcha/dist_external'))); //Self-Hosted PoW-based Captcha
|
||||
app.use('/lib/hls.js',express.static(path.join(__dirname, '../node_modules/hls.js/dist'))); //HLS Media Handler
|
||||
//Server public 'www' folder
|
||||
app.use(express.static(path.join(__dirname, '../www')));
|
||||
|
||||
//Set View Engine
|
||||
app.set('view engine', 'ejs');
|
||||
app.set('views', __dirname + '/views');
|
||||
|
|
@ -164,6 +173,9 @@ io.engine.use(sessionMiddleware);
|
|||
app.use(accountValidator.rememberMeID());
|
||||
app.use(accountValidator.rememberMeToken());
|
||||
|
||||
//Use remember me middleware
|
||||
app.use(sessionUtils.rememberMeMiddleware);
|
||||
|
||||
//Routes
|
||||
//Humie-Friendly
|
||||
app.use('/', indexRouter);
|
||||
|
|
@ -183,14 +195,6 @@ app.use('/tooltip', tooltipRouter);
|
|||
//Bot-Ready
|
||||
app.use('/api', apiRouter);
|
||||
|
||||
//Static File Server
|
||||
//Serve client-side libraries
|
||||
app.use('/lib/bootstrap-icons',express.static(path.join(__dirname, '../node_modules/bootstrap-icons'))); //Icon set
|
||||
app.use('/lib/altcha',express.static(path.join(__dirname, '../node_modules/altcha/dist_external'))); //Self-Hosted PoW-based Captcha
|
||||
app.use('/lib/hls.js',express.static(path.join(__dirname, '../node_modules/hls.js/dist'))); //HLS Media Handler
|
||||
//Server public 'www' folder
|
||||
app.use(express.static(path.join(__dirname, '../www')));
|
||||
|
||||
//Handle error checking
|
||||
app.use(errorMiddleware);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue