restructure and rethink setup

This commit is contained in:
2023-08-10 14:11:13 +02:00
parent 0735224dd1
commit 0a1dee882a
12 changed files with 26 additions and 165 deletions

View File

@@ -54,9 +54,9 @@ const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/se
console.log( '[ Server ] Setting up static routes' );
if ( settings.init ) {
app.use( express.static( '../webapp/main/dist' ) );
app.use( express.static( 'webapp/main/dist' ) );
} else {
app.use( express.static( '../webapp/setup/dist' ) );
app.use( express.static( 'webapp/setup/dist' ) );
}
// initialise express with middlewares
@@ -76,7 +76,7 @@ app.use( expressSession( {
// app.use( bodyParser.json() );
app.use( cookieParser() );
let file = path.join( __dirname + '/webapp/index.html' );
let file = path.join( __dirname + '/webapp/main/dist/index.html' );
console.log( '[ Server ] loading backend components' );
if ( settings.init ) {
@@ -86,7 +86,7 @@ if ( settings.init ) {
require( './backend/userRoutes.js' )( app, settings ); // user routes
} else {
require( './setup/setupRoutes.js' )( app, settings ); // setup routes
file = path.join( __dirname + '/../webapp/setup/dist/index.html' );
file = path.join( __dirname + '/webapp/setup/dist/index.html' );
}
console.log( '[ Server ] loading plugins' );

View File

@@ -1,6 +1,7 @@
{
"init": true,
"init": false,
"twoFA": "allow",
"setupKey": "hello world",
"twoFAMode": "enhanced",
"db": "mysql",
"payments": "stripe",

View File

@@ -7,11 +7,19 @@
*
*/
const db = require( '../backend/db/db.js' );
module.exports = ( app, settings ) => {
/*
Admin login route that checks the password
*/
app.get( '/setup/start', ( request, response ) => {} );
app.get( '/setup/start', ( request, response ) => {
if ( request.query.token === settings.setupToken ) {
response.send( 'ok' );
} else {
response.send( 'incorrect' );
}
} );
}

View File

@@ -1 +1 @@
../webapp/main/dist/
../webapp/