From e7cce7e71bbe58797ecba87cd72d2177c3066cba Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Fri, 17 Jul 2026 19:22:14 -0400 Subject: [PATCH] Remove code branch where web app sends metadata --- .../components/VideoPlayer/VideoContentJob.bs | 97 +++++++++---------- .../Middleware/VideoQueueRouter.bs | 3 - 2 files changed, 47 insertions(+), 53 deletions(-) diff --git a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs index 64605be4..409055fa 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs @@ -33,58 +33,55 @@ function ExecuteJob() as void service = new Invidious.InvidiousService(invidiousNode) backend = preferencesNode["backend.selected"] - metadata = contentNode.metadata - if not IsAssociativeArray(metadata) - cancellation = JobGetCancellation() - if backend = "playlet" + cancellation = JobGetCancellation() + if backend = "playlet" - sessionData = GetSessionData(innertubeNode, cancellation) - if sessionData.cancel = true - JobCancel() - return - end if - if sessionData.error <> invalid - JobError(sessionData.error) - return - end if - - accessToken = invalid - onBehalfOfUser = invalid - profileNode = invalid - profile = profilesService.currentProfile - if profile <> invalid and profile.type = "youtube" - auth = ProfileContentAuthTokenUtils.EnsureFreshAccessToken(profile) - if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.NeedsReauth - JobError(Locale.Dialogs.ProfileNeedsReauthMessage) - return - end if - if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.Ok - accessToken = auth.token - onBehalfOfUser = auth.activeIdentifyToken - profileNode = profile - end if - end if - - metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, { - "cancellation": cancellation - "credentialTransferToken": loungeServiceNode.credentialTransferToken - "visitorData": sessionData.visitorData - "livingRoomPoTokenId": sessionData.livingRoomPoTokenId - "accessToken": accessToken - "onBehalfOfUser": onBehalfOfUser - "profileNode": profileNode - "profilesService": profilesService - }) - if IsAssociativeArray(metadata) - contentNode.addFields({ - potAttached: ValidBool(metadata.potAttached) - potSource: ValidString(metadata.potSource) - loggedIn: not StringUtils.IsNullOrEmpty(accessToken) - }) - end if - else - metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation }) + sessionData = GetSessionData(innertubeNode, cancellation) + if sessionData.cancel = true + JobCancel() + return end if + if sessionData.error <> invalid + JobError(sessionData.error) + return + end if + + accessToken = invalid + onBehalfOfUser = invalid + profileNode = invalid + profile = profilesService.currentProfile + if profile <> invalid and profile.type = "youtube" + auth = ProfileContentAuthTokenUtils.EnsureFreshAccessToken(profile) + if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.NeedsReauth + JobError(Locale.Dialogs.ProfileNeedsReauthMessage) + return + end if + if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.Ok + accessToken = auth.token + onBehalfOfUser = auth.activeIdentifyToken + profileNode = profile + end if + end if + + metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, { + "cancellation": cancellation + "credentialTransferToken": loungeServiceNode.credentialTransferToken + "visitorData": sessionData.visitorData + "livingRoomPoTokenId": sessionData.livingRoomPoTokenId + "accessToken": accessToken + "onBehalfOfUser": onBehalfOfUser + "profileNode": profileNode + "profilesService": profilesService + }) + if IsAssociativeArray(metadata) + contentNode.addFields({ + potAttached: ValidBool(metadata.potAttached) + potSource: ValidString(metadata.potSource) + loggedIn: not StringUtils.IsNullOrEmpty(accessToken) + }) + end if + else + metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation }) end if if JobIsCancelled() diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs index 27168b34..c6fa7c97 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs @@ -91,9 +91,6 @@ namespace Http instance = m.invidiousService.GetInstance() contentNode = InvidiousContent.ToRowCellContentNode(payload, instance) - if IsAssociativeArray(payload.metadata) - contentNode.addFields({ metadata: payload.metadata }) - end if nodeType = contentNode.type