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

View File

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

View File

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

View File

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

View File

@ -135,7 +135,7 @@ export default {
methods: { methods: {
open_parent_directory: function () { 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)) { if (parent === '' || this.$store.state.config.directories.includes(this.current_directory)) {
this.$router.push({ path: '/files' }) this.$router.push({ path: '/files' })
} else { } else {

View File

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

View File

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

View File

@ -278,10 +278,10 @@ export default {
return webapi.spotify().then(({ data }) => { return webapi.spotify().then(({ data }) => {
this.search_param.market = data.webapi_country this.search_param.market = data.webapi_country
var spotifyApi = new SpotifyWebApi() const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(data.webapi_token) 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) return spotifyApi.search(this.query.query, types, this.search_param)
}) })
}, },

View File

@ -64,7 +64,7 @@ export default new Vuex.Store({
getters: { getters: {
now_playing: state => { 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.id === state.player.item_id
}) })
return (item === undefined) ? {} : item return (item === undefined) ? {} : item
@ -167,7 +167,7 @@ export default new Vuex.Store({
}, },
[types.ADD_NOTIFICATION] (state, notification) { [types.ADD_NOTIFICATION] (state, notification) {
if (notification.topic) { 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) { if (index >= 0) {
state.notifications.list.splice(index, 1, notification) state.notifications.list.splice(index, 1, notification)
return return
@ -183,7 +183,7 @@ export default new Vuex.Store({
} }
}, },
[types.ADD_RECENT_SEARCH] (state, query) { [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) { if (index >= 0) {
state.recent_searches.splice(index, 1) state.recent_searches.splice(index, 1)
} }

View File

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