Attempt to fix session data fetch errors
This commit is contained in:
1 parent
e7cce7e71b
commit
a974670f8d
4 files changed
+25
-13
No files matched your search
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Display issues for 720p devices
|
||||
- Attempt to fix session data fetch errors
|
||||
|
||||
## [0.48.2] - 2026-07-11
|
||||
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
import "pkg:/components/JobSystem/Jobs.bs"
|
||||
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||
import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.observeField("requestSessionData", FuncName(OnRequestSessionData))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
QueueSessionDataJob()
|
||||
end function
|
||||
|
||||
function OnRequestSessionData() as void
|
||||
sessionData = m.top.sessionData
|
||||
if IsAssociativeArray(sessionData) and not StringUtils.IsNullOrEmpty(sessionData.visitorData) and not StringUtils.IsNullOrEmpty(sessionData.livingRoomPoTokenId)
|
||||
return
|
||||
end if
|
||||
function EnsureSessionDataJob(_unused as dynamic) as object
|
||||
QueueSessionDataJob()
|
||||
return m.innertubeSessionDataJob
|
||||
end function
|
||||
|
||||
function QueueSessionDataJob() as void
|
||||
@@ -33,6 +28,9 @@ function QueueSessionDataJob() as void
|
||||
end function
|
||||
|
||||
function OnInnertubeSessionDataJobDone(event as object) as void
|
||||
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||
m.innertubeSessionDataJob = invalid
|
||||
node = event.getRoSGNode()
|
||||
JobSystem.UnobserveCallback(node)
|
||||
if m.innertubeSessionDataJob <> invalid and m.innertubeSessionDataJob.isSameNode(node)
|
||||
m.innertubeSessionDataJob = invalid
|
||||
end if
|
||||
end function
|
||||
@@ -1,7 +1,7 @@
|
||||
<component name="Innertube" extends="Node" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="sessionData" type="assocarray" alwaysNotify="true" />
|
||||
<field id="requestSessionData" type="boolean" alwaysNotify="true" />
|
||||
<field id="jobQueue" type="node" />
|
||||
<function name="EnsureSessionDataJob" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -177,17 +177,30 @@ function GetSessionData(innertubeNode as object, cancellation as object) as obje
|
||||
return sessionData
|
||||
end if
|
||||
|
||||
callback = innertubeNode.callFunc("EnsureSessionDataJob", invalid)
|
||||
|
||||
port = CreateObject("roMessagePort")
|
||||
MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "sessionData", port)
|
||||
MessagePortUtils.ObserveFieldScopedExSafe(callback, "done", port)
|
||||
CancellationUtils.ObserveCancellationScoped(cancellation, port)
|
||||
|
||||
innertubeNode.requestSessionData = true
|
||||
message = wait(30000, port)
|
||||
cancelled = false
|
||||
while not SessionDataComplete(innertubeNode.sessionData) and callback.done <> true
|
||||
message = wait(30000, port)
|
||||
if message = invalid
|
||||
exit while
|
||||
end if
|
||||
if CancellationUtils.IsCancellationEvent(cancellation, message)
|
||||
cancelled = true
|
||||
exit while
|
||||
end if
|
||||
end while
|
||||
|
||||
innertubeNode.unobserveFieldScoped("sessionData")
|
||||
callback.unobserveFieldScoped("done")
|
||||
CancellationUtils.UnobserveCancellationScoped(cancellation)
|
||||
|
||||
if message <> invalid and CancellationUtils.IsCancellationEvent(cancellation, message)
|
||||
if cancelled
|
||||
return {
|
||||
cancel: true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user