Files
playlet-piped/playlet-lib/src/components/Services/ProfilesService/ProfilesVerifyTokensJob.bs
T
2026-07-03 21:34:35 -04:00

27 lines
932 B
Plaintext

import "pkg:/components/ContentNode/ProfileContentAuthTokenUtils.types.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/StringUtils.bs"
@job("ProfilesVerifyTokensJob")
function ExecuteJob() as void
input = JobGetInput()
invidiousNode = input.invidious
profileContentNodes = input.profileNodes
service = new Invidious.InvidiousService(invidiousNode)
for each profileNode in profileContentNodes
if profileNode.type <> "invidious"
continue for
end if
if profileNode.authState = ProfileContentAuthTokenUtils.ProfileAuthState.NeedsReauth
continue for
end if
if not service.VerifyTokenScope(profileNode.accessToken)
' The stored token can't make authenticated calls anymore (e.g. scopes changed in an update).
profileNode@.MarkNeedsReauth()
end if
end for
end function