diff --git a/.editorconfig b/.editorconfig index 26e86bb..ce41ae1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,7 @@ insert_final_newline = false [./public/safe.fiery.me.sxcu] insert_final_newline = false + +[./.vscode/settings.json] +indent_size = 4 +insert_final_newline = false diff --git a/.gitignore b/.gitignore index 1604c07..2f20378 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ migrate.js yarn.lock yarn-error.log package-lock.json -.vscode/ diff --git a/.jsbeautifyrc b/.jsbeautifyrc new file mode 100644 index 0000000..8c9721d --- /dev/null +++ b/.jsbeautifyrc @@ -0,0 +1,6 @@ +{ + "indent_size": 2, + "indent_char": " ", + "indent_inner_html": true, + "indent_handlebars": true +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f4c4690 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,33 @@ +{ + "beautify.ignore": [ + "**/*.js" + ], + "beautify.language": { + "js": {}, + "css": [ + "css", + "scss" + ], + "html": [ + "htm", + "html", + "hbs", + "handlebars" + ] + }, + "discord.enabled": true, + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.rulers": [ + 120 + ], + "editor.wordWrapColumn": 120, + "editor.wordWrap": "bounded", + "editor.wrappingIndent": "indent", + "eslint.enable": true, + "eslint.autoFixOnSave": true, + "javascript.format.enable": false, + "javascript.suggestionActions.enabled": false, + "javascript.validate.enable": false, + "npm-intellisense.importES6": false +} \ No newline at end of file diff --git a/controllers/albumsController.js b/controllers/albumsController.js index c9e8b11..b3416b5 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -1,10 +1,11 @@ -const config = require('../config.js') +const config = require('./../config') const db = require('knex')(config.database) -const randomstring = require('randomstring') -const utils = require('./utilsController.js') -const path = require('path') const fs = require('fs') +const path = require('path') +const randomstring = require('randomstring') +const utils = require('./utilsController') const Zip = require('jszip') + const albumsController = {} albumsController.list = async (req, res, next) => { diff --git a/controllers/authController.js b/controllers/authController.js index 6612e82..1137f06 100644 --- a/controllers/authController.js +++ b/controllers/authController.js @@ -1,8 +1,8 @@ -const config = require('../config.js') -const db = require('knex')(config.database) const bcrypt = require('bcrypt') +const config = require('./../config') +const db = require('knex')(config.database) const randomstring = require('randomstring') -const utils = require('./utilsController.js') +const utils = require('./utilsController') const authController = {} diff --git a/controllers/tokenController.js b/controllers/tokenController.js index 6e2249b..4386e65 100644 --- a/controllers/tokenController.js +++ b/controllers/tokenController.js @@ -1,7 +1,7 @@ -const config = require('../config.js') +const config = require('./../config') const db = require('knex')(config.database) const randomstring = require('randomstring') -const utils = require('./utilsController.js') +const utils = require('./utilsController') const tokenController = {} diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 056f942..22014c6 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -1,11 +1,11 @@ -const config = require('../config.js') +const config = require('./../config') const path = require('path') const multer = require('multer') const randomstring = require('randomstring') const db = require('knex')(config.database) const crypto = require('crypto') const fs = require('fs') -const utils = require('./utilsController.js') +const utils = require('./utilsController') const uploadsController = {} @@ -450,17 +450,6 @@ uploadsController.processFilesForDisplay = async (req, res, files, existingFiles }) } - if (req.params.nojs) { - return res.render('nojs', { - layout: false, - files: mappedFiles.map(file => { - const exec = /.[\w]+(\?|$)/.exec(file.url) - file.image = exec && exec[0] && utils.imageExtensions.includes(exec[0].toLowerCase()) - return file - }) - }) - } - return res.json({ success: albumSuccess, description: albumSuccess ? null : 'Warning: Album may not have been properly updated.', diff --git a/controllers/utilsController.js b/controllers/utilsController.js index 109885f..f1ec01c 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -1,9 +1,9 @@ -const path = require('path') -const config = require('../config.js') +const config = require('./../config') +const db = require('knex')(config.database) +const ffmpeg = require('fluent-ffmpeg') const fs = require('fs') const gm = require('gm') -const ffmpeg = require('fluent-ffmpeg') -const db = require('knex')(config.database) +const path = require('path') const units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] diff --git a/database/migration.js b/database/migration.js index 73638a4..4b55d7f 100644 --- a/database/migration.js +++ b/database/migration.js @@ -1,4 +1,4 @@ -const config = require('../config.js') +const config = require('./../config') const db = require('knex')(config.database) const map = { diff --git a/lolisafe.js b/lolisafe.js index 98bd045..86e4df6 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -1,7 +1,7 @@ -const config = require('./config.js') -const api = require('./routes/api.js') -const album = require('./routes/album.js') -const nojs = require('./routes/nojs.js') +const config = require('./config') +const api = require('./routes/api') +const album = require('./routes/album') +const nojs = require('./routes/nojs') const express = require('express') const helmet = require('helmet') const bodyParser = require('body-parser') @@ -64,11 +64,11 @@ for (const page of config.pages) { // NOTE: Uses fiery.me branch of https://github.com/BobbyWibowo/HttpErrorPages safe.use((req, res, next) => { - res.status(404).sendFile('HTTP404.html', { root: '../HttpErrorPages/dist/' }) + res.status(404).sendFile('HTTP404.html', { root: './../HttpErrorPages/dist/' }) }) safe.use((error, req, res, next) => { console.error(error) - res.status(500).sendFile('HTTP505.html', { root: '../HttpErrorPages/dist/' }) + res.status(500).sendFile('HTTP500.html', { root: './../HttpErrorPages/dist/' }) }) safe.listen(config.port, () => console.log(`lolisafe started on port ${config.port}`)) diff --git a/pages/album.html b/pages/album.html index 70718c5..0999a67 100644 --- a/pages/album.html +++ b/pages/album.html @@ -1,5 +1,6 @@ +
@@ -10,11 +11,11 @@