refactor: "install" page (#39400)

1. remove useless options
2. set AppDataPath instead of repo root path
3. make "disable self-registration" default enabled
4. avoid writing corrupted ini file
5. avoid auto-sign-in the existing admin user
This commit is contained in:
wxiaoguang
2026-09-23 23:14:31 +00:00
committed by GitHub
parent 71065941a9
commit f14cedc4fa
35 changed files with 261 additions and 439 deletions
+1 -15
View File
@@ -3,13 +3,6 @@
package setting
import (
"net/url"
"path"
"gitea.dev/modules/log"
)
// API settings
var API = struct {
EnableSwagger bool
@@ -31,12 +24,5 @@ var API = struct {
func loadAPIFrom(rootCfg ConfigProvider) {
mustMapSetting(rootCfg, "api", &API)
defaultAppURL := string(Protocol) + "://" + Domain + ":" + HTTPPort
u, err := url.Parse(rootCfg.Section("server").Key("ROOT_URL").MustString(defaultAppURL))
if err != nil {
log.Fatal("Invalid ROOT_URL '%s': %s", AppURL, err)
}
u.Path = path.Join(u.Path, "api", "swagger")
API.SwaggerURL = u.String()
API.SwaggerURL = AppURL + "api/swagger"
}