Browse Source

Fix no res.locals.user in api_v2

pull/6/head
Menci 7 years ago
parent
commit
6cba999a52
  1. 3
      app.js

3
app.js

@ -61,6 +61,8 @@ global.syzoj = {
let multer = require('multer');
app.multer = multer({ dest: syzoj.utils.resolvePath(syzoj.config.upload_dir, 'tmp') });
// This should before load api_v2, to init the `res.locals.user`
this.loadHooks();
// Trick to bypass CSRF for APIv2
app.use((() => {
let router = new Express.Router();
@ -73,7 +75,6 @@ global.syzoj = {
app.use(csurf({ cookie: true }));
await this.connectDatabase();
this.loadHooks();
this.loadModules();
},
async connectDatabase() {

Loading…
Cancel
Save