diff --git a/CHANGELOG.md b/CHANGELOG.md index abc869c5..e243a1cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- Issue with deep linking not working due to session data race condition + ## [0.40.4] - 2025-06-17 ### Fixed diff --git a/playlet-lib/src/components/Services/Innertube/Innertube.bs b/playlet-lib/src/components/Services/Innertube/Innertube.bs index 38249f77..b2ffa405 100644 --- a/playlet-lib/src/components/Services/Innertube/Innertube.bs +++ b/playlet-lib/src/components/Services/Innertube/Innertube.bs @@ -1,9 +1,27 @@ import "pkg:/components/Services/Innertube/Constants.bs" import "pkg:/source/AsyncTask/AsyncTask.bs" import "pkg:/source/AsyncTask/Tasks.bs" +import "pkg:/source/utils/StringUtils.bs" function Init() - AsyncTask.Start(Tasks.InnertubeInitTask, { + OnRequestVisitorData() +end function + +function OnRequestVisitorData() as void + if m.innertubeInitTask <> invalid + return + end if + + visitorData = m.top.visitorData + if not StringUtils.IsNullOrEmpty(visitorData) + return + end if + + m.innertubeInitTask = AsyncTask.Start(Tasks.InnertubeInitTask, { innertube: m.top - }) + }, OnInnertubeInitTaskResult) +end function + +function OnInnertubeInitTaskResult(output as object) as void + m.innertubeInitTask = invalid end function diff --git a/playlet-lib/src/components/Services/Innertube/Innertube.xml b/playlet-lib/src/components/Services/Innertube/Innertube.xml index 2325c0ae..719c09f5 100644 --- a/playlet-lib/src/components/Services/Innertube/Innertube.xml +++ b/playlet-lib/src/components/Services/Innertube/Innertube.xml @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs b/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs index 759d5256..088c1d24 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs @@ -24,10 +24,26 @@ function VideoContentTask(input as object) as object metadata = contentNode.metadata if not IsAssociativeArray(metadata) if backend = "playlet" + visitorData = innertubeNode.visitorData + if StringUtils.IsNullOrEmpty(visitorData) + messagePort = CreateObject("roMessagePort") + MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "visitorData", messagePort) + innertubeNode.requestVisitorData = true + message = wait(10000, messagePort) + innertubeNode.unobserveFieldScoped("visitorData") + if message = invalid + return { + success: false + error: "Failed to get visitor data. Please try again later." + } + end if + visitorData = message.getData() + end if + metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, { "cancellation": m.top.cancellation "credentialTransferToken": loungeServiceNode.credentialTransferToken - "visitorData": innertubeNode.visitorData + "visitorData": visitorData }) else metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation }) diff --git a/tools/restart-app.js b/tools/restart-app.js index d1ce5953..2a047761 100644 --- a/tools/restart-app.js +++ b/tools/restart-app.js @@ -11,15 +11,20 @@ const config = getEnvVars(['ROKU_DEV_TARGET']); }); parser.add_argument('--app-id', { help: 'App Id' }); + parser.add_argument('--query', { help: 'Query parameters to append to the URL' }); const args = parser.parse_args(); let appId = args.app_id || "dev"; + const query = args.query || ""; if (appId === "prod") { appId = "693751"; } - const url = `http://${config.ROKU_DEV_TARGET}:8060/launch/${appId}?restart=true`; + let url = `http://${config.ROKU_DEV_TARGET}:8060/launch/${appId}?restart=true`; + if (query) { + url += `&${query}`; + } console.log("Restarting app", appId); await fetch(url, { method: 'POST',