[web] Remove unused parameters

This commit is contained in:
Alain Nussbaumer 2025-04-26 08:20:17 +02:00
parent 40c658cb8b
commit 6091ae31aa
7 changed files with 32 additions and 46 deletions

View File

@ -81,7 +81,6 @@ export default {
}, },
created() { created() {
this.connect() this.connect()
// Hook the progress bar to start before we move router-view
this.$router.beforeEach((to, from, next) => { this.$router.beforeEach((to, from, next) => {
this.updateClipping() this.updateClipping()
if (!(to.path === from.path && to.hash)) { if (!(to.path === from.path && to.hash)) {
@ -92,8 +91,7 @@ export default {
} }
next() next()
}) })
// Hook the progress bar to finish after we've finished moving router-view this.$router.afterEach(() => {
this.$router.afterEach((to, from) => {
this.$Progress.finish() this.$Progress.finish()
}) })
}, },
@ -118,7 +116,6 @@ export default {
}, },
openWebsocket() { openWebsocket() {
const socket = this.createWebsocket() const socket = this.createWebsocket()
const vm = this
socket.onopen = () => { socket.onopen = () => {
socket.send( socket.send(
JSON.stringify({ JSON.stringify({
@ -136,46 +133,36 @@ export default {
] ]
}) })
) )
vm.updateOutputs() this.updateOutputs()
vm.updatePlayerStatus() this.updatePlayerStatus()
vm.updateLibraryStats() this.updateLibraryStats()
vm.updateSettings() this.updateSettings()
vm.updateQueue() this.updateQueue()
vm.updateSpotify() this.updateSpotify()
vm.updateLastfm() this.updateLastfm()
vm.updatePairing() this.updatePairing()
} }
/*
* When the app becomes active, force an update of all information,
* because we may have missed notifications while the app was inactive.
* There are two relevant events - focus and visibilitychange, so we
* throttle the updates to avoid multiple redundant updates.
*/
let updateThrottled = false let updateThrottled = false
const updateInfo = () => { const updateInfo = () => {
if (updateThrottled) { if (updateThrottled) {
return return
} }
vm.updateOutputs() this.updateOutputs()
vm.updatePlayerStatus() this.updatePlayerStatus()
vm.updateLibraryStats() this.updateLibraryStats()
vm.updateSettings() this.updateSettings()
vm.updateQueue() this.updateQueue()
vm.updateSpotify() this.updateSpotify()
vm.updateLastfm() this.updateLastfm()
vm.updatePairing() this.updatePairing()
updateThrottled = true updateThrottled = true
setTimeout(() => { setTimeout(() => {
updateThrottled = false updateThrottled = false
}, 500) }, 500)
} }
/*
* These events are fired when the window becomes active in different
* ways. When this happens, we should update 'now playing' info, etc.
*/
window.addEventListener('focus', updateInfo) window.addEventListener('focus', updateInfo)
document.addEventListener('visibilitychange', () => { document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') { if (document.visibilityState === 'visible') {
@ -189,29 +176,29 @@ export default {
data.notify.includes('update') || data.notify.includes('update') ||
data.notify.includes('database') data.notify.includes('database')
) { ) {
vm.updateLibraryStats() this.updateLibraryStats()
} }
if ( if (
data.notify.includes('player') || data.notify.includes('player') ||
data.notify.includes('options') || data.notify.includes('options') ||
data.notify.includes('volume') data.notify.includes('volume')
) { ) {
vm.updatePlayerStatus() this.updatePlayerStatus()
} }
if (data.notify.includes('outputs') || data.notify.includes('volume')) { if (data.notify.includes('outputs') || data.notify.includes('volume')) {
vm.updateOutputs() this.updateOutputs()
} }
if (data.notify.includes('queue')) { if (data.notify.includes('queue')) {
vm.updateQueue() this.updateQueue()
} }
if (data.notify.includes('spotify')) { if (data.notify.includes('spotify')) {
vm.updateSpotify() this.updateSpotify()
} }
if (data.notify.includes('lastfm')) { if (data.notify.includes('lastfm')) {
vm.updateLastfm() this.updateLastfm()
} }
if (data.notify.includes('pairing')) { if (data.notify.includes('pairing')) {
vm.updatePairing() this.updatePairing()
} }
} }
}, },
@ -302,7 +289,6 @@ export default {
} }
}) })
} }
}, }
template: '<App/>'
} }
</script> </script>

View File

@ -47,7 +47,7 @@ export default {
} }
}, },
methods: { methods: {
changeVolume(value) { changeVolume() {
webapi.player_volume(this.player.volume) webapi.player_volume(this.player.volume)
}, },
toggle() { toggle() {

View File

@ -26,7 +26,7 @@ export const filters = {
minutes: Math.floor(seconds / 60) minutes: Math.floor(seconds / 60)
}).shiftTo(...unit) }).shiftTo(...unit)
const filtered = Object.fromEntries( const filtered = Object.fromEntries(
Object.entries(shifted.toObject()).filter(([_, value]) => value > 0) Object.entries(shifted.toObject()).filter(([, value]) => value > 0)
) )
return Duration.fromObject(filtered, { locale: locale.value }).toHuman() return Duration.fromObject(filtered, { locale: locale.value }).toHuman()
}, },

View File

@ -150,7 +150,7 @@ export default {
get() { get() {
return this.queueStore.items return this.queueStore.items
}, },
set(value) { set() {
/* Do nothing? Send move request in @end event */ /* Do nothing? Send move request in @end event */
} }
} }

View File

@ -242,7 +242,7 @@ export const router = createRouter({
const delay = 0 const delay = 0
if (savedPosition) { if (savedPosition) {
// Use the saved scroll position (browser back/forward navigation) // Use the saved scroll position (browser back/forward navigation)
return new Promise((resolve, reject) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
resolve(savedPosition) resolve(savedPosition)
}, delay) }, delay)
@ -257,7 +257,7 @@ export const router = createRouter({
} }
if (to.hash) { if (to.hash) {
// We are navigating to an anchor of a new page, add a timeout to let the transition effect finish before scrolling // We are navigating to an anchor of a new page, add a timeout to let the transition effect finish before scrolling
return new Promise((resolve, reject) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
resolve({ el: to.hash, top: TOP_WITH_TABS }) resolve({ el: to.hash, top: TOP_WITH_TABS })
}, delay) }, delay)

View File

@ -14,7 +14,7 @@ export const useQueueStore = defineStore('QueueStore', {
isPauseAllowed(state) { isPauseAllowed(state) {
return state.current && state.current.data_kind !== 'pipe' return state.current && state.current.data_kind !== 'pipe'
}, },
isSavingAllowed(state) { isSavingAllowed() {
const configuration = useConfigurationStore() const configuration = useConfigurationStore()
return ( return (
configuration.allow_modifying_stored_playlists && configuration.allow_modifying_stored_playlists &&

View File

@ -28,7 +28,7 @@ export const useSettingsStore = defineStore('SettingsStore', {
} }
}, },
getters: { getters: {
locales(state) { locales() {
return availableLocales.map((item) => ({ return availableLocales.map((item) => ({
id: item, id: item,
name: t(`language.${item}`) name: t(`language.${item}`)