auth exception for images in electron

This commit is contained in:
azivner
2018-01-07 09:59:05 -05:00
parent 743d72a0c3
commit 8bc2a21d80
2 changed files with 18 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ const imageType = require('image-type');
const sanitizeFilename = require('sanitize-filename');
const wrap = require('express-promise-wrap').wrap;
router.get('/:imageId/:filename', auth.checkApiAuth, wrap(async (req, res, next) => {
router.get('/:imageId/:filename', auth.checkApiAuthOrElectron, wrap(async (req, res, next) => {
const image = await sql.getFirst("SELECT * FROM images WHERE image_id = ?", [req.params.imageId]);
if (!image) {
@@ -28,7 +28,7 @@ router.get('/:imageId/:filename', auth.checkApiAuth, wrap(async (req, res, next)
res.send(image.data);
}));
router.post('', auth.checkApiAuth, multer.single('upload'), wrap(async (req, res, next) => {
router.post('', auth.checkApiAuthOrElectron, multer.single('upload'), wrap(async (req, res, next) => {
const sourceId = req.headers.source_id;
const noteId = req.query.noteId;
const file = req.file;