WIP: fix public playlists
This commit is contained in:
parent
91e2e7b3cb
commit
bd7f77a103
1 changed files with 29 additions and 11 deletions
|
|
@ -98,6 +98,24 @@ const syncManager = {
|
|||
});
|
||||
return JSON.parse(recovered);
|
||||
} catch {
|
||||
try {
|
||||
// Python-style fallback (Single quotes, True/False, None)
|
||||
// This handles data that was incorrectly serialized as Python repr string
|
||||
if (str.includes("'") || str.includes('True') || str.includes('False')) {
|
||||
const jsFriendly = str
|
||||
.replace(/\bTrue\b/g, 'true')
|
||||
.replace(/\bFalse\b/g, 'false')
|
||||
.replace(/\bNone\b/g, 'null');
|
||||
|
||||
// Basic safety check: ensure it looks like a structure and doesn't contain obvious code vectors
|
||||
if ((jsFriendly.trim().startsWith('[') || jsFriendly.trim().startsWith('{')) &&
|
||||
!jsFriendly.match(/function|=>|window|document|alert|eval/)) {
|
||||
return (new Function('return ' + jsFriendly))();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore fallback error
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
|
@ -361,7 +379,7 @@ const syncManager = {
|
|||
image: playlist.cover,
|
||||
cover: playlist.cover,
|
||||
playlist_cover: playlist.cover,
|
||||
tracks: playlist.tracks,
|
||||
tracks: JSON.stringify(playlist.tracks || []),
|
||||
isPublic: true,
|
||||
data: {
|
||||
title: playlist.name,
|
||||
|
|
|
|||
Loading…
Reference in a new issue