mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
various changes
This commit is contained in:
8
notes.md
8
notes.md
@@ -1,25 +1,21 @@
|
|||||||
# Account view:
|
# Account view:
|
||||||
|
|
||||||
- create function that parses DB every 15 minutes and clears out junk --> Also update data in db when user goes to purchase to prevent clearing during purchase
|
- Also update data in db when user goes to purchase to prevent clearing during purchase
|
||||||
|
|
||||||
- Require user to confirm email before purchasing
|
|
||||||
|
|
||||||
- Load all orders of customer from db when selecting tickets and save to memory to check if ticket count has been exceeded or not.
|
- Load all orders of customer from db when selecting tickets and save to memory to check if ticket count has been exceeded or not.
|
||||||
|
|
||||||
|
|
||||||
- Create function that updates currency for every event when updating currency.
|
|
||||||
|
|
||||||
- Update files to import when deploying for included json files instead of secret.json files
|
- Update files to import when deploying for included json files instead of secret.json files
|
||||||
|
|
||||||
- Fix text field overflow (text too big for box)
|
- Fix text field overflow (text too big for box)
|
||||||
- Other optimization for seat plan editor
|
- Other optimization for seat plan editor
|
||||||
|
|
||||||
|
|
||||||
- Implement Permission system
|
|
||||||
|
|
||||||
- Seat numbering!!
|
- Seat numbering!!
|
||||||
|
|
||||||
|
|
||||||
|
- FUTURE: Implement Permission system
|
||||||
- FUTURE: Add Admin profile (page to change account settings per person like changing pwd)
|
- FUTURE: Add Admin profile (page to change account settings per person like changing pwd)
|
||||||
- FUTURE add multi-language support
|
- FUTURE add multi-language support
|
||||||
- FUTURE: Guest purchase
|
- FUTURE: Guest purchase
|
||||||
|
|||||||
@@ -62,6 +62,16 @@ class GETHandler {
|
|||||||
} ).catch( error => {
|
} ).catch( error => {
|
||||||
reject( { 'code': 500, 'error': error } );
|
reject( { 'code': 500, 'error': error } );
|
||||||
} );
|
} );
|
||||||
|
} else if ( call === 'getEventStatus' ) {
|
||||||
|
db.getJSONDataSimple( 'events', query.event ).then( data => {
|
||||||
|
if ( Object.keys( data ) ) {
|
||||||
|
resolve( true );
|
||||||
|
} else {
|
||||||
|
resolve( false );
|
||||||
|
}
|
||||||
|
} ).catch( error => {
|
||||||
|
reject( { 'code': 500, 'error': error } );
|
||||||
|
} );
|
||||||
} else if ( call === 'getAllEvents' ) {
|
} else if ( call === 'getAllEvents' ) {
|
||||||
db.getJSONData( 'eventDrafts' ).then( data => {
|
db.getJSONData( 'eventDrafts' ).then( data => {
|
||||||
db.getJSONData( 'events' ).then( dat => {
|
db.getJSONData( 'events' ).then( dat => {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ const db = require( '../../backend/db/db.js' );
|
|||||||
const fs = require( 'fs' );
|
const fs = require( 'fs' );
|
||||||
const path = require( 'path' );
|
const path = require( 'path' );
|
||||||
|
|
||||||
|
const letters = [ ',', '{' ];
|
||||||
|
|
||||||
class POSTHandler {
|
class POSTHandler {
|
||||||
constructor ( settings ) {
|
constructor ( settings ) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
@@ -118,7 +120,19 @@ class POSTHandler {
|
|||||||
this.settings[ 'twoFA' ] = data.twoFA;
|
this.settings[ 'twoFA' ] = data.twoFA;
|
||||||
this.settings[ 'currency' ] = data.currency;
|
this.settings[ 'currency' ] = data.currency;
|
||||||
this.settings[ 'payments' ] = data.payments;
|
this.settings[ 'payments' ] = data.payments;
|
||||||
fs.writeFileSync( path.join( __dirname + '/../../config/settings.config.json' ), JSON.stringify( this.settings ) );
|
this.settings[ 'ticketTimeout' ] = data.ticketTimeout;
|
||||||
|
const settingsString = JSON.stringify( this.settings );
|
||||||
|
let settingsToSave = '';
|
||||||
|
for ( let letter in settingsString ) {
|
||||||
|
if ( letters.includes( settingsString[ letter ] ) ) {
|
||||||
|
settingsToSave += settingsString[ letter ] + '\n\t';
|
||||||
|
} else if ( settingsString[ letter ] === '}' ) {
|
||||||
|
settingsToSave += '\n' + settingsString[ letter ];
|
||||||
|
} else {
|
||||||
|
settingsToSave += settingsString[ letter ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.writeFileSync( path.join( __dirname + '/../../config/settings.config.json' ), settingsToSave );
|
||||||
db.getJSONData( 'events' ).then( dat => {
|
db.getJSONData( 'events' ).then( dat => {
|
||||||
let updated = dat;
|
let updated = dat;
|
||||||
for ( let event in updated ) {
|
for ( let event in updated ) {
|
||||||
|
|||||||
@@ -52,6 +52,18 @@ class GETHandler {
|
|||||||
} ).catch( error => {
|
} ).catch( error => {
|
||||||
reject( { 'code': 500, 'error': error } );
|
reject( { 'code': 500, 'error': error } );
|
||||||
} );
|
} );
|
||||||
|
} else if ( call === 'extendTicketDeletion' ) {
|
||||||
|
db.getDataSimple( 'temp', 'user_id', session.id ).then( res => {
|
||||||
|
if ( res[ 0 ] ) {
|
||||||
|
db.writeDataSimple( 'temp', 'user_id', session.id, { 'timestamp': new Date().toString() } );
|
||||||
|
// TODO: make sure it works, seems to be still unreliable
|
||||||
|
resolve( 'extended' );
|
||||||
|
} else {
|
||||||
|
reject( { 'code': 404, 'error': 'UserNotFound' } );
|
||||||
|
}
|
||||||
|
} ).catch( error => {
|
||||||
|
reject( { 'code': 500, 'error': error } );
|
||||||
|
} );
|
||||||
} else if ( call === 'getName' ) {
|
} else if ( call === 'getName' ) {
|
||||||
resolve( { 'name': settings.name } );
|
resolve( { 'name': settings.name } );
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{}
|
{"libreevent_temp":{"1":{"user_id":"Vw5d2Ak1jgC9Bj8Q-PzB2O0M1pc4QkR_","timestamp":"Wed Aug 23 2023 11:56:21 GMT+0200 (Central European Summer Time)","data":"{\"test4\":{\"secAr4s10\":{\"id\":\"secAr4s10\",\"component\":1,\"ticketOption\":\"2\",\"eventID\":\"test4\",\"category\":\"1\",\"name\":\"Row 5, Seat 11\"}}}"}},"libreevent_admin":{},"libreevent_orders":{},"libreevent_users":{}}
|
||||||
@@ -208,7 +208,7 @@ const gc = () => {
|
|||||||
*/
|
*/
|
||||||
setInterval( () => {
|
setInterval( () => {
|
||||||
gc();
|
gc();
|
||||||
}, parseInt( settings.gcInterval ) );
|
}, parseInt( settings.gcInterval ) * 1000 );
|
||||||
|
|
||||||
// TODO: Build garbage collector for DB (parse DB every so often (get from settings)
|
// TODO: Build garbage collector for DB (parse DB every so often (get from settings)
|
||||||
// and delete all items where timestamp is older than a certain amount of time (get from settings))
|
// and delete all items where timestamp is older than a certain amount of time (get from settings))
|
||||||
@@ -10,6 +10,6 @@
|
|||||||
"mailSender":"libreevent <info@libreevent.janishutz.com>",
|
"mailSender":"libreevent <info@libreevent.janishutz.com>",
|
||||||
"maxTickets":10,
|
"maxTickets":10,
|
||||||
"currency":"CHF",
|
"currency":"CHF",
|
||||||
"gcInterval": "600",
|
"gcInterval":300,
|
||||||
"ticketTimeout": "900"
|
"ticketTimeout":900
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,41 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'currency': {
|
||||||
|
'display': 'Currency',
|
||||||
|
'id': 'currency',
|
||||||
|
'tooltip':'Specify a currency in which the prices are displayed to the customer. Defaults to USD. Please use valid currency codes.',
|
||||||
|
'value': 'USD',
|
||||||
|
'type': 'text',
|
||||||
|
},
|
||||||
|
'ticketTimeout': {
|
||||||
|
'display': 'Ticket Timeout (s)',
|
||||||
|
'id': 'ticketTimeout',
|
||||||
|
'tooltip': 'Specify how long the user has to be inactive for their order to be canceled. Time is to be specified in seconds',
|
||||||
|
'value': 900,
|
||||||
|
'type': 'number',
|
||||||
|
'restrictions': {
|
||||||
|
'min': 0,
|
||||||
|
'max': 10000,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'paymentGateway': {
|
||||||
|
'display': 'Select the payment gateway to use',
|
||||||
|
'id': 'paymentGateway',
|
||||||
|
'tooltip':'With this setting you may change which payment gateway you want to use. You will need to provide details below! If you are not sure what this setting means, please click the link below.',
|
||||||
|
'value': 'stripe',
|
||||||
|
'type': 'select',
|
||||||
|
'restrictions': {
|
||||||
|
'payrexx': {
|
||||||
|
'displayName':'Payrexx',
|
||||||
|
'value': 'payrexx'
|
||||||
|
},
|
||||||
|
'stripe': {
|
||||||
|
'displayName':'Stripe',
|
||||||
|
'value': 'stripe'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
// 'addressRequired': {
|
// 'addressRequired': {
|
||||||
// 'display': 'Require user to provide address?',
|
// 'display': 'Require user to provide address?',
|
||||||
// 'id': 'addressRequired',
|
// 'id': 'addressRequired',
|
||||||
@@ -108,30 +143,6 @@
|
|||||||
// 'value': false,
|
// 'value': false,
|
||||||
// 'type': 'toggle',
|
// 'type': 'toggle',
|
||||||
// },
|
// },
|
||||||
'currency': {
|
|
||||||
'display': 'Currency',
|
|
||||||
'id': 'currency',
|
|
||||||
'tooltip':'Specify a currency in which the prices are displayed to the customer. Defaults to USD. Please use valid currency codes.',
|
|
||||||
'value': 'USD',
|
|
||||||
'type': 'text',
|
|
||||||
},
|
|
||||||
'paymentGateway': {
|
|
||||||
'display': 'Select the payment gateway to use',
|
|
||||||
'id': 'paymentGateway',
|
|
||||||
'tooltip':'With this setting you may change which payment gateway you want to use. You will need to provide details below! If you are not sure what this setting means, please click the link below.',
|
|
||||||
'value': 'stripe',
|
|
||||||
'type': 'select',
|
|
||||||
'restrictions': {
|
|
||||||
'payrexx': {
|
|
||||||
'displayName':'Payrexx',
|
|
||||||
'value': 'payrexx'
|
|
||||||
},
|
|
||||||
'stripe': {
|
|
||||||
'displayName':'Stripe',
|
|
||||||
'value': 'stripe'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -243,6 +254,7 @@
|
|||||||
this.settings[ '2fa' ].value = json.twoFA;
|
this.settings[ '2fa' ].value = json.twoFA;
|
||||||
this.settings.currency.value = json.currency;
|
this.settings.currency.value = json.currency;
|
||||||
this.settings.paymentGateway.value = json.payments;
|
this.settings.paymentGateway.value = json.payments;
|
||||||
|
this.settings.ticketTimeout.value = json.ticketTimeout;
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
@@ -250,7 +262,12 @@
|
|||||||
save() {
|
save() {
|
||||||
let fetchOptions = {
|
let fetchOptions = {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: JSON.stringify( { 'twoFA': this.settings[ '2fa' ].value, 'currency': this.settings.currency.value, 'payments': this.settings.paymentGateway.value } ),
|
body: JSON.stringify( {
|
||||||
|
'twoFA': this.settings[ '2fa' ].value,
|
||||||
|
'currency': this.settings.currency.value,
|
||||||
|
'payments': this.settings.paymentGateway.value,
|
||||||
|
'ticketTimeout': this.settings.ticketTimeout.value,
|
||||||
|
} ),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'charset': 'utf-8'
|
'charset': 'utf-8'
|
||||||
@@ -268,7 +285,7 @@
|
|||||||
this.loadData();
|
this.loadData();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// TODO: Load gateways and settings in general from server.
|
// TODO: Load gateways and settings for gateways from server.
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,11 @@
|
|||||||
if ( !sessionStorage.getItem( 'selectedTicket' ) ) {
|
if ( !sessionStorage.getItem( 'selectedTicket' ) ) {
|
||||||
this.$router.push( '/admin/events' );
|
this.$router.push( '/admin/events' );
|
||||||
}
|
}
|
||||||
// TODO: Check if there is a live version of the event
|
fetch( localStorage.getItem( 'url' ) + '/admin/getAPI/getEventStatus' ).then( res => {
|
||||||
|
res.text().then( status => {
|
||||||
|
this.hasLiveVersion = Boolean( status );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
this.eventID = sessionStorage.getItem( 'selectedTicket' );
|
this.eventID = sessionStorage.getItem( 'selectedTicket' );
|
||||||
fetch( localStorage.getItem( 'url' ) + '/admin/getAPI/getLocations' ).then( res => {
|
fetch( localStorage.getItem( 'url' ) + '/admin/getAPI/getLocations' ).then( res => {
|
||||||
res.json().then( data => {
|
res.json().then( data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user