package oauth import ( "github.com/markbates/goth" "github.com/markbates/goth/providers/gitea" "github.com/thomiceli/opengist/internal/config" ) type GiteaProvider struct { Provider URL string } func (p *GiteaProvider) RegisterProvider() error { goth.UseProviders( gitea.NewCustomisedURL( config.C.GiteaClientKey, config.C.GiteaSecret, urlJoin(p.URL, "/oauth/gitea/callback"), urlJoin(config.C.GiteaUrl, "/login/oauth/authorize"), urlJoin(config.C.GiteaUrl, "/login/oauth/access_token"), urlJoin(config.C.GiteaUrl, "/api/v1/user"), ), ) return nil } func NewGiteaProvider(url string) *GiteaProvider { return &GiteaProvider{ URL: url, } }