diff options
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) } |