From aee8834d719f872665db0149167a34466dd96e1d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 18 Jan 2023 13:44:29 +0800 Subject: [PATCH 1/3] Disable run user change in installation page --- options/locale/locale_en-US.ini | 2 +- routers/install/install.go | 9 ++++++--- templates/install.tmpl | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index f10d6620ff0d6..376e6252dc256 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -224,7 +224,7 @@ repo_path_helper = Remote Git repositories will be saved to this directory. lfs_path = Git LFS Root Path lfs_path_helper = Files tracked by Git LFS will be stored in this directory. Leave empty to disable. run_user = Run As Username -run_user_helper = Enter the operating system username that Gitea runs as. Note that this user must have access to the repository root path. +run_user_helper = The operating system username that Gitea runs as. Note that this user must have access to the repository root path. domain = Server Domain domain_helper = Domain or host address for the server. ssh_port = SSH Server Port diff --git a/routers/install/install.go b/routers/install/install.go index f121f313769d1..59723d9bb4aa7 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -120,10 +120,13 @@ func Install(ctx *context.Context) { // Note(unknown): it's hard for Windows users change a running user, // so just use current one if config says default. - if setting.IsWindows && setting.RunUser == "git" { - form.RunUser = user.CurrentUsername() - } else { + if setting.RunUser != "" { form.RunUser = setting.RunUser + } else { + form.RunUser = user.CurrentUsername() + if form.RunUser == "" { + form.RunUser = "git" + } } form.Domain = setting.Domain diff --git a/templates/install.tmpl b/templates/install.tmpl index c9f147a64df36..8ffd8f6da5283 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -119,7 +119,7 @@
- + {{.locale.Tr "install.run_user_helper"}}
From 7a47420d983ed0d20a39a454d374400e50200410 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 5 Jul 2023 16:22:02 +0800 Subject: [PATCH 2/3] Revert change on install --- routers/install/install.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/routers/install/install.go b/routers/install/install.go index 59723d9bb4aa7..f121f313769d1 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -120,13 +120,10 @@ func Install(ctx *context.Context) { // Note(unknown): it's hard for Windows users change a running user, // so just use current one if config says default. - if setting.RunUser != "" { - form.RunUser = setting.RunUser - } else { + if setting.IsWindows && setting.RunUser == "git" { form.RunUser = user.CurrentUsername() - if form.RunUser == "" { - form.RunUser = "git" - } + } else { + form.RunUser = setting.RunUser } form.Domain = setting.Domain From f3c759145d1930a79a31ca9674a01d2c51dcb3fb Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 5 Jul 2023 17:33:30 +0800 Subject: [PATCH 3/3] Change disabled to readonly --- templates/install.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/install.tmpl b/templates/install.tmpl index 8ffd8f6da5283..ccbd67347000b 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -119,7 +119,7 @@
- + {{.locale.Tr "install.run_user_helper"}}