mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
start page settings done
This commit is contained in:
@@ -62,4 +62,13 @@ module.exports = ( app ) => {
|
|||||||
res.send( 'ok' );
|
res.send( 'ok' );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
app.post( '/admin/pages/uploadImages', multer.array( 'image', 1 ), ( req, res ) => {
|
||||||
|
if ( req.query.image.includes( '/' ) || req.query.image.includes( '.' ) || req.query.template.includes( '/' ) || req.query.template.includes( '.' ) ) {
|
||||||
|
res.status( 400 ).send( 'fp_wrong' );
|
||||||
|
} else {
|
||||||
|
fs.writeFileSync( path.join( __dirname + '/../ui/home/templates/' + req.query.template + '/' + req.query.image + '.jpg' ), req.files[ 0 ].buffer );
|
||||||
|
res.send( 'ok' );
|
||||||
|
}
|
||||||
|
} );
|
||||||
};
|
};
|
||||||
@@ -20,4 +20,8 @@ module.exports = ( app, settings ) => {
|
|||||||
app.get( '/startPage/mainStyle', ( req, res ) => {
|
app.get( '/startPage/mainStyle', ( req, res ) => {
|
||||||
res.sendFile( path.join( __dirname + '/../ui/home/main.css' ) );
|
res.sendFile( path.join( __dirname + '/../ui/home/main.css' ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
app.get( '/startPage/assets/:image', ( req, res ) => {
|
||||||
|
res.sendFile( path.join( __dirname + '/../assets/' + settings.startPage + '/assets/' + req.param.image ) );
|
||||||
|
} );
|
||||||
};
|
};
|
||||||
@@ -138,10 +138,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveImage( image ) {
|
saveImage( image ) {
|
||||||
if ( this.$refs[ image ].file ) {
|
if ( this.$refs[ image ][ 0 ].file ) {
|
||||||
|
console.log( 'saving image' );
|
||||||
let fd = new FormData();
|
let fd = new FormData();
|
||||||
fd.append( 'image', this.$refs[ image ].file );
|
fd.append( 'image', this.$refs[ image ][ 0 ].file );
|
||||||
fd.append( 'name', image );
|
|
||||||
let fetchOptions = {
|
let fetchOptions = {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: fd,
|
body: fd,
|
||||||
@@ -150,13 +150,15 @@
|
|||||||
if ( res.status === 200 ) {
|
if ( res.status === 200 ) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
this.$refs.notification.createNotification( 'There was an error uploading the image', 5, 'error', 'normal' );
|
||||||
}
|
}
|
||||||
} ).catch( err => {
|
} ).catch( err => {
|
||||||
console.error( err );
|
console.error( err );
|
||||||
} );
|
} );
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
console.log( this.$refs[ image ][ 0 ] );
|
||||||
|
console.log( image );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user