ShareLinks: hide add-to-playlist/collection via robust JS match
The CSS data-id selector wasn't reliably hiding the action-sheet item in guest sessions, so add a JS pass (part of the lockdown refresh) that matches menu items by data-id, localized visible text, and icon, and hides them with an inline style. The action sheet is added on menu open, which the existing mutation observer already picks up.
Cette révision appartient à :
@@ -2,7 +2,7 @@
|
||||
var pluginId = '68540b76-ee74-436d-85ff-2abc884bbea6';
|
||||
var copyLabel = 'Copy Stream URL';
|
||||
var actionLabel = 'ShareLink';
|
||||
var clientVersion = '1.0.0-ui-modal-10';
|
||||
var clientVersion = '1.0.0-ui-modal-11';
|
||||
var allowedItemStorageKey = 'sharelinks.allowedItemId';
|
||||
var guestClassName = 'sharelinks-guest';
|
||||
var hiddenAttr = 'data-sharelinks-hidden';
|
||||
@@ -165,6 +165,34 @@
|
||||
return guestStatePromise;
|
||||
}
|
||||
|
||||
function hideBlockedGuestMenuItems() {
|
||||
var nodes = document.querySelectorAll('.actionSheetMenuItem');
|
||||
Array.prototype.forEach.call(nodes, function (node) {
|
||||
if (!node || node.getAttribute('data-sharelinks-blocked') === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
var dataId = String(node.getAttribute('data-id') || '').toLowerCase();
|
||||
var label = getVisibleLabel(node).toLowerCase();
|
||||
var icon = node.querySelector('.material-icons');
|
||||
var iconClass = icon ? String(icon.className || '') : '';
|
||||
|
||||
var blocked = dataId === 'playlist'
|
||||
|| dataId === 'addtoplaylist'
|
||||
|| dataId === 'addtocollection'
|
||||
|| label.indexOf('liste de lecture') >= 0
|
||||
|| label.indexOf('playlist') >= 0
|
||||
|| label.indexOf('add to collection') >= 0
|
||||
|| label.indexOf('ajouter à la collection') >= 0
|
||||
|| (iconClass.indexOf('playlist_add') >= 0 && dataId !== 'queue' && dataId !== 'queuenext');
|
||||
|
||||
if (blocked) {
|
||||
node.setAttribute('data-sharelinks-blocked', '1');
|
||||
node.style.setProperty('display', 'none', 'important');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function applyGuestLockdown() {
|
||||
var context = await getGuestContext();
|
||||
if (!context.locked) {
|
||||
@@ -174,6 +202,7 @@
|
||||
ensureGuestStyle();
|
||||
ensurePluginHideStyle(context.hiddenSelectors);
|
||||
hideGuestControls();
|
||||
hideBlockedGuestMenuItems();
|
||||
|
||||
// UX-only lockdown: the guest user's real access boundary is still the
|
||||
// server-side policy and item tags. This just keeps the web client out
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
"changelog": "Initial release: ShareLink button on the item menu, temporary guest users confined by tag policy, expiring one-use links, admin dashboard with revoke, and a configurable guest lockdown that hides tag/genre/studio/cast links, the add-to-playlist and add-to-collection actions, and other plugins' UI.",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://github.com/Franciskid/jellyfin-plugin-sharelinks/releases/download/v1.0.0.0/sharelinks_1.0.0.0.zip",
|
||||
"checksum": "992bec11d21d0c4c1823ec32a7d325df",
|
||||
"checksum": "b9d94ddab91e7078046711b77d6ef18b",
|
||||
"timestamp": "2026-07-07T00:00:00Z"
|
||||
}
|
||||
]
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur