Files
playlet-piped/playlet-lib/src/components/Services/Profiles/ProfilesVerifyTokensTask.bs
T
Brahim Hadricheandgithub-action linter 394dd23999 Multiple profiles (#312)
* Navbar user profile

* profiles stuff

* fix profile

* Lint fix

* Some ui experiments

* More ui work

* progress

* Lint fix

* migration, web api, wip

* profile view and web app

* web app and apis

* Invidious and profiles

* Lint fix

* bug fix

* Remove ActionContentNode

* Profile icon button, profile color

* Lint fix

* reset server url

* href that doesn't work

* remove activate button on active profile

* TODO

* Fin.

* Final touches

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-04 09:04:34 -05:00

39 lines
1.2 KiB
Plaintext

import "pkg:/components/Services/Invidious/InvidiousService.bs"
@asynctask
function ProfilesVerifyTokensTask(input as object) as object
profilesNode = input.profiles
invidiousNode = input.invidious
profileContentNodes = input.profileNodes
service = new Invidious.InvidiousService(invidiousNode)
invalidProfiles = []
for each profileNode in profileContentNodes
if not service.VerifyTokenScope(profileNode.accessToken)
invalidProfiles.push(profileNode)
end if
end for
if invalidProfiles.Count() = 0
return invalid
end if
profilesNode@.LogoutWithProfiles(invalidProfiles)
profileNames = []
for each profileNode in invalidProfiles
profileNames.push(profileNode.username)
end for
profileNames = profileNames.join(", ")
message = `It looks like you are logged in to Invidious, but do not have the required permissions.
For that reason, we have logged you out from the following profiles: ${profileNames}
Please log in again.
This can happen when Playlet is updated with new features.
We apologize for the inconvenience.`
DialogUtils.ShowDialog(message, "User logged out")
return invalid
end function