Refactor project
This commit is contained in:
1 parent
9c1a2b987b
commit
2f2516eade
115 files changed
+12522
No files matched your search
@@ -0,0 +1,27 @@
|
||||
namespace Http
|
||||
|
||||
class InvidiousRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("*", function(router as object, request as Http.HttpRequest, response as Http.HttpResponse) as boolean
|
||||
uri = request.uri
|
||||
if uri.StartsWith("/token_callback")
|
||||
components = WebUtils.UrlQueryComponents(uri)
|
||||
if components["token"] <> invalid
|
||||
' Token is encoded twice for some reason
|
||||
token = WebUtils.UrlUnescape(components["token"]).DecodeUriComponent()
|
||||
print(`Got Token: ${token}`)
|
||||
RegistryUtils.Write("token", token)
|
||||
end if
|
||||
response.Redirect(Invidious.GetCurrentHost())
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function)
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
Reference in new issue
Block a user