mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-26 22:04:23 +00:00
fix bugs, full two fa system done
This commit is contained in:
@@ -15,39 +15,52 @@ const bodyParser = require( 'body-parser' );
|
||||
const cookieParser = require( 'cookie-parser' );
|
||||
const http = require( 'http' );
|
||||
const fs = require( 'fs' );
|
||||
const mail = require( './backend/mail/mailSender.js' );
|
||||
const mailManager = new mail();
|
||||
|
||||
const dbh = require( './backend/db/mysqldb.js' );
|
||||
const db = new dbh();
|
||||
|
||||
db.connect();
|
||||
|
||||
// const env = process.env.PROD || false;
|
||||
|
||||
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/settings.config.json' ) ) );
|
||||
|
||||
if ( !settings.init ) {
|
||||
db.setupDB( 'janishut_libreeventTest' );
|
||||
}
|
||||
// const mail = require( './backend/mail/mailSender.js' );
|
||||
// const mailManager = new mail();
|
||||
|
||||
// const dbh = require( './backend/db/mysqldb.js' );
|
||||
// const db = new dbh();
|
||||
|
||||
// db.connect();
|
||||
|
||||
// const env = process.env.PROD || false;
|
||||
|
||||
|
||||
// if ( !settings.init ) {
|
||||
// db.setupDB( 'janishut_libreeventTest' );
|
||||
// }
|
||||
|
||||
// const responseTime = require( 'response-time' );
|
||||
// app.use( responseTime( ( request, response, time ) => {
|
||||
// console.log( time );
|
||||
// } ) );
|
||||
|
||||
app.use( express.static( '../webapp/dist' ) );
|
||||
// app.use( express.static( '.' ) );
|
||||
|
||||
// initialise express with middlewares
|
||||
// TODO: Generate random token
|
||||
app.use( expressSession( {
|
||||
secret: 'gaoevgoawefgo083tq2rfvöfaf0p8',
|
||||
resave: true,
|
||||
saveUninitialized: true
|
||||
saveUninitialized: true,
|
||||
cookie: {
|
||||
sameSite: 'none'
|
||||
}
|
||||
} ) );
|
||||
|
||||
app.use( bodyParser.urlencoded( { extended: false } ) );
|
||||
app.use( bodyParser.json() );
|
||||
app.use( cookieParser() );
|
||||
app.use( express.static( '../webapp/dist' ) );
|
||||
|
||||
require( './admin/routes.js' )( app, settings ); // admin routes
|
||||
require( './backend/userRoutes.js' )( app, settings ); // user routes
|
||||
|
||||
app.use( ( request, response ) => {
|
||||
console.log( 'index fallback' );
|
||||
response.sendFile( path.join( __dirname + '/../webapp/dist/index.html' ) );
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user