[web-src] Fix linting errors

This commit is contained in:
chme 2021-01-10 07:51:50 +01:00
parent 4f5e736b6b
commit cdc7d7a1da
11 changed files with 34 additions and 34 deletions

View File

@ -107,18 +107,18 @@ export default {
const vm = this
var protocol = 'ws://'
let protocol = 'ws://'
if (window.location.protocol === 'https:') {
protocol = 'wss://'
}
var wsUrl = protocol + window.location.hostname + ':' + vm.$store.state.config.websocket_port
let wsUrl = protocol + window.location.hostname + ':' + vm.$store.state.config.websocket_port
if (process.env.NODE_ENV === 'development' && process.env.VUE_APP_WEBSOCKET_SERVER) {
// If we are running in the development server, use the websocket url configured in .env.development
wsUrl = process.env.VUE_APP_WEBSOCKET_SERVER
}
var socket = new ReconnectingWebSocket(
const socket = new ReconnectingWebSocket(
wsUrl,
'notify',
{ reconnectInterval: 3000 }
@ -146,7 +146,7 @@ export default {
vm.$store.dispatch('add_notification', { text: 'Connection lost. Reconnecting ... (' + vm.reconnect_attempts + ')', type: 'danger', topic: 'connection' })
}
socket.onmessage = function (response) {
var data = JSON.parse(response.data)
const data = JSON.parse(response.data)
if (data.notify.includes('update') || data.notify.includes('database')) {
vm.update_library_stats()
}

View File

@ -10,7 +10,7 @@ export default {
// setup audio routing
setupAudio () {
var AudioContext = window.AudioContext || window.webkitAudioContext
const AudioContext = window.AudioContext || window.webkitAudioContext
this._context = new AudioContext()
this._source = this._context.createMediaElementSource(this._audio)
this._gain = this._context.createGain()

View File

@ -43,7 +43,7 @@ export default class Albums {
}
createSortedAndFilteredList () {
var albumsSorted = this.items
let albumsSorted = this.items
if (this.options.hideSingles || this.options.hideSpotify || this.options.hideOther) {
albumsSorted = albumsSorted.filter(album => this.isAlbumVisible(album))
}

View File

@ -39,7 +39,7 @@ export default class Artists {
}
createSortedAndFilteredList () {
var artistsSorted = this.items
let artistsSorted = this.items
if (this.options.hideSingles || this.options.hideSpotify || this.options.hideOther) {
artistsSorted = artistsSorted.filter(artist => this.isArtistVisible(artist))
}

View File

@ -135,7 +135,7 @@ export default {
methods: {
open_parent_directory: function () {
var parent = this.current_directory.slice(0, this.current_directory.lastIndexOf('/'))
const parent = this.current_directory.slice(0, this.current_directory.lastIndexOf('/'))
if (parent === '' || this.$store.state.config.directories.includes(this.current_directory)) {
this.$router.push({ path: '/files' })
} else {

View File

@ -124,9 +124,9 @@ export default {
},
move_item: function (e) {
var oldPosition = !this.show_only_next_items ? e.oldIndex : e.oldIndex + this.current_position
var item = this.queue_items[oldPosition]
var newPosition = item.position + (e.newIndex - e.oldIndex)
const oldPosition = !this.show_only_next_items ? e.oldIndex : e.oldIndex + this.current_position
const item = this.queue_items[oldPosition]
const newPosition = item.position + (e.newIndex - e.oldIndex)
if (newPosition !== oldPosition) {
webapi.queue_move(item.id, newPosition)
}

View File

@ -262,7 +262,7 @@ export default {
return
}
var searchParams = {
const searchParams = {
type: query.type,
media_kind: 'music'
}
@ -291,7 +291,7 @@ export default {
return
}
var searchParams = {
const searchParams = {
type: 'album',
media_kind: 'audiobook'
}
@ -317,7 +317,7 @@ export default {
return
}
var searchParams = {
const searchParams = {
type: 'album',
media_kind: 'podcast'
}

View File

@ -278,10 +278,10 @@ export default {
return webapi.spotify().then(({ data }) => {
this.search_param.market = data.webapi_country
var spotifyApi = new SpotifyWebApi()
const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(data.webapi_token)
var types = this.query.type.split(',').filter(type => this.validSearchTypes.includes(type))
const types = this.query.type.split(',').filter(type => this.validSearchTypes.includes(type))
return spotifyApi.search(this.query.query, types, this.search_param)
})
},

View File

@ -64,7 +64,7 @@ export default new Vuex.Store({
getters: {
now_playing: state => {
var item = state.queue.items.find(function (item) {
const item = state.queue.items.find(function (item) {
return item.id === state.player.item_id
})
return (item === undefined) ? {} : item
@ -167,7 +167,7 @@ export default new Vuex.Store({
},
[types.ADD_NOTIFICATION] (state, notification) {
if (notification.topic) {
var index = state.notifications.list.findIndex(elem => elem.topic === notification.topic)
const index = state.notifications.list.findIndex(elem => elem.topic === notification.topic)
if (index >= 0) {
state.notifications.list.splice(index, 1, notification)
return
@ -183,7 +183,7 @@ export default new Vuex.Store({
}
},
[types.ADD_RECENT_SEARCH] (state, query) {
var index = state.recent_searches.findIndex(elem => elem === query)
const index = state.recent_searches.findIndex(elem => elem === query)
if (index >= 0) {
state.recent_searches.splice(index, 1)
}

View File

@ -63,7 +63,7 @@ export default {
},
queue_add_next (uri) {
var position = 0
let position = 0
if (store.getters.now_playing && store.getters.now_playing.id) {
position = store.getters.now_playing.position + 1
}
@ -74,7 +74,7 @@ export default {
},
queue_expression_add (expression) {
var options = {}
const options = {}
options.expression = expression
return axios.post('./api/queue/items/add', undefined, { params: options }).then((response) => {
@ -84,7 +84,7 @@ export default {
},
queue_expression_add_next (expression) {
var options = {}
const options = {}
options.expression = expression
options.position = 0
if (store.getters.now_playing && store.getters.now_playing.id) {
@ -109,7 +109,7 @@ export default {
},
player_play_uri (uris, shuffle, position = undefined) {
var options = {}
const options = {}
options.uris = uris
options.shuffle = shuffle ? 'true' : 'false'
options.clear = 'true'
@ -120,7 +120,7 @@ export default {
},
player_play_expression (expression, shuffle, position = undefined) {
var options = {}
const options = {}
options.expression = expression
options.shuffle = shuffle ? 'true' : 'false'
options.clear = 'true'
@ -159,12 +159,12 @@ export default {
},
player_shuffle (newState) {
var shuffle = newState ? 'true' : 'false'
const shuffle = newState ? 'true' : 'false'
return axios.put('./api/player/shuffle?state=' + shuffle)
},
player_consume (newState) {
var consume = newState ? 'true' : 'false'
const consume = newState ? 'true' : 'false'
return axios.put('./api/player/consume?state=' + consume)
},
@ -235,7 +235,7 @@ export default {
},
library_genre (genre) {
var genreParams = {
const genreParams = {
type: 'albums',
media_kind: 'music',
expression: 'genre is "' + genre + '"'
@ -246,7 +246,7 @@ export default {
},
library_genre_tracks (genre) {
var genreParams = {
const genreParams = {
type: 'tracks',
media_kind: 'music',
expression: 'genre is "' + genre + '"'
@ -257,7 +257,7 @@ export default {
},
library_radio_streams () {
var params = {
const params = {
type: 'tracks',
media_kind: 'music',
expression: 'data_kind is url and song_length = 0'
@ -269,7 +269,7 @@ export default {
library_artist_tracks (artist) {
if (artist) {
var artistParams = {
const artistParams = {
type: 'tracks',
expression: 'songartistid is "' + artist + '"'
}
@ -280,7 +280,7 @@ export default {
},
library_podcasts_new_episodes () {
var episodesParams = {
const episodesParams = {
type: 'tracks',
expression: 'media_kind is podcast and play_count = 0 ORDER BY time_added DESC'
}
@ -290,7 +290,7 @@ export default {
},
library_podcast_episodes (albumId) {
var episodesParams = {
const episodesParams = {
type: 'tracks',
expression: 'media_kind is podcast and songalbumid is "' + albumId + '" ORDER BY date_released DESC'
}
@ -336,7 +336,7 @@ export default {
},
library_files (directory = undefined) {
var filesParams = { directory: directory }
const filesParams = { directory: directory }
return axios.get('./api/library/files', {
params: filesParams
})

View File

@ -10,7 +10,7 @@ module.exports = {
assetsDir: 'player',
// Relative public path
// Relative public path
publicPath: './',
// Do not add hashes to the generated js/css filenames, would otherwise