mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -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="track-count">${p.trackCount || 0}</td>
|
||||||
<td class="cache-age">${p.cacheAge || '-'}</td>
|
<td class="cache-age">${p.cacheAge || '-'}</td>
|
||||||
<td>
|
<td>
|
||||||
<button onclick="viewTracks('${escapeHtml(p.name)}')">View</button>
|
<button onclick="viewTracks('${escapeJs(p.name)}')">View</button>
|
||||||
<button class="danger" onclick="removePlaylist('${escapeHtml(p.name)}')">Remove</button>
|
<button class="danger" onclick="removePlaylist('${escapeJs(p.name)}')">Remove</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`).join('');
|
`).join('');
|
||||||
@@ -1104,8 +1104,8 @@
|
|||||||
: '<span class="status-badge"><span class="status-dot"></span>Not Linked</span>';
|
: '<span class="status-badge"><span class="status-dot"></span>Not Linked</span>';
|
||||||
|
|
||||||
const actionButton = p.isConfigured
|
const actionButton = p.isConfigured
|
||||||
? `<button class="danger" onclick="unlinkPlaylist('${escapeHtml(p.name)}')">Unlink</button>`
|
? `<button class="danger" onclick="unlinkPlaylist('${escapeJs(p.name)}')">Unlink</button>`
|
||||||
: `<button class="primary" onclick="openLinkPlaylist('${escapeHtml(p.id)}', '${escapeHtml(p.name)}')">Link to Spotify</button>`;
|
: `<button class="primary" onclick="openLinkPlaylist('${escapeJs(p.id)}', '${escapeJs(p.name)}')">Link to Spotify</button>`;
|
||||||
|
|
||||||
const localCount = p.localTracks || 0;
|
const localCount = p.localTracks || 0;
|
||||||
const externalCount = p.externalTracks || 0;
|
const externalCount = p.externalTracks || 0;
|
||||||
@@ -1448,6 +1448,11 @@
|
|||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeJs(text) {
|
||||||
|
if (!text) return '';
|
||||||
|
return text.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/"/g, '\\"');
|
||||||
|
}
|
||||||
|
|
||||||
// Initial load
|
// Initial load
|
||||||
fetchStatus();
|
fetchStatus();
|
||||||
fetchPlaylists();
|
fetchPlaylists();
|
||||||
|
|||||||
Reference in New Issue
Block a user