aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes')
-rw-r--r--src/api/routes/albums/link/linkPOST.js2
-rw-r--r--src/api/routes/auth/registerPOST.js2
-rw-r--r--src/api/routes/files/uploadPOST.js4
-rw-r--r--src/api/routes/service/configGET.js18
4 files changed, 13 insertions, 13 deletions
diff --git a/src/api/routes/albums/link/linkPOST.js b/src/api/routes/albums/link/linkPOST.js
index 968e57d..e929c89 100644
--- a/src/api/routes/albums/link/linkPOST.js
+++ b/src/api/routes/albums/link/linkPOST.js
@@ -22,7 +22,7 @@ class linkPOST extends Route {
Count the amount of links created for that album already and error out if max was reached
*/
const count = await db.table('links').where('albumId', albumId).count({ count: 'id' });
- if (count[0].count >= process.env.MAX_LINKS_PER_ALBUM) return res.status(400).json({ message: 'Maximum links per album reached' });
+ if (count[0].count >= parseInt(process.env.MAX_LINKS_PER_ALBUM, 10)) return res.status(400).json({ message: 'Maximum links per album reached' });
/*
Try to allocate a new identifier on the db
diff --git a/src/api/routes/auth/registerPOST.js b/src/api/routes/auth/registerPOST.js
index ee8e5ae..0bd8cfd 100644
--- a/src/api/routes/auth/registerPOST.js
+++ b/src/api/routes/auth/registerPOST.js
@@ -10,7 +10,7 @@ class registerPOST extends Route {
}
async run(req, res, db) {
- if (!process.env.USER_ACCOUNTS) return res.status(401).json({ message: 'Creation of new accounts is currently disabled' });
+ if (process.env.USER_ACCOUNTS == 'false') return res.status(401).json({ message: 'Creation of new accounts is currently disabled' });
if (!req.body) return res.status(400).json({ message: 'No body provided' });
const { username, password } = req.body;
if (!username || !password) return res.status(401).json({ message: 'Invalid body provided' });
diff --git a/src/api/routes/files/uploadPOST.js b/src/api/routes/files/uploadPOST.js
index 82e9d09..e88091a 100644
--- a/src/api/routes/files/uploadPOST.js
+++ b/src/api/routes/files/uploadPOST.js
@@ -181,7 +181,7 @@ class uploadPOST extends Route {
/*
If exif removal has been force service-wide or requested by the user, remove it
*/
- if (process.env.STRIP_EXIF) { // || user.settings.stripExif) {
+ if (process.env.STRIP_EXIF == 'true') { // || user.settings.stripExif) {
// Util.removeExif(upload.filename);
}
@@ -195,7 +195,7 @@ class uploadPOST extends Route {
const busboy = new Busboy({
headers: req.headers,
limits: {
- fileSize: process.env.MAX_SIZE * (1000 * 1000),
+ fileSize: parseInt(process.env.MAX_SIZE, 10) * (1000 * 1000),
files: 1
}
});
diff --git a/src/api/routes/service/configGET.js b/src/api/routes/service/configGET.js
index 230b594..e12c57b 100644
--- a/src/api/routes/service/configGET.js
+++ b/src/api/routes/service/configGET.js
@@ -11,15 +11,15 @@ class configGET extends Route {
config: {
serviceName: process.env.SERVICE_NAME,
uploadFolder: process.env.UPLOAD_FOLDER,
- linksPerAlbum: process.env.MAX_LINKS_PER_ALBUM,
- maxUploadSize: process.env.MAX_SIZE,
- filenameLength: process.env.GENERATED_FILENAME_LENGTH,
- albumLinkLength: process.env.GENERATED_ALBUM_LENGTH,
- generateThumbnails: process.env.GENERATE_THUMBNAILS,
- generateZips: process.env.GENERATE_ZIPS,
- stripExif: process.env.STRIP_EXIF,
- publicMode: process.env.PUBLIC_MODE,
- enableAccounts: process.env.USER_ACCOUNTS
+ linksPerAlbum: parseInt(process.env.MAX_LINKS_PER_ALBUM, 10),
+ maxUploadSize: parseInt(process.env.MAX_SIZE, 10),
+ filenameLength: parseInt(process.env.GENERATED_FILENAME_LENGTH, 10),
+ albumLinkLength: parseInt(process.env.GENERATED_ALBUM_LENGTH, 10),
+ generateThumbnails: process.env.GENERATE_THUMBNAILS == 'true' ? true : false,
+ generateZips: process.env.GENERATE_ZIPS == 'true' ? true : false,
+ stripExif: process.env.STRIP_EXIF == 'true' ? true : false,
+ publicMode: process.env.PUBLIC_MODE == 'true' ? true : false,
+ enableAccounts: process.env.USER_ACCOUNTS == 'true' ? true : false
}
});
}