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:
Wim
2022-10-31 09:56:23 +08:00
committed by Lunny Xiao
parent 2a8c1daa67
commit 6a848cb72a
4 changed files with 31 additions and 6 deletions

View File

@ -30,6 +30,11 @@ var CmdLoginAdd = cli.Command{
EnvVars: []string{"GITEA_SERVER_URL"},
Usage: "Server URL",
},
&cli.BoolFlag{
Name: "no-version-check",
Aliases: []string{"nv"},
Usage: "Do not check version of Gitea instance",
},
&cli.StringFlag{
Name: "token",
Aliases: []string{"t"},
@ -96,5 +101,6 @@ func runLoginAdd(ctx *cli.Context) error {
ctx.String("ssh-agent-principal"),
ctx.String("ssh-agent-key"),
ctx.Bool("insecure"),
sshAgent)
sshAgent,
!ctx.Bool("no-version-check"))
}