mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 21:03:30 +01:00
Fix #543
This commit is contained in:
parent
23d53561d1
commit
54d25c13d7
3 changed files with 23 additions and 0 deletions
|
@ -29,6 +29,8 @@ KEY_FILE = custom/https/key.pem
|
||||||
STATIC_ROOT_PATH =
|
STATIC_ROOT_PATH =
|
||||||
; Application level GZIP support
|
; Application level GZIP support
|
||||||
ENABLE_GZIP = false
|
ENABLE_GZIP = false
|
||||||
|
; Landing page for non-logged users, can be "home" or "explore"
|
||||||
|
LANDING_PAGE = home
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
; Either "mysql", "postgres" or "sqlite3", it's your choice
|
; Either "mysql", "postgres" or "sqlite3", it's your choice
|
||||||
|
|
|
@ -29,6 +29,12 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checking non-logged users landing page.
|
||||||
|
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageUrl != setting.LANDING_PAGE_HOME {
|
||||||
|
ctx.Redirect(string(setting.LandingPageUrl))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect to dashboard if user tries to visit any non-login page.
|
// Redirect to dashboard if user tries to visit any non-login page.
|
||||||
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
|
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubUrl + "/")
|
||||||
|
|
|
@ -31,6 +31,13 @@ const (
|
||||||
FCGI Scheme = "fcgi"
|
FCGI Scheme = "fcgi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type LandingPage string
|
||||||
|
|
||||||
|
const (
|
||||||
|
LANDING_PAGE_HOME LandingPage = "/"
|
||||||
|
LANDING_PAGE_EXPLORE LandingPage = "/explore"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// App settings.
|
// App settings.
|
||||||
AppVer string
|
AppVer string
|
||||||
|
@ -48,6 +55,7 @@ var (
|
||||||
CertFile, KeyFile string
|
CertFile, KeyFile string
|
||||||
StaticRootPath string
|
StaticRootPath string
|
||||||
EnableGzip bool
|
EnableGzip bool
|
||||||
|
LandingPageUrl LandingPage
|
||||||
|
|
||||||
// Security settings.
|
// Security settings.
|
||||||
InstallLock bool
|
InstallLock bool
|
||||||
|
@ -197,6 +205,13 @@ func NewConfigContext() {
|
||||||
LogRootPath = Cfg.MustValue("log", "ROOT_PATH", path.Join(workDir, "log"))
|
LogRootPath = Cfg.MustValue("log", "ROOT_PATH", path.Join(workDir, "log"))
|
||||||
EnableGzip = Cfg.MustBool("server", "ENABLE_GZIP")
|
EnableGzip = Cfg.MustBool("server", "ENABLE_GZIP")
|
||||||
|
|
||||||
|
switch Cfg.MustValue("server", "LANDING_PAGE", "home") {
|
||||||
|
case "explore":
|
||||||
|
LandingPageUrl = LANDING_PAGE_EXPLORE
|
||||||
|
default:
|
||||||
|
LandingPageUrl = LANDING_PAGE_HOME
|
||||||
|
}
|
||||||
|
|
||||||
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK")
|
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK")
|
||||||
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
|
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
|
||||||
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
|
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
|
||||||
|
|
Loading…
Reference in a new issue