diff options
| author | Zephyrrus <[email protected]> | 2020-12-24 10:40:50 +0200 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2020-12-24 10:40:50 +0200 |
| commit | 90001c2df56d58e69fd199a518ae7f3e4ed327fc (patch) | |
| tree | ac601537b5f464a1b03b084e5139e460f42e3473 /src/api/utils | |
| parent | chore: update lock files (diff) | |
| download | host.fuwn.me-90001c2df56d58e69fd199a518ae7f3e4ed327fc.tar.xz host.fuwn.me-90001c2df56d58e69fd199a518ae7f3e4ed327fc.zip | |
chore: remove trailing commas
Diffstat (limited to 'src/api/utils')
| -rw-r--r-- | src/api/utils/QueryHelper.js | 8 | ||||
| -rw-r--r-- | src/api/utils/ThumbUtil.js | 8 | ||||
| -rw-r--r-- | src/api/utils/Util.js | 18 | ||||
| -rw-r--r-- | src/api/utils/videoPreview/FragmentPreview.js | 2 | ||||
| -rw-r--r-- | src/api/utils/videoPreview/FrameIntervalPreview.js | 4 |
5 files changed, 19 insertions, 21 deletions
diff --git a/src/api/utils/QueryHelper.js b/src/api/utils/QueryHelper.js index c9fe8c6..7fabd06 100644 --- a/src/api/utils/QueryHelper.js +++ b/src/api/utils/QueryHelper.js @@ -4,7 +4,7 @@ class QueryHelper { static parsers = { before: (val) => QueryHelper.parseChronoList(val), after: (val) => QueryHelper.parseChronoList(val), - tag: (val) => QueryHelper.sanitizeTags(val), + tag: (val) => QueryHelper.sanitizeTags(val) }; static requirementHandlers = { @@ -13,14 +13,14 @@ class QueryHelper { .join('albums', 'albumsFiles.albumId', '=', 'album.id'), tag: (knex) => knex .join('fileTags', 'files.id', '=', 'fileTags.fileId') - .join('tags', 'fileTags.tagId', '=', 'tags.id'), + .join('tags', 'fileTags.tagId', '=', 'tags.id') } static fieldToSQLMapping = { album: 'albums.name', tag: 'tags.name', before: 'files.createdAt', - after: 'files.createdAt', + after: 'files.createdAt' } static handlers = { @@ -53,7 +53,7 @@ class QueryHelper { } } return knex; - }, + } } static verify(field, list) { diff --git a/src/api/utils/ThumbUtil.js b/src/api/utils/ThumbUtil.js index 6a22c3b..2f7d75a 100644 --- a/src/api/utils/ThumbUtil.js +++ b/src/api/utils/ThumbUtil.js @@ -51,7 +51,7 @@ class ThumbUtil { timestamps: [0], filename: '%b.png', folder: ThumbUtil.squareThumbPath, - size: '64x64', + size: '64x64' }) .on('error', (error) => log.error(error.message)); @@ -60,7 +60,7 @@ class ThumbUtil { timestamps: [0], filename: '%b.png', folder: ThumbUtil.thumbPath, - size: '150x?', + size: '150x?' }) .on('error', (error) => log.error(error.message)); @@ -69,7 +69,7 @@ class ThumbUtil { input: filePath, width: 150, output: path.join(ThumbUtil.videoPreviewPath, output), - log: log.debug, + log: log.debug }); } catch (e) { log.error(e); @@ -87,7 +87,7 @@ class ThumbUtil { if (isVideo) { return { thumb: `${filename.slice(0, -ext.length)}.png`, - preview: `${filename.slice(0, -ext.length)}.webm`, + preview: `${filename.slice(0, -ext.length)}.webm` }; } diff --git a/src/api/utils/Util.js b/src/api/utils/Util.js index ee4c748..4279b6f 100644 --- a/src/api/utils/Util.js +++ b/src/api/utils/Util.js @@ -10,9 +10,9 @@ const db = require('knex')({ user: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.DB_DATABASE, - filename: path.join(__dirname, '../../../database.sqlite'), + filename: path.join(__dirname, '../../../database.sqlite') }, - useNullAsDefault: process.env.DB_CLIENT === 'sqlite', + useNullAsDefault: process.env.DB_CLIENT === 'sqlite' }); const moment = require('moment'); const crypto = require('crypto'); @@ -25,7 +25,7 @@ const ThumbUtil = require('./ThumbUtil'); const blockedExtensions = process.env.BLOCKED_EXTENSIONS.split(','); class Util { - static uploadPath = path.join(__dirname, '..', '..', '..', process.env.UPLOAD_FOLDER); + static uploadPath = path.join(__dirname, '../../../', process.env.UPLOAD_FOLDER); static uuid() { return uuidv4(); @@ -54,7 +54,7 @@ class Util { const retry = (i = 0) => { const filename = randomstring.generate({ length: parseInt(process.env.GENERATED_FILENAME_LENGTH, 10), - capitalization: 'lowercase', + capitalization: 'lowercase' }) + path.extname(name).toLowerCase(); // TODO: Change this to look for the file in the db instead of in the filesystem @@ -71,7 +71,7 @@ class Util { const retry = async (i = 0) => { const identifier = randomstring.generate({ length: parseInt(process.env.GENERATED_ALBUM_LENGTH, 10), - capitalization: 'lowercase', + capitalization: 'lowercase' }); const exists = await db .table('links') @@ -214,13 +214,11 @@ class Util { zip.writeZip( path.join( __dirname, - '..', - '..', - '..', + '../../../', process.env.UPLOAD_FOLDER, 'zips', - `${album.userId}-${album.id}.zip`, - ), + `${album.userId}-${album.id}.zip` + ) ); } catch (error) { log.error(error); diff --git a/src/api/utils/videoPreview/FragmentPreview.js b/src/api/utils/videoPreview/FragmentPreview.js index bf623c1..4f681fa 100644 --- a/src/api/utils/videoPreview/FragmentPreview.js +++ b/src/api/utils/videoPreview/FragmentPreview.js @@ -38,7 +38,7 @@ module.exports = async (opts) => { fragmentDurationSecond = 3, ignoreBeforePercent = 0.25, - ignoreAfterPercent = 0.75, + ignoreAfterPercent = 0.75 } = opts; const info = await probe(input); diff --git a/src/api/utils/videoPreview/FrameIntervalPreview.js b/src/api/utils/videoPreview/FrameIntervalPreview.js index 8c5f1c3..8bb9836 100644 --- a/src/api/utils/videoPreview/FrameIntervalPreview.js +++ b/src/api/utils/videoPreview/FrameIntervalPreview.js @@ -16,7 +16,7 @@ module.exports = async (opts) => { output, numFrames, - numFramesPercent = 0.05, + numFramesPercent = 0.05 } = opts; const info = await probe(input); @@ -32,7 +32,7 @@ module.exports = async (opts) => { const result = { output, - numFrames: numFramesToCapture, + numFrames: numFramesToCapture }; await new Promise((resolve, reject) => { |