add user scripting with lua

This commit is contained in:
Lukas Werner
2025-07-03 17:07:35 -07:00
parent 5d2b82876d
commit 3920b8913d
8 changed files with 151 additions and 5 deletions
+3 -3
View File
@@ -177,7 +177,7 @@ func (s *OAuthStore) CallbackHandler() http.Handler {
http.Error(w, "Failed to exchange token", http.StatusInternalServerError)
return
}
userID, err := getUserInfo(s.config.OAuthProvider.Kind, tok.AccessToken)
userID, err := getUserInfo(s.config.OAuthProvider.Kind, tok.AccessToken, s.config)
if err != nil {
http.Error(w, "Failed to get info", http.StatusInternalServerError)
return
@@ -210,7 +210,7 @@ func (s *OAuthStore) CallbackHandler() http.Handler {
})
}
func getUserInfo(providerKind, token string) (string, error) {
func getUserInfo(providerKind, token string, c *Config) (string, error) {
switch providerKind {
case "google":
type UserInfo struct {
@@ -249,6 +249,6 @@ func getUserInfo(providerKind, token string) (string, error) {
}
return userInfo.Login, nil
default:
panic("unimplemented")
return RunScript(c.OAuthProvider.Script, token)
}
}