From d22b940dde9225cb4889467d5409db0504d3124f Mon Sep 17 00:00:00 2001 From: Alexander Adam Date: Sat, 2 May 2026 14:23:11 +0100 Subject: [PATCH] fix: stop sending mine=true into playlistItems problem was: open "my playlists", click any list, get items from a totally different one. happens because mine=true was kept in the per-item passthrough. when LMS then asked playlistItems.list for one specific playlist, mine=true was still attached and YT returned whatever first matched the auth context, not the requested playlistId. mine is only valid on playlists.list. keep it there, drop it from the per-item bag, and also delete it again in playlistHandler so we cant trip on it later. --- plugin/Plugin.pm | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/plugin/Plugin.pm b/plugin/Plugin.pm index 43ed038..abf18b2 100644 --- a/plugin/Plugin.pm +++ b/plugin/Plugin.pm @@ -366,20 +366,24 @@ sub myPlaylistHandler { delete $params->{count}; - # need to passthrough the personal account items - my $account = { - _cache_ttl => 60, + # mine=true is for playlists.list only. dont put it in the per-item + # passthrough or playlistItems.list will get it later and load the + # wrong playlist. + my $token = $cache->get('yt:access_token'); + my $itemPassthrough = { _noKey => 1, - mine => 'true', - access_token => $cache->get('yt:access_token'), + access_token => $token, }; Plugins::YouTube::API->searchDirect('playlists', sub { - $cb->( _renderList($_[0], 'title', $account) ); + $cb->( _renderList($_[0], 'title', $itemPassthrough) ); }, { - %$account, - _index => $args->{index}, - _quantity => $args->{quantity}, + _cache_ttl => 60, + _noKey => 1, + mine => 'true', + access_token => $token, + _index => $args->{index}, + _quantity => $args->{quantity}, }); } @@ -390,6 +394,10 @@ sub playlistHandler { $params->{_quantity} = $args->{quantity}; $params->{_cache_ttl} = $prefs->get('cache_ttl'); + # extra paranoia. mine belongs to playlists.list, never to playlistItems.list. + # if it slips in here YT returns the wrong playlist. + delete $params->{mine}; + Plugins::YouTube::API->searchDirect('playlistItems', sub { $cb->( _renderList($_[0], $prefs->get('playlist_sort')) ); }, $params);