Lint with latest standard

This commit is contained in:
Kylart 2018-10-04 22:34:15 +02:00
parent 51e4181347
commit 61cc8a8d9b
57 changed files with 179 additions and 179 deletions

View File

@ -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) => {

View File

@ -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),

View File

@ -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')

View File

@ -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')

View File

@ -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,

View File

@ -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')

6
app/api/env/win.js vendored
View File

@ -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))
}

View File

@ -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')

View File

@ -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

View File

@ -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),

View File

@ -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) => {

View File

@ -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 + '...')

View File

@ -1,4 +1,4 @@
const {getNews} = require('./news.js')
const { getNews } = require('./news.js')
const routes = [
(app) => app.get('/news', getNews)

View File

@ -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 || '',

View File

@ -1,4 +1,4 @@
const {openExternal, openInBrowser} = require('./openExternal.js')
const { openExternal, openInBrowser } = require('./openExternal.js')
const routes = [
(app) => app.get('/openThis', openExternal),

View File

@ -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]

View File

@ -1,6 +1,6 @@
const { getEpisodesList } = require('mal-scraper')
const getEps = ({query}, res) => {
const getEps = ({ query }, res) => {
const { id, name } = query
getEpisodesList({ name, id })

View File

@ -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)

View File

@ -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) => {

View File

@ -1,4 +1,4 @@
const {getSeason} = require('./seasons.js')
const { getSeason } = require('./seasons.js')
const routes = [
(app) => app.get('/seasons.json', getSeason)

View File

@ -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}.`)

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
const {homedir} = require('os')
const {join} = require('path')
const { homedir } = require('os')
const { join } = require('path')
const BASE_PATH = homedir()

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -1,4 +1,4 @@
const {stream, tracks} = require('./streaming.js')
const { stream, tracks } = require('./streaming.js')
const sseExpress = require('sse-express')
const routes = [

View File

@ -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 }

View File

@ -1,4 +1,4 @@
const {get, save} = require('./watchList.js')
const { get, save } = require('./watchList.js')
const routes = [
(app) => app.get('/watchLists', get),

View File

@ -3,7 +3,7 @@
*/
const electron = require('electron')
const {app} = electron
const { app } = electron
const template = () => {
let menu = [

View File

@ -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) {

View File

@ -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)
}

View File

@ -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 }
]
}),

View File

@ -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)

View File

@ -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' }
]
}),

View File

@ -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
]
})
}

View File

@ -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

View File

@ -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)

View File

@ -1,4 +1,4 @@
import {log} from 'store/utils'
import { log } from 'store/utils'
export default {
set (state, data) {

View File

@ -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)

View File

@ -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')

View File

@ -1,4 +1,4 @@
import {log} from 'store/utils'
import { log } from 'store/utils'
export default {
set (state, data) {

View File

@ -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)

View File

@ -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.')

View File

@ -1,4 +1,4 @@
import {_} from 'store/utils.js'
import { _ } from 'store/utils.js'
export default {
lists (state) {

View File

@ -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') {

View File

@ -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')

View File

@ -1,4 +1,4 @@
import {moment} from 'store/utils.js'
import { moment } from 'store/utils.js'
export default {
set (state, data) {

View File

@ -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 }) {

View File

@ -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!`)

View File

@ -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')

View File

@ -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) {

View File

@ -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 }) {

View File

@ -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)

View File

@ -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)