restructuring

This commit is contained in:
2023-07-18 09:00:57 +02:00
parent 98ac5c8dfc
commit 21afcdb036
94 changed files with 50 additions and 33 deletions

View File

@@ -21,25 +21,11 @@ const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/se
// 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( '.' ) );
if ( settings.init ) {
app.use( express.static( '../webapp/main/dist' ) );
} else {
app.use( express.static( '../webapp/setup/dist' ) );
}
// initialise express with middlewares
// TODO: Generate random token
@@ -56,11 +42,19 @@ app.use( bodyParser.urlencoded( { extended: false } ) );
app.use( bodyParser.json() );
app.use( cookieParser() );
require( './admin/routes.js' )( app, settings ); // admin routes
require( './backend/userRoutes.js' )( app, settings ); // user routes
let file = path.join( __dirname + '/../webapp/main/dist/index.html' );
if ( settings.init ) {
require( './admin/adminRoutes.js' )( app, settings ); // admin routes
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' );
}
app.use( ( request, response ) => {
response.sendFile( path.join( __dirname + '/../webapp/dist/index.html' ) );
response.sendFile( file );
} );
const PORT = process.env.PORT || 8081;

View File

@@ -1,5 +1,5 @@
{
"init": false,
"init": true,
"twoFA": "enhanced",
"db": "mysql"
}

View File

@@ -0,0 +1,17 @@
/*
* libreevent - setupRoutes.js
*
* Created by Janis Hutz 07/18/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
module.exports = ( app, settings ) => {
/*
Admin login route that checks the password
*/
app.get( '/setup/start', ( request, response ) => {} );
}

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

View File

@@ -31,7 +31,7 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'complete', true );
this.backendStore.addVisitedSetupPages( 'tos', true );
this.$router.push( '/setup/tos' );
}
},

View File

@@ -37,7 +37,7 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'events', true );
this.backendStore.addVisitedSetupPages( 'payments', true );
this.$router.push( '/setup/payments' );
}
},

View File

@@ -31,7 +31,7 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'tos', true );
this.backendStore.addVisitedSetupPages( 'events', true );
this.$router.push( '/setup/events' );
}
},

View File

@@ -46,7 +46,7 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'payments', true );
this.backendStore.addVisitedSetupPages( 'page', true );
this.$router.push( 'page' );
}
},

View File

@@ -14,7 +14,7 @@
<i style="font-size: small;">All links during setup open in separate tabs</i>
<p>Thank you for downloading libreǝvent, the free & open source event management solution. libreǝvent aims to help you save both time and money when hosting events, so you can focus on what really matters.</p>
<p>Let's start by setting it up. We strongly encourage you to also have a look at the extensive documentation of the setup process <a href="https://libreevent.janishutz.com/docs/setup/setup" target="_blank">here</a></p>
<router-link to="/setup/root" @click="setup();">Start setup</router-link>
<button @click="setup();">Start setup</button>
</div>
</template>
@@ -33,7 +33,8 @@
},
methods: {
setup () {
this.backendStore.addVisitedSetupPages( 'page', true );
this.backendStore.addVisitedSetupPages( 'root', true );
this.$router.push( '/setup/root' );
}
},
};

View File

@@ -31,6 +31,7 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'complete', true );
this.$router.push( '/setup/complete' );
}
},

View File

@@ -11,12 +11,13 @@
<div>
<nav class="setup-nav">
<router-link to="/setup">Start</router-link> |
<router-link to="/setup/root" @click="unlock( 'page' )">Root account</router-link> |
<router-link to="/setup/page" v-if="backendStore.getVisitedSetupPages[ 'page' ]" @click="unlock( 'payments' )">Landing page</router-link>
<router-link to="/setup/root" v-if="backendStore.getVisitedSetupPages[ 'root' ]">Root account</router-link>
<a v-else class="inactive">Root account</a> |
<router-link to="/setup/page" v-if="backendStore.getVisitedSetupPages[ 'page' ]">Landing page</router-link>
<a v-else class="inactive">Landing page</a> |
<router-link to="/setup/payments" v-if="backendStore.getVisitedSetupPages[ 'payments' ]" @click="unlock( 'events' )">Payments</router-link>
<router-link to="/setup/payments" v-if="backendStore.getVisitedSetupPages[ 'payments' ]">Payments</router-link>
<a v-else class="inactive">Payments</a> |
<router-link to="/setup/events" v-if="backendStore.getVisitedSetupPages[ 'events' ]" @click="unlock( 'tos' )">Events</router-link>
<router-link to="/setup/events" v-if="backendStore.getVisitedSetupPages[ 'events' ]">Events</router-link>
<a v-else class="inactive">Events</a> |
<router-link to="/setup/tos" v-if="backendStore.getVisitedSetupPages[ 'tos' ]" @click="unlock( 'complete' )">TOS</router-link>
<a v-else class="inactive">TOS</a> |