mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 09:58:29 +02:00
Add option to disable version checking (#520)
Fixes "Only signed in user is allowed to call APIs." as the /api/v1/version returns a 403 when running a gitea where REQUIRE_SIGNIN_VIEW is enabled Co-authored-by: Wim <wim@42.be> Reviewed-on: https://gitea.com/gitea/tea/pulls/520 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Wim <42wim@noreply.gitea.io> Co-committed-by: Wim <42wim@noreply.gitea.io>
This commit is contained in:
@ -33,6 +33,7 @@ type Login struct {
|
||||
SSHAgent bool `yaml:"ssh_agent"`
|
||||
SSHKeyFingerprint string `yaml:"ssh_key_agent_pub"`
|
||||
SSHPassphrase string `yaml:"-"`
|
||||
VersionCheck bool `yaml:"version_check"`
|
||||
// User is username from gitea
|
||||
User string `yaml:"user"`
|
||||
// Created is auto created unix timestamp
|
||||
@ -182,6 +183,11 @@ func (l *Login) Client(options ...gitea.ClientOption) *gitea.Client {
|
||||
}
|
||||
}
|
||||
|
||||
// versioncheck must be prepended in options to make sure we don't hit any version checks in the sdk
|
||||
if !l.VersionCheck {
|
||||
options = append([]gitea.ClientOption{gitea.SetGiteaVersion("")}, options...)
|
||||
}
|
||||
|
||||
options = append(options, gitea.SetToken(l.Token), gitea.SetHTTPClient(httpClient))
|
||||
|
||||
if ok, err := utils.IsKeyEncrypted(l.SSHKey); ok && err == nil && l.SSHPassphrase == "" {
|
||||
|
Reference in New Issue
Block a user