diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-22 09:05:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 09:05:26 +0800 |
commit | 648d9e253c1924b832248f26fee42b2fb64dc3bc (patch) | |
tree | 51649fad974cd7284a47d30e412c90e7ab72cd2c /internal/context/api.go | |
parent | 5b14cc6f0b7b661beb2640a94bd15660cdb48587 (diff) |
conf: overhaul server settings (#5928)
* conf: rename package
* Requires Go 1.12
* Fix lint
* Fix lint
* Overhaul
* db: fix tests
* Save my work
* Fix tests
* Server.UnixSocketPermission
* Server.LocalRootURL
* SSH settings
* Server.OfflineMode
* Save my work
* App.Version
* Remove [server] STATIC_ROOT_PATH
* Server.LandingURL
Diffstat (limited to 'internal/context/api.go')
-rw-r--r-- | internal/context/api.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/context/api.go b/internal/context/api.go index 153997d3..881e9aa8 100644 --- a/internal/context/api.go +++ b/internal/context/api.go @@ -13,7 +13,7 @@ import ( "gopkg.in/macaron.v1" log "unknwon.dev/clog/v2" - "gogs.io/gogs/internal/setting" + "gogs.io/gogs/internal/conf" ) type APIContext struct { @@ -79,16 +79,16 @@ func (c *APIContext) SetLinkHeader(total, pageSize int) { page := paginater.New(total, pageSize, c.QueryInt("page"), 0) links := make([]string, 0, 4) if page.HasNext() { - links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", setting.AppURL, c.Req.URL.Path[1:], page.Next())) + links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", conf.Server.ExternalURL, c.Req.URL.Path[1:], page.Next())) } if !page.IsLast() { - links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", setting.AppURL, c.Req.URL.Path[1:], page.TotalPages())) + links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", conf.Server.ExternalURL, c.Req.URL.Path[1:], page.TotalPages())) } if !page.IsFirst() { - links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", setting.AppURL, c.Req.URL.Path[1:])) + links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", conf.Server.ExternalURL, c.Req.URL.Path[1:])) } if page.HasPrevious() { - links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", setting.AppURL, c.Req.URL.Path[1:], page.Previous())) + links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", conf.Server.ExternalURL, c.Req.URL.Path[1:], page.Previous())) } if len(links) > 0 { @@ -100,7 +100,7 @@ func APIContexter() macaron.Handler { return func(ctx *Context) { c := &APIContext{ Context: ctx, - BaseURL: setting.AppURL + "api/v1", + BaseURL: conf.Server.ExternalURL + "api/v1", } ctx.Map(c) } |