0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-15 22:41:44 +01:00

Allow custom redirect for landing page (#19324)

* Allow custom redirect for landing page

* Update modules/setting/setting.go

Co-authored-by: delvh <dev.lh@web.de>

* fix lint

* one option

Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
techknowlogick 2022-04-05 12:16:01 -04:00 committed by GitHub
parent 5ae875a1ae
commit 48dc88acd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View file

@ -237,7 +237,7 @@ RUN_MODE = ; prod
;; PPROF_DATA_PATH, use an absolute path when you start gitea as service ;; PPROF_DATA_PATH, use an absolute path when you start gitea as service
;PPROF_DATA_PATH = data/tmp/pprof ;PPROF_DATA_PATH = data/tmp/pprof
;; ;;
;; Landing page, can be "home", "explore", "organizations" or "login" ;; Landing page, can be "home", "explore", "organizations", "login", or any URL such as "/org/repo" or even "https://anotherwebsite.com"
;; The "login" choice is not a security measure but just a UI flow change, use REQUIRE_SIGNIN_VIEW to force users to log in. ;; The "login" choice is not a security measure but just a UI flow change, use REQUIRE_SIGNIN_VIEW to force users to log in.
;LANDING_PAGE = home ;LANDING_PAGE = home
;; ;;

View file

@ -300,8 +300,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `ENABLE_GZIP`: **false**: Enable gzip compression for runtime-generated content, static resources excluded. - `ENABLE_GZIP`: **false**: Enable gzip compression for runtime-generated content, static resources excluded.
- `ENABLE_PPROF`: **false**: Application profiling (memory and cpu). For "web" command it listens on localhost:6060. For "serv" command it dumps to disk at `PPROF_DATA_PATH` as `(cpuprofile|memprofile)_<username>_<temporary id>` - `ENABLE_PPROF`: **false**: Application profiling (memory and cpu). For "web" command it listens on localhost:6060. For "serv" command it dumps to disk at `PPROF_DATA_PATH` as `(cpuprofile|memprofile)_<username>_<temporary id>`
- `PPROF_DATA_PATH`: **data/tmp/pprof**: `PPROF_DATA_PATH`, use an absolute path when you start Gitea as service - `PPROF_DATA_PATH`: **data/tmp/pprof**: `PPROF_DATA_PATH`, use an absolute path when you start Gitea as service
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login\]. - `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login, **custom**\]. Where custom would instead be any URL such as "/org/repo" or even "https://anotherwebsite.com"
- `LFS_START_SERVER`: **false**: Enables Git LFS support. - `LFS_START_SERVER`: **false**: Enables Git LFS support.
- `LFS_CONTENT_PATH`: **%(APP_DATA_PATH)/lfs**: Default LFS content path. (if it is on local storage.) **DEPRECATED** use settings in `[lfs]`. - `LFS_CONTENT_PATH`: **%(APP_DATA_PATH)/lfs**: Default LFS content path. (if it is on local storage.) **DEPRECATED** use settings in `[lfs]`.
- `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string. - `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string.

View file

@ -106,6 +106,7 @@ var (
StaticCacheTime time.Duration StaticCacheTime time.Duration
EnableGzip bool EnableGzip bool
LandingPageURL LandingPage LandingPageURL LandingPage
LandingPageCustom string
UnixSocketPermission uint32 UnixSocketPermission uint32
EnablePprof bool EnablePprof bool
PprofDataPath string PprofDataPath string
@ -776,15 +777,19 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
PprofDataPath = filepath.Join(AppWorkPath, PprofDataPath) PprofDataPath = filepath.Join(AppWorkPath, PprofDataPath)
} }
switch sec.Key("LANDING_PAGE").MustString("home") { landingPage := sec.Key("LANDING_PAGE").MustString("home")
switch landingPage {
case "explore": case "explore":
LandingPageURL = LandingPageExplore LandingPageURL = LandingPageExplore
case "organizations": case "organizations":
LandingPageURL = LandingPageOrganizations LandingPageURL = LandingPageOrganizations
case "login": case "login":
LandingPageURL = LandingPageLogin LandingPageURL = LandingPageLogin
default: case "":
case "home":
LandingPageURL = LandingPageHome LandingPageURL = LandingPageHome
default:
LandingPageURL = LandingPage(landingPage)
} }
if len(SSH.Domain) == 0 { if len(SSH.Domain) == 0 {