Fix(Blocked Content): Manage System Not Working
This commit is contained in:
parent
022c27056b
commit
edc0b5d1bd
4 changed files with 74 additions and 10 deletions
58
index.html
58
index.html
|
|
@ -4501,6 +4501,64 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
id="blocked-content-list"
|
||||||
|
style="
|
||||||
|
display: none;
|
||||||
|
margin-top: 1rem;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding-top: 1rem;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
id="blocked-empty-message"
|
||||||
|
style="text-align: center; color: var(--muted-foreground); padding: 1rem"
|
||||||
|
>
|
||||||
|
No content blocked yet.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="blocked-artists-section" style="margin-bottom: 1.5rem; display: none">
|
||||||
|
<h4
|
||||||
|
style="
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--foreground);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
Blocked Artists
|
||||||
|
</h4>
|
||||||
|
<ul id="blocked-artists-list" class="blocked-items-list"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="blocked-albums-section" style="margin-bottom: 1.5rem; display: none">
|
||||||
|
<h4
|
||||||
|
style="
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--foreground);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
Blocked Albums
|
||||||
|
</h4>
|
||||||
|
<ul id="blocked-albums-list" class="blocked-items-list"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="blocked-tracks-section" style="margin-bottom: 1.5rem; display: none">
|
||||||
|
<h4
|
||||||
|
style="
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--foreground);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
Blocked Tracks
|
||||||
|
</h4>
|
||||||
|
<ul id="blocked-tracks-list" class="blocked-items-list"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
id="settings-commit-info"
|
id="settings-commit-info"
|
||||||
|
|
|
||||||
|
|
@ -1858,8 +1858,8 @@ export async function handleTrackAction(
|
||||||
} else if (action === 'block-album') {
|
} else if (action === 'block-album') {
|
||||||
const { contentBlockingSettings } = await import('./storage.js');
|
const { contentBlockingSettings } = await import('./storage.js');
|
||||||
const albumId = type === 'album' ? item.id : item.album?.id;
|
const albumId = type === 'album' ? item.id : item.album?.id;
|
||||||
const albumTitle = type === 'album' ? item.title : item.album?.title;
|
const albumTitle = type === 'album' ? (item.title || item.name) : (item.album?.title || item.album?.name);
|
||||||
const albumArtist = type === 'album' ? item.artist : item.album?.artist;
|
const albumArtist = type === 'album' ? (item.artist?.name || item.artist) : (item.album?.artist?.name || item.album?.artist);
|
||||||
|
|
||||||
if (!albumId) {
|
if (!albumId) {
|
||||||
showNotification('No album information available');
|
showNotification('No album information available');
|
||||||
|
|
|
||||||
|
|
@ -3718,6 +3718,8 @@ function initializeBlockedContentManager() {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const id = btn.dataset.id;
|
const id = btn.dataset.id;
|
||||||
const type = btn.dataset.type;
|
const type = btn.dataset.type;
|
||||||
|
const itemLi = btn.closest('li');
|
||||||
|
const itemName = itemLi ? itemLi.querySelector('.item-name').textContent : 'item';
|
||||||
|
|
||||||
if (type === 'artist') {
|
if (type === 'artist') {
|
||||||
contentBlockingSettings.unblockArtist(id);
|
contentBlockingSettings.unblockArtist(id);
|
||||||
|
|
@ -3727,6 +3729,10 @@ function initializeBlockedContentManager() {
|
||||||
contentBlockingSettings.unblockTrack(id);
|
contentBlockingSettings.unblockTrack(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof showNotification === 'function') {
|
||||||
|
showNotification(`Unblocked ${type}: ${itemName}`);
|
||||||
|
}
|
||||||
|
|
||||||
renderBlockedLists();
|
renderBlockedLists();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2543,7 +2543,7 @@ export const contentBlockingSettings = {
|
||||||
|
|
||||||
isArtistBlocked(artistId) {
|
isArtistBlocked(artistId) {
|
||||||
if (!artistId) return false;
|
if (!artistId) return false;
|
||||||
return this.getBlockedArtists().some((a) => a.id === artistId);
|
return this.getBlockedArtists().some((a) => a.id == artistId);
|
||||||
},
|
},
|
||||||
|
|
||||||
blockArtist(artist) {
|
blockArtist(artist) {
|
||||||
|
|
@ -2560,7 +2560,7 @@ export const contentBlockingSettings = {
|
||||||
},
|
},
|
||||||
|
|
||||||
unblockArtist(artistId) {
|
unblockArtist(artistId) {
|
||||||
const blocked = this.getBlockedArtists().filter((a) => a.id !== artistId);
|
const blocked = this.getBlockedArtists().filter((a) => a.id != artistId);
|
||||||
this.setBlockedArtists(blocked);
|
this.setBlockedArtists(blocked);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2580,13 +2580,13 @@ export const contentBlockingSettings = {
|
||||||
|
|
||||||
isTrackBlocked(trackId) {
|
isTrackBlocked(trackId) {
|
||||||
if (!trackId) return false;
|
if (!trackId) return false;
|
||||||
return this.getBlockedTracks().some((t) => t.id === trackId);
|
return this.getBlockedTracks().some((t) => t.id == trackId);
|
||||||
},
|
},
|
||||||
|
|
||||||
blockTrack(track) {
|
blockTrack(track) {
|
||||||
if (!track || !track.id) return;
|
if (!track || !track.id) return;
|
||||||
const blocked = this.getBlockedTracks();
|
const blocked = this.getBlockedTracks();
|
||||||
if (!blocked.some((t) => t.id === track.id)) {
|
if (!blocked.some((t) => t.id == track.id)) {
|
||||||
blocked.push({
|
blocked.push({
|
||||||
id: track.id,
|
id: track.id,
|
||||||
title: track.title || 'Unknown Track',
|
title: track.title || 'Unknown Track',
|
||||||
|
|
@ -2598,7 +2598,7 @@ export const contentBlockingSettings = {
|
||||||
},
|
},
|
||||||
|
|
||||||
unblockTrack(trackId) {
|
unblockTrack(trackId) {
|
||||||
const blocked = this.getBlockedTracks().filter((t) => t.id !== trackId);
|
const blocked = this.getBlockedTracks().filter((t) => t.id != trackId);
|
||||||
this.setBlockedTracks(blocked);
|
this.setBlockedTracks(blocked);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2618,13 +2618,13 @@ export const contentBlockingSettings = {
|
||||||
|
|
||||||
isAlbumBlocked(albumId) {
|
isAlbumBlocked(albumId) {
|
||||||
if (!albumId) return false;
|
if (!albumId) return false;
|
||||||
return this.getBlockedAlbums().some((a) => a.id === albumId);
|
return this.getBlockedAlbums().some((a) => a.id == albumId);
|
||||||
},
|
},
|
||||||
|
|
||||||
blockAlbum(album) {
|
blockAlbum(album) {
|
||||||
if (!album || !album.id) return;
|
if (!album || !album.id) return;
|
||||||
const blocked = this.getBlockedAlbums();
|
const blocked = this.getBlockedAlbums();
|
||||||
if (!blocked.some((a) => a.id === album.id)) {
|
if (!blocked.some((a) => a.id == album.id)) {
|
||||||
blocked.push({
|
blocked.push({
|
||||||
id: album.id,
|
id: album.id,
|
||||||
title: album.title || 'Unknown Album',
|
title: album.title || 'Unknown Album',
|
||||||
|
|
@ -2636,7 +2636,7 @@ export const contentBlockingSettings = {
|
||||||
},
|
},
|
||||||
|
|
||||||
unblockAlbum(albumId) {
|
unblockAlbum(albumId) {
|
||||||
const blocked = this.getBlockedAlbums().filter((a) => a.id !== albumId);
|
const blocked = this.getBlockedAlbums().filter((a) => a.id != albumId);
|
||||||
this.setBlockedAlbums(blocked);
|
this.setBlockedAlbums(blocked);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue