mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-10 07:58:39 -05:00
Fix JS syntax error: escape quotes in onclick handlers for playlist names
This commit is contained in:
@@ -1002,8 +1002,8 @@
|
||||
<td class="track-count">${p.trackCount || 0}</td>
|
||||
<td class="cache-age">${p.cacheAge || '-'}</td>
|
||||
<td>
|
||||
<button onclick="viewTracks('${escapeHtml(p.name)}')">View</button>
|
||||
<button class="danger" onclick="removePlaylist('${escapeHtml(p.name)}')">Remove</button>
|
||||
<button onclick="viewTracks('${escapeJs(p.name)}')">View</button>
|
||||
<button class="danger" onclick="removePlaylist('${escapeJs(p.name)}')">Remove</button>
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
@@ -1104,8 +1104,8 @@
|
||||
: '<span class="status-badge"><span class="status-dot"></span>Not Linked</span>';
|
||||
|
||||
const actionButton = p.isConfigured
|
||||
? `<button class="danger" onclick="unlinkPlaylist('${escapeHtml(p.name)}')">Unlink</button>`
|
||||
: `<button class="primary" onclick="openLinkPlaylist('${escapeHtml(p.id)}', '${escapeHtml(p.name)}')">Link to Spotify</button>`;
|
||||
? `<button class="danger" onclick="unlinkPlaylist('${escapeJs(p.name)}')">Unlink</button>`
|
||||
: `<button class="primary" onclick="openLinkPlaylist('${escapeJs(p.id)}', '${escapeJs(p.name)}')">Link to Spotify</button>`;
|
||||
|
||||
const localCount = p.localTracks || 0;
|
||||
const externalCount = p.externalTracks || 0;
|
||||
@@ -1448,6 +1448,11 @@
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
function escapeJs(text) {
|
||||
if (!text) return '';
|
||||
return text.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/"/g, '\\"');
|
||||
}
|
||||
|
||||
// Initial load
|
||||
fetchStatus();
|
||||
fetchPlaylists();
|
||||
|
||||
Reference in New Issue
Block a user