Compare commits

..

No commits in common. "6f7e161c0fada52a9b2e61cb6c32fc9dbc68f5a3" and "aaf58f03e17421c2facd6516d21a2b64946d143e" have entirely different histories.

3 changed files with 3 additions and 21 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "MSR Mod", "name": "MSR Mod",
"version": "0.0.4", "version": "0.0.3",
"description": "塞壬唱片Monster Siren Records官网的替代前端。", "description": "塞壬唱片Monster Siren Records官网的替代前端。",
"content_scripts": [ "content_scripts": [
{ {

View File

@ -28,7 +28,7 @@ onMounted(async () => {
// //
const updatedSong = await apis.getSong(props.item.song.cid) const updatedSong = await apis.getSong(props.item.song.cid)
console.log('Updated song:', updatedSong) console.log('Updated song:', updatedSong)
favourites.updateSongInFavourites(props.item.song.cid, updatedSong) props.item.song.sourceUrl = updatedSong.sourceUrl
} }
}) })
</script> </script>

View File

@ -282,23 +282,6 @@ export const useFavourites = defineStore('favourites', () => {
} }
}, { deep: true }) }, { deep: true })
// 更新收藏列表中的歌曲信息
const updateSongInFavourites = async (songCid: string, updatedSong: Song) => {
const index = favourites.value.findIndex(item => item.song.cid === songCid)
if (index !== -1) {
// 更新歌曲信息,保持其他属性不变
favourites.value[index].song = { ...favourites.value[index].song, ...updatedSong }
if (isLoaded.value) {
try {
await saveFavourites()
} catch (error) {
// 保存失败时可以考虑回滚或错误处理
console.error('Failed to save updated song:', error)
}
}
}
}
// 立即初始化 // 立即初始化
initializeFavourites() initializeFavourites()
@ -316,8 +299,7 @@ export const useFavourites = defineStore('favourites', () => {
toggleFavourite, toggleFavourite,
clearFavourites, clearFavourites,
getStoredValue, getStoredValue,
setStoredValue, setStoredValue
updateSongInFavourites
} }
}) })