From 61cc8a8d9bc490b8f0c873b21626a78ce707921a Mon Sep 17 00:00:00 2001 From: Kylart Date: Thu, 4 Oct 2018 22:34:15 +0200 Subject: [PATCH] Lint with latest standard --- app/api/config/config.js | 6 +- app/api/config/index.js | 4 +- app/api/config/setupAccount.js | 8 +-- app/api/env/index.js | 2 +- app/api/env/releaseNotes.js | 6 +- app/api/env/updateReleaseVersion.js | 6 +- app/api/env/win.js | 6 +- app/api/generateEnv.js | 4 +- app/api/history/history.js | 8 +-- app/api/mal/index.js | 4 +- app/api/mal/official.js | 4 +- app/api/mal/scrap.js | 6 +- app/api/news/index.js | 2 +- app/api/nyaa/download.js | 4 +- app/api/openExternal/index.js | 2 +- app/api/openExternal/openExternal.js | 8 +-- app/api/search/episodes.js | 2 +- app/api/search/index.js | 6 +- app/api/search/search.js | 4 +- app/api/seasons/index.js | 2 +- app/api/seasons/seasons.js | 6 +- app/api/torrent/index.js | 2 +- app/api/torrent/torrent.js | 4 +- app/api/updater/index.js | 4 +- app/api/utils/dir.js | 4 +- app/api/utils/index.js | 2 +- app/api/utils/logger.js | 4 +- app/api/vault/index.js | 8 +-- app/api/video/index.js | 2 +- app/api/video/streaming.js | 6 +- app/api/watchList/index.js | 2 +- app/electron/resources/menu.js | 2 +- app/electron/runner.js | 2 +- app/web/components/global/malForm.vue | 72 +++++++++---------- .../layout/leftNavigationDrawer.vue | 14 ++-- app/web/components/localLists/card.vue | 2 +- app/web/components/seasons/form.vue | 8 +-- app/web/router/index.js | 4 +- app/web/store/actions.js | 16 ++--- app/web/store/modules/config/actions.js | 8 +-- app/web/store/modules/config/mutations.js | 2 +- app/web/store/modules/downloader/actions.js | 2 +- app/web/store/modules/history/actions.js | 8 +-- app/web/store/modules/history/mutations.js | 2 +- app/web/store/modules/logs/actions.js | 6 +- app/web/store/modules/mal/actions.js | 22 +++--- app/web/store/modules/mal/getters.js | 2 +- app/web/store/modules/player/actions.js | 6 +- app/web/store/modules/releases/actions.js | 4 +- app/web/store/modules/releases/mutations.js | 2 +- app/web/store/modules/seasons/actions.js | 2 +- app/web/store/modules/streaming/actions.js | 8 +-- app/web/store/modules/torrents/actions.js | 4 +- app/web/store/modules/update/actions.js | 12 ++-- app/web/store/modules/watchLists/actions.js | 2 +- app/web/store/utils.js | 6 +- test/api/local.test.js | 2 +- 57 files changed, 179 insertions(+), 179 deletions(-) diff --git a/app/api/config/config.js b/app/api/config/config.js index 071308b..5e5bd07 100644 --- a/app/api/config/config.js +++ b/app/api/config/config.js @@ -1,7 +1,7 @@ -const {join} = require('path') -const {writeFileSync, readFileSync} = require('fs') +const { join } = require('path') +const { writeFileSync, readFileSync } = require('fs') -const {dir, Logger} = require('../utils') +const { dir, Logger } = require('../utils') const logger = new Logger('Config') const get = (req, res) => { diff --git a/app/api/config/index.js b/app/api/config/index.js index 70a479e..762ec69 100644 --- a/app/api/config/index.js +++ b/app/api/config/index.js @@ -1,5 +1,5 @@ -const {save, get} = require('./config.js') -const {setupAccount} = require('./setupAccount.js') +const { save, get } = require('./config.js') +const { setupAccount } = require('./setupAccount.js') const routes = [ (app) => app.get('/getConfig.json', get), diff --git a/app/api/config/setupAccount.js b/app/api/config/setupAccount.js index 098acf2..e53a932 100644 --- a/app/api/config/setupAccount.js +++ b/app/api/config/setupAccount.js @@ -1,12 +1,12 @@ -const {join} = require('path') -const {writeFileSync} = require('fs') +const { join } = require('path') +const { writeFileSync } = require('fs') const vault = require('../vault') -const {dir} = require('../utils') +const { dir } = require('../utils') const setupAccount = (req, res) => { req.on('data', (chunk) => { - const {service, credentials} = JSON.parse(chunk) + const { service, credentials } = JSON.parse(chunk) // Writting the username in the config file so no one forgets const p = join(dir, 'config.json') diff --git a/app/api/env/index.js b/app/api/env/index.js index 03ed495..d559754 100644 --- a/app/api/env/index.js +++ b/app/api/env/index.js @@ -1,6 +1,6 @@ const getEnv = require('./env.js') const isOnline = require('./isOnline.js') -const {actOnWin, toggleFullScreen} = require('./win.js') +const { actOnWin, toggleFullScreen } = require('./win.js') const getNotes = require('./releaseNotes.js') const updateReleaseVersion = require('./updateReleaseVersion.js') diff --git a/app/api/env/releaseNotes.js b/app/api/env/releaseNotes.js index 734cd8a..2ffa8ea 100644 --- a/app/api/env/releaseNotes.js +++ b/app/api/env/releaseNotes.js @@ -1,7 +1,7 @@ -const {join} = require('path') +const { join } = require('path') const _ = require('lodash') const axios = require('axios') -const {dir} = require('../utils') +const { dir } = require('../utils') const _VERSION_ = require(join(__dirname, '..', '..', '..', 'package.json')).version const configPath = join(dir, 'config.json') @@ -11,7 +11,7 @@ const mustShow = config.config.version !== _VERSION_ const get = async (req, res) => { try { - const {data, status} = await axios.get('https://api.github.com/repos/Kylart/KawAnime/releases') + const { data, status } = await axios.get('https://api.github.com/repos/Kylart/KawAnime/releases') const toSend = { logs: _.find(data, (e) => e.name === `v${_VERSION_}`).body, diff --git a/app/api/env/updateReleaseVersion.js b/app/api/env/updateReleaseVersion.js index e6c5c98..53b222a 100644 --- a/app/api/env/updateReleaseVersion.js +++ b/app/api/env/updateReleaseVersion.js @@ -1,6 +1,6 @@ -const {join} = require('path') -const {writeFileSync} = require('fs') -const {dir} = require('../utils') +const { join } = require('path') +const { writeFileSync } = require('fs') +const { dir } = require('../utils') const _VERSION_ = require(join(__dirname, '..', '..', '..', 'package.json')).version const configPath = join(dir, 'config.json') diff --git a/app/api/env/win.js b/app/api/env/win.js index 7836a72..1009a8c 100644 --- a/app/api/env/win.js +++ b/app/api/env/win.js @@ -1,5 +1,5 @@ -const actOnWin = ({query}, res) => { - const {action} = query +const actOnWin = ({ query }, res) => { + const { action } = query if (action === 'minimize') { process.win.minimize() @@ -14,7 +14,7 @@ const actOnWin = ({query}, res) => { res.status(200).send() } -const toggleFullScreen = ({query}, res) => { +const toggleFullScreen = ({ query }, res) => { if (process.win && process.win.isVisible()) { process.win.setFullScreen(JSON.parse(query.bool)) } diff --git a/app/api/generateEnv.js b/app/api/generateEnv.js index 2ba9ec1..cd9ac26 100644 --- a/app/api/generateEnv.js +++ b/app/api/generateEnv.js @@ -1,9 +1,9 @@ const fs = require('fs') -const {join} = require('path') +const { join } = require('path') const _ = require('lodash') const randomString = require('randomstring') -const {dir, Logger} = require('./utils') +const { dir, Logger } = require('./utils') const logger = new Logger('Env') diff --git a/app/api/history/history.js b/app/api/history/history.js index 2be6c2a..a694348 100644 --- a/app/api/history/history.js +++ b/app/api/history/history.js @@ -2,10 +2,10 @@ * Created by Kylart on 24/04/2017. */ -const {join} = require('path') -const {writeFileSync} = require('fs') +const { join } = require('path') +const { writeFileSync } = require('fs') -const {Logger, dir} = require('../utils') +const { Logger, dir } = require('../utils') const logger = new Logger('History') const historyPath = join(dir, 'history.json') @@ -59,7 +59,7 @@ const removeFromHistory = (req, res) => { // Getting history const historyFile = require(historyPath) - const {date, info} = chunk + const { date, info } = chunk historyFile[date] = historyFile[date].filter((elem) => { return elem.time !== info.time diff --git a/app/api/mal/index.js b/app/api/mal/index.js index 58fddb1..d870fbc 100644 --- a/app/api/mal/index.js +++ b/app/api/mal/index.js @@ -1,5 +1,5 @@ -const {getWatchList} = require('./scrap.js') -const {initOfficialApi, actOnList} = require('./official.js') +const { getWatchList } = require('./scrap.js') +const { initOfficialApi, actOnList } = require('./official.js') const routes = [ (app) => app.get('/getWatchList', getWatchList), diff --git a/app/api/mal/official.js b/app/api/mal/official.js index a13993d..74498b2 100644 --- a/app/api/mal/official.js +++ b/app/api/mal/official.js @@ -2,7 +2,7 @@ const vault = require('../vault') const malScraper = require('mal-scraper') const Api = malScraper.officialApi -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Mal-Scraper') let api @@ -37,7 +37,7 @@ const actOnList = (req, res) => { req.on('data', (chunk) => { chunk = JSON.parse(chunk) - const {type, opts, id} = chunk + const { type, opts, id } = chunk api.actOnList(type, id, opts) .then((data) => { diff --git a/app/api/mal/scrap.js b/app/api/mal/scrap.js index 88d5dbe..a6fafdd 100644 --- a/app/api/mal/scrap.js +++ b/app/api/mal/scrap.js @@ -1,9 +1,9 @@ const malScraper = require('mal-scraper') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Mal-Scraper') -const getWatchList = ({query}, res) => { - const {user} = query +const getWatchList = ({ query }, res) => { + const { user } = query logger.info('Looking for the watch lists of ' + user + '...') diff --git a/app/api/news/index.js b/app/api/news/index.js index d4dc7e5..1497b72 100644 --- a/app/api/news/index.js +++ b/app/api/news/index.js @@ -1,4 +1,4 @@ -const {getNews} = require('./news.js') +const { getNews } = require('./news.js') const routes = [ (app) => app.get('/news', getNews) diff --git a/app/api/nyaa/download.js b/app/api/nyaa/download.js index 61178d6..bc6991d 100644 --- a/app/api/nyaa/download.js +++ b/app/api/nyaa/download.js @@ -1,6 +1,6 @@ const { parseAnime: parse } = require('zettai') const _ = require('lodash') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Nyaa (Download)') const engines = require('./engines.js') @@ -44,7 +44,7 @@ const download = (req, res) => { req.on('data', (chunk) => { chunk = JSON.parse(chunk) - const {feed} = chunk + const { feed } = chunk const searchData = { quality: chunk.quality || '', diff --git a/app/api/openExternal/index.js b/app/api/openExternal/index.js index 4984e78..5a09868 100644 --- a/app/api/openExternal/index.js +++ b/app/api/openExternal/index.js @@ -1,4 +1,4 @@ -const {openExternal, openInBrowser} = require('./openExternal.js') +const { openExternal, openInBrowser } = require('./openExternal.js') const routes = [ (app) => app.get('/openThis', openExternal), diff --git a/app/api/openExternal/openExternal.js b/app/api/openExternal/openExternal.js index 571d2f0..7adb4b1 100644 --- a/app/api/openExternal/openExternal.js +++ b/app/api/openExternal/openExternal.js @@ -2,8 +2,8 @@ * Created by Kylart on 04/04/2017. */ -const {dialog, BrowserWindow, shell} = require('electron') -const {Logger} = require('../utils') +const { dialog, BrowserWindow, shell } = require('electron') +const { Logger } = require('../utils') const logger = new Logger('Open-External') const sendEmptyRes = (res) => { @@ -15,7 +15,7 @@ const sendRes = (res, data) => { res.status(200).send(JSON.stringify(data)) } -const openExternal = ({query}, res) => { +const openExternal = ({ query }, res) => { const type = query.type logger.info('Got a request for external open of a ' + type) @@ -53,7 +53,7 @@ const openExternal = ({query}, res) => { break case 'dialog': - dialog.showOpenDialog({properties: ['openDirectory']}, (dirPath) => { + dialog.showOpenDialog({ properties: ['openDirectory'] }, (dirPath) => { if (dirPath !== undefined) { const result = { path: dirPath[0] diff --git a/app/api/search/episodes.js b/app/api/search/episodes.js index 78c7e2e..2706ec4 100644 --- a/app/api/search/episodes.js +++ b/app/api/search/episodes.js @@ -1,6 +1,6 @@ const { getEpisodesList } = require('mal-scraper') -const getEps = ({query}, res) => { +const getEps = ({ query }, res) => { const { id, name } = query getEpisodesList({ name, id }) diff --git a/app/api/search/index.js b/app/api/search/index.js index 5e20896..f932136 100644 --- a/app/api/search/index.js +++ b/app/api/search/index.js @@ -1,10 +1,10 @@ -const {searchTerm, fromName, fromUrl} = require('./search.js') -const {getEps} = require('./episodes.js') +const { searchTerm, fromName, fromUrl } = require('./search.js') +const { getEps } = require('./episodes.js') const routes = [ (app) => app.get('/searchTermOnMal', searchTerm), (app) => app.get('/searchEpsOnMal', getEps), - (app) => app.get('/getInfoFromMal', ({query}, res) => + (app) => app.get('/getInfoFromMal', ({ query }, res) => query.url ? fromUrl(query, res) : fromName(query, res) diff --git a/app/api/search/search.js b/app/api/search/search.js index 33b9a90..b591f69 100644 --- a/app/api/search/search.js +++ b/app/api/search/search.js @@ -3,10 +3,10 @@ */ const malScraper = require('mal-scraper') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Search') -const searchTerm = ({query}, res) => { +const searchTerm = ({ query }, res) => { malScraper.getResultsFromSearch(query.term) .then((data) => res.json(data)) .catch(/* istanbul ignore next */(err) => { diff --git a/app/api/seasons/index.js b/app/api/seasons/index.js index 24c960c..984c38f 100644 --- a/app/api/seasons/index.js +++ b/app/api/seasons/index.js @@ -1,4 +1,4 @@ -const {getSeason} = require('./seasons.js') +const { getSeason } = require('./seasons.js') const routes = [ (app) => app.get('/seasons.json', getSeason) diff --git a/app/api/seasons/seasons.js b/app/api/seasons/seasons.js index 5b45c47..b553dad 100644 --- a/app/api/seasons/seasons.js +++ b/app/api/seasons/seasons.js @@ -2,12 +2,12 @@ * Created by Kylart on 03/04/2017. */ -const {getSeason} = require('mal-scraper') +const { getSeason } = require('mal-scraper') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Mal-Scraper (Seasons)') -exports.getSeason = ({query}, res) => { +exports.getSeason = ({ query }, res) => { getSeason(query.year, query.season).then((data) => { logger.info(`Now having ${query.season} ${query.year}.`) diff --git a/app/api/torrent/index.js b/app/api/torrent/index.js index c48f656..3328dc1 100644 --- a/app/api/torrent/index.js +++ b/app/api/torrent/index.js @@ -1,4 +1,4 @@ -const {init, add, remove, info, togglePlay} = require('./torrent.js') +const { init, add, remove, info, togglePlay } = require('./torrent.js') const routes = [ (app) => app.get('/torrent/init', init), diff --git a/app/api/torrent/torrent.js b/app/api/torrent/torrent.js index c7d6963..9533221 100644 --- a/app/api/torrent/torrent.js +++ b/app/api/torrent/torrent.js @@ -1,7 +1,7 @@ const fs = require('fs') const { extname } = require('path') const WebTorrent = require('webtorrent') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Torrent Client') // TODO Limit download speed, check https://github.com/webtorrent/webtorrent/issues/163 @@ -66,7 +66,7 @@ const add = (req, res) => { res.send() } -const remove = ({query: {magnet}}, res) => { +const remove = ({ query: { magnet } }, res) => { // Be careful calling this one. magnet = (extname(magnet) === '.torrent' && fs.readFileSync(magnet)) || magnet diff --git a/app/api/updater/index.js b/app/api/updater/index.js index e0e9849..3707d29 100644 --- a/app/api/updater/index.js +++ b/app/api/updater/index.js @@ -1,6 +1,6 @@ module.exports = (app, routes) => { - const {join} = require('path') - const {autoUpdater} = require('electron-updater') + const { join } = require('path') + const { autoUpdater } = require('electron-updater') let isUpdateAvailable = false let isInstallable = false let downloadProgress diff --git a/app/api/utils/dir.js b/app/api/utils/dir.js index 70fc73e..c6462f7 100644 --- a/app/api/utils/dir.js +++ b/app/api/utils/dir.js @@ -1,5 +1,5 @@ -const {homedir} = require('os') -const {join} = require('path') +const { homedir } = require('os') +const { join } = require('path') const BASE_PATH = homedir() diff --git a/app/api/utils/index.js b/app/api/utils/index.js index fde7f4e..dbb0b93 100644 --- a/app/api/utils/index.js +++ b/app/api/utils/index.js @@ -3,7 +3,7 @@ */ const removeUnwanted = require('./removeUnwanted') -const {Logger} = require('./logger.js') +const { Logger } = require('./logger.js') const dir = require('./dir.js') const readJson = require('./readJson.js') diff --git a/app/api/utils/logger.js b/app/api/utils/logger.js index f2d79bb..513cf03 100644 --- a/app/api/utils/logger.js +++ b/app/api/utils/logger.js @@ -2,8 +2,8 @@ * Very basic logger as we don't need much more. */ -const {join} = require('path') -const {appendFileSync} = require('fs') +const { join } = require('path') +const { appendFileSync } = require('fs') const chalk = require('chalk') const dir = require('./dir.js') diff --git a/app/api/vault/index.js b/app/api/vault/index.js index 53bd1a6..465704b 100644 --- a/app/api/vault/index.js +++ b/app/api/vault/index.js @@ -1,10 +1,10 @@ -const {join} = require('path') -const {writeFileSync, readFileSync, existsSync, mkdirSync} = require('fs') +const { join } = require('path') +const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('fs') const randomString = require('randomstring') const buttercup = require('buttercup') -const {Archive, createCredentials, FileDatasource, EntryFinder} = buttercup +const { Archive, createCredentials, FileDatasource, EntryFinder } = buttercup -const {Logger, dir} = require('../utils') +const { Logger, dir } = require('../utils') const logger = new Logger('Vault') const DIR = join(dir, 'vault') diff --git a/app/api/video/index.js b/app/api/video/index.js index 490ca38..a69c532 100644 --- a/app/api/video/index.js +++ b/app/api/video/index.js @@ -1,4 +1,4 @@ -const {stream, tracks} = require('./streaming.js') +const { stream, tracks } = require('./streaming.js') const sseExpress = require('sse-express') const routes = [ diff --git a/app/api/video/streaming.js b/app/api/video/streaming.js index 35a8dc8..b8b18b4 100644 --- a/app/api/video/streaming.js +++ b/app/api/video/streaming.js @@ -2,7 +2,7 @@ const fs = require('fs') const { extname } = require('path') const parseRange = require('range-parser') const mime = require('mime') -const {Logger} = require('../utils') +const { Logger } = require('../utils') const logger = new Logger('Torrent Streamer') const decode = require('urldecode') const MatroskaSubtitles = require('matroska-subtitles') @@ -108,7 +108,7 @@ const tracks = (req, res) => { logger.info(`Tracks for ${type}: ${isMagnet ? magnet : path}`) - const processFile = (obj = {files: []}) => { + const processFile = (obj = { files: [] }) => { obj = obj || { files: [] } const { files: [torrent] } = obj const mimeType = mime.getType(path || torrent.name) @@ -150,4 +150,4 @@ const tracks = (req, res) => { processFile(isTorrent ? process.torrentClient.get(magnet) : undefined) } -module.exports = {stream, tracks} +module.exports = { stream, tracks } diff --git a/app/api/watchList/index.js b/app/api/watchList/index.js index 80a0d51..de5defe 100644 --- a/app/api/watchList/index.js +++ b/app/api/watchList/index.js @@ -1,4 +1,4 @@ -const {get, save} = require('./watchList.js') +const { get, save } = require('./watchList.js') const routes = [ (app) => app.get('/watchLists', get), diff --git a/app/electron/resources/menu.js b/app/electron/resources/menu.js index 09803bb..bd7e072 100644 --- a/app/electron/resources/menu.js +++ b/app/electron/resources/menu.js @@ -3,7 +3,7 @@ */ const electron = require('electron') -const {app} = electron +const { app } = electron const template = () => { let menu = [ diff --git a/app/electron/runner.js b/app/electron/runner.js index 996cfce..56bfc87 100644 --- a/app/electron/runner.js +++ b/app/electron/runner.js @@ -2,7 +2,7 @@ const electron = require('electron') const { join } = require('path') const { spawn } = require('child_process') -function init ({verbose}) { +function init ({ verbose }) { const electronProcess = spawn(electron, [join(__dirname, '..', 'index.js')]) if (verbose) { diff --git a/app/web/components/global/malForm.vue b/app/web/components/global/malForm.vue index ff51e30..0dfebbe 100644 --- a/app/web/components/global/malForm.vue +++ b/app/web/components/global/malForm.vue @@ -132,46 +132,46 @@ export default { return { datePickers: [false, false], status: [ - {text: 'Watching', value: 1}, - {text: 'Completed', value: 2}, - {text: 'On Hold', value: 3}, - {text: 'Dropped', value: 4}, - {text: 'Plan to watch', value: 6} + { text: 'Watching', value: 1 }, + { text: 'Completed', value: 2 }, + { text: 'On Hold', value: 3 }, + { text: 'Dropped', value: 4 }, + { text: 'Plan to watch', value: 6 } ], score: [ - {text: 'None', value: null}, - {text: '1 - Appalling', value: 1}, - {text: '2 - Horrible', value: 2}, - {text: '3 - Very bad', value: 3}, - {text: '4 - Bad', value: 4}, - {text: '5 - Average', value: 5}, - {text: '6 - Fine', value: 6}, - {text: '7 - Good', value: 7}, - {text: '8 - Very good', value: 8}, - {text: '9 - Great', value: 9}, - {text: '10 - Masterpiece', value: 10} + { text: 'None', value: null }, + { text: '1 - Appalling', value: 1 }, + { text: '2 - Horrible', value: 2 }, + { text: '3 - Very bad', value: 3 }, + { text: '4 - Bad', value: 4 }, + { text: '5 - Average', value: 5 }, + { text: '6 - Fine', value: 6 }, + { text: '7 - Good', value: 7 }, + { text: '8 - Very good', value: 8 }, + { text: '9 - Great', value: 9 }, + { text: '10 - Masterpiece', value: 10 } ].reverse(), storage: [ - {text: 'Hard Drive', value: 1}, - {text: 'DVD / CD', value: 2}, - {text: 'Retail DVD', value: 4}, - {text: 'VHS', value: 5}, - {text: 'External HD', value: 6}, - {text: 'NAS', value: 7}, - {text: 'Blu-ray', value: 8}, - {text: 'None', value: 3} + { text: 'Hard Drive', value: 1 }, + { text: 'DVD / CD', value: 2 }, + { text: 'Retail DVD', value: 4 }, + { text: 'VHS', value: 5 }, + { text: 'External HD', value: 6 }, + { text: 'NAS', value: 7 }, + { text: 'Blu-ray', value: 8 }, + { text: 'None', value: 3 } ], priority: [ - {text: 'Low', value: 0}, - {text: 'Medium', value: 1}, - {text: 'High', value: 2} + { text: 'Low', value: 0 }, + { text: 'Medium', value: 1 }, + { text: 'High', value: 2 } ], rewatch: [ - {text: 'Very low', value: 1}, - {text: 'Low', value: 2}, - {text: 'Medium', value: 3}, - {text: 'High', value: 4}, - {text: 'Very high', value: 5} + { text: 'Very low', value: 1 }, + { text: 'Low', value: 2 }, + { text: 'Medium', value: 3 }, + { text: 'High', value: 4 }, + { text: 'Very high', value: 5 } ], initForm: { status: 1, @@ -292,14 +292,14 @@ export default { this.form.date_finish = obj.myEndDate === '0000-00-00' ? null : obj.myEndDate } - const {id} = obj + const { id } = obj if (obj.name) { try { - const {data} = await this.$axios.get(`getInfoFromMal`, { - params: {url: obj.url} + const { data } = await this.$axios.get(`getInfoFromMal`, { + params: { url: obj.url } }) - this.$store.commit('mal/setEntry', {id, ...data}) + this.$store.commit('mal/setEntry', { id, ...data }) } catch (e) { console.error((new Date()).toLocaleTimeString(), e) } diff --git a/app/web/components/layout/leftNavigationDrawer.vue b/app/web/components/layout/leftNavigationDrawer.vue index 2f8c980..a1321cb 100644 --- a/app/web/components/layout/leftNavigationDrawer.vue +++ b/app/web/components/layout/leftNavigationDrawer.vue @@ -46,8 +46,8 @@ export default { data: () => ({ itemGroup: [ - {divider: true}, - {header: 'Core'}, + { divider: true }, + { header: 'Core' }, { title: 'Releases', action: 'access_time', @@ -57,8 +57,8 @@ export default { action: 'file_download', href: '/torrenting' }, - {divider: true}, - {header: 'Anime world'}, + { divider: true }, + { header: 'Anime world' }, { title: 'Seasons', action: 'hourglass_empty', @@ -69,8 +69,8 @@ export default { action: 'more', href: '/news' }, - {divider: true}, - {header: 'Local'}, + { divider: true }, + { header: 'Local' }, { title: 'Anime related', action: 'folder_open', @@ -91,7 +91,7 @@ export default { } ] }, - {divider: true} + { divider: true } ] }), diff --git a/app/web/components/localLists/card.vue b/app/web/components/localLists/card.vue index 6ed5327..eeeea41 100644 --- a/app/web/components/localLists/card.vue +++ b/app/web/components/localLists/card.vue @@ -68,7 +68,7 @@ export default { await this.$store.dispatch('downloader/download', config) }, watch () { - this.$router.push({path: '/', query: { name: this.name }}) + this.$router.push({ path: '/', query: { name: this.name } }) }, search () { this.$store.commit('info/setTerm', this.name) diff --git a/app/web/components/seasons/form.vue b/app/web/components/seasons/form.vue index b1fd9b5..c1ba1f1 100644 --- a/app/web/components/seasons/form.vue +++ b/app/web/components/seasons/form.vue @@ -27,10 +27,10 @@ export default { data: () => ({ seasons: [ - {name: 'Winter', value: 'winter'}, - {name: 'Spring', value: 'spring'}, - {name: 'Summer', value: 'summer'}, - {name: 'Fall', value: 'fall'} + { name: 'Winter', value: 'winter' }, + { name: 'Spring', value: 'spring' }, + { name: 'Summer', value: 'summer' }, + { name: 'Fall', value: 'fall' } ] }), diff --git a/app/web/router/index.js b/app/web/router/index.js index 621f1e1..2a3585c 100644 --- a/app/web/router/index.js +++ b/app/web/router/index.js @@ -20,7 +20,7 @@ export function createRouter () { return new Router({ base: __dirname, mode: 'history', - scrollBehavior: () => ({y: 0}), + scrollBehavior: () => ({ y: 0 }), routes: [ route('/', 'releases'), route('/torrenting', 'torrenting'), @@ -30,7 +30,7 @@ export function createRouter () { route('/watchList', 'watchList'), route('/malPage', 'malPage'), // Global redirect for 404 - {path: '*', redirect: '/'} // TODO: make a custom 404 page + { path: '*', redirect: '/' } // TODO: make a custom 404 page ] }) } diff --git a/app/web/store/actions.js b/app/web/store/actions.js index b4cc910..047f3ef 100644 --- a/app/web/store/actions.js +++ b/app/web/store/actions.js @@ -2,13 +2,13 @@ * Created by Kylart on 26/07/2017. */ -import {axios} from './utils' +import { axios } from './utils' export default { - async init ({commit, dispatch}) { + async init ({ commit, dispatch }) { // Offline try { - const {data} = await axios.get('getConfig.json') + const { data } = await axios.get('getConfig.json') commit('config/set', data.config) @@ -31,7 +31,7 @@ export default { await dispatch('checkOnlineStatus').catch(err => { void err }) dispatch('online').catch(err => { void err }) }, - async online ({commit, dispatch}) { + async online ({ commit, dispatch }) { dispatch('logs/init').catch(err => { void err }) dispatch('releases/init').catch(err => { void err }) dispatch('news/init').catch(err => { void err }) @@ -39,17 +39,17 @@ export default { dispatch('mal/init').catch(err => { void err }) }, - async getEnv ({commit}) { - const {data} = await axios.get('_env') + async getEnv ({ commit }) { + const { data } = await axios.get('_env') commit('setEnv', data) }, async openInBrowser () { await axios.get('/_openInBrowser') }, - async checkOnlineStatus ({commit, dispatch}) { + async checkOnlineStatus ({ commit, dispatch }) { try { - const {status} = await axios.get('_isOnline') + const { status } = await axios.get('_isOnline') const isOnline = status === 200 diff --git a/app/web/store/modules/config/actions.js b/app/web/store/modules/config/actions.js index 3ee059f..d27e605 100644 --- a/app/web/store/modules/config/actions.js +++ b/app/web/store/modules/config/actions.js @@ -1,7 +1,7 @@ -import {axios, log, isRoot} from 'store/utils' +import { axios, log, isRoot } from 'store/utils' export default { - save ({state, commit}, data = null) { + save ({ state, commit }, data = null) { axios.post('saveConfig', JSON.stringify({ config: data || state.config })).then((res) => { @@ -18,8 +18,8 @@ export default { ) }) }, - async changeDir ({commit, dispatch}) { - const {data} = await axios.get('openThis?type=dialog') + async changeDir ({ commit, dispatch }) { + const { data } = await axios.get('openThis?type=dialog') if (data) { commit('setDir', data.path) diff --git a/app/web/store/modules/config/mutations.js b/app/web/store/modules/config/mutations.js index ce303cd..0e587d2 100644 --- a/app/web/store/modules/config/mutations.js +++ b/app/web/store/modules/config/mutations.js @@ -1,4 +1,4 @@ -import {log} from 'store/utils' +import { log } from 'store/utils' export default { set (state, data) { diff --git a/app/web/store/modules/downloader/actions.js b/app/web/store/modules/downloader/actions.js index 11619c7..b30b5ce 100644 --- a/app/web/store/modules/downloader/actions.js +++ b/app/web/store/modules/downloader/actions.js @@ -1,7 +1,7 @@ import { axios, log } from 'store/utils' export default { - async download ({state, commit, rootState}, config) { + async download ({ state, commit, rootState }, config) { try { const { data, status } = await axios.post('download', config) diff --git a/app/web/store/modules/history/actions.js b/app/web/store/modules/history/actions.js index 2127671..73bcac9 100644 --- a/app/web/store/modules/history/actions.js +++ b/app/web/store/modules/history/actions.js @@ -1,4 +1,4 @@ -import {axios, log} from 'store/utils' +import { axios, log } from 'store/utils' export default { append (store, data) { @@ -8,14 +8,14 @@ export default { log('An error occurred while appending to history...', err) }) }, - async get ({commit}) { - const {data, status} = await axios.get('getHistory') + async get ({ commit }) { + const { data, status } = await axios.get('getHistory') if (status !== 200) { log(`An error occurred while gathering the history.`) } commit('set', data) }, - async remove ({dispatch}, data) { + async remove ({ dispatch }, data) { await axios.post('removeFromHistory', JSON.stringify(data)) dispatch('get') diff --git a/app/web/store/modules/history/mutations.js b/app/web/store/modules/history/mutations.js index ddf133e..a3069f9 100644 --- a/app/web/store/modules/history/mutations.js +++ b/app/web/store/modules/history/mutations.js @@ -1,4 +1,4 @@ -import {log} from 'store/utils' +import { log } from 'store/utils' export default { set (state, data) { diff --git a/app/web/store/modules/logs/actions.js b/app/web/store/modules/logs/actions.js index 2c025f7..4654883 100644 --- a/app/web/store/modules/logs/actions.js +++ b/app/web/store/modules/logs/actions.js @@ -1,14 +1,14 @@ -import {axios, log} from 'store/utils' +import { axios, log } from 'store/utils' export default { - async init ({rootState, commit, dispatch}) { + async init ({ rootState, commit, dispatch }) { if (!rootState.isConnected) { setTimeout(() => { dispatch('init') }, 60 * 1000) return } try { - const {data, status} = await axios.get('releaseNotes') + const { data, status } = await axios.get('releaseNotes') if (status === 200) { commit('set', data.logs) diff --git a/app/web/store/modules/mal/actions.js b/app/web/store/modules/mal/actions.js index 600da8f..147ed6b 100644 --- a/app/web/store/modules/mal/actions.js +++ b/app/web/store/modules/mal/actions.js @@ -1,8 +1,8 @@ -import {axios, log, isRoot, _} from 'store/utils' +import { axios, log, isRoot, _ } from 'store/utils' export default { - async init ({rootState, commit, dispatch}) { - const {malUsername} = rootState.config.config + async init ({ rootState, commit, dispatch }) { + const { malUsername } = rootState.config.config if (!rootState.isConnected) { setTimeout(() => { @@ -27,16 +27,16 @@ export default { } } }, - async setupAccount ({rootState, commit, dispatch, state}, credentials) { + async setupAccount ({ rootState, commit, dispatch, state }, credentials) { try { - const {status} = await axios.post('_setupAccount', { + const { status } = await axios.post('_setupAccount', { service: state.service, credentials }) if (status === 204) throw new Error('Error while registering service.') - const {username} = credentials + const { username } = credentials rootState.config.config.malUsername = username await dispatch('init', username) @@ -49,7 +49,7 @@ export default { const { malUsername } = rootState.config.config try { - const {status} = await axios.post('_initOfficalApi', { + const { status } = await axios.post('_initOfficalApi', { service: state.service }) @@ -69,11 +69,11 @@ export default { ) } }, - async getWatchLists ({state, commit}, user) { + async getWatchLists ({ state, commit }, user) { try { commit('isLoading', true) - const { data } = await axios.get('getWatchList', {params: {user}}) + const { data } = await axios.get('getWatchList', { params: { user } }) if (!data) return @@ -93,9 +93,9 @@ export default { log('MyAnimeList >', e) } }, - async actOnList ({rootState, commit, dispatch}, data) { + async actOnList ({ rootState, commit, dispatch }, data) { try { - const {status} = await axios.post('actOnMalList', data) + const { status } = await axios.post('actOnMalList', data) if (status === 204) throw new Error('Invalid request.') diff --git a/app/web/store/modules/mal/getters.js b/app/web/store/modules/mal/getters.js index 3c8a90f..6e197ab 100644 --- a/app/web/store/modules/mal/getters.js +++ b/app/web/store/modules/mal/getters.js @@ -1,4 +1,4 @@ -import {_} from 'store/utils.js' +import { _ } from 'store/utils.js' export default { lists (state) { diff --git a/app/web/store/modules/player/actions.js b/app/web/store/modules/player/actions.js index 2d0d57d..760ca21 100644 --- a/app/web/store/modules/player/actions.js +++ b/app/web/store/modules/player/actions.js @@ -1,5 +1,5 @@ export default { - setUp ({rootState}) { + setUp ({ rootState }) { try { const sound = rootState.config.config.sound document.player = new window.Audio() @@ -13,8 +13,8 @@ export default { document.player.play() } }, - testSound ({rootState}) { - const {sound} = rootState.config.config + testSound ({ rootState }) { + const { sound } = rootState.config.config if (sound !== 'None') { if (sound !== 'None') { diff --git a/app/web/store/modules/releases/actions.js b/app/web/store/modules/releases/actions.js index 611631f..8c437b1 100644 --- a/app/web/store/modules/releases/actions.js +++ b/app/web/store/modules/releases/actions.js @@ -1,4 +1,4 @@ -import {axios, log} from 'store/utils' +import { axios, log } from 'store/utils' export default { async init ({ dispatch }) { @@ -33,7 +33,7 @@ export default { commit('set', data) commit('refreshing', false) }, - autoRefresh ({dispatch}) { + autoRefresh ({ dispatch }) { // Refresh releases every 10 minutes setInterval(() => { dispatch('refresh') diff --git a/app/web/store/modules/releases/mutations.js b/app/web/store/modules/releases/mutations.js index b054cf6..5e8e281 100644 --- a/app/web/store/modules/releases/mutations.js +++ b/app/web/store/modules/releases/mutations.js @@ -1,4 +1,4 @@ -import {moment} from 'store/utils.js' +import { moment } from 'store/utils.js' export default { set (state, data) { diff --git a/app/web/store/modules/seasons/actions.js b/app/web/store/modules/seasons/actions.js index 8b709c2..4f6795f 100644 --- a/app/web/store/modules/seasons/actions.js +++ b/app/web/store/modules/seasons/actions.js @@ -1,4 +1,4 @@ -import {axios, log, isRoot} from 'store/utils' +import { axios, log, isRoot } from 'store/utils' export default { async init ({ rootState, commit, dispatch }) { diff --git a/app/web/store/modules/streaming/actions.js b/app/web/store/modules/streaming/actions.js index ef13d4e..3cb0092 100644 --- a/app/web/store/modules/streaming/actions.js +++ b/app/web/store/modules/streaming/actions.js @@ -1,7 +1,7 @@ -import {axios, log, isRoot} from 'store/utils' +import { axios, log, isRoot } from 'store/utils' export default { - async watch ({state, commit, rootState}, obj = {}) { + async watch ({ state, commit, rootState }, obj = {}) { const { name } = obj log(`Received a request to watch ${name}. Transmitting...`) @@ -14,7 +14,7 @@ export default { choice: 'si' } - const {data, status} = await axios.post('download', infos) + const { data, status } = await axios.post('download', infos) if (status === 200) { log(`Request fulfilled!`) @@ -27,7 +27,7 @@ export default { log('nyaa.si is down, trying with nyaa.pantsu.cat') infos.choice = 'pantsu' - const {data, status} = await axios.post('download', infos) + const { data, status } = await axios.post('download', infos) if (status === 200 && data.magnets.length) { log(`Request fulfilled!`) diff --git a/app/web/store/modules/torrents/actions.js b/app/web/store/modules/torrents/actions.js index 6fa68c8..c95bec3 100644 --- a/app/web/store/modules/torrents/actions.js +++ b/app/web/store/modules/torrents/actions.js @@ -1,7 +1,7 @@ -import {axios} from 'store/utils' +import { axios } from 'store/utils' export default { - async getData ({commit}) { + async getData ({ commit }) { try { const { data: { client, torrents }, status } = await axios.get('torrent/info') diff --git a/app/web/store/modules/update/actions.js b/app/web/store/modules/update/actions.js index fa76185..204fc1e 100644 --- a/app/web/store/modules/update/actions.js +++ b/app/web/store/modules/update/actions.js @@ -1,11 +1,11 @@ -import {axios, log, isRoot} from 'store/utils' +import { axios, log, isRoot } from 'store/utils' export default { - async check ({state, commit, dispatch}) { + async check ({ state, commit, dispatch }) { setTimeout(async () => { if (!state.isAvailable) { try { - const {data} = await axios.get('_isUpdateAvailable') + const { data } = await axios.get('_isUpdateAvailable') if (data.ok) { if (!state.isRunning) { commit('setRunning') @@ -19,9 +19,9 @@ export default { } }, 30 * 1000) }, - async isInstallable ({commit, dispatch}) { + async isInstallable ({ commit, dispatch }) { try { - const {data} = await axios.get('_isInstallable') + const { data } = await axios.get('_isInstallable') if (data.ok) { commit('setStatus') commit('setInfoSnackbar', 'Update available. Think about installing it~', isRoot) @@ -33,7 +33,7 @@ export default { log(`Error while checking if downloadable. ${e.message}`) } }, - async updateApp ({commit}) { + async updateApp ({ commit }) { try { await axios.get('_quitAndInstall') } catch (e) { diff --git a/app/web/store/modules/watchLists/actions.js b/app/web/store/modules/watchLists/actions.js index 3aa40a4..d51e1d5 100644 --- a/app/web/store/modules/watchLists/actions.js +++ b/app/web/store/modules/watchLists/actions.js @@ -6,7 +6,7 @@ export default { dispatch('get') }, - async save ({state}) { + async save ({ state }) { await axios.post('saveWatchList', JSON.stringify(state.lists)) }, async get ({ commit }) { diff --git a/app/web/store/utils.js b/app/web/store/utils.js index 76c0903..eee60f2 100644 --- a/app/web/store/utils.js +++ b/app/web/store/utils.js @@ -2,9 +2,9 @@ * Created by Kylart on 26/07/2017. */ -export {default as axios} from 'axios' -export {default as moment} from 'moment' -export {default as _} from 'lodash' +export { default as axios } from 'axios' +export { default as moment } from 'moment' +export { default as _ } from 'lodash' export const log = (...messages) => { console.log(`[${(new Date()).toLocaleTimeString()}]:`, ...messages) diff --git a/test/api/local.test.js b/test/api/local.test.js index d185a1a..cf594d9 100644 --- a/test/api/local.test.js +++ b/test/api/local.test.js @@ -49,7 +49,7 @@ test('/local.json route exists and returns three files and code 200', async (t) test('/local.json route exits and returns empty array on empty directory', async (t) => { const { body, status } = await request(makeApp()) .get('/local.json') - .query({dir: __dirname}) + .query({ dir: __dirname }) t.is(status, 200)