mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
config update, Almost fully styled details page
This commit is contained in:
@@ -102,15 +102,19 @@ class JSONDB {
|
||||
*/
|
||||
|
||||
if ( operation.command === 'getAllData' ) {
|
||||
resolve( this.db[ table ] );
|
||||
let ret = [];
|
||||
for ( let entry in this.db[ table ] ) {
|
||||
ret.push( this.db[ table ][ entry ] );
|
||||
}
|
||||
resolve( ret );
|
||||
} else if ( operation.command === 'getFilteredData' || operation.command === 'checkDataAvailability' ) {
|
||||
let ret = {};
|
||||
let ret = [];
|
||||
for ( let entry in this.db[ table ] ) {
|
||||
if ( this.db[ table ][ entry ][ operation.property ] == operation.searchQuery ) {
|
||||
ret[ entry ] = this.db[ table ][ entry ];
|
||||
ret.push( this.db[ table ][ entry ] );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
resolve( ret );
|
||||
} else if ( operation.command === 'addData' ) {
|
||||
this.dbIndex[ table ] += 1;
|
||||
this.db[ table ][ this.dbIndex[ table ] ] = operation.data;
|
||||
|
||||
@@ -30,13 +30,15 @@ module.exports = ( app, settings ) => {
|
||||
delete dat[ 'pass' ];
|
||||
response.send( { 'data': dat, 'status': true } );
|
||||
} else {
|
||||
response.send( { 'data': 'This user does not exist', 'status': false } );
|
||||
response.status( 404 ).send( { 'data': 'This user does not exist', 'status': false } );
|
||||
}
|
||||
} ).catch( () => {
|
||||
response.send( { 'data': 'There was an error reading data from the database. If this error persists, please contact the administrators', 'status': false } );
|
||||
console.log( 'dbError' );
|
||||
response.status( 500 ).send( { 'data': 'There was an error reading data from the database. If this error persists, please contact the administrators', 'status': false } );
|
||||
} );
|
||||
} else {
|
||||
response.status( 403 ).send( path.join( __dirname + '/../ui/en/errors/403.html' ) );
|
||||
console.log( 'unauthorised' );
|
||||
response.status( 403 ).sendFile( path.join( __dirname + '/../ui/en/errors/403.html' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user