mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Add suburl support
This commit is contained in:
parent
6a7bd097fe
commit
7ba9257a7f
90 changed files with 287 additions and 283 deletions
|
@ -25,13 +25,13 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
|||
return func(ctx *Context) {
|
||||
// Cannot view any page before installation.
|
||||
if !setting.InstallLock {
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/install")
|
||||
ctx.Redirect(setting.AppSubUrl + "/install")
|
||||
return
|
||||
}
|
||||
|
||||
// Redirect to dashboard if user tries to visit any non-login page.
|
||||
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
|||
if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
|
||||
return
|
||||
}
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
return
|
||||
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
|
||||
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
||||
|
|
|
@ -187,7 +187,7 @@ func Contexter() macaron.Handler {
|
|||
Session: sess,
|
||||
}
|
||||
// Compute current URL for real-time change language.
|
||||
link := setting.AppRootSubUrl + ctx.Req.RequestURI
|
||||
link := setting.AppSubUrl + ctx.Req.RequestURI
|
||||
i := strings.Index(link, "?")
|
||||
if i > -1 {
|
||||
link = link[:i]
|
||||
|
|
|
@ -38,7 +38,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
ctx.Handle(404, "GetUserByName", err)
|
||||
} else if redirect {
|
||||
log.Error(4, "GetUserByName", err)
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
} else {
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
}
|
||||
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
||||
|
||||
ctx.Org.OrgLink = setting.AppRootSubUrl + "/org/" + org.Name
|
||||
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name
|
||||
ctx.Data["OrgLink"] = ctx.Org.OrgLink
|
||||
|
||||
// Team.
|
||||
|
@ -80,7 +80,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
ctx.Handle(404, "GetTeam", err)
|
||||
} else if redirect {
|
||||
log.Error(4, "GetTeam", err)
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
} else {
|
||||
ctx.Handle(500, "GetTeam", err)
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
ctx.Handle(404, "GetUserByName", err)
|
||||
} else if redirect {
|
||||
log.Error(4, "GetUserByName", err)
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
} else {
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
|
||||
if u == nil {
|
||||
if redirect {
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
return
|
||||
}
|
||||
ctx.Handle(404, "RepoAssignment", errors.New("invliad user account for single repository"))
|
||||
|
@ -92,7 +92,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
ctx.Handle(404, "GetRepositoryByName", err)
|
||||
return
|
||||
} else if redirect {
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
return
|
||||
}
|
||||
ctx.Handle(500, "GetRepositoryByName", err)
|
||||
|
@ -160,7 +160,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||
return
|
||||
}
|
||||
ctx.Repo.GitRepo = gitRepo
|
||||
ctx.Repo.RepoLink = setting.AppRootSubUrl + "/" + u.Name + "/" + repo.Name
|
||||
ctx.Repo.RepoLink = setting.AppSubUrl + "/" + u.Name + "/" + repo.Name
|
||||
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
|
||||
|
||||
tags, err := ctx.Repo.GitRepo.GetTags()
|
||||
|
@ -298,8 +298,8 @@ func RequireTrueOwner() macaron.Handler {
|
|||
return func(ctx *Context) {
|
||||
if !ctx.Repo.IsTrueOwner && !ctx.Repo.IsAdmin {
|
||||
if !ctx.IsSigned {
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
|
||||
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
return
|
||||
}
|
||||
ctx.Handle(404, ctx.Req.RequestURI, nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue