Update Plex library item URLs to use app.plex.tv format

Change library item links to use the official Plex Web App URL format
instead of direct server URLs. This ensures items open correctly in
the Plex web interface.

Changes:
- usePlexApi.fetchPlexServers() now returns machineIdentifier (clientIdentifier)
- PlexSettings stores and passes machineId through the library loading flow
- usePlexLibraries.loadLibraries() accepts machineIdentifier parameter
- processLibrarySection() passes machineIdentifier to processLibraryItem()
- plexHelpers.processLibraryItem() updated signature and URL generation

New URL format:
https://app.plex.tv/desktop/#!/server/{machineId}/details?key=%2Flibrary%2Fmetadata%2F{ratingKey}

Example:
fe85f47ef9/details

Benefits:
- Links work universally (not dependent on local server URL)
- Opens in official Plex Web App with full functionality
- Consistent with Plex's own linking conventions
- Works from any network location
This commit is contained in:
2026-02-27 18:31:38 +01:00
parent f98fdb6860
commit 65ad916df8
4 changed files with 26 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ export function usePlexLibraries() {
sections: any[],
authToken: string,
serverUrl: string,
machineIdentifier: string,
username: string,
fetchLibraryDetailsFn: any
) {
@@ -40,6 +41,7 @@ export function usePlexLibraries() {
await processLibrarySection(
authToken,
serverUrl,
machineIdentifier,
key,
"movies",
stats,
@@ -50,6 +52,7 @@ export function usePlexLibraries() {
await processLibrarySection(
authToken,
serverUrl,
machineIdentifier,
key,
"shows",
stats,
@@ -60,6 +63,7 @@ export function usePlexLibraries() {
await processLibrarySection(
authToken,
serverUrl,
machineIdentifier,
key,
"music",
stats,
@@ -102,6 +106,7 @@ export function usePlexLibraries() {
async function processLibrarySection(
authToken: string,
serverUrl: string,
machineIdentifier: string,
sectionKey: string,
libraryType: string,
stats: any,
@@ -129,7 +134,13 @@ export function usePlexLibraries() {
// Process recently added items
const recentItems = data.recentMetadata.map((item: any) =>
processLibraryItem(item, libraryType, authToken, serverUrl)
processLibraryItem(
item,
libraryType,
authToken,
serverUrl,
machineIdentifier
)
);
// Calculate stats