fix bug in start page settings + a bit of progress

This commit is contained in:
janis
2023-09-05 10:33:55 +02:00
parent a52ec14845
commit 1ad22482a4
4 changed files with 19 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ module.exports = ( app ) => {
getHandler.handleCall( req.params.call, req.query ).then( data => {
res.send( data );
} ).catch( error => {
res.status( error.code ).send( error.error );
res.status( error.code ?? 500 ).send( error.error );
} );
} else {
res.status( 403 ).sendFile( path.join( __dirname + '/../ui/' + ( req.query.lang ?? 'en' ) + '/errors/403.html' ) );
@@ -41,7 +41,7 @@ module.exports = ( app ) => {
res.send( data );
} ).catch( error => {
console.error( error );
res.status( error.code ).send( error.error );
res.status( error.code ?? 500 ).send( error.error );
} );
} else {
res.status( 403 ).sendFile( path.join( __dirname + '/../ui/' + ( req.query.lang ?? 'en' ) + '/errors/403.html' ) );

View File

@@ -22,7 +22,14 @@ class StartPageManager {
}
loadStartPagePreferences( startPageName ) {
return JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.config.html' ) ) );
let conf, options;
try {
conf = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.json' ) ) );
options = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.config.json' ) ) );
return { 'conf': conf, 'options': options };
} catch ( err ) {
return {};
}
}
findAllStartPageTemplates() {