Merge pull request #252 from AkkiaS7/master

fix: Gitee login error
This commit is contained in:
naiba 2022-10-14 08:48:27 +08:00 committed by GitHub
commit 7d8fe82aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"net/url"
"strings"
"code.gitea.io/sdk/gitea"
@ -149,7 +150,11 @@ func (oa *oauth2controller) callback(c *gin.Context) {
var client *GitHubAPI.Client
oc := oauth2Config.Client(ctx, otk)
if singleton.Conf.Oauth2.Type == model.ConfigTypeGitee {
client, err = GitHubAPI.NewEnterpriseClient("https://gitee.com/api/v5/", "https://gitee.com/api/v5/", oc)
baseURL, _ := url.Parse("https://gitee.com/api/v5/")
uploadURL, _ := url.Parse("https://gitee.com/api/v5/uploads/")
client = GitHubAPI.NewClient(oc)
client.BaseURL = baseURL
client.UploadURL = uploadURL
} else {
client = GitHubAPI.NewClient(oc)
}