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/

View File

@@ -11,6 +11,7 @@
<div>
<h2>Event analytics</h2>
<p>Get insights into tickets sold, people checked in, available tickets, revenue, etc, in real time!</p>
<p>Coming soon! (in the next major update)</p>
<!-- TODO: Add toggle for real-time update (gets live updates from sse) -->
<!-- Use chart.js for visualisations -->
</div>

View File

@@ -43,33 +43,6 @@ export default {
setupAuthRequired: true,
}
},
{
path: 'payments',
name: 'setupPayments',
component: () => import( '../views/SetupPaymentsView.vue' ),
meta: {
title: 'Payments :: Setup - libreevent',
setupAuthRequired: true,
}
},
{
path: 'events',
name: 'setupEvents',
component: () => import( '../views/SetupEventsView.vue' ),
meta: {
title: 'Events :: Setup - libreevent',
setupAuthRequired: true,
}
},
{
path: 'tos',
name: 'setupTOS',
component: () => import( '../views/SetupTOSView.vue' ),
meta: {
title: 'TOS (Optional) :: Setup - libreevent',
setupAuthRequired: true,
}
},
{
path: 'complete',
name: 'setupComplete',

View File

@@ -13,6 +13,12 @@
<h1>Setup complete!</h1>
<p>Congratulations on finishing the setup of libreǝvent!</p>
<p>Please restart the node.js application to have it load the actual user interface for libreevent. You may then log in at <a :href="windowURL" target="_blank">{{ windowURL }}</a></p>
<p>In the admin panel, there are a few things you still need to change. You may find a list of all things <a href="/docs/setup/afterSetup">here</a></p>
<ul>
<li>Choose a payment gateway and set it up</li>
<li>Create a event location and an event</li>
<li>Create other admin accounts with less privileges</li>
</ul>
</div>
</template>

View File

@@ -1,39 +0,0 @@
<!--
* libreevent - SetupEventsView.vue
*
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
-->
<template>
<div>
<h1>Events</h1>
<p>You may choose all of the below payment methods, but we recommend to only select one payment gateway for simplicity. Recommended: Either Stripe or Adyen. See the comparison of the different payment methods <a href="https://libreevent.janishutz.com/docs/payments">here</a></p>
<p>You may find more infos about this part <a href="https://libreevent.janishutz.com/docs/setup/setup#payment-methods" target="_blank">here</a></p>
<button @click="submit()">Continue</button>
</div>
</template>
<script>
import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia';
export default {
data () {
return {
formData: {}
}
},
computed: {
...mapStores( useBackendStore )
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'tos', true );
this.$router.push( '/setup/tos' );
}
},
};
</script>

View File

@@ -29,7 +29,7 @@
export default {
data () {
return {
options: { 'default': { 'id': 'default', 'name': 'Default' }},
options: { 'default': { 'id': 'default', 'name': 'Default' } },
}
},
computed: {
@@ -37,8 +37,8 @@
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'payments', true );
this.$router.push( '/setup/payments' );
this.backendStore.addVisitedSetupPages( 'complete', true );
this.$router.push( '/setup/complete' );
}
},
};

View File

@@ -1,39 +0,0 @@
<!--
* libreevent - SetupPaymentsView.vue
*
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
-->
<template>
<div>
<h1>Setting up payment methods</h1>
<p>You may choose all of the below payment methods, but we recommend to only select one payment gateway for simplicity. Recommended: Either Stripe or Adyen. See the comparison of the different payment methods <a href="https://libreevent.janishutz.com/docs/payments" target="_blank">here</a></p>
<p>You may find more infos about this part <a href="https://libreevent.janishutz.com/docs/setup/setup#payment-methods" target="_blank">here</a></p>
<button @click="submit()">Continue</button>
</div>
</template>
<script>
import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia';
export default {
data () {
return {
formData: {}
}
},
computed: {
...mapStores( useBackendStore )
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'events', true );
this.$router.push( '/setup/events' );
}
},
};
</script>

View File

@@ -1,39 +0,0 @@
<!--
* libreevent - SetupTOSView.vue
*
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
-->
<template>
<div>
<h3>Setting up TOS (optional)</h3>
<p>You may choose all of the below payment methods, but we recommend to only select one payment gateway for simplicity. Recommended: Either Stripe or Adyen. See the comparison of the different payment methods <a href="https://libreevent.janishutz.com/docs/payments" target="_blank">here</a></p>
<p>You may find more infos about this part <a href="https://libreevent.janishutz.com/docs/setup/setup#payment-methods" target="_blank">here</a></p>
<button @click="submit()">Continue</button>
</div>
</template>
<script>
import { useBackendStore } from '@/stores/backendStore.js';
import { mapStores } from 'pinia';
export default {
data () {
return {
formData: {}
}
},
computed: {
...mapStores( useBackendStore )
},
methods: {
submit () {
this.backendStore.addVisitedSetupPages( 'complete', true );
this.$router.push( '/setup/complete' );
}
},
};
</script>

View File

@@ -15,12 +15,6 @@
<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' ]">Payments</router-link>
<a v-else class="inactive">Payments</a> |
<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> |
<router-link to="/setup/complete" v-if="backendStore.getVisitedSetupPages[ 'complete' ]">Complete</router-link>
<a v-else class="inactive">Complete</a>
</nav>
@@ -50,11 +44,6 @@
created () {
this.backendStore.loadVisitedSetupPages();
},
methods: {
unlock ( page ) {
this.backendStore.addVisitedSetupPages( page, true );
}
}
};
</script>