Skip to content

Commit

Permalink
fix special character song_art_path in lrc view
Browse files Browse the repository at this point in the history
  • Loading branch information
yuygfgg committed Jul 18, 2024
1 parent 265ba28 commit cf28a58
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion webui/album.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ <h2>全部歌曲 (共 <span id="song-count">0</span> 首)</h2>
const songArtBlob = await fetchFile(song.song_art_path);
let songArtUrl = "default_cover.png";
if (songArtBlob) {
songArtUrl = `${apiBaseUrl}/getfile?file_path=${song.song_art_path}`
songArtUrl = `${apiBaseUrl}/getfile?file_path=${encodeURIComponent(song.song_art_path)}`
}

window.parent.postMessage(
Expand Down
2 changes: 1 addition & 1 deletion webui/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ <h2>艺术家</h2>
const songArtBlob = await fetchFile(song.song_art_path);
let songArtUrl = "default_cover.png";
if (songArtBlob) {
songArtUrl = `${apiBaseUrl}/getfile?file_path=${song.song_art_path}`
songArtUrl = `${apiBaseUrl}/getfile?file_path=${encodeURIComponent(song.song_art_path)}`
}

window.parent.postMessage(
Expand Down
2 changes: 1 addition & 1 deletion webui/artist.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ <h2>歌曲</h2>
const songArtBlob = await fetchFile(song.song_art_path);
let songArtUrl = "default_cover.png";
if (songArtBlob) {
songArtUrl = `${apiBaseUrl}/getfile?file_path=${song.song_art_path}`
songArtUrl = `${apiBaseUrl}/getfile?file_path=${encodeURIComponent(song.song_art_path)}`
}

window.parent.postMessage(
Expand Down
8 changes: 8 additions & 0 deletions webui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
.song-popup .right-section .lyrics {
color: #ffffff;
white-space: pre-wrap;
overflow-y: auto;
}

.close-popup {
Expand Down Expand Up @@ -307,6 +308,8 @@
font-weight: bold;
color: #ff0;
}


</style>
</head>

Expand Down Expand Up @@ -565,6 +568,11 @@ <h3>歌词</h3>

lyricsContainer.innerHTML = lyricsHtml;
lyricsContainer.scrollTop = lyricsContainer.scrollHeight / lrc.lines.length * line - lyricsContainer.clientHeight / 2;

const currentLineElement = document.getElementById(`line-${line}`);
if (currentLineElement) {
currentLineElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}


Expand Down
2 changes: 1 addition & 1 deletion webui/liked.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ <h2>喜欢的专辑</h2>
const songArtBlob = await fetchFile(song.song_art_path);
let songArtUrl = "default_cover.png";
if (songArtBlob) {
songArtUrl = `${apiBaseUrl}/getfile?file_path=${song.song_art_path}`
songArtUrl = `${apiBaseUrl}/getfile?file_path=${encodeURIComponent(song.song_art_path)}`
}

window.parent.postMessage(
Expand Down
2 changes: 1 addition & 1 deletion webui/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ <h2>艺术家</h2>
const songArtBlob = await fetchFile(song.song_art_path);
let songArtUrl = "default_cover.png";
if (songArtBlob) {
songArtUrl = `${apiBaseUrl}/getfile?file_path=${song.song_art_path}`
songArtUrl = `${apiBaseUrl}/getfile?file_path=${encodeURIComponent(song.song_art_path)}`
}

window.parent.postMessage(
Expand Down

0 comments on commit cf28a58

Please sign in to comment.