Add logout support (#9)

* Add logout support

* Use token as json payload

* Comment
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2022-11-22 18:33:55 -05:00
1 parent 8aa1d1ae51
commit 22dfe785f1
4 files changed
+52 -7

No files matched your search

@@ -5,6 +5,18 @@ namespace Http
function new()
super()
m.Get("/api/command/logout", function(context as object) as boolean
response = context.response
server = context.server
if Invidious.Logout()
server.task.top.login = false
end if
response.Default(204, "OK")
return true
end function)
m.Get("*", function(context as object) as boolean
request = context.request
response = context.response
@@ -24,7 +36,7 @@ namespace Http
' 302 to prevent redirection to current host permanently
response.Redirect(`${Invidious.GetCurrentHost()}/watch?v=${components["v"]}`, 302)
else
response.Default(200, "OK")
response.Default(204, "OK")
end if
return true
end if