From 7d329a0db18979c55cfadf7cb1f7a88e0660cb2f Mon Sep 17 00:00:00 2001 From: saopig1 Date: Mon, 30 Mar 2026 14:57:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20safe=20router.back()=20=E2=80=94=20fallb?= =?UTF-8?q?ack=20to=20home=20if=20no=20history=20(prevents=20navigating=20?= =?UTF-8?q?to=20external=20site)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- web/src/components/Player.vue | 7 ++++++- web/src/views/Lyrics.vue | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web/src/components/Player.vue b/web/src/components/Player.vue index 8126932..f021704 100644 --- a/web/src/components/Player.vue +++ b/web/src/components/Player.vue @@ -89,7 +89,12 @@ const currentSong = computed(() => store.currentSong); function toggleLyrics() { if (route.path === '/lyrics') { - router.back(); + // Go back if there's history, otherwise go home + if (window.history.length > 1) { + router.back(); + } else { + router.push('/'); + } } else { router.push('/lyrics'); } diff --git a/web/src/views/Lyrics.vue b/web/src/views/Lyrics.vue index a0c2677..a977c34 100644 --- a/web/src/views/Lyrics.vue +++ b/web/src/views/Lyrics.vue @@ -1,7 +1,7 @@