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
+15
View File
@@ -19,6 +19,12 @@ type OAuthProvider struct {
ClientID string `toml:"client_id"`
ClientSecret string `toml:"client_secret"`
RedirectURL string `toml:"redirect_url"`
// Only for custom OAuth provider
AuthURL string `toml:"auth_url"`
TokenURL string `toml:"token_url"`
Scopes []string `toml:"scopes"`
Script string `toml:"info_script"`
}
type Config struct {
@@ -50,6 +56,15 @@ func LoadConfig() (Config, oauth2.Config, error) {
case "google":
oa2.Endpoint = endpoints.Google
oa2.Scopes = []string{"https://www.googleapis.com/auth/userinfo.email"}
default:
oa2.Endpoint = oauth2.Endpoint{
AuthURL: config.OAuthProvider.AuthURL,
TokenURL: config.OAuthProvider.TokenURL,
}
oa2.Scopes = config.OAuthProvider.Scopes
if config.OAuthProvider.Script == "" {
panic("no script provided")
}
}
return config, oa2, err