[skip ci] more job system work

This commit is contained in:
Brahim Hadriche committed 2025-06-18 22:34:44 -04:00
1 parent 2fa06604a7
commit 9d7b792f42
14 files changed
+126 -95

No files matched your search

@@ -0,0 +1,25 @@
import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/source/utils/ErrorUtils.bs"
@job("ProfileRefreshTokenJob")
function ExecuteJob() as void
input = JobGetInput()
profileNode = input.profile
accessTokenObject = input.accessTokenObject
profilesService = input.profilesService
try
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
if InnertubeService.AuthRefreshAccessToken(accessTokenObject, cancellation)
profileNode.expiresIn = accessTokenObject.expiresIn
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
profileNode.accessToken = accessTokenObject.accessToken
profilesService@.SaveUserProfilesToRegistry()
else
JobError("Failed to refresh access token")
profileNode.accessToken = invalid
end if
catch error
JobError("Failed to refresh access token: " + ErrorUtils.Format(error))
profileNode.accessToken = invalid
end try
end function