Browse Source

pkg/setting: rename {AppUrl, AppSubUrl} -> {AppURL, AppSubURL}

pull/3974/merge
Unknwon 8 years ago
parent
commit
90b9f7e08c
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 14
      cmd/web.go
  2. 6
      models/action.go
  3. 2
      models/pull.go
  4. 6
      models/repo.go
  5. 16
      models/user.go
  6. 10
      models/webhook_discord.go
  7. 10
      models/webhook_slack.go
  8. 8
      pkg/context/api.go
  9. 14
      pkg/context/auth.go
  10. 2
      pkg/context/context.go
  11. 2
      pkg/context/org.go
  12. 4
      pkg/context/repo.go
  13. 6
      pkg/markup/markdown.go
  14. 4
      pkg/markup/markdown_test.go
  15. 6
      pkg/markup/markup.go
  16. 2
      pkg/markup/markup_test.go
  17. 30
      pkg/setting/setting.go
  18. 10
      pkg/template/template.go
  19. 2
      pkg/tool/tool.go
  20. 6
      routers/admin/admin.go
  21. 8
      routers/admin/auths.go
  22. 2
      routers/admin/notice.go
  23. 2
      routers/admin/repos.go
  24. 10
      routers/admin/users.go
  25. 2
      routers/api/v1/repo/key.go
  26. 2
      routers/api/v1/user/key.go
  27. 2
      routers/dev/template.go
  28. 2
      routers/home.go
  29. 2
      routers/install.go
  30. 2
      routers/org/members.go
  31. 2
      routers/org/org.go
  32. 4
      routers/org/setting.go
  33. 12
      routers/repo/commit.go
  34. 2
      routers/repo/editor.go
  35. 6
      routers/repo/issue.go
  36. 12
      routers/repo/pull.go
  37. 4
      routers/repo/repo.go
  38. 12
      routers/repo/setting.go
  39. 50
      routers/user/auth.go
  40. 2
      routers/user/home.go
  41. 52
      routers/user/setting.go
  42. 6
      templates/admin/auth/list.tmpl
  43. 4
      templates/admin/config.tmpl
  44. 14
      templates/admin/dashboard.tmpl
  45. 16
      templates/admin/nav.tmpl
  46. 16
      templates/admin/navbar.tmpl
  47. 2
      templates/admin/notice.tmpl
  48. 2
      templates/admin/org/list.tmpl
  49. 4
      templates/admin/repo/list.tmpl
  50. 4
      templates/admin/user/list.tmpl
  51. 20
      templates/base/footer.tmpl
  52. 72
      templates/base/head.tmpl
  53. 6
      templates/explore/navbar.tmpl
  54. 2
      templates/explore/repo_list.tmpl
  55. 2
      templates/home.tmpl
  56. 2
      templates/install.tmpl
  57. 4
      templates/mail/auth/activate.tmpl
  58. 4
      templates/mail/auth/activate_email.tmpl
  59. 4
      templates/mail/auth/register_notify.tmpl
  60. 4
      templates/mail/auth/reset_passwd.tmpl
  61. 2
      templates/org/create.tmpl
  62. 2
      templates/org/home.tmpl
  63. 4
      templates/org/settings/webhook_new.tmpl
  64. 2
      templates/org/team/repositories.tmpl
  65. 4
      templates/repo/commits_table.tmpl
  66. 2
      templates/repo/create.tmpl
  67. 4
      templates/repo/editor/edit.tmpl
  68. 4
      templates/repo/forks.tmpl
  69. 4
      templates/repo/header.tmpl
  70. 6
      templates/repo/issue/comment_tab.tmpl
  71. 10
      templates/repo/issue/view_content.tmpl
  72. 2
      templates/repo/migrate.tmpl
  73. 4
      templates/repo/pulls/fork.tmpl
  74. 4
      templates/repo/release/list.tmpl
  75. 4
      templates/repo/release/new.tmpl
  76. 2
      templates/repo/settings/collaboration.tmpl
  77. 2
      templates/repo/settings/deploy_keys.tmpl
  78. 6
      templates/repo/settings/webhook/list.tmpl
  79. 4
      templates/repo/settings/webhook/new.tmpl
  80. 2
      templates/repo/view_file.tmpl
  81. 4
      templates/repo/view_list.tmpl
  82. 2
      templates/repo/wiki/new.tmpl
  83. 2
      templates/status/404.tmpl
  84. 2
      templates/status/500.tmpl
  85. 2
      templates/user/auth/activate.tmpl
  86. 4
      templates/user/auth/login.tmpl
  87. 2
      templates/user/auth/signup.tmpl
  88. 2
      templates/user/auth/two_factor.tmpl
  89. 2
      templates/user/auth/two_factor_recovery_code.tmpl
  90. 14
      templates/user/dashboard/dashboard.tmpl
  91. 4
      templates/user/dashboard/feeds.tmpl
  92. 2
      templates/user/dashboard/issues.tmpl
  93. 12
      templates/user/dashboard/navbar.tmpl
  94. 2
      templates/user/profile.tmpl
  95. 20
      templates/user/settings/navbar.tmpl
  96. 2
      templates/user/settings/organizations.tmpl
  97. 2
      templates/user/settings/repositories.tmpl
  98. 6
      templates/user/settings/security.tmpl

14
cmd/web.go

@ -85,7 +85,7 @@ func newMacaron() *macaron.Macaron {
m.Use(gzip.Gziper()) m.Use(gzip.Gziper())
} }
if setting.Protocol == setting.SCHEME_FCGI { if setting.Protocol == setting.SCHEME_FCGI {
m.SetURLPrefix(setting.AppSubUrl) m.SetURLPrefix(setting.AppSubURL)
} }
m.Use(macaron.Static( m.Use(macaron.Static(
path.Join(setting.StaticRootPath, "public"), path.Join(setting.StaticRootPath, "public"),
@ -120,7 +120,7 @@ func newMacaron() *macaron.Macaron {
localFiles[name] = bindata.MustAsset("conf/locale/" + name) localFiles[name] = bindata.MustAsset("conf/locale/" + name)
} }
m.Use(i18n.I18n(i18n.Options{ m.Use(i18n.I18n(i18n.Options{
SubURL: setting.AppSubUrl, SubURL: setting.AppSubURL,
Files: localFiles, Files: localFiles,
CustomDirectory: path.Join(setting.CustomPath, "conf/locale"), CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
Langs: setting.Langs, Langs: setting.Langs,
@ -134,7 +134,7 @@ func newMacaron() *macaron.Macaron {
Interval: setting.CacheInterval, Interval: setting.CacheInterval,
})) }))
m.Use(captcha.Captchaer(captcha.Options{ m.Use(captcha.Captchaer(captcha.Options{
SubURL: setting.AppSubUrl, SubURL: setting.AppSubURL,
})) }))
m.Use(session.Sessioner(setting.SessionConfig)) m.Use(session.Sessioner(setting.SessionConfig))
m.Use(csrf.Csrfer(csrf.Options{ m.Use(csrf.Csrfer(csrf.Options{
@ -142,7 +142,7 @@ func newMacaron() *macaron.Macaron {
Cookie: setting.CSRFCookieName, Cookie: setting.CSRFCookieName,
SetCookie: true, SetCookie: true,
Header: "X-Csrf-Token", Header: "X-Csrf-Token",
CookiePath: setting.AppSubUrl, CookiePath: setting.AppSubURL,
})) }))
m.Use(toolbox.Toolboxer(m, toolbox.Options{ m.Use(toolbox.Toolboxer(m, toolbox.Options{
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
@ -178,7 +178,7 @@ func runWeb(ctx *cli.Context) error {
m.Get("/", ignSignIn, routers.Home) m.Get("/", ignSignIn, routers.Home)
m.Group("/explore", func() { m.Group("/explore", func() {
m.Get("", func(ctx *context.Context) { m.Get("", func(ctx *context.Context) {
ctx.Redirect(setting.AppSubUrl + "/explore/repos") ctx.Redirect(setting.AppSubURL + "/explore/repos")
}) })
m.Get("/repos", routers.ExploreRepos) m.Get("/repos", routers.ExploreRepos)
m.Get("/users", routers.ExploreUsers) m.Get("/users", routers.ExploreUsers)
@ -655,7 +655,7 @@ func runWeb(ctx *cli.Context) error {
// Flag for port number in case first time run conflict. // Flag for port number in case first time run conflict.
if ctx.IsSet("port") { if ctx.IsSet("port") {
setting.AppUrl = strings.Replace(setting.AppUrl, setting.HTTPPort, ctx.String("port"), 1) setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, ctx.String("port"), 1)
setting.HTTPPort = ctx.String("port") setting.HTTPPort = ctx.String("port")
} }
@ -665,7 +665,7 @@ func runWeb(ctx *cli.Context) error {
} else { } else {
listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort) listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
} }
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubUrl) log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
var err error var err error
switch setting.Protocol { switch setting.Protocol {

6
models/action.go

@ -136,8 +136,8 @@ func (a *Action) ShortRepoPath() string {
} }
func (a *Action) GetRepoLink() string { func (a *Action) GetRepoLink() string {
if len(setting.AppSubUrl) > 0 { if len(setting.AppSubURL) > 0 {
return path.Join(setting.AppSubUrl, a.GetRepoPath()) return path.Join(setting.AppSubURL, a.GetRepoPath())
} }
return "/" + a.GetRepoPath() return "/" + a.GetRepoPath()
} }
@ -540,7 +540,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
return nil return nil
} }
compareURL := setting.AppUrl + opts.Commits.CompareURL compareURL := setting.AppURL + opts.Commits.CompareURL
if isNewRef { if isNewRef {
compareURL = "" compareURL = ""
if err = PrepareWebhooks(repo, HOOK_EVENT_CREATE, &api.CreatePayload{ if err = PrepareWebhooks(repo, HOOK_EVENT_CREATE, &api.CreatePayload{

2
models/pull.go

@ -324,7 +324,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
Ref: git.BRANCH_PREFIX + pr.BaseBranch, Ref: git.BRANCH_PREFIX + pr.BaseBranch,
Before: pr.MergeBase, Before: pr.MergeBase,
After: pr.MergedCommitID, After: pr.MergedCommitID,
CompareURL: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID), CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
Commits: commits, Commits: commits,
Repo: pr.BaseRepo.APIFormat(nil), Repo: pr.BaseRepo.APIFormat(nil),
Pusher: pr.HeadRepo.MustOwner().APIFormat(), Pusher: pr.HeadRepo.MustOwner().APIFormat(),

6
models/repo.go

@ -279,7 +279,7 @@ func (repo *Repository) FullName() string {
} }
func (repo *Repository) HTMLURL() string { func (repo *Repository) HTMLURL() string {
return setting.AppUrl + repo.FullName() return setting.AppURL + repo.FullName()
} }
// Arguments that are allowed to be nil: permission // Arguments that are allowed to be nil: permission
@ -458,7 +458,7 @@ func (repo *Repository) RelLink() string {
} }
func (repo *Repository) Link() string { func (repo *Repository) Link() string {
return setting.AppSubUrl + "/" + repo.FullName() return setting.AppSubURL + "/" + repo.FullName()
} }
func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string { func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string {
@ -597,7 +597,7 @@ type CloneLink struct {
// ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name. // ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
func ComposeHTTPSCloneURL(owner, repo string) string { func ComposeHTTPSCloneURL(owner, repo string) string {
return fmt.Sprintf("%s%s/%s.git", setting.AppUrl, owner, repo) return fmt.Sprintf("%s%s/%s.git", setting.AppURL, owner, repo)
} }
func (repo *Repository) cloneLink(isWiki bool) *CloneLink { func (repo *Repository) cloneLink(isWiki bool) *CloneLink {

16
models/user.go

@ -175,18 +175,18 @@ func (u *User) CanImportLocal() bool {
// DashboardLink returns the user dashboard page link. // DashboardLink returns the user dashboard page link.
func (u *User) DashboardLink() string { func (u *User) DashboardLink() string {
if u.IsOrganization() { if u.IsOrganization() {
return setting.AppSubUrl + "/org/" + u.Name + "/dashboard/" return setting.AppSubURL + "/org/" + u.Name + "/dashboard/"
} }
return setting.AppSubUrl + "/" return setting.AppSubURL + "/"
} }
// HomeLink returns the user or organization home page link. // HomeLink returns the user or organization home page link.
func (u *User) HomeLink() string { func (u *User) HomeLink() string {
return setting.AppSubUrl + "/" + u.Name return setting.AppSubURL + "/" + u.Name
} }
func (u *User) HTMLURL() string { func (u *User) HTMLURL() string {
return setting.AppUrl + u.Name return setting.AppURL + u.Name
} }
// GenerateEmailActivateCode generates an activate code based on user information and given e-mail. // GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
@ -242,7 +242,7 @@ func (u *User) GenerateRandomAvatar() error {
// which includes app sub-url as prefix. However, it is possible // which includes app sub-url as prefix. However, it is possible
// to return full URL if user enables Gravatar-like service. // to return full URL if user enables Gravatar-like service.
func (u *User) RelAvatarLink() string { func (u *User) RelAvatarLink() string {
defaultImgUrl := setting.AppSubUrl + "/img/avatar_default.png" defaultImgUrl := setting.AppSubURL + "/img/avatar_default.png"
if u.ID == -1 { if u.ID == -1 {
return defaultImgUrl return defaultImgUrl
} }
@ -252,7 +252,7 @@ func (u *User) RelAvatarLink() string {
if !com.IsExist(u.CustomAvatarPath()) { if !com.IsExist(u.CustomAvatarPath()) {
return defaultImgUrl return defaultImgUrl
} }
return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID) return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
case setting.DisableGravatar, setting.OfflineMode: case setting.DisableGravatar, setting.OfflineMode:
if !com.IsExist(u.CustomAvatarPath()) { if !com.IsExist(u.CustomAvatarPath()) {
if err := u.GenerateRandomAvatar(); err != nil { if err := u.GenerateRandomAvatar(); err != nil {
@ -260,7 +260,7 @@ func (u *User) RelAvatarLink() string {
} }
} }
return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID) return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
} }
return tool.AvatarLink(u.AvatarEmail) return tool.AvatarLink(u.AvatarEmail)
} }
@ -269,7 +269,7 @@ func (u *User) RelAvatarLink() string {
func (u *User) AvatarLink() string { func (u *User) AvatarLink() string {
link := u.RelAvatarLink() link := u.RelAvatarLink()
if link[0] == '/' && link[1] != '/' { if link[0] == '/' && link[1] != '/' {
return setting.AppUrl + strings.TrimPrefix(link, setting.AppSubUrl)[1:] return setting.AppURL + strings.TrimPrefix(link, setting.AppSubURL)[1:]
} }
return link return link
} }

10
models/webhook_discord.go

@ -77,7 +77,7 @@ func getDiscordCreatePayload(p *api.CreatePayload) (*DiscordPayload, error) {
return &DiscordPayload{ return &DiscordPayload{
Embeds: []*DiscordEmbedObject{{ Embeds: []*DiscordEmbedObject{{
Description: content, Description: content,
URL: setting.AppUrl + p.Sender.UserName, URL: setting.AppURL + p.Sender.UserName,
Author: &DiscordEmbedAuthorObject{ Author: &DiscordEmbedAuthorObject{
Name: p.Sender.UserName, Name: p.Sender.UserName,
IconURL: p.Sender.AvatarUrl, IconURL: p.Sender.AvatarUrl,
@ -94,7 +94,7 @@ func getDiscordDeletePayload(p *api.DeletePayload) (*DiscordPayload, error) {
return &DiscordPayload{ return &DiscordPayload{
Embeds: []*DiscordEmbedObject{{ Embeds: []*DiscordEmbedObject{{
Description: content, Description: content,
URL: setting.AppUrl + p.Sender.UserName, URL: setting.AppURL + p.Sender.UserName,
Author: &DiscordEmbedAuthorObject{ Author: &DiscordEmbedAuthorObject{
Name: p.Sender.UserName, Name: p.Sender.UserName,
IconURL: p.Sender.AvatarUrl, IconURL: p.Sender.AvatarUrl,
@ -111,7 +111,7 @@ func getDiscordForkPayload(p *api.ForkPayload) (*DiscordPayload, error) {
return &DiscordPayload{ return &DiscordPayload{
Embeds: []*DiscordEmbedObject{{ Embeds: []*DiscordEmbedObject{{
Description: content, Description: content,
URL: setting.AppUrl + p.Sender.UserName, URL: setting.AppURL + p.Sender.UserName,
Author: &DiscordEmbedAuthorObject{ Author: &DiscordEmbedAuthorObject{
Name: p.Sender.UserName, Name: p.Sender.UserName,
IconURL: p.Sender.AvatarUrl, IconURL: p.Sender.AvatarUrl,
@ -159,7 +159,7 @@ func getDiscordPushPayload(p *api.PushPayload, slack *SlackMeta) (*DiscordPayloa
AvatarURL: slack.IconURL, AvatarURL: slack.IconURL,
Embeds: []*DiscordEmbedObject{{ Embeds: []*DiscordEmbedObject{{
Description: content, Description: content,
URL: setting.AppUrl + p.Sender.UserName, URL: setting.AppURL + p.Sender.UserName,
Color: int(color), Color: int(color),
Author: &DiscordEmbedAuthorObject{ Author: &DiscordEmbedAuthorObject{
Name: p.Sender.UserName, Name: p.Sender.UserName,
@ -360,7 +360,7 @@ func getDiscordReleasePayload(p *api.ReleasePayload) (*DiscordPayload, error) {
return &DiscordPayload{ return &DiscordPayload{
Embeds: []*DiscordEmbedObject{{ Embeds: []*DiscordEmbedObject{{
Description: content, Description: content,
URL: setting.AppUrl + p.Sender.UserName, URL: setting.AppURL + p.Sender.UserName,
Author: &DiscordEmbedAuthorObject{ Author: &DiscordEmbedAuthorObject{
Name: p.Sender.UserName, Name: p.Sender.UserName,
IconURL: p.Sender.AvatarUrl, IconURL: p.Sender.AvatarUrl,

10
models/webhook_slack.go

@ -146,7 +146,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
} }
func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) (*SlackPayload, error) { func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) (*SlackPayload, error) {
senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName) senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Index), titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Index),
fmt.Sprintf("#%d %s", p.Index, p.Issue.Title)) fmt.Sprintf("#%d %s", p.Index, p.Issue.Title))
var text, title, attachmentText string var text, title, attachmentText string
@ -164,7 +164,7 @@ func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) (*SlackPayloa
attachmentText = SlackTextFormatter(p.Issue.Body) attachmentText = SlackTextFormatter(p.Issue.Body)
case api.HOOK_ISSUE_ASSIGNED: case api.HOOK_ISSUE_ASSIGNED:
text = fmt.Sprintf("[%s] Issue assigned to %s: %s by %s", p.Repository.FullName, text = fmt.Sprintf("[%s] Issue assigned to %s: %s by %s", p.Repository.FullName,
SlackLinkFormatter(setting.AppUrl+p.Issue.Assignee.UserName, p.Issue.Assignee.UserName), SlackLinkFormatter(setting.AppURL+p.Issue.Assignee.UserName, p.Issue.Assignee.UserName),
titleLink, senderLink) titleLink, senderLink)
case api.HOOK_ISSUE_UNASSIGNED: case api.HOOK_ISSUE_UNASSIGNED:
text = fmt.Sprintf("[%s] Issue unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink) text = fmt.Sprintf("[%s] Issue unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)
@ -192,7 +192,7 @@ func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) (*SlackPayloa
} }
func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) (*SlackPayload, error) { func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) (*SlackPayload, error) {
senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName) senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID)), titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID)),
fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title)) fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title))
var text, title, attachmentText string var text, title, attachmentText string
@ -226,7 +226,7 @@ func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) (
} }
func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) { func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) {
senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName) senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index), titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index),
fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title)) fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title))
var text, title, attachmentText string var text, title, attachmentText string
@ -248,7 +248,7 @@ func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*S
attachmentText = SlackTextFormatter(p.PullRequest.Body) attachmentText = SlackTextFormatter(p.PullRequest.Body)
case api.HOOK_ISSUE_ASSIGNED: case api.HOOK_ISSUE_ASSIGNED:
text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName, text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
SlackLinkFormatter(setting.AppUrl+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName), SlackLinkFormatter(setting.AppURL+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName),
titleLink, senderLink) titleLink, senderLink)
case api.HOOK_ISSUE_UNASSIGNED: case api.HOOK_ISSUE_UNASSIGNED:
text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink) text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)

8
pkg/context/api.go

@ -48,16 +48,16 @@ func (ctx *APIContext) SetLinkHeader(total, pageSize int) {
page := paginater.New(total, pageSize, ctx.QueryInt("page"), 0) page := paginater.New(total, pageSize, ctx.QueryInt("page"), 0)
links := make([]string, 0, 4) links := make([]string, 0, 4)
if page.HasNext() { if page.HasNext() {
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.Next())) links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", setting.AppURL, ctx.Req.URL.Path[1:], page.Next()))
} }
if !page.IsLast() { if !page.IsLast() {
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.TotalPages())) links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", setting.AppURL, ctx.Req.URL.Path[1:], page.TotalPages()))
} }
if !page.IsFirst() { if !page.IsFirst() {
links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", setting.AppUrl, ctx.Req.URL.Path[1:])) links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", setting.AppURL, ctx.Req.URL.Path[1:]))
} }
if page.HasPrevious() { if page.HasPrevious() {
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.Previous())) links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", setting.AppURL, ctx.Req.URL.Path[1:], page.Previous()))
} }
if len(links) > 0 { if len(links) > 0 {

14
pkg/context/auth.go

@ -25,7 +25,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return func(ctx *Context) { return func(ctx *Context) {
// Cannot view any page before installation. // Cannot view any page before installation.
if !setting.InstallLock { if !setting.InstallLock {
ctx.Redirect(setting.AppSubUrl + "/install") ctx.Redirect(setting.AppSubURL + "/install")
return return
} }
@ -38,13 +38,13 @@ func Toggle(options *ToggleOptions) macaron.Handler {
// Check non-logged users landing page. // Check non-logged users landing page.
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME { if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME {
ctx.Redirect(setting.AppSubUrl + string(setting.LandingPageURL)) ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
return 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.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" { if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" {
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
return return
} }
@ -65,8 +65,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return return
} }
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
return return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { } else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
ctx.Data["Title"] = ctx.Tr("auth.active_your_account") ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
@ -78,8 +78,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
// Redirect to log in page if auto-signin info is provided and has not signed in. // Redirect to log in page if auto-signin info is provided and has not signed in.
if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
len(ctx.GetCookie(setting.CookieUserName)) > 0 { len(ctx.GetCookie(setting.CookieUserName)) > 0 {
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
return return
} }

2
pkg/context/context.go

@ -185,7 +185,7 @@ func Contexter() macaron.Handler {
} }
// Compute current URL for real-time change language. // Compute current URL for real-time change language.
ctx.Data["Link"] = setting.AppSubUrl + strings.TrimSuffix(ctx.Req.URL.Path, "/") ctx.Data["Link"] = setting.AppSubURL + strings.TrimSuffix(ctx.Req.URL.Path, "/")
ctx.Data["PageStartTime"] = time.Now() ctx.Data["PageStartTime"] = time.Now()

2
pkg/context/org.go

@ -91,7 +91,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name ctx.Org.OrgLink = setting.AppSubURL + "/org/" + org.Name
ctx.Data["OrgLink"] = ctx.Org.OrgLink ctx.Data["OrgLink"] = ctx.Org.OrgLink
// Team. // Team.

4
pkg/context/repo.go

@ -110,7 +110,7 @@ func (r *Repository) PullRequestURL(baseBranch, headBranch string) string {
// composeGoGetImport returns go-get-import meta content. // composeGoGetImport returns go-get-import meta content.
func composeGoGetImport(owner, repo string) string { func composeGoGetImport(owner, repo string) string {
return path.Join(setting.Domain, setting.AppSubUrl, owner, repo) return path.Join(setting.Domain, setting.AppSubURL, owner, repo)
} }
// earlyResponseForGoGetMeta responses appropriate go-get meta with status 200 // earlyResponseForGoGetMeta responses appropriate go-get meta with status 200
@ -311,7 +311,7 @@ func RepoAssignment(pages ...bool) macaron.Handler {
if ctx.Query("go-get") == "1" { if ctx.Query("go-get") == "1" {
ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name) ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
prefix := setting.AppUrl + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName) prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
ctx.Data["GoDocDirectory"] = prefix + "{/dir}" ctx.Data["GoDocDirectory"] = prefix + "{/dir}"
ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}" ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}"
} }

6
pkg/markup/markdown.go

@ -63,7 +63,7 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
// Since this method could only possibly serve one link at a time, // Since this method could only possibly serve one link at a time,
// we do not need to find all. // we do not need to find all.
if bytes.HasPrefix(link, []byte(setting.AppUrl)) { if bytes.HasPrefix(link, []byte(setting.AppURL)) {
m := CommitPattern.Find(link) m := CommitPattern.Find(link)
if m != nil { if m != nil {
m = bytes.TrimSpace(m) m = bytes.TrimSpace(m)
@ -86,14 +86,14 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
} }
index := string(m[i+7 : j]) index := string(m[i+7 : j])
fullRepoURL := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/") fullRepoURL := setting.AppURL + strings.TrimPrefix(r.urlPrefix, "/")
var link string var link string
if strings.HasPrefix(string(m), fullRepoURL) { if strings.HasPrefix(string(m), fullRepoURL) {
// Use a short issue reference if the URL refers to this repository // Use a short issue reference if the URL refers to this repository
link = fmt.Sprintf(`<a href="%s">#%s</a>`, m, index) link = fmt.Sprintf(`<a href="%s">#%s</a>`, m, index)
} else { } else {
// Use a cross-repository issue reference if the URL refers to a different repository // Use a cross-repository issue reference if the URL refers to a different repository
repo := string(m[len(setting.AppUrl) : i-1]) repo := string(m[len(setting.AppURL) : i-1])
link = fmt.Sprintf(`<a href="%s">%s#%s</a>`, m, repo, index) link = fmt.Sprintf(`<a href="%s">%s#%s</a>`, m, repo, index)
} }
out.WriteString(link) out.WriteString(link)

4
pkg/markup/markdown_test.go

@ -40,7 +40,7 @@ func Test_IsMarkdownFile(t *testing.T) {
func Test_Markdown(t *testing.T) { func Test_Markdown(t *testing.T) {
Convey("Rendering an issue URL", t, func() { Convey("Rendering an issue URL", t, func() {
setting.AppUrl = "http://localhost:3000/" setting.AppURL = "http://localhost:3000/"
htmlFlags := 0 htmlFlags := 0
htmlFlags |= blackfriday.HTML_SKIP_STYLE htmlFlags |= blackfriday.HTML_SKIP_STYLE
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
@ -82,7 +82,7 @@ func Test_Markdown(t *testing.T) {
}) })
Convey("Rendering a commit URL", t, func() { Convey("Rendering a commit URL", t, func() {
setting.AppUrl = "http://localhost:3000/" setting.AppURL = "http://localhost:3000/"
htmlFlags := 0 htmlFlags := 0
htmlFlags |= blackfriday.HTML_SKIP_STYLE htmlFlags |= blackfriday.HTML_SKIP_STYLE
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS htmlFlags |= blackfriday.HTML_OMIT_CONTENTS

6
pkg/markup/markup.go

@ -74,7 +74,7 @@ func cutoutVerbosePrefix(prefix string) string {
if prefix[i] == '/' { if prefix[i] == '/' {
count++ count++
} }
if count >= 3+setting.AppSubUrlDepth { if count >= 3+setting.AppSubURLDepth {
return prefix[:i] return prefix[:i]
} }
} }
@ -128,7 +128,7 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me
repo := string(m[:delimIdx]) repo := string(m[:delimIdx])
index := string(m[delimIdx+1:]) index := string(m[delimIdx+1:])
link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppUrl, repo, index, m) link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppURL, repo, index, m)
rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1) rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1)
} }
return rawBytes return rawBytes
@ -150,7 +150,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]strin
for _, m := range ms { for _, m := range ms {
m = m[bytes.Index(m, []byte("@")):] m = m[bytes.Index(m, []byte("@")):]
rawBytes = bytes.Replace(rawBytes, m, rawBytes = bytes.Replace(rawBytes, m,
[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1) []byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubURL, m[1:], m)), -1)
} }
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas) rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)

2
pkg/markup/markup_test.go

@ -62,7 +62,7 @@ func Test_RenderIssueIndexPattern(t *testing.T) {
urlPrefix = "/prefix" urlPrefix = "/prefix"
metas map[string]string = nil metas map[string]string = nil
) )
setting.AppSubUrlDepth = 0 setting.AppSubURLDepth = 0
Convey("To the internal issue tracker", func() { Convey("To the internal issue tracker", func() {
Convey("It should not render anything when there are no mentions", func() { Convey("It should not render anything when there are no mentions", func() {

30
pkg/setting/setting.go

@ -54,16 +54,17 @@ var (
// App settings // App settings
AppVer string AppVer string
AppName string AppName string
AppUrl string AppURL string
AppSubUrl string AppSubURL string
AppSubUrlDepth int // Number of slashes AppSubURLDepth int // Number of slashes
AppPath string AppPath string
AppDataPath string AppDataPath string
// Server settings // Server settings
Protocol Scheme Protocol Scheme
Domain string Domain string
HTTPAddr, HTTPPort string HTTPAddr string
HTTPPort string
LocalURL string LocalURL string
OfflineMode bool OfflineMode bool
DisableRouterLog bool DisableRouterLog bool
@ -288,8 +289,9 @@ var (
} }
// I18n settings // I18n settings
Langs, Names []string Langs []string
dateLangs map[string]string Names []string
dateLangs map[string]string
// Highlight settings are loaded in modules/template/hightlight.go // Highlight settings are loaded in modules/template/hightlight.go
@ -416,20 +418,20 @@ func NewContext() {
sec := Cfg.Section("server") sec := Cfg.Section("server")
AppName = Cfg.Section("").Key("APP_NAME").MustString("Gogs") AppName = Cfg.Section("").Key("APP_NAME").MustString("Gogs")
AppUrl = sec.Key("ROOT_URL").MustString("http://localhost:3000/") AppURL = sec.Key("ROOT_URL").MustString("http://localhost:3000/")
if AppUrl[len(AppUrl)-1] != '/' { if AppURL[len(AppURL)-1] != '/' {
AppUrl += "/" AppURL += "/"
} }
// Check if has app suburl. // Check if has app suburl.
url, err := url.Parse(AppUrl) url, err := url.Parse(AppURL)
if err != nil { if err != nil {
log.Fatal(2, "Invalid ROOT_URL '%s': %s", AppUrl, err) log.Fatal(2, "Invalid ROOT_URL '%s': %s", AppURL, err)
} }
// Suburl should start with '/' and end without '/', such as '/{subpath}'. // Suburl should start with '/' and end without '/', such as '/{subpath}'.
// This value is empty if site does not have sub-url. // This value is empty if site does not have sub-url.
AppSubUrl = strings.TrimSuffix(url.Path, "/") AppSubURL = strings.TrimSuffix(url.Path, "/")
AppSubUrlDepth = strings.Count(AppSubUrl, "/") AppSubURLDepth = strings.Count(AppSubURL, "/")
Protocol = SCHEME_HTTP Protocol = SCHEME_HTTP
if sec.Key("PROTOCOL").String() == "https" { if sec.Key("PROTOCOL").String() == "https" {
@ -771,7 +773,7 @@ func newSessionService() {
[]string{"memory", "file", "redis", "mysql"}) []string{"memory", "file", "redis", "mysql"})
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ") SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ")
SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits") SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits")
SessionConfig.CookiePath = AppSubUrl SessionConfig.CookiePath = AppSubURL
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool() SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(3600) SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(3600)
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400) SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)

10
pkg/template/template.go

@ -33,16 +33,16 @@ func NewFuncMap() []template.FuncMap {
return strings.Title(runtime.Version()) return strings.Title(runtime.Version())
}, },
"UseHTTPS": func() bool { "UseHTTPS": func() bool {
return strings.HasPrefix(setting.AppUrl, "https") return strings.HasPrefix(setting.AppURL, "https")
}, },
"AppName": func() string { "AppName": func() string {
return setting.AppName return setting.AppName
}, },
"AppSubUrl": func() string { "AppSubURL": func() string {
return setting.AppSubUrl return setting.AppSubURL
}, },
"AppUrl": func() string { "AppURL": func() string {
return setting.AppUrl return setting.AppURL
}, },
"AppVer": func() string { "AppVer": func() string {
return setting.AppVer return setting.AppVer

2
pkg/tool/tool.go

@ -202,7 +202,7 @@ func AvatarLink(email string) (url string) {
url = setting.GravatarSource + HashEmail(email) url = setting.GravatarSource + HashEmail(email)
} }
if len(url) == 0 { if len(url) == 0 {
url = setting.AppSubUrl + "/img/avatar_default.png" url = setting.AppSubURL + "/img/avatar_default.png"
} }
return url return url
} }

6
routers/admin/admin.go

@ -165,7 +165,7 @@ func Dashboard(ctx *context.Context) {
} else { } else {
ctx.Flash.Success(success) ctx.Flash.Success(success)
} }
ctx.Redirect(setting.AppSubUrl + "/admin") ctx.Redirect(setting.AppSubURL + "/admin")
return return
} }
@ -185,7 +185,7 @@ func SendTestMail(ctx *context.Context) {
ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email)) ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
} }
ctx.Redirect(setting.AppSubUrl + "/admin/config") ctx.Redirect(setting.AppSubURL + "/admin/config")
} }
func Config(ctx *context.Context) { func Config(ctx *context.Context) {
@ -193,7 +193,7 @@ func Config(ctx *context.Context) {
ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminConfig"] = true ctx.Data["PageIsAdminConfig"] = true
ctx.Data["AppUrl"] = setting.AppUrl ctx.Data["AppURL"] = setting.AppURL
ctx.Data["Domain"] = setting.Domain ctx.Data["Domain"] = setting.Domain
ctx.Data["OfflineMode"] = setting.OfflineMode ctx.Data["OfflineMode"] = setting.OfflineMode
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog ctx.Data["DisableRouterLog"] = setting.DisableRouterLog

8
routers/admin/auths.go

@ -163,7 +163,7 @@ func NewAuthSourcePost(ctx *context.Context, f form.Authentication) {
log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, f.Name) log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, f.Name)
ctx.Flash.Success(ctx.Tr("admin.auths.new_success", f.Name)) ctx.Flash.Success(ctx.Tr("admin.auths.new_success", f.Name))
ctx.Redirect(setting.AppSubUrl + "/admin/auths") ctx.Redirect(setting.AppSubURL + "/admin/auths")
} }
func EditAuthSource(ctx *context.Context) { func EditAuthSource(ctx *context.Context) {
@ -230,7 +230,7 @@ func EditAuthSourcePost(ctx *context.Context, f form.Authentication) {
log.Trace("Authentication changed by admin(%s): %d", ctx.User.Name, source.ID) log.Trace("Authentication changed by admin(%s): %d", ctx.User.Name, source.ID)
ctx.Flash.Success(ctx.Tr("admin.auths.update_success")) ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + com.ToStr(f.ID)) ctx.Redirect(setting.AppSubURL + "/admin/auths/" + com.ToStr(f.ID))
} }
func DeleteAuthSource(ctx *context.Context) { func DeleteAuthSource(ctx *context.Context) {
@ -247,7 +247,7 @@ func DeleteAuthSource(ctx *context.Context) {
ctx.Flash.Error(fmt.Sprintf("DeleteSource: %v", err)) ctx.Flash.Error(fmt.Sprintf("DeleteSource: %v", err))
} }
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"), "redirect": setting.AppSubURL + "/admin/auths/" + ctx.Params(":authid"),
}) })
return return
} }
@ -255,6 +255,6 @@ func DeleteAuthSource(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success")) ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/auths", "redirect": setting.AppSubURL + "/admin/auths",
}) })
} }

2
routers/admin/notice.go

@ -68,5 +68,5 @@ func EmptyNotices(ctx *context.Context) {
log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.User.Name, 0) log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.User.Name, 0)
ctx.Flash.Success(ctx.Tr("admin.notices.delete_success")) ctx.Flash.Success(ctx.Tr("admin.notices.delete_success"))
ctx.Redirect(setting.AppSubUrl + "/admin/notices") ctx.Redirect(setting.AppSubURL + "/admin/notices")
} }

2
routers/admin/repos.go

@ -82,6 +82,6 @@ func DeleteRepo(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.settings.deletion_success")) ctx.Flash.Success(ctx.Tr("repo.settings.deletion_success"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/repos?page=" + ctx.Query("page"), "redirect": setting.AppSubURL + "/admin/repos?page=" + ctx.Query("page"),
}) })
} }

10
routers/admin/users.go

@ -120,7 +120,7 @@ func NewUserPost(ctx *context.Context, f form.AdminCrateUser) {
} }
ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name)) ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.ID)) ctx.Redirect(setting.AppSubURL + "/admin/users/" + com.ToStr(u.ID))
} }
func prepareUserInfo(ctx *context.Context) *models.User { func prepareUserInfo(ctx *context.Context) *models.User {
@ -226,7 +226,7 @@ func EditUserPost(ctx *context.Context, f form.AdminEditUser) {
log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name) log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name)
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success")) ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid")) ctx.Redirect(setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"))
} }
func DeleteUser(ctx *context.Context) { func DeleteUser(ctx *context.Context) {
@ -241,12 +241,12 @@ func DeleteUser(ctx *context.Context) {
case models.IsErrUserOwnRepos(err): case models.IsErrUserOwnRepos(err):
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo")) ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"), "redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
}) })
case models.IsErrUserHasOrgs(err): case models.IsErrUserHasOrgs(err):
ctx.Flash.Error(ctx.Tr("admin.users.still_has_org")) ctx.Flash.Error(ctx.Tr("admin.users.still_has_org"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"), "redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
}) })
default: default:
ctx.Handle(500, "DeleteUser", err) ctx.Handle(500, "DeleteUser", err)
@ -257,6 +257,6 @@ func DeleteUser(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("admin.users.deletion_success")) ctx.Flash.Success(ctx.Tr("admin.users.deletion_success"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/admin/users", "redirect": setting.AppSubURL + "/admin/users",
}) })
} }

2
routers/api/v1/repo/key.go

@ -16,7 +16,7 @@ import (
) )
func composeDeployKeysAPILink(repoPath string) string { func composeDeployKeysAPILink(repoPath string) string {
return setting.AppUrl + "api/v1/repos/" + repoPath + "/keys/" return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/"
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys

2
routers/api/v1/user/key.go

@ -34,7 +34,7 @@ func GetUserByParams(ctx *context.APIContext) *models.User {
} }
func composePublicKeysAPILink() string { func composePublicKeysAPILink() string {
return setting.AppUrl + "api/v1/user/keys/" return setting.AppURL + "api/v1/user/keys/"
} }
func listPublicKeys(ctx *context.APIContext, uid int64) { func listPublicKeys(ctx *context.APIContext, uid int64) {

2
routers/dev/template.go

@ -14,7 +14,7 @@ func TemplatePreview(ctx *context.Context) {
ctx.Data["User"] = models.User{Name: "Unknown"} ctx.Data["User"] = models.User{Name: "Unknown"}
ctx.Data["AppName"] = setting.AppName ctx.Data["AppName"] = setting.AppName
ctx.Data["AppVer"] = setting.AppVer ctx.Data["AppVer"] = setting.AppVer
ctx.Data["AppUrl"] = setting.AppUrl ctx.Data["AppURL"] = setting.AppURL
ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374" ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60 ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60
ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60 ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60

2
routers/home.go

@ -34,7 +34,7 @@ func Home(ctx *context.Context) {
// Check auto-login. // Check auto-login.
uname := ctx.GetCookie(setting.CookieUserName) uname := ctx.GetCookie(setting.CookieUserName)
if len(uname) != 0 { if len(uname) != 0 {
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
return return
} }

2
routers/install.go

@ -145,7 +145,7 @@ func Install(ctx *context.Context) {
f.SSHPort = setting.SSH.Port f.SSHPort = setting.SSH.Port
f.UseBuiltinSSHServer = setting.SSH.StartBuiltinServer f.UseBuiltinSSHServer = setting.SSH.StartBuiltinServer
f.HTTPPort = setting.HTTPPort f.HTTPPort = setting.HTTPPort
f.AppUrl = setting.AppUrl f.AppUrl = setting.AppURL
f.LogRootPath = setting.LogRootPath f.LogRootPath = setting.LogRootPath
// E-mail service settings // E-mail service settings

2
routers/org/members.go

@ -87,7 +87,7 @@ func MembersAction(ctx *context.Context) {
if ctx.Params(":action") != "leave" { if ctx.Params(":action") != "leave" {
ctx.Redirect(ctx.Org.OrgLink + "/members") ctx.Redirect(ctx.Org.OrgLink + "/members")
} else { } else {
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
} }
} }

2
routers/org/org.go

@ -52,5 +52,5 @@ func CreatePost(ctx *context.Context, f form.CreateOrg) {
} }
log.Trace("Organization created: %s", org.Name) log.Trace("Organization created: %s", org.Name)
ctx.Redirect(setting.AppSubUrl + "/org/" + f.OrgName + "/dashboard") ctx.Redirect(setting.AppSubURL + "/org/" + f.OrgName + "/dashboard")
} }

4
routers/org/setting.go

@ -63,7 +63,7 @@ func SettingsPost(ctx *context.Context, f form.UpdateOrgSetting) {
return return
} }
// reset ctx.org.OrgLink with new name // reset ctx.org.OrgLink with new name
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + f.Name ctx.Org.OrgLink = setting.AppSubURL + "/org/" + f.Name
log.Trace("Organization name changed: %s -> %s", org.Name, f.Name) log.Trace("Organization name changed: %s -> %s", org.Name, f.Name)
} }
// In case it's just a case change. // In case it's just a case change.
@ -130,7 +130,7 @@ func SettingsDelete(ctx *context.Context) {
} }
} else { } else {
log.Trace("Organization deleted: %s", org.Name) log.Trace("Organization deleted: %s", org.Name)
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
} }
return return
} }

12
routers/repo/commit.go

@ -171,11 +171,11 @@ func Diff(ctx *context.Context) {
ctx.Data["Diff"] = diff ctx.Data["Diff"] = diff
ctx.Data["Parents"] = parents ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitID) ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", commitID)
if commit.ParentCount() > 0 { if commit.ParentCount() > 0 {
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0]) ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
} }
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitID) ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
ctx.HTML(200, DIFF) ctx.HTML(200, DIFF)
} }
@ -232,8 +232,8 @@ func CompareDiff(ctx *context.Context) {
ctx.Data["Commit"] = commit ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff ctx.Data["Diff"] = diff
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitID) ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitID) ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitID) ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
ctx.HTML(200, DIFF) ctx.HTML(200, DIFF)
} }

2
routers/repo/editor.go

@ -110,7 +110,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
ctx.Data["MarkdownFileExts"] = strings.Join(setting.Markdown.FileExtensions, ",") ctx.Data["MarkdownFileExts"] = strings.Join(setting.Markdown.FileExtensions, ",")
ctx.Data["LineWrapExtensions"] = strings.Join(setting.Repository.Editor.LineWrapExtensions, ",") ctx.Data["LineWrapExtensions"] = strings.Join(setting.Repository.Editor.LineWrapExtensions, ",")
ctx.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",") ctx.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",")
ctx.Data["EditorconfigURLPrefix"] = fmt.Sprintf("%s/api/v1/repos/%s/editorconfig/", setting.AppSubUrl, ctx.Repo.Repository.FullName()) ctx.Data["EditorconfigURLPrefix"] = fmt.Sprintf("%s/api/v1/repos/%s/editorconfig/", setting.AppSubURL, ctx.Repo.Repository.FullName())
ctx.HTML(200, EDIT_FILE) ctx.HTML(200, EDIT_FILE)
} }

6
routers/repo/issue.go

@ -116,8 +116,8 @@ func issues(ctx *context.Context, isPullList bool) {
// Must sign in to see issues about you. // Must sign in to see issues about you.
if viewType != "all" && !ctx.IsSigned { if viewType != "all" && !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
return return
} }
@ -653,7 +653,7 @@ func viewIssue(ctx *context.Context, isPullList bool) {
ctx.Data["NumParticipants"] = len(participants) ctx.Data["NumParticipants"] = len(participants)
ctx.Data["Issue"] = issue ctx.Data["Issue"] = issue
ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID)) ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))
ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login?redirect_to=" + ctx.Data["Link"].(string) ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string)
ctx.HTML(200, ISSUE_VIEW) ctx.HTML(200, ISSUE_VIEW)
} }

12
routers/repo/pull.go

@ -371,9 +371,9 @@ func ViewPullFiles(ctx *context.Context) {
ctx.Data["Reponame"] = pull.HeadRepo.Name ctx.Data["Reponame"] = pull.HeadRepo.Name
headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name) headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name)
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", endCommitID) ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", endCommitID)
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", startCommitID) ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", startCommitID)
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", endCommitID) ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", endCommitID)
} }
ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireHighlightJS"] = true
@ -573,9 +573,9 @@ func PrepareCompareDiff(
ctx.Data["IsImageFile"] = headCommit.IsImageFile ctx.Data["IsImageFile"] = headCommit.IsImageFile
headTarget := path.Join(headUser.Name, repo.Name) headTarget := path.Join(headUser.Name, repo.Name)
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID) ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", headCommitID)
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase) ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", headCommitID) ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", headCommitID)
return false return false
} }

4
routers/repo/repo.go

@ -132,7 +132,7 @@ func CreatePost(ctx *context.Context, f form.CreateRepo) {
}) })
if err == nil { if err == nil {
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name) log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name) ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
return return
} }
@ -204,7 +204,7 @@ func MigratePost(ctx *context.Context, f form.MigrateRepo) {
}) })
if err == nil { if err == nil {
log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, f.RepoName) log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, f.RepoName)
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + f.RepoName) ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + f.RepoName)
return return
} }

12
routers/repo/setting.go

@ -189,7 +189,7 @@ func SettingsPost(ctx *context.Context, f form.RepoSetting) {
} }
log.Trace("Repository converted from mirror to regular: %s/%s", ctx.Repo.Owner.Name, repo.Name) log.Trace("Repository converted from mirror to regular: %s/%s", ctx.Repo.Owner.Name, repo.Name)
ctx.Flash.Success(ctx.Tr("repo.settings.convert_succeed")) ctx.Flash.Success(ctx.Tr("repo.settings.convert_succeed"))
ctx.Redirect(setting.AppSubUrl + "/" + ctx.Repo.Owner.Name + "/" + repo.Name) ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name)
case "transfer": case "transfer":
if !ctx.Repo.IsOwner() { if !ctx.Repo.IsOwner() {
@ -228,7 +228,7 @@ func SettingsPost(ctx *context.Context, f form.RepoSetting) {
} }
log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner) log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed")) ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
ctx.Redirect(setting.AppSubUrl + "/" + newOwner + "/" + repo.Name) ctx.Redirect(setting.AppSubURL + "/" + newOwner + "/" + repo.Name)
case "delete": case "delete":
if !ctx.Repo.IsOwner() { if !ctx.Repo.IsOwner() {
@ -307,7 +307,7 @@ func SettingsCollaboration(ctx *context.Context) {
func SettingsCollaborationPost(ctx *context.Context) { func SettingsCollaborationPost(ctx *context.Context) {
name := strings.ToLower(ctx.Query("collaborator")) name := strings.ToLower(ctx.Query("collaborator"))
if len(name) == 0 || ctx.Repo.Owner.LowerName == name { if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
return return
} }
@ -315,7 +315,7 @@ func SettingsCollaborationPost(ctx *context.Context) {
if err != nil { if err != nil {
if errors.IsUserNotExist(err) { if errors.IsUserNotExist(err) {
ctx.Flash.Error(ctx.Tr("form.user_not_exist")) ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
} else { } else {
ctx.Handle(500, "GetUserByName", err) ctx.Handle(500, "GetUserByName", err)
} }
@ -325,7 +325,7 @@ func SettingsCollaborationPost(ctx *context.Context) {
// Organization is not allowed to be added as a collaborator // Organization is not allowed to be added as a collaborator
if u.IsOrganization() { if u.IsOrganization() {
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator")) ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
return return
} }
@ -339,7 +339,7 @@ func SettingsCollaborationPost(ctx *context.Context) {
} }
ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success")) ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success"))
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
} }
func ChangeCollaborationAccessMode(ctx *context.Context) { func ChangeCollaborationAccessMode(ctx *context.Context) {

50
routers/user/auth.go

@ -44,9 +44,9 @@ func AutoLogin(c *context.Context) (bool, error) {
defer func() { defer func() {
if !isSucceed { if !isSucceed {
log.Trace("auto-login cookie cleared: %s", uname) log.Trace("auto-login cookie cleared: %s", uname)
c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
c.SetCookie(setting.LoginStatusCookieName, "", -1, setting.AppSubUrl) c.SetCookie(setting.LoginStatusCookieName, "", -1, setting.AppSubURL)
} }
}() }()
@ -65,9 +65,9 @@ func AutoLogin(c *context.Context) (bool, error) {
isSucceed = true isSucceed = true
c.Session.Set("uid", u.ID) c.Session.Set("uid", u.ID)
c.Session.Set("uname", u.Name) c.Session.Set("uname", u.Name)
c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
if setting.EnableLoginStatusCookie { if setting.EnableLoginStatusCookie {
c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubUrl) c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubURL)
} }
return true, nil return true, nil
} }
@ -91,17 +91,17 @@ func Login(c *context.Context) {
redirectTo := c.Query("redirect_to") redirectTo := c.Query("redirect_to")
if len(redirectTo) > 0 { if len(redirectTo) > 0 {
c.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl) c.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL)
} else { } else {
redirectTo, _ = url.QueryUnescape(c.GetCookie("redirect_to")) redirectTo, _ = url.QueryUnescape(c.GetCookie("redirect_to"))
} }
c.SetCookie("redirect_to", "", -1, setting.AppSubUrl) c.SetCookie("redirect_to", "", -1, setting.AppSubURL)
if isSucceed { if isSucceed {
if isValidRedirect(redirectTo) { if isValidRedirect(redirectTo) {
c.Redirect(redirectTo) c.Redirect(redirectTo)
} else { } else {
c.Redirect(setting.AppSubUrl + "/") c.Redirect(setting.AppSubURL + "/")
} }
return return
} }
@ -112,8 +112,8 @@ func Login(c *context.Context) {
func afterLogin(c *context.Context, u *models.User, remember bool) { func afterLogin(c *context.Context, u *models.User, remember bool) {
if remember { if remember {
days := 86400 * setting.LoginRememberDays days := 86400 * setting.LoginRememberDays
c.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl, "", setting.CookieSecure, true) c.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubURL, "", setting.CookieSecure, true)
c.SetSuperSecureCookie(u.Rands+u.Passwd, setting.CookieRememberName, u.Name, days, setting.AppSubUrl, "", setting.CookieSecure, true) c.SetSuperSecureCookie(u.Rands+u.Passwd, setting.CookieRememberName, u.Name, days, setting.AppSubURL, "", setting.CookieSecure, true)
} }
c.Session.Set("uid", u.ID) c.Session.Set("uid", u.ID)
@ -122,19 +122,19 @@ func afterLogin(c *context.Context, u *models.User, remember bool) {
c.Session.Delete("twoFactorUserID") c.Session.Delete("twoFactorUserID")
// Clear whatever CSRF has right now, force to generate a new one // Clear whatever CSRF has right now, force to generate a new one
c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
if setting.EnableLoginStatusCookie { if setting.EnableLoginStatusCookie {
c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubUrl) c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubURL)
} }
redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to")) redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to"))
c.SetCookie("redirect_to", "", -1, setting.AppSubUrl) c.SetCookie("redirect_to", "", -1, setting.AppSubURL)
if isValidRedirect(redirectTo) { if isValidRedirect(redirectTo) {
c.Redirect(redirectTo) c.Redirect(redirectTo)
return return
} }
c.Redirect(setting.AppSubUrl + "/") c.Redirect(setting.AppSubURL + "/")
} }
func LoginPost(c *context.Context, f form.SignIn) { func LoginPost(c *context.Context, f form.SignIn) {
@ -162,7 +162,7 @@ func LoginPost(c *context.Context, f form.SignIn) {
c.Session.Set("twoFactorRemember", f.Remember) c.Session.Set("twoFactorRemember", f.Remember)
c.Session.Set("twoFactorUserID", u.ID) c.Session.Set("twoFactorUserID", u.ID)
c.Redirect(setting.AppSubUrl + "/user/login/two_factor") c.Redirect(setting.AppSubURL + "/user/login/two_factor")
} }
func LoginTwoFactor(c *context.Context) { func LoginTwoFactor(c *context.Context) {
@ -193,7 +193,7 @@ func LoginTwoFactorPost(c *context.Context) {
return return
} else if !valid { } else if !valid {
c.Flash.Error(c.Tr("settings.two_factor_invalid_passcode")) c.Flash.Error(c.Tr("settings.two_factor_invalid_passcode"))
c.Redirect(setting.AppSubUrl + "/user/login/two_factor") c.Redirect(setting.AppSubURL + "/user/login/two_factor")
return return
} }
@ -225,7 +225,7 @@ func LoginTwoFactorRecoveryCodePost(c *context.Context) {
if err := models.UseRecoveryCode(userID, c.Query("recovery_code")); err != nil { if err := models.UseRecoveryCode(userID, c.Query("recovery_code")); err != nil {
if errors.IsTwoFactorRecoveryCodeNotFound(err) { if errors.IsTwoFactorRecoveryCodeNotFound(err) {
c.Flash.Error(c.Tr("auth.login_two_factor_invalid_recovery_code")) c.Flash.Error(c.Tr("auth.login_two_factor_invalid_recovery_code"))
c.Redirect(setting.AppSubUrl + "/user/login/two_factor_recovery_code") c.Redirect(setting.AppSubURL + "/user/login/two_factor_recovery_code")
} else { } else {
c.ServerError("UseRecoveryCode", err) c.ServerError("UseRecoveryCode", err)
} }
@ -243,10 +243,10 @@ func LoginTwoFactorRecoveryCodePost(c *context.Context) {
func SignOut(ctx *context.Context) { func SignOut(ctx *context.Context) {
ctx.Session.Delete("uid") ctx.Session.Delete("uid")
ctx.Session.Delete("uname") ctx.Session.Delete("uname")
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
} }
func SignUp(ctx *context.Context) { func SignUp(ctx *context.Context) {
@ -341,7 +341,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, f form.Register) {
return return
} }
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
} }
func Activate(ctx *context.Context) { func Activate(ctx *context.Context) {
@ -389,7 +389,7 @@ func Activate(ctx *context.Context) {
ctx.Session.Set("uid", user.ID) ctx.Session.Set("uid", user.ID)
ctx.Session.Set("uname", user.Name) ctx.Session.Set("uname", user.Name)
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
return return
} }
@ -411,7 +411,7 @@ func ActivateEmail(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("settings.add_email_success")) ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
} }
ctx.Redirect(setting.AppSubUrl + "/user/settings/email") ctx.Redirect(setting.AppSubURL + "/user/settings/email")
return return
} }
@ -525,7 +525,7 @@ func ResetPasswdPost(ctx *context.Context) {
} }
log.Trace("User password reset: %s", u.Name) log.Trace("User password reset: %s", u.Name)
ctx.Redirect(setting.AppSubUrl + "/user/login") ctx.Redirect(setting.AppSubURL + "/user/login")
return return
} }

2
routers/user/home.go

@ -420,5 +420,5 @@ func Email2User(ctx *context.Context) {
ctx.NotFoundOrServerError("GetUserByEmail", errors.IsUserNotExist, err) ctx.NotFoundOrServerError("GetUserByEmail", errors.IsUserNotExist, err)
return return
} }
ctx.Redirect(setting.AppSubUrl + "/user/" + u.Name) ctx.Redirect(setting.AppSubURL + "/user/" + u.Name)
} }

52
routers/user/setting.go

@ -67,16 +67,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
switch { switch {
case models.IsErrUserAlreadyExist(err): case models.IsErrUserAlreadyExist(err):
ctx.Flash.Error(ctx.Tr("newName_been_taken")) ctx.Flash.Error(ctx.Tr("newName_been_taken"))
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrEmailAlreadyUsed(err): case models.IsErrEmailAlreadyUsed(err):
ctx.Flash.Error(ctx.Tr("form.email_been_used")) ctx.Flash.Error(ctx.Tr("form.email_been_used"))
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrNameReserved(err): case models.IsErrNameReserved(err):
ctx.Flash.Error(ctx.Tr("user.newName_reserved")) ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrNamePatternNotAllowed(err): case models.IsErrNamePatternNotAllowed(err):
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed")) ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubURL + "/user/settings")
default: default:
ctx.Handle(500, "ChangeUserName", err) ctx.Handle(500, "ChangeUserName", err)
} }
@ -116,7 +116,7 @@ func SettingsPost(ctx *context.Context, f form.UpdateProfile) {
log.Trace("User settings updated: %s", ctx.User.Name) log.Trace("User settings updated: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.update_profile_success")) ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubURL + "/user/settings")
} }
// FIXME: limit size. // FIXME: limit size.
@ -174,7 +174,7 @@ func SettingsAvatarPost(ctx *context.Context, f form.Avatar) {
ctx.Flash.Success(ctx.Tr("settings.update_avatar_success")) ctx.Flash.Success(ctx.Tr("settings.update_avatar_success"))
} }
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar") ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
} }
func SettingsDeleteAvatar(ctx *context.Context) { func SettingsDeleteAvatar(ctx *context.Context) {
@ -182,7 +182,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
ctx.Flash.Error(err.Error()) ctx.Flash.Error(err.Error())
} }
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar") ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
} }
func SettingsPassword(ctx *context.Context) { func SettingsPassword(ctx *context.Context) {
@ -220,7 +220,7 @@ func SettingsPasswordPost(ctx *context.Context, f form.ChangePassword) {
ctx.Flash.Success(ctx.Tr("settings.change_password_success")) ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
} }
ctx.Redirect(setting.AppSubUrl + "/user/settings/password") ctx.Redirect(setting.AppSubURL + "/user/settings/password")
} }
func SettingsEmails(ctx *context.Context) { func SettingsEmails(ctx *context.Context) {
@ -249,7 +249,7 @@ func SettingsEmailPost(ctx *context.Context, f form.AddEmail) {
} }
log.Trace("Email made primary: %s", ctx.User.Name) log.Trace("Email made primary: %s", ctx.User.Name)
ctx.Redirect(setting.AppSubUrl + "/user/settings/email") ctx.Redirect(setting.AppSubURL + "/user/settings/email")
return return
} }
@ -293,7 +293,7 @@ func SettingsEmailPost(ctx *context.Context, f form.AddEmail) {
} }
log.Trace("Email address added: %s", email.Email) log.Trace("Email address added: %s", email.Email)
ctx.Redirect(setting.AppSubUrl + "/user/settings/email") ctx.Redirect(setting.AppSubURL + "/user/settings/email")
} }
func DeleteEmail(ctx *context.Context) { func DeleteEmail(ctx *context.Context) {
@ -308,7 +308,7 @@ func DeleteEmail(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("settings.email_deletion_success")) ctx.Flash.Success(ctx.Tr("settings.email_deletion_success"))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/email", "redirect": setting.AppSubURL + "/user/settings/email",
}) })
} }
@ -348,7 +348,7 @@ func SettingsSSHKeysPost(ctx *context.Context, f form.AddSSHKey) {
ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key")) ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
} else { } else {
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error())) ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
return return
} }
} }
@ -369,7 +369,7 @@ func SettingsSSHKeysPost(ctx *context.Context, f form.AddSSHKey) {
} }
ctx.Flash.Success(ctx.Tr("settings.add_key_success", f.Title)) ctx.Flash.Success(ctx.Tr("settings.add_key_success", f.Title))
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
} }
func DeleteSSHKey(ctx *context.Context) { func DeleteSSHKey(ctx *context.Context) {
@ -380,7 +380,7 @@ func DeleteSSHKey(ctx *context.Context) {
} }
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/ssh", "redirect": setting.AppSubURL + "/user/settings/ssh",
}) })
} }
@ -452,20 +452,20 @@ func SettingsTwoFactorEnablePost(c *context.Context) {
if !totp.Validate(c.Query("passcode"), secret) { if !totp.Validate(c.Query("passcode"), secret) {
c.Flash.Error(c.Tr("settings.two_factor_invalid_passcode")) c.Flash.Error(c.Tr("settings.two_factor_invalid_passcode"))
c.Redirect(setting.AppSubUrl + "/user/settings/security/two_factor_enable") c.Redirect(setting.AppSubURL + "/user/settings/security/two_factor_enable")
return return
} }
if err := models.NewTwoFactor(c.UserID(), secret); err != nil { if err := models.NewTwoFactor(c.UserID(), secret); err != nil {
c.Flash.Error(c.Tr("settings.two_factor_enable_error", err)) c.Flash.Error(c.Tr("settings.two_factor_enable_error", err))
c.Redirect(setting.AppSubUrl + "/user/settings/security/two_factor_enable") c.Redirect(setting.AppSubURL + "/user/settings/security/two_factor_enable")
return return
} }
c.Session.Delete("twoFactorSecret") c.Session.Delete("twoFactorSecret")
c.Session.Delete("twoFactorURL") c.Session.Delete("twoFactorURL")
c.Flash.Success(c.Tr("settings.two_factor_enable_success")) c.Flash.Success(c.Tr("settings.two_factor_enable_success"))
c.Redirect(setting.AppSubUrl + "/user/settings/security/two_factor_recovery_codes") c.Redirect(setting.AppSubURL + "/user/settings/security/two_factor_recovery_codes")
} }
func SettingsTwoFactorRecoveryCodes(c *context.Context) { func SettingsTwoFactorRecoveryCodes(c *context.Context) {
@ -499,7 +499,7 @@ func SettingsTwoFactorRecoveryCodesPost(c *context.Context) {
c.Flash.Success(c.Tr("settings.two_factor_regenerate_recovery_codes_success")) c.Flash.Success(c.Tr("settings.two_factor_regenerate_recovery_codes_success"))
} }
c.Redirect(setting.AppSubUrl + "/user/settings/security/two_factor_recovery_codes") c.Redirect(setting.AppSubURL + "/user/settings/security/two_factor_recovery_codes")
} }
func SettingsTwoFactorDisable(c *context.Context) { func SettingsTwoFactorDisable(c *context.Context) {
@ -515,7 +515,7 @@ func SettingsTwoFactorDisable(c *context.Context) {
c.Flash.Success(c.Tr("settings.two_factor_disable_success")) c.Flash.Success(c.Tr("settings.two_factor_disable_success"))
c.JSONSuccess(map[string]interface{}{ c.JSONSuccess(map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/security", "redirect": setting.AppSubURL + "/user/settings/security",
}) })
} }
@ -563,7 +563,7 @@ func SettingsLeaveOrganization(ctx *context.Context) {
} }
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/organizations", "redirect": setting.AppSubURL + "/user/settings/organizations",
}) })
} }
@ -581,7 +581,7 @@ func SettingsLeaveRepo(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("settings.repos.leave_success", repo.FullName())) ctx.Flash.Success(ctx.Tr("settings.repos.leave_success", repo.FullName()))
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/repositories", "redirect": setting.AppSubURL + "/user/settings/repositories",
}) })
} }
@ -612,7 +612,7 @@ func SettingsApplicationsPost(ctx *context.Context, f form.NewAccessToken) {
ctx.Flash.Success(ctx.Tr("settings.generate_token_succees")) ctx.Flash.Success(ctx.Tr("settings.generate_token_succees"))
ctx.Flash.Info(t.Sha1) ctx.Flash.Info(t.Sha1)
ctx.Redirect(setting.AppSubUrl + "/user/settings/applications") ctx.Redirect(setting.AppSubURL + "/user/settings/applications")
} }
func SettingsDeleteApplication(ctx *context.Context) { func SettingsDeleteApplication(ctx *context.Context) {
@ -623,7 +623,7 @@ func SettingsDeleteApplication(ctx *context.Context) {
} }
ctx.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/applications", "redirect": setting.AppSubURL + "/user/settings/applications",
}) })
} }
@ -659,16 +659,16 @@ func SettingsDelete(ctx *context.Context) {
switch { switch {
case models.IsErrUserOwnRepos(err): case models.IsErrUserOwnRepos(err):
ctx.Flash.Error(ctx.Tr("form.still_own_repo")) ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete") ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
case models.IsErrUserHasOrgs(err): case models.IsErrUserHasOrgs(err):
ctx.Flash.Error(ctx.Tr("form.still_has_org")) ctx.Flash.Error(ctx.Tr("form.still_has_org"))
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete") ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
default: default:
ctx.Handle(500, "DeleteUser", err) ctx.Handle(500, "DeleteUser", err)
} }
} else { } else {
log.Trace("Account deleted: %s", ctx.User.Name) log.Trace("Account deleted: %s", ctx.User.Name)
ctx.Redirect(setting.AppSubUrl + "/") ctx.Redirect(setting.AppSubURL + "/")
} }
return return
} }

6
templates/admin/auth/list.tmpl

@ -8,7 +8,7 @@
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "admin.auths.auth_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}}) {{.i18n.Tr "admin.auths.auth_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
<div class="ui right"> <div class="ui right">
<a class="ui blue tiny button" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a> <a class="ui blue tiny button" href="{{AppSubURL}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
</div> </div>
</h4> </h4>
<div class="ui attached table segment"> <div class="ui attached table segment">
@ -28,12 +28,12 @@
{{range .Sources}} {{range .Sources}}
<tr> <tr>
<td>{{.ID}}</td> <td>{{.ID}}</td>
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td> <td><a href="{{AppSubURL}}/admin/auths/{{.ID}}">{{.Name}}</a></td>
<td>{{.TypeName}}</td> <td>{{.TypeName}}</td>
<td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td> <td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td>
<td><span class="poping up" data-content="{{DateFmtLong .Updated}}" data-variation="tiny">{{DateFmtShort .Updated}}</span></td> <td><span class="poping up" data-content="{{DateFmtLong .Updated}}" data-variation="tiny">{{DateFmtShort .Updated}}</span></td>
<td><span class="poping up" data-content="{{DateFmtLong .Created}}" data-variation="tiny">{{DateFmtShort .Created}}</span></td> <td><span class="poping up" data-content="{{DateFmtLong .Created}}" data-variation="tiny">{{DateFmtShort .Created}}</span></td>
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td> <td><a href="{{AppSubURL}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>

4
templates/admin/config.tmpl

@ -15,7 +15,7 @@
<dt>{{.i18n.Tr "admin.config.app_ver"}}</dt> <dt>{{.i18n.Tr "admin.config.app_ver"}}</dt>
<dd>{{AppVer}}</dd> <dd>{{AppVer}}</dd>
<dt>{{.i18n.Tr "admin.config.app_url"}}</dt> <dt>{{.i18n.Tr "admin.config.app_url"}}</dt>
<dd>{{.AppUrl}}</dd> <dd>{{.AppURL}}</dd>
<dt>{{.i18n.Tr "admin.config.domain"}}</dt> <dt>{{.i18n.Tr "admin.config.domain"}}</dt>
<dd>{{.Domain}}</dd> <dd>{{.Domain}}</dd>
<dt>{{.i18n.Tr "admin.config.offline_mode"}}</dt> <dt>{{.i18n.Tr "admin.config.offline_mode"}}</dt>
@ -177,7 +177,7 @@
<dd>{{.Mailer.Host}}</dd> <dd>{{.Mailer.Host}}</dd>
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt> <dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
<dd>{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}</dd><br> <dd>{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}</dd><br>
<form class="ui form" action="{{AppSubUrl}}/admin/config/test_mail" method="post"> <form class="ui form" action="{{AppSubURL}}/admin/config/test_mail" method="post">
{{.CSRFTokenHTML}} {{.CSRFTokenHTML}}
<div class="inline field ui left"> <div class="inline field ui left">
<div class="ui input"> <div class="ui input">

14
templates/admin/dashboard.tmpl

@ -21,31 +21,31 @@
<tbody> <tbody>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.delete_inactivate_accounts"}}</td> <td>{{.i18n.Tr "admin.dashboard.delete_inactivate_accounts"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=1">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=1">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.delete_repo_archives"}}</td> <td>{{.i18n.Tr "admin.dashboard.delete_repo_archives"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=2">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=2">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.delete_missing_repos"}}</td> <td>{{.i18n.Tr "admin.dashboard.delete_missing_repos"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=3">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=3">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.git_gc_repos"}}</td> <td>{{.i18n.Tr "admin.dashboard.git_gc_repos"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=4">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=4">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td> <td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=5">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=5">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td> <td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=6">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=6">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
<tr> <tr>
<td>{{.i18n.Tr "admin.dashboard.reinit_missing_repos"}}</td> <td>{{.i18n.Tr "admin.dashboard.reinit_missing_repos"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=7">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubURL}}/admin?op=7">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

16
templates/admin/nav.tmpl

@ -2,14 +2,14 @@
<p class="panel-header"><strong>{{.i18n.Tr "admin_panel"}}</strong></p> <p class="panel-header"><strong>{{.i18n.Tr "admin_panel"}}</strong></p>
<div class="panel-body"> <div class="panel-body">
<ul class="menu menu-vertical switching-list grid-1-5 left"> <ul class="menu menu-vertical switching-list grid-1-5 left">
<li {{if .PageIsAdminDashboard}}class="current"{{end}}><a href="{{AppSubUrl}}/admin">{{.i18n.Tr "admin.dashboard"}}</a></li> <li {{if .PageIsAdminDashboard}}class="current"{{end}}><a href="{{AppSubURL}}/admin">{{.i18n.Tr "admin.dashboard"}}</a></li>
<li {{if .PageIsAdminUsers}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/users">{{.i18n.Tr "admin.users"}}</a></li> <li {{if .PageIsAdminUsers}}class="current"{{end}}><a href="{{AppSubURL}}/admin/users">{{.i18n.Tr "admin.users"}}</a></li>
<li {{if .PageIsAdminOrganizations}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/orgs">{{.i18n.Tr "admin.organizations"}}</a></li> <li {{if .PageIsAdminOrganizations}}class="current"{{end}}><a href="{{AppSubURL}}/admin/orgs">{{.i18n.Tr "admin.organizations"}}</a></li>
<li {{if .PageIsAdminRepositories}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/repos">{{.i18n.Tr "admin.repositories"}}</a></li> <li {{if .PageIsAdminRepositories}}class="current"{{end}}><a href="{{AppSubURL}}/admin/repos">{{.i18n.Tr "admin.repositories"}}</a></li>
<li {{if .PageIsAdminAuthentications}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/auths">{{.i18n.Tr "admin.authentication"}}</a></li> <li {{if .PageIsAdminAuthentications}}class="current"{{end}}><a href="{{AppSubURL}}/admin/auths">{{.i18n.Tr "admin.authentication"}}</a></li>
<li {{if .PageIsAdminConfig}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/config">{{.i18n.Tr "admin.config"}}</a></li> <li {{if .PageIsAdminConfig}}class="current"{{end}}><a href="{{AppSubURL}}/admin/config">{{.i18n.Tr "admin.config"}}</a></li>
<li {{if .PageIsAdminNotices}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/notices">{{.i18n.Tr "admin.notices"}}</a></li> <li {{if .PageIsAdminNotices}}class="current"{{end}}><a href="{{AppSubURL}}/admin/notices">{{.i18n.Tr "admin.notices"}}</a></li>
<li {{if .PageIsAdminMonitor}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/monitor">{{.i18n.Tr "admin.monitor"}}</a></li> <li {{if .PageIsAdminMonitor}}class="current"{{end}}><a href="{{AppSubURL}}/admin/monitor">{{.i18n.Tr "admin.monitor"}}</a></li>
</ul> </ul>
</div> </div>
</div> </div>

16
templates/admin/navbar.tmpl

@ -1,28 +1,28 @@
<div class="four wide column"> <div class="four wide column">
<div class="ui vertical menu"> <div class="ui vertical menu">
<div class="header item">{{.i18n.Tr "admin_panel"}}</div> <div class="header item">{{.i18n.Tr "admin_panel"}}</div>
<a class="{{if .PageIsAdminDashboard}}active{{end}} item" href="{{AppSubUrl}}/admin"> <a class="{{if .PageIsAdminDashboard}}active{{end}} item" href="{{AppSubURL}}/admin">
{{.i18n.Tr "admin.dashboard"}} {{.i18n.Tr "admin.dashboard"}}
</a> </a>
<a class="{{if .PageIsAdminUsers}}active{{end}} item" href="{{AppSubUrl}}/admin/users"> <a class="{{if .PageIsAdminUsers}}active{{end}} item" href="{{AppSubURL}}/admin/users">
{{.i18n.Tr "admin.users"}} {{.i18n.Tr "admin.users"}}
</a> </a>
<a class="{{if .PageIsAdminOrganizations}}active{{end}} item" href="{{AppSubUrl}}/admin/orgs"> <a class="{{if .PageIsAdminOrganizations}}active{{end}} item" href="{{AppSubURL}}/admin/orgs">
{{.i18n.Tr "admin.organizations"}} {{.i18n.Tr "admin.organizations"}}
</a> </a>
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos"> <a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubURL}}/admin/repos">
{{.i18n.Tr "admin.repositories"}} {{.i18n.Tr "admin.repositories"}}
</a> </a>
<a class="{{if .PageIsAdminAuthentications}}active{{end}} item" href="{{AppSubUrl}}/admin/auths"> <a class="{{if .PageIsAdminAuthentications}}active{{end}} item" href="{{AppSubURL}}/admin/auths">
{{.i18n.Tr "admin.authentication"}} {{.i18n.Tr "admin.authentication"}}
</a> </a>
<a class="{{if .PageIsAdminConfig}}active{{end}} item" href="{{AppSubUrl}}/admin/config"> <a class="{{if .PageIsAdminConfig}}active{{end}} item" href="{{AppSubURL}}/admin/config">
{{.i18n.Tr "admin.config"}} {{.i18n.Tr "admin.config"}}
</a> </a>
<a class="{{if .PageIsAdminNotices}}active{{end}} item" href="{{AppSubUrl}}/admin/notices"> <a class="{{if .PageIsAdminNotices}}active{{end}} item" href="{{AppSubURL}}/admin/notices">
{{.i18n.Tr "admin.notices"}} {{.i18n.Tr "admin.notices"}}
</a> </a>
<a class="{{if .PageIsAdminMonitor}}active{{end}} item" href="{{AppSubUrl}}/admin/monitor"> <a class="{{if .PageIsAdminMonitor}}active{{end}} item" href="{{AppSubURL}}/admin/monitor">
{{.i18n.Tr "admin.monitor"}} {{.i18n.Tr "admin.monitor"}}
</a> </a>
</div> </div>

2
templates/admin/notice.tmpl

@ -41,7 +41,7 @@
<th></th> <th></th>
<th colspan="5"> <th colspan="5">
<div class="ui right"> <div class="ui right">
<a class="ui red small button" href="{{AppSubUrl}}/admin/notices/empty">{{.i18n.Tr "admin.notices.delete_all"}}</a> <a class="ui red small button" href="{{AppSubURL}}/admin/notices/empty">{{.i18n.Tr "admin.notices.delete_all"}}</a>
</div> </div>
<div class="ui floating upward dropdown small button"> <div class="ui floating upward dropdown small button">
<span class="text">{{.i18n.Tr "admin.notices.actions"}}</span> <span class="text">{{.i18n.Tr "admin.notices.actions"}}</span>

2
templates/admin/org/list.tmpl

@ -33,7 +33,7 @@
<td>{{.NumMembers}}</td> <td>{{.NumMembers}}</td>
<td>{{.NumRepos}}</td> <td>{{.NumRepos}}</td>
<td><span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span></td> <td><span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span></td>
<td><a href="{{AppSubUrl}}/org/{{.Name}}/settings"><i class="fa fa-pencil-square-o"></i></a></td> <td><a href="{{AppSubURL}}/org/{{.Name}}/settings"><i class="fa fa-pencil-square-o"></i></a></td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>

4
templates/admin/repo/list.tmpl

@ -31,8 +31,8 @@
{{range .Repos}} {{range .Repos}}
<tr> <tr>
<td>{{.ID}}</td> <td>{{.ID}}</td>
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a></td> <td><a href="{{AppSubURL}}/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td> <td><a href="{{AppSubURL}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td> <td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
<td>{{.NumWatches}}</td> <td>{{.NumWatches}}</td>
<td>{{.NumStars}}</td> <td>{{.NumStars}}</td>

4
templates/admin/user/list.tmpl

@ -8,7 +8,7 @@
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "admin.users.user_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}}) {{.i18n.Tr "admin.users.user_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
<div class="ui right"> <div class="ui right">
<a class="ui black tiny button" href="{{AppSubUrl}}/admin/users/new">{{.i18n.Tr "admin.users.new_account"}}</a> <a class="ui black tiny button" href="{{AppSubURL}}/admin/users/new">{{.i18n.Tr "admin.users.new_account"}}</a>
</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
@ -32,7 +32,7 @@
{{range .Users}} {{range .Users}}
<tr> <tr>
<td>{{.ID}}</td> <td>{{.ID}}</td>
<td><a href="{{AppSubUrl}}/{{.Name}}">{{.Name}}</a></td> <td><a href="{{AppSubURL}}/{{.Name}}">{{.Name}}</a></td>
<td><span class="text truncate email">{{.Email}}</span></td> <td><span class="text truncate email">{{.Email}}</span></td>
<td><i class="fa fa{{if .IsActive}}-check{{end}}-square-o"></i></td> <td><i class="fa fa{{if .IsActive}}-check{{end}}-square-o"></i></td>
<td><i class="fa fa{{if .IsAdmin}}-check{{end}}-square-o"></i></td> <td><i class="fa fa{{if .IsAdmin}}-check{{end}}-square-o"></i></td>

20
templates/base/footer.tmpl

@ -34,23 +34,23 @@
<!-- Third-party libraries --> <!-- Third-party libraries -->
{{if .RequireHighlightJS}} {{if .RequireHighlightJS}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/highlight-9.6.0/github.css"> <link rel="stylesheet" href="{{AppSubURL}}/plugins/highlight-9.6.0/github.css">
<script src="{{AppSubUrl}}/plugins/highlight-9.6.0/highlight.pack.js"></script> <script src="{{AppSubURL}}/plugins/highlight-9.6.0/highlight.pack.js"></script>
{{end}} {{end}}
{{if .RequireMinicolors}} {{if .RequireMinicolors}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.css"> <link rel="stylesheet" href="{{AppSubURL}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.css">
<script src="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.min.js"></script> <script src="{{AppSubURL}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.min.js"></script>
{{end}} {{end}}
{{if .RequireDatetimepicker}} {{if .RequireDatetimepicker}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.css"> <link rel="stylesheet" href="{{AppSubURL}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.css">
<script src="{{AppSubUrl}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.js"></script> <script src="{{AppSubURL}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.js"></script>
{{end}} {{end}}
{{if .RequireDropzone}} {{if .RequireDropzone}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css"> <link rel="stylesheet" href="{{AppSubURL}}/plugins/dropzone-4.2.0/dropzone.css">
<script src="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.js"></script> <script src="{{AppSubURL}}/plugins/dropzone-4.2.0/dropzone.js"></script>
{{end}} {{end}}
<script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script> <script src="{{AppSubURL}}/js/libs/emojify-1.1.0.min.js"></script>
<script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script> <script src="{{AppSubURL}}/js/libs/clipboard-1.5.9.min.js"></script>
{{template "inject/footer" .}} {{template "inject/footer" .}}
</html> </html>

72
templates/base/head.tmpl

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head data-suburl="{{AppSubUrl}}"> <head data-suburl="{{AppSubURL}}">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
{{if not .PageIsAdmin}} {{if not .PageIsAdmin}}
@ -10,7 +10,7 @@
{{end}} {{end}}
<meta name="referrer" content="no-referrer" /> <meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="{{.CSRFToken}}" /> <meta name="_csrf" content="{{.CSRFToken}}" />
<meta name="_suburl" content="{{AppSubUrl}}" /> <meta name="_suburl" content="{{AppSubURL}}" />
{{if .GoGetImport}} {{if .GoGetImport}}
<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}"> <meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}"> <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
@ -31,44 +31,44 @@
<meta property="og:description" content="{{.Repository.Description}}"> <meta property="og:description" content="{{.Repository.Description}}">
<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" /> <meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
{{else}} {{else}}
<meta property="og:url" content="{{AppUrl}}" /> <meta property="og:url" content="{{AppURL}}" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="{{AppName}}"> <meta property="og:title" content="{{AppName}}">
<meta property="og:description" content="Gogs is a painless self-hosted Git service."> <meta property="og:description" content="Gogs is a painless self-hosted Git service.">
<meta property="og:image" content="{{AppUrl}}img/gogs-lg.png" /> <meta property="og:image" content="{{AppURL}}img/gogs-lg.png" />
<meta property="og:site_name" content="Gogs"> <meta property="og:site_name" content="Gogs">
{{end}} {{end}}
<link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" /> <link rel="shortcut icon" href="{{AppSubURL}}/img/favicon.png" />
<script src="{{AppSubUrl}}/js/jquery-1.11.3.min.js"></script> <script src="{{AppSubURL}}/js/jquery-1.11.3.min.js"></script>
<script src="{{AppSubUrl}}/js/libs/jquery.are-you-sure.js"></script> <script src="{{AppSubURL}}/js/libs/jquery.are-you-sure.js"></script>
<link rel="stylesheet" href="{{AppSubUrl}}/assets/font-awesome-4.6.3/css/font-awesome.min.css"> <link rel="stylesheet" href="{{AppSubURL}}/assets/font-awesome-4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="{{AppSubUrl}}/assets/octicons-4.3.0/octicons.min.css"> <link rel="stylesheet" href="{{AppSubURL}}/assets/octicons-4.3.0/octicons.min.css">
<!-- notebook.js for rendering ipython notebooks and marked.js for rendering markdown in notebooks --> <!-- notebook.js for rendering ipython notebooks and marked.js for rendering markdown in notebooks -->
{{if .IsIPythonNotebook }} {{if .IsIPythonNotebook }}
<script src="{{AppSubUrl}}/plugins/notebookjs-0.2.6/notebook.min.js"></script> <script src="{{AppSubURL}}/plugins/notebookjs-0.2.6/notebook.min.js"></script>
<script src="{{AppSubUrl}}/plugins/marked-0.3.6/marked.min.js"></script> <script src="{{AppSubURL}}/plugins/marked-0.3.6/marked.min.js"></script>
{{end}} {{end}}
{{if .RequireSimpleMDE}} {{if .RequireSimpleMDE}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/simplemde-1.10.1/simplemde.min.css"> <link rel="stylesheet" href="{{AppSubURL}}/plugins/simplemde-1.10.1/simplemde.min.css">
<script src="{{AppSubUrl}}/plugins/simplemde-1.10.1/simplemde.min.js"></script> <script src="{{AppSubURL}}/plugins/simplemde-1.10.1/simplemde.min.js"></script>
<script src="{{AppSubUrl}}/plugins/codemirror-5.17.0/addon/mode/loadmode.js"></script> <script src="{{AppSubURL}}/plugins/codemirror-5.17.0/addon/mode/loadmode.js"></script>
<script src="{{AppSubUrl}}/plugins/codemirror-5.17.0/mode/meta.js"></script> <script src="{{AppSubURL}}/plugins/codemirror-5.17.0/mode/meta.js"></script>
<script> <script>
CodeMirror.modeURL = "{{AppSubUrl}}/plugins/codemirror-5.17.0/mode/%N/%N.js"; CodeMirror.modeURL = "{{AppSubURL}}/plugins/codemirror-5.17.0/mode/%N/%N.js";
</script> </script>
{{end}} {{end}}
<!-- Stylesheet --> <!-- Stylesheet -->
<link rel="stylesheet" href="{{AppSubUrl}}/css/semantic-2.2.10.min.css"> <link rel="stylesheet" href="{{AppSubURL}}/css/semantic-2.2.10.min.css">
<link rel="stylesheet" href="{{AppSubUrl}}/css/gogs.css?v={{MD5 AppVer}}"> <link rel="stylesheet" href="{{AppSubURL}}/css/gogs.css?v={{MD5 AppVer}}">
<!-- JavaScript --> <!-- JavaScript -->
<script src="{{AppSubUrl}}/js/semantic-2.2.10.min.js"></script> <script src="{{AppSubURL}}/js/semantic-2.2.10.min.js"></script>
<script src="{{AppSubUrl}}/js/gogs.js?v={{MD5 AppVer}}"></script> <script src="{{AppSubURL}}/js/gogs.js?v={{MD5 AppVer}}"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title> <title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
@ -86,19 +86,19 @@
<div class="ui grid"> <div class="ui grid">
<div class="column"> <div class="column">
<div class="ui top secondary menu"> <div class="ui top secondary menu">
<a class="item brand" href="{{AppSubUrl}}/"> <a class="item brand" href="{{AppSubURL}}/">
<img class="ui mini image" src="{{AppSubUrl}}/img/favicon.png"> <img class="ui mini image" src="{{AppSubURL}}/img/favicon.png">
</a> </a>
{{if .IsSigned}} {{if .IsSigned}}
<a class="item{{if .PageIsDashboard}} active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "dashboard"}}</a> <a class="item{{if .PageIsDashboard}} active{{end}}" href="{{AppSubURL}}/">{{.i18n.Tr "dashboard"}}</a>
<a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> <a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubURL}}/issues">{{.i18n.Tr "issues"}}</a>
<a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> <a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubURL}}/pulls">{{.i18n.Tr "pull_requests"}}</a>
{{else}} {{else}}
<a class="item{{if .PageIsHome}} active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "home"}}</a> <a class="item{{if .PageIsHome}} active{{end}}" href="{{AppSubURL}}/">{{.i18n.Tr "home"}}</a>
{{end}} {{end}}
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "explore"}}</a> <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubURL}}/explore/repos">{{.i18n.Tr "explore"}}</a>
{{/*<div class="item"> {{/*<div class="item">
<div class="ui icon input"> <div class="ui icon input">
<input class="searchbox" type="text" placeholder="{{.i18n.Tr "search_project"}}"> <input class="searchbox" type="text" placeholder="{{.i18n.Tr "search_project"}}">
@ -114,14 +114,14 @@
<i class="octicon octicon-triangle-down"></i> <i class="octicon octicon-triangle-down"></i>
</span> </span>
<div class="menu"> <div class="menu">
<a class="item" href="{{AppSubUrl}}/repo/create"> <a class="item" href="{{AppSubURL}}/repo/create">
<i class="octicon octicon-plus"></i> {{.i18n.Tr "new_repo"}} <i class="octicon octicon-plus"></i> {{.i18n.Tr "new_repo"}}
</a> </a>
<a class="item" href="{{AppSubUrl}}/repo/migrate"> <a class="item" href="{{AppSubURL}}/repo/migrate">
<i class="octicon octicon-repo-clone"></i> {{.i18n.Tr "new_migrate"}} <i class="octicon octicon-repo-clone"></i> {{.i18n.Tr "new_migrate"}}
</a> </a>
{{if .SignedUser.CanCreateOrganization}} {{if .SignedUser.CanCreateOrganization}}
<a class="item" href="{{AppSubUrl}}/org/create"> <a class="item" href="{{AppSubURL}}/org/create">
<i class="octicon octicon-organization"></i> {{.i18n.Tr "new_org"}} <i class="octicon octicon-organization"></i> {{.i18n.Tr "new_org"}}
</a> </a>
{{end}} {{end}}
@ -140,11 +140,11 @@
</div> </div>
<div class="divider"></div> <div class="divider"></div>
<a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}"> <a class="item" href="{{AppSubURL}}/{{.SignedUser.Name}}">
<i class="octicon octicon-person"></i> <i class="octicon octicon-person"></i>
{{.i18n.Tr "your_profile"}}<!-- Your profile --> {{.i18n.Tr "your_profile"}}<!-- Your profile -->
</a> </a>
<a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubUrl}}/user/settings"> <a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubURL}}/user/settings">
<i class="octicon octicon-settings"></i> <i class="octicon octicon-settings"></i>
{{.i18n.Tr "your_settings"}}<!-- Your settings --> {{.i18n.Tr "your_settings"}}<!-- Your settings -->
</a> </a>
@ -155,14 +155,14 @@
{{if .IsAdmin}} {{if .IsAdmin}}
<div class="divider"></div> <div class="divider"></div>
<a class="{{if .PageIsAdmin}}active{{end}} item" href="{{AppSubUrl}}/admin"> <a class="{{if .PageIsAdmin}}active{{end}} item" href="{{AppSubURL}}/admin">
<i class="icon settings"></i> <i class="icon settings"></i>
{{.i18n.Tr "admin_panel"}}<!-- Admin Panel --> {{.i18n.Tr "admin_panel"}}<!-- Admin Panel -->
</a> </a>
{{end}} {{end}}
<div class="divider"></div> <div class="divider"></div>
<a class="item" href="{{AppSubUrl}}/user/logout"> <a class="item" href="{{AppSubURL}}/user/logout">
<i class="octicon octicon-sign-out"></i> <i class="octicon octicon-sign-out"></i>
{{.i18n.Tr "sign_out"}}<!-- Sign Out --> {{.i18n.Tr "sign_out"}}<!-- Sign Out -->
</a> </a>
@ -175,11 +175,11 @@
<a class="item" target="_blank" href="https://gogs.io/docs" rel="noreferrer">{{.i18n.Tr "help"}}</a> <a class="item" target="_blank" href="https://gogs.io/docs" rel="noreferrer">{{.i18n.Tr "help"}}</a>
<div class="right menu"> <div class="right menu">
{{if .ShowRegistrationButton}} {{if .ShowRegistrationButton}}
<a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up"> <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubURL}}/user/sign_up">
<i class="octicon octicon-person"></i> {{.i18n.Tr "register"}} <i class="octicon octicon-person"></i> {{.i18n.Tr "register"}}
</a> </a>
{{end}} {{end}}
<a class="item{{if .PageIsSignIn}} active{{end}}" href="{{AppSubUrl}}/user/login?redirect_to={{.Link}}"> <a class="item{{if .PageIsSignIn}} active{{end}}" href="{{AppSubURL}}/user/login?redirect_to={{.Link}}">
<i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}} <i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}}
</a> </a>
</div><!-- end anonymous right menu --> </div><!-- end anonymous right menu -->

6
templates/explore/navbar.tmpl

@ -1,13 +1,13 @@
<div class="four wide column"> <div class="four wide column">
<div class="ui vertical menu navbar"> <div class="ui vertical menu navbar">
<div class="header item">{{.i18n.Tr "explore"}}</div> <div class="header item">{{.i18n.Tr "explore"}}</div>
<a class="{{if .PageIsExploreRepositories}}active{{end}} item" href="{{AppSubUrl}}/explore/repos"> <a class="{{if .PageIsExploreRepositories}}active{{end}} item" href="{{AppSubURL}}/explore/repos">
<span class="octicon octicon-repo"></span> {{.i18n.Tr "explore.repos"}} <span class="octicon octicon-repo"></span> {{.i18n.Tr "explore.repos"}}
</a> </a>
<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users"> <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubURL}}/explore/users">
<span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}} <span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}}
</a> </a>
<a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubUrl}}/explore/organizations"> <a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubURL}}/explore/organizations">
<span class="octicon octicon-organization"></span> {{.i18n.Tr "explore.organizations"}} <span class="octicon octicon-organization"></span> {{.i18n.Tr "explore.organizations"}}
</a> </a>
</div> </div>

2
templates/explore/repo_list.tmpl

@ -2,7 +2,7 @@
{{range .Repos}} {{range .Repos}}
<div class="item"> <div class="item">
<div class="ui header"> <div class="ui header">
<a class="name" href="{{AppSubUrl}}/{{if .Owner}}{{.Owner.Name}}{{else if $.Org}}{{$.Org.Name}}{{else}}{{$.Owner.Name}}{{end}}/{{.Name}}">{{if $.PageIsExplore}}{{.Owner.Name}} / {{end}}{{.Name}}</a> <a class="name" href="{{AppSubURL}}/{{if .Owner}}{{.Owner.Name}}{{else if $.Org}}{{$.Org.Name}}{{else}}{{$.Owner.Name}}{{end}}/{{.Name}}">{{if $.PageIsExplore}}{{.Owner.Name}} / {{end}}{{.Name}}</a>
{{if .IsPrivate}} {{if .IsPrivate}}
<span class="text gold"><i class="octicon octicon-lock"></i></span> <span class="text gold"><i class="octicon octicon-lock"></i></span>
{{else if .IsFork}} {{else if .IsFork}}

2
templates/home.tmpl

@ -3,7 +3,7 @@
<div class="ui stackable middle very relaxed page grid"> <div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column"> <div class="sixteen wide center aligned centered column">
<div class="logo"> <div class="logo">
<img src="{{AppSubUrl}}/img/favicon.png" /> <img src="{{AppSubURL}}/img/favicon.png" />
</div> </div>
<div class="hero"> <div class="hero">
<h1 class="ui icon header title"> <h1 class="ui icon header title">

2
templates/install.tmpl

@ -10,7 +10,7 @@
<p>{{.i18n.Tr "install.docker_helper" "https://github.com/gogits/gogs/tree/master/docker" | Safe}}</p> <p>{{.i18n.Tr "install.docker_helper" "https://github.com/gogits/gogs/tree/master/docker" | Safe}}</p>
<form class="ui form" action="{{AppSubUrl}}/install" method="post"> <form class="ui form" action="{{AppSubURL}}/install" method="post">
<!-- Dtabase Settings --> <!-- Dtabase Settings -->
<h4 class="ui dividing header">{{.i18n.Tr "install.db_title"}}</h4> <h4 class="ui dividing header">{{.i18n.Tr "install.db_title"}}</h4>
<p>{{.i18n.Tr "install.requite_db_desc"}}</p> <p>{{.i18n.Tr "install.requite_db_desc"}}</p>

4
templates/mail/auth/activate.tmpl

@ -8,8 +8,8 @@
<body> <body>
<p>Hi <b>{{.Username}}</b>, thanks for registering at {{AppName}}!</p> <p>Hi <b>{{.Username}}</b>, thanks for registering at {{AppName}}!</p>
<p>Please click the following link to verify your e-mail address within <b>{{.ActiveCodeLives}} hours</b>:</p> <p>Please click the following link to verify your e-mail address within <b>{{.ActiveCodeLives}} hours</b>:</p>
<p><a href="{{AppUrl}}user/activate?code={{.Code}}">{{AppUrl}}user/activate?code={{.Code}}</a></p> <p><a href="{{AppURL}}user/activate?code={{.Code}}">{{AppURL}}user/activate?code={{.Code}}</a></p>
<p>Not working? Try copying and pasting it to your browser.</p> <p>Not working? Try copying and pasting it to your browser.</p>
<p>© 2017 <a target="_blank" href="{{AppUrl}}">{{AppName}}</a></p> <p>© 2017 <a target="_blank" href="{{AppURL}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

4
templates/mail/auth/activate_email.tmpl

@ -8,8 +8,8 @@
<body> <body>
<p>Hi <b>{{.Username}}</b>,</p> <p>Hi <b>{{.Username}}</b>,</p>
<p>Please click the following link to verify your email address within <b>{{.ActiveCodeLives}} hours</b>:</p> <p>Please click the following link to verify your email address within <b>{{.ActiveCodeLives}} hours</b>:</p>
<p><a href="{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}">{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}</a></p> <p><a href="{{AppURL}}user/activate_email?code={{.Code}}&email={{.Email}}">{{AppURL}}user/activate_email?code={{.Code}}&email={{.Email}}</a></p>
<p>Not working? Try copying and pasting it to your browser.</p> <p>Not working? Try copying and pasting it to your browser.</p>
<p>© 2017 <a target="_blank" href="{{AppUrl}}">{{AppName}}</a></p> <p>© 2017 <a target="_blank" href="{{AppURL}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

4
templates/mail/auth/register_notify.tmpl

@ -8,7 +8,7 @@
<body> <body>
<p>Hi <b>{{.Username}}</b>, this is your registration confirmation email for {{AppName}}!</p> <p>Hi <b>{{.Username}}</b>, this is your registration confirmation email for {{AppName}}!</p>
<p>You can now login via username: {{.Username}}.</p> <p>You can now login via username: {{.Username}}.</p>
<p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p> <p><a href="{{AppURL}}user/login">{{AppURL}}user/login</a></p>
<p>© 2017 <a target="_blank" href="{{AppUrl}}">{{AppName}}</a></p> <p>© 2017 <a target="_blank" href="{{AppURL}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

4
templates/mail/auth/reset_passwd.tmpl

@ -8,8 +8,8 @@
<body> <body>
<p>Hi <b>{{.Username}}</b>,</p> <p>Hi <b>{{.Username}}</b>,</p>
<p>Please click the following link to verify your email address within <b>{{.ResetPwdCodeLives}} hours</b>:</p> <p>Please click the following link to verify your email address within <b>{{.ResetPwdCodeLives}} hours</b>:</p>
<p><a href="{{AppUrl}}user/reset_password?code={{.Code}}">{{AppUrl}}user/reset_password?code={{.Code}}</a></p> <p><a href="{{AppURL}}user/reset_password?code={{.Code}}">{{AppURL}}user/reset_password?code={{.Code}}</a></p>
<p>Not working? Try copying and pasting it to your browser.</p> <p>Not working? Try copying and pasting it to your browser.</p>
<p>© 2017 <a target="_blank" href="{{AppUrl}}">{{AppName}}</a></p> <p>© 2017 <a target="_blank" href="{{AppURL}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

2
templates/org/create.tmpl

@ -20,7 +20,7 @@
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "org.create_org"}} {{.i18n.Tr "org.create_org"}}
</button> </button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a> <a class="ui button" href="{{AppSubURL}}/">{{.i18n.Tr "cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>

2
templates/org/home.tmpl

@ -27,7 +27,7 @@
<div class="ui eleven wide column"> <div class="ui eleven wide column">
{{if .IsOrganizationOwner}} {{if .IsOrganizationOwner}}
<div class="text right"> <div class="text right">
<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "new_repo"}}</a> <a class="ui green button" href="{{AppSubURL}}/repo/create?org={{.Org.ID}}"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "new_repo"}}</a>
</div> </div>
<div class="ui divider"></div> <div class="ui divider"></div>
{{end}} {{end}}

4
templates/org/settings/webhook_new.tmpl

@ -10,9 +10,9 @@
{{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}} {{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}}
<div class="ui right"> <div class="ui right">
{{if eq .HookType "gogs"}} {{if eq .HookType "gogs"}}
<img class="img-13" src="{{AppSubUrl}}/img/favicon.png"> <img class="img-13" src="{{AppSubURL}}/img/favicon.png">
{{else}} {{else}}
<img class="img-13" src="{{AppSubUrl}}/img/{{.HookType}}.png"> <img class="img-13" src="{{AppSubURL}}/img/{{.HookType}}.png">
{{end}} {{end}}
</div> </div>
</h4> </h4>

2
templates/org/team/repositories.tmpl

@ -16,7 +16,7 @@
{{if $canAddRemove}} {{if $canAddRemove}}
<a class="ui red small button right" href="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove?repoid={{.ID}}">{{$.i18n.Tr "org.teams.remove_repo"}}</a> <a class="ui red small button right" href="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove?repoid={{.ID}}">{{$.i18n.Tr "org.teams.remove_repo"}}</a>
{{end}} {{end}}
<a class="member" href="{{AppSubUrl}}/{{$.Org.Name}}/{{.Name}}"> <a class="member" href="{{AppSubURL}}/{{$.Org.Name}}/{{.Name}}">
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i> <i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
<strong>{{$.Org.Name}}/{{.Name}}</strong> <strong>{{$.Org.Name}}/{{.Name}}</strong>
</a> </a>

4
templates/repo/commits_table.tmpl

@ -34,7 +34,7 @@
<tr> <tr>
<td class="author"> <td class="author">
{{if .User}} {{if .User}}
<img class="ui avatar image" src="{{.User.RelAvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a> <img class="ui avatar image" src="{{.User.RelAvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubURL}}/{{.User.Name}}">{{.Author.Name}}</a>
{{else}} {{else}}
<img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}} <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
{{end}} {{end}}
@ -45,7 +45,7 @@
{{if not (and $.Username $.Reponame)}} {{if not (and $.Username $.Reponame)}}
<span class="ui sha label">{{ShortSHA1 .ID.String}}</span> <span class="ui sha label">{{ShortSHA1 .ID.String}}</span>
{{else}} {{else}}
<a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSHA1 .ID.String}}</a> <a rel="nofollow" class="ui sha label" href="{{AppSubURL}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSHA1 .ID.String}}</a>
{{end}} {{end}}
<span {{if gt .ParentCount 1}}class="grey text"{{end}}>{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}}</span> <span {{if gt .ParentCount 1}}class="grey text"{{end}}>{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}}</span>
</td> </td>

2
templates/repo/create.tmpl

@ -106,7 +106,7 @@
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.create_repo"}} {{.i18n.Tr "repo.create_repo"}}
</button> </button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a> <a class="ui button" href="{{AppSubURL}}/">{{.i18n.Tr "cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>

4
templates/repo/editor/edit.tmpl

@ -30,13 +30,13 @@
<div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff"> <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
<a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.editor.new_file"}}{{else}}{{.i18n.Tr "repo.editor.edit_file"}}{{end}}</a> <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.editor.new_file"}}{{else}}{{.i18n.Tr "repo.editor.edit_file"}}{{end}}</a>
{{if not .IsNewFile}} {{if not .IsNewFile}}
<a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchName}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a> <a class="item" data-tab="preview" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchName}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a>
<a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.editor.preview_changes"}}</a> <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.editor.preview_changes"}}</a>
{{end}} {{end}}
</div> </div>
<div class="ui bottom attached active tab segment" data-tab="write"> <div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
data-url="{{AppSubUrl}}/api/v1/markdown" data-url="{{AppSubURL}}/api/v1/markdown"
data-context="{{.RepoLink}}" data-context="{{.RepoLink}}"
data-markdown-file-exts="{{.MarkdownFileExts}}" data-markdown-file-exts="{{.MarkdownFileExts}}"
data-line-wrap-extensions="{{.LineWrapExtensions}}"> data-line-wrap-extensions="{{.LineWrapExtensions}}">

4
templates/repo/forks.tmpl

@ -10,9 +10,9 @@
<div class="item"> <div class="item">
<img class="ui avatar image" src="{{.Owner.RelAvatarLink}}"> <img class="ui avatar image" src="{{.Owner.RelAvatarLink}}">
<div class="link"> <div class="link">
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a> <a href="{{AppSubURL}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
/ /
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a> <a href="{{AppSubURL}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a>
</div> </div>
</div> </div>
{{end}} {{end}}

4
templates/repo/header.tmpl

@ -6,7 +6,7 @@
<div class="ui header"> <div class="ui header">
<div class="ui huge breadcrumb"> <div class="ui huge breadcrumb">
<i class="mega-octicon octicon-{{if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else if .IsFork}}repo-forked{{else}}repo{{end}}"></i> <i class="mega-octicon octicon-{{if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else if .IsFork}}repo-forked{{else}}repo{{end}}"></i>
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a> <a href="{{AppSubURL}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
<div class="divider"> / </div> <div class="divider"> / </div>
<a href="{{$.RepoLink}}">{{.Name}}</a> <a href="{{$.RepoLink}}">{{.Name}}</a>
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}} {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}}
@ -33,7 +33,7 @@
</div> </div>
{{if .CanBeForked}} {{if .CanBeForked}}
<div class="ui labeled button" tabindex="0"> <div class="ui labeled button" tabindex="0">
<a class="ui basic button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" href="{{AppSubUrl}}/repo/fork/{{.ID}}"> <a class="ui basic button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" href="{{AppSubURL}}/repo/fork/{{.ID}}">
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a> </a>
<a class="ui basic label" href="{{.Link}}/forks"> <a class="ui basic label" href="{{.Link}}/forks">

6
templates/repo/issue/comment_tab.tmpl

@ -1,10 +1,10 @@
<div class="field"> <div class="field">
<div class="ui top attached tabular menu" data-write="write" data-preview="preview"> <div class="ui top attached tabular menu" data-write="write" data-preview="preview">
<a class="active item" data-tab="write">{{.i18n.Tr "repo.release.write"}}</a> <a class="active item" data-tab="write">{{.i18n.Tr "repo.release.write"}}</a>
<a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a> <a class="item" data-tab="preview" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a>
</div> </div>
<div class="ui bottom attached active tab segment" data-tab="write"> <div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="content" class="edit_area" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}"> <textarea id="content" class="edit_area" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}">
{{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea> {{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
</div> </div>
<div class="ui bottom attached tab segment markdown" data-tab="preview"> <div class="ui bottom attached tab segment markdown" data-tab="preview">
@ -13,5 +13,5 @@
</div> </div>
{{if .IsAttachmentEnabled}} {{if .IsAttachmentEnabled}}
<div class="files"></div> <div class="files"></div>
<div class="ui basic button dropzone" id="dropzone" data-upload-url="{{AppSubUrl}}/issues/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="{{.AttachmentMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div> <div class="ui basic button dropzone" id="dropzone" data-upload-url="{{AppSubURL}}/issues/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="{{.AttachmentMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div>
{{end}} {{end}}

10
templates/repo/issue/view_content.tmpl

@ -41,9 +41,9 @@
<div class="ui bottom attached segment"> <div class="ui bottom attached segment">
<div class="ui small images"> <div class="ui small images">
{{range .Issue.Attachments}} {{range .Issue.Attachments}}
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"> <a target="_blank" href="{{AppSubURL}}/attachments/{{.UUID}}">
{{if FilenameIsImage .Name}} {{if FilenameIsImage .Name}}
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> <img class="ui image" src="{{AppSubURL}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
{{else}} {{else}}
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span> <span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
{{end}} {{end}}
@ -102,9 +102,9 @@
<div class="ui bottom attached segment"> <div class="ui bottom attached segment">
<div class="ui small images"> <div class="ui small images">
{{range .Attachments}} {{range .Attachments}}
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"> <a target="_blank" href="{{AppSubURL}}/attachments/{{.UUID}}">
{{if FilenameIsImage .Name}} {{if FilenameIsImage .Name}}
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> <img class="ui image" src="{{AppSubURL}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
{{else}} {{else}}
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span> <span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
{{end}} {{end}}
@ -361,7 +361,7 @@
<div class="ui comment form"> <div class="ui comment form">
<div class="ui top attached tabular menu"> <div class="ui top attached tabular menu">
<a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a> <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a> <a class="preview item" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
</div> </div>
<div class="ui bottom attached active write tab segment"> <div class="ui bottom attached active write tab segment">
<textarea tabindex="1" id="content" name="content"></textarea> <textarea tabindex="1" id="content" name="content"></textarea>

2
templates/repo/migrate.tmpl

@ -97,7 +97,7 @@
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.migrate_repo"}} {{.i18n.Tr "repo.migrate_repo"}}
</button> </button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a> <a class="ui button" href="{{AppSubURL}}/">{{.i18n.Tr "cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>

4
templates/repo/pulls/fork.tmpl

@ -37,7 +37,7 @@
<div class="inline field"> <div class="inline field">
<label>{{.i18n.Tr "repo.fork_from"}}</label> <label>{{.i18n.Tr "repo.fork_from"}}</label>
<a href="{{AppSubUrl}}/{{.ForkFrom}}">{{.ForkFrom}}</a> <a href="{{AppSubURL}}/{{.ForkFrom}}">{{.ForkFrom}}</a>
</div> </div>
<div class="inline required field {{if .Err_RepoName}}error{{end}}"> <div class="inline required field {{if .Err_RepoName}}error{{end}}">
<label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
@ -61,7 +61,7 @@
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.fork_repo"}} {{.i18n.Tr "repo.fork_repo"}}
</button> </button>
<a class="ui button" href="{{AppSubUrl}}/{{.ForkFrom}}">{{.i18n.Tr "cancel"}}</a> <a class="ui button" href="{{AppSubURL}}/{{.ForkFrom}}">{{.i18n.Tr "cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>

4
templates/repo/release/list.tmpl

@ -40,7 +40,7 @@
<p class="text grey"> <p class="text grey">
<span class="author"> <span class="author">
<img class="img-10" src="{{.Publisher.RelAvatarLink}}"> <img class="img-10" src="{{.Publisher.RelAvatarLink}}">
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.DisplayName}}</a> <a href="{{AppSubURL}}/{{.Publisher.Name}}">{{.Publisher.DisplayName}}</a>
</span> </span>
{{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}} {{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}}
<span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span> <span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span>
@ -53,7 +53,7 @@
<ul class="list"> <ul class="list">
{{range .Attachments}} {{range .Attachments}}
<li> <li>
<i class="octicon octicon-package"></i> <a href="{{AppSubUrl}}/attachments/{{.UUID}}" rel="nofollow">{{.Name}}</a> <i class="octicon octicon-package"></i> <a href="{{AppSubURL}}/attachments/{{.UUID}}" rel="nofollow">{{.Name}}</a>
</li> </li>
{{end}} {{end}}
{{if not .IsDraft}} {{if not .IsDraft}}

4
templates/repo/release/new.tmpl

@ -55,7 +55,7 @@
{{range .attachments}} {{range .attachments}}
<tr> <tr>
<td> <td>
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}" rel="nofollow">{{.Name}}</a> <a target="_blank" href="{{AppSubURL}}/attachments/{{.UUID}}" rel="nofollow">{{.Name}}</a>
<a class="ui text red right delete-attachment-button" href="#"><i class="octicon octicon-x" data-uuid="{{.UUID}}"></i></a> <a class="ui text red right delete-attachment-button" href="#"><i class="octicon octicon-x" data-uuid="{{.UUID}}"></i></a>
<input name="files" type="hidden" value="{{.UUID}}"> <input name="files" type="hidden" value="{{.UUID}}">
</td> </td>
@ -67,7 +67,7 @@
</div> </div>
{{if .IsAttachmentEnabled}} {{if .IsAttachmentEnabled}}
<div class="files"></div> <div class="files"></div>
<div class="ui basic button dropzone" id="dropzone" data-upload-url="{{AppSubUrl}}/releases/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="{{.AttachmentMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div> <div class="ui basic button dropzone" id="dropzone" data-upload-url="{{AppSubURL}}/releases/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="{{.AttachmentMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div>
{{end}} {{end}}
</div> </div>
<div class="ui container"> <div class="ui container">

2
templates/repo/settings/collaboration.tmpl

@ -13,7 +13,7 @@
{{range .Collaborators}} {{range .Collaborators}}
<div class="item ui grid"> <div class="item ui grid">
<div class="ui five wide column"> <div class="ui five wide column">
<a href="{{AppSubUrl}}/{{.Name}}"> <a href="{{AppSubURL}}/{{.Name}}">
<img class="ui avatar image" src="{{.RelAvatarLink}}"> <img class="ui avatar image" src="{{.RelAvatarLink}}">
{{.DisplayName}} {{.DisplayName}}
</a> </a>

2
templates/repo/settings/deploy_keys.tmpl

@ -45,7 +45,7 @@
{{end}} {{end}}
</div> </div>
<br> <br>
<p>{{.i18n.Tr "repo.settings.deploy_keys_helper" AppSubUrl "/user/settings/ssh" | Safe}}</p> <p>{{.i18n.Tr "repo.settings.deploy_keys_helper" AppSubURL "/user/settings/ssh" | Safe}}</p>
<div {{if not .HasError}}class="hide"{{end}} id="add-deploy-key-panel"> <div {{if not .HasError}}class="hide"{{end}} id="add-deploy-key-panel">
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "repo.settings.add_deploy_key"}} {{.i18n.Tr "repo.settings.add_deploy_key"}}

6
templates/repo/settings/webhook/list.tmpl

@ -10,15 +10,15 @@
{{range .Types}} {{range .Types}}
{{if eq . "gogs"}} {{if eq . "gogs"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/gogs/new"> <a class="item" href="{{$.BaseLink}}/settings/hooks/gogs/new">
<img class="img-12" src="{{AppSubUrl}}/img/favicon.png">Gogs <img class="img-12" src="{{AppSubURL}}/img/favicon.png">Gogs
</a> </a>
{{else if eq . "slack"}} {{else if eq . "slack"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/slack/new"> <a class="item" href="{{$.BaseLink}}/settings/hooks/slack/new">
<img class="img-12" src="{{AppSubUrl}}/img/slack.png">Slack <img class="img-12" src="{{AppSubURL}}/img/slack.png">Slack
</a> </a>
{{else if eq . "discord"}} {{else if eq . "discord"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/discord/new"> <a class="item" href="{{$.BaseLink}}/settings/hooks/discord/new">
<img class="img-12" src="{{AppSubUrl}}/img/discord.png">Discord <img class="img-12" src="{{AppSubURL}}/img/discord.png">Discord
</a> </a>
{{end}} {{end}}
{{end}} {{end}}

4
templates/repo/settings/webhook/new.tmpl

@ -10,9 +10,9 @@
{{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}} {{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}}
<div class="ui right"> <div class="ui right">
{{if eq .HookType "gogs"}} {{if eq .HookType "gogs"}}
<img class="img-13" src="{{AppSubUrl}}/img/favicon.png"> <img class="img-13" src="{{AppSubURL}}/img/favicon.png">
{{else}} {{else}}
<img class="img-13" src="{{AppSubUrl}}/img/{{.HookType}}.png"> <img class="img-13" src="{{AppSubURL}}/img/{{.HookType}}.png">
{{end}} {{end}}
</div> </div>
</h4> </h4>

2
templates/repo/view_file.tmpl

@ -67,7 +67,7 @@
<strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong> <strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong>
</video> </video>
{{else if .IsPDFFile}} {{else if .IsPDFFile}}
<iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe> <iframe width="100%" height="600px" src="{{AppSubURL}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
{{else}} {{else}}
<a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a> <a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
{{end}} {{end}}

4
templates/repo/view_list.tmpl

@ -4,7 +4,7 @@
<th class="four wide"> <th class="four wide">
{{if .LatestCommitUser}} {{if .LatestCommitUser}}
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" /> <img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" />
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></a> <a href="{{AppSubURL}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></a>
{{else}} {{else}}
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" /> <img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
<strong>{{.LatestCommit.Author.Name}}</strong> <strong>{{.LatestCommit.Author.Name}}</strong>
@ -30,7 +30,7 @@
{{if $entry.IsSubModule}} {{if $entry.IsSubModule}}
<td> <td>
<span class="octicon octicon-file-submodule"></span> <span class="octicon octicon-file-submodule"></span>
{{$refURL := $commit.RefURL AppUrl $.BranchLink}} {{$refURL := $commit.RefURL AppURL $.BranchLink}}
{{if $refURL}} {{if $refURL}}
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSHA1 $commit.RefID}}</a> <a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSHA1 $commit.RefID}}</a>
{{else}} {{else}}

2
templates/repo/wiki/new.tmpl

@ -18,7 +18,7 @@
<input name="title" value="{{.title}}" autofocus required> <input name="title" value="{{.title}}" autofocus required>
</div> </div>
<div class="field"> <div class="field">
<textarea id="edit_area" name="content" data-id="wiki-{{.old_title}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea required> <textarea id="edit_area" name="content" data-id="wiki-{{.old_title}}" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{.RepoLink}}">{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea required>
</div> </div>
<div class="field"> <div class="field">
<input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}"> <input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}">

2
templates/status/404.tmpl

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="ui container center"> <div class="ui container center">
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p> <p style="margin-top: 100px"><img src="{{AppSubURL}}/img/404.png" alt="404"/></p>
<div class="ui divider"></div> <div class="ui divider"></div>
<br> <br>
{{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}} {{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}

2
templates/status/500.tmpl

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="ui container center"> <div class="ui container center">
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/500.png" alt="500"/></p> <p style="margin-top: 100px"><img src="{{AppSubURL}}/img/500.png" alt="500"/></p>
<div class="ui divider"></div> <div class="ui divider"></div>
<br> <br>
{{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}} {{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}}

2
templates/user/auth/activate.tmpl

@ -2,7 +2,7 @@
<div class="user activate"> <div class="user activate">
<div class="ui middle very relaxed page grid"> <div class="ui middle very relaxed page grid">
<div class="column"> <div class="column">
<form class="ui form" action="{{AppSubUrl}}/user/activate" method="post"> <form class="ui form" action="{{AppSubURL}}/user/activate" method="post">
{{.CSRFTokenHTML}} {{.CSRFTokenHTML}}
<h2 class="ui top attached header"> <h2 class="ui top attached header">
{{.i18n.Tr "auth.active_your_account"}} {{.i18n.Tr "auth.active_your_account"}}

4
templates/user/auth/login.tmpl

@ -28,12 +28,12 @@
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<button class="ui green button">{{.i18n.Tr "sign_in"}}</button> <button class="ui green button">{{.i18n.Tr "sign_in"}}</button>
<a href="{{AppSubUrl}}/user/forget_password">{{.i18n.Tr "auth.forget_password"}}</a> <a href="{{AppSubURL}}/user/forget_password">{{.i18n.Tr "auth.forget_password"}}</a>
</div> </div>
{{if .ShowRegistrationButton}} {{if .ShowRegistrationButton}}
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a> <a href="{{AppSubURL}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>

2
templates/user/auth/signup.tmpl

@ -45,7 +45,7 @@
</div> </div>
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_hepler_msg"}}</a> <a href="{{AppSubURL}}/user/login">{{.i18n.Tr "auth.register_hepler_msg"}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>

2
templates/user/auth/two_factor.tmpl

@ -19,7 +19,7 @@
<button class="ui fluid green button">{{.i18n.Tr "settings.two_factor_verify"}}</button> <button class="ui fluid green button">{{.i18n.Tr "settings.two_factor_verify"}}</button>
</div> </div>
<p> <p>
<a href="{{AppSubUrl}}/user/login/two_factor_recovery_code">{{.i18n.Tr "auth.login_two_factor_enter_recovery_code"}}</a> <a href="{{AppSubURL}}/user/login/two_factor_recovery_code">{{.i18n.Tr "auth.login_two_factor_enter_recovery_code"}}</a>
</p> </p>
</form> </form>
</div> </div>

2
templates/user/auth/two_factor_recovery_code.tmpl

@ -19,7 +19,7 @@
<button class="ui fluid green button">{{.i18n.Tr "settings.two_factor_verify"}}</button> <button class="ui fluid green button">{{.i18n.Tr "settings.two_factor_verify"}}</button>
</div> </div>
<p> <p>
<a href="{{AppSubUrl}}/user/login/two_factor">{{.i18n.Tr "auth.login_two_factor_enter_passcode"}}</a> <a href="{{AppSubURL}}/user/login/two_factor">{{.i18n.Tr "auth.login_two_factor_enter_passcode"}}</a>
</p> </p>
</form> </form>
</div> </div>

14
templates/user/dashboard/dashboard.tmpl

@ -21,7 +21,7 @@
<div class="ui top attached header"> <div class="ui top attached header">
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.RepoCount}}</span> {{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.RepoCount}}</span>
<div class="ui right"> <div class="ui right">
<a class="poping up" href="{{AppSubUrl}}/repo/create{{if .ContextUser.IsOrganization}}?org={{.ContextUser.ID}}{{end}}" data-content="{{.i18n.Tr "new_repo"}}" data-variation="tiny inverted" data-position="left center"> <a class="poping up" href="{{AppSubURL}}/repo/create{{if .ContextUser.IsOrganization}}?org={{.ContextUser.ID}}{{end}}" data-content="{{.i18n.Tr "new_repo"}}" data-variation="tiny inverted" data-position="left center">
<i class="plus icon"></i> <i class="plus icon"></i>
<span class="sr-only">{{.i18n.Tr "new_repo"}}</span> <span class="sr-only">{{.i18n.Tr "new_repo"}}</span>
</a> </a>
@ -31,7 +31,7 @@
<ul class="repo-owner-name-list"> <ul class="repo-owner-name-list">
{{range .Repos}} {{range .Repos}}
<li {{if .IsPrivate}}class="private"{{end}}> <li {{if .IsPrivate}}class="private"{{end}}>
<a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}"> <a href="{{AppSubURL}}/{{$.ContextUser.Name}}/{{.Name}}">
<i class="octicon octicon-{{if .IsFork}}repo-forked{{else if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i> <i class="octicon octicon-{{if .IsFork}}repo-forked{{else if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
<strong class="text truncate item-name">{{.Name}}</strong> <strong class="text truncate item-name">{{.Name}}</strong>
<span class="ui right text light grey"> <span class="ui right text light grey">
@ -56,7 +56,7 @@
<ul id="collaborative-repo-list"> <ul id="collaborative-repo-list">
{{range .CollaborativeRepos}} {{range .CollaborativeRepos}}
<li {{if .IsPrivate}}class="private"{{end}}> <li {{if .IsPrivate}}class="private"{{end}}>
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}"> <a href="{{AppSubURL}}/{{.Owner.Name}}/{{.Name}}">
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i> <i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
<span class="text truncate owner-and-repo"> <span class="text truncate owner-and-repo">
<span class="text truncate owner-name">{{.Owner.Name}}</span> / <strong>{{.Name}}</strong> <span class="text truncate owner-name">{{.Owner.Name}}</span> / <strong>{{.Name}}</strong>
@ -77,7 +77,7 @@
<div class="ui top attached header"> <div class="ui top attached header">
{{.i18n.Tr "home.my_orgs"}} <span class="ui grey label">{{.ContextUser.GetOrganizationCount}}</span> {{.i18n.Tr "home.my_orgs"}} <span class="ui grey label">{{.ContextUser.GetOrganizationCount}}</span>
<div class="ui right"> <div class="ui right">
<a class="poping up" href="{{AppSubUrl}}/org/create" data-content="{{.i18n.Tr "new_org"}}" data-variation="tiny inverted" data-position="left center"> <a class="poping up" href="{{AppSubURL}}/org/create" data-content="{{.i18n.Tr "new_org"}}" data-variation="tiny inverted" data-position="left center">
<i class="plus icon"></i> <i class="plus icon"></i>
<span class="sr-only">{{.i18n.Tr "new_org"}}</span> <span class="sr-only">{{.i18n.Tr "new_org"}}</span>
</a> </a>
@ -87,7 +87,7 @@
<ul class="repo-owner-name-list"> <ul class="repo-owner-name-list">
{{range .ContextUser.Orgs}} {{range .ContextUser.Orgs}}
<li> <li>
<a href="{{AppSubUrl}}/{{.Name}}"> <a href="{{AppSubURL}}/{{.Name}}">
<i class="octicon octicon-organization"></i> <i class="octicon octicon-organization"></i>
<strong class="text truncate item-name">{{.Name}}</strong> <strong class="text truncate item-name">{{.Name}}</strong>
<span class="ui right text light grey"> <span class="ui right text light grey">
@ -105,7 +105,7 @@
<div class="ui top attached header"> <div class="ui top attached header">
{{.i18n.Tr "home.my_mirrors"}} <span class="ui grey label">{{.MirrorCount}}</span> {{.i18n.Tr "home.my_mirrors"}} <span class="ui grey label">{{.MirrorCount}}</span>
<div class="ui right"> <div class="ui right">
<a class="poping up" href="{{AppSubUrl}}/repo/migrate?mirror=1" data-content="{{.i18n.Tr "new_mirror"}}" data-variation="tiny inverted" data-position="left center"> <a class="poping up" href="{{AppSubURL}}/repo/migrate?mirror=1" data-content="{{.i18n.Tr "new_mirror"}}" data-variation="tiny inverted" data-position="left center">
<i class="plus icon"></i> <i class="plus icon"></i>
<span class="sr-only">{{.i18n.Tr "new_mirror"}}</span> <span class="sr-only">{{.i18n.Tr "new_mirror"}}</span>
</a> </a>
@ -115,7 +115,7 @@
<ul class="repo-owner-name-list"> <ul class="repo-owner-name-list">
{{range .Mirrors}} {{range .Mirrors}}
<li {{if .IsPrivate}}class="private"{{end}}> <li {{if .IsPrivate}}class="private"{{end}}>
<a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}"> <a href="{{AppSubURL}}/{{$.ContextUser.Name}}/{{.Name}}">
<i class="octicon octicon-repo-clone"></i> <i class="octicon octicon-repo-clone"></i>
<strong class="text truncate item-name">{{.Name}}</strong> <strong class="text truncate item-name">{{.Name}}</strong>
<span class="ui right text light grey"> <span class="ui right text light grey">

4
templates/user/dashboard/feeds.tmpl

@ -7,7 +7,7 @@
<div class="ui fifteen wide column"> <div class="ui fifteen wide column">
<div class="{{if eq .GetOpType 5}}push news{{end}}"> <div class="{{if eq .GetOpType 5}}push news{{end}}">
<p> <p>
<a href="{{AppSubUrl}}/{{.GetActUserName}}">{{.ShortActUserName}}</a> <a href="{{AppSubURL}}/{{.GetActUserName}}">{{.ShortActUserName}}</a>
<!-- Reference types to models/action.go --> <!-- Reference types to models/action.go -->
{{if eq .GetOpType 1}} {{if eq .GetOpType 1}}
{{$.i18n.Tr "action.create_repo" .GetRepoLink .ShortRepoPath | Str2html}} {{$.i18n.Tr "action.create_repo" .GetRepoLink .ShortRepoPath | Str2html}}
@ -65,7 +65,7 @@
<li><img class="img-8" src="{{$push.AvatarLink .AuthorEmail}}"> <a class="commit-id" href="{{$repoLink}}/commit/{{.Sha1}}">{{ShortSHA1 .Sha1}}</a> <span class="text truncate light grey has-emoji">{{.Message}}</span></li> <li><img class="img-8" src="{{$push.AvatarLink .AuthorEmail}}"> <a class="commit-id" href="{{$repoLink}}/commit/{{.Sha1}}">{{ShortSHA1 .Sha1}}</a> <span class="text truncate light grey has-emoji">{{.Message}}</span></li>
{{end}} {{end}}
{{end}} {{end}}
{{if and (gt $push.Len 1) $push.CompareURL}}<li><a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}} {{if and (gt $push.Len 1) $push.CompareURL}}<li><a href="{{AppSubURL}}/{{$push.CompareURL}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}}
</ul> </ul>
</div> </div>
{{else if eq .GetOpType 6}} {{else if eq .GetOpType 6}}

2
templates/user/dashboard/issues.tmpl

@ -68,7 +68,7 @@
{{ $timeStr:= TimeSince .Created $.Lang }} {{ $timeStr:= TimeSince .Created $.Lang }}
<li class="item"> <li class="item">
<div class="ui label">{{if not $.RepoID}}{{.Repo.FullName}}{{end}}#{{.Index}}</div> <div class="ui label">{{if not $.RepoID}}{{.Repo.FullName}}{{end}}#{{.Index}}</div>
<a class="title has-emoji" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Title}}</a> <a class="title has-emoji" href="{{AppSubURL}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Title}}</a>
{{if .NumComments}} {{if .NumComments}}
<span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span> <span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span>

12
templates/user/dashboard/navbar.tmpl

@ -10,18 +10,18 @@
{{.i18n.Tr "home.switch_dashboard_context"}} {{.i18n.Tr "home.switch_dashboard_context"}}
</div> </div>
<div class="items"> <div class="items">
<a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{end}}"> <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item" href="{{AppSubURL}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{end}}">
<img class="ui avatar image" src="{{.SignedUser.RelAvatarLink}}"> <img class="ui avatar image" src="{{.SignedUser.RelAvatarLink}}">
{{.SignedUser.Name}} {{.SignedUser.Name}}
</a> </a>
{{range .Orgs}} {{range .Orgs}}
<a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" href="{{AppSubUrl}}/org/{{.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else}}dashboard{{end}}"> <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" href="{{AppSubURL}}/org/{{.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else}}dashboard{{end}}">
<img class="ui avatar image" src="{{.RelAvatarLink}}"> <img class="ui avatar image" src="{{.RelAvatarLink}}">
{{.ShortName 20}} {{.ShortName 20}}
</a> </a>
{{end}} {{end}}
</div> </div>
<a class="item" href="{{AppSubUrl}}/org/create"> <a class="item" href="{{AppSubURL}}/org/create">
<i class="octicon octicon-plus"></i>&nbsp;&nbsp;&nbsp;{{.i18n.Tr "new_org"}} <i class="octicon octicon-plus"></i>&nbsp;&nbsp;&nbsp;{{.i18n.Tr "new_org"}}
</a> </a>
</div> </div>
@ -30,13 +30,13 @@
{{if .ContextUser.IsOrganization}} {{if .ContextUser.IsOrganization}}
<div class="ui right"> <div class="ui right">
<div class="ui secondary head menu"> <div class="ui secondary head menu">
<a class="{{if .PageIsNews}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/dashboard"> <a class="{{if .PageIsNews}}active{{end}} item" href="{{AppSubURL}}/org/{{.ContextUser.Name}}/dashboard">
<i class="octicon octicon-rss"></i>&nbsp;{{.i18n.Tr "activities"}} <i class="octicon octicon-rss"></i>&nbsp;{{.i18n.Tr "activities"}}
</a> </a>
<a class="{{if .PageIsIssues}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/issues"> <a class="{{if .PageIsIssues}}active{{end}} item" href="{{AppSubURL}}/org/{{.ContextUser.Name}}/issues">
<i class="octicon octicon-issue-opened"></i>&nbsp;{{.i18n.Tr "issues"}} <i class="octicon octicon-issue-opened"></i>&nbsp;{{.i18n.Tr "issues"}}
</a> </a>
<a class="{{if .PageIsPulls}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/pulls"> <a class="{{if .PageIsPulls}}active{{end}} item" href="{{AppSubURL}}/org/{{.ContextUser.Name}}/pulls">
<i class="octicon octicon-git-pull-request"></i>&nbsp;{{.i18n.Tr "pull_requests"}} <i class="octicon octicon-git-pull-request"></i>&nbsp;{{.i18n.Tr "pull_requests"}}
</a> </a>
<div class="right menu"> <div class="right menu">

2
templates/user/profile.tmpl

@ -5,7 +5,7 @@
<div class="ui five wide column"> <div class="ui five wide column">
<div class="ui card"> <div class="ui card">
{{if eq .SignedUserName .Owner.Name}} {{if eq .SignedUserName .Owner.Name}}
<a class="image poping up" href="{{AppSubUrl}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center"> <a class="image poping up" href="{{AppSubURL}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center">
<img src="{{.Owner.RelAvatarLink}}?s=290" title="{{.Owner.Name}}"/> <img src="{{.Owner.RelAvatarLink}}?s=290" title="{{.Owner.Name}}"/>
</a> </a>
{{else}} {{else}}

20
templates/user/settings/navbar.tmpl

@ -1,34 +1,34 @@
<div class="four wide column"> <div class="four wide column">
<div class="ui vertical menu"> <div class="ui vertical menu">
<div class="header item">{{.i18n.Tr "settings"}}</div> <div class="header item">{{.i18n.Tr "settings"}}</div>
<a class="{{if .PageIsSettingsProfile}}active{{end}} item" href="{{AppSubUrl}}/user/settings"> <a class="{{if .PageIsSettingsProfile}}active{{end}} item" href="{{AppSubURL}}/user/settings">
{{.i18n.Tr "settings.profile"}} {{.i18n.Tr "settings.profile"}}
</a> </a>
<a class="{{if .PageIsSettingsAvatar}}active{{end}} item" href="{{AppSubUrl}}/user/settings/avatar"> <a class="{{if .PageIsSettingsAvatar}}active{{end}} item" href="{{AppSubURL}}/user/settings/avatar">
{{.i18n.Tr "settings.avatar"}} {{.i18n.Tr "settings.avatar"}}
</a> </a>
<a class="{{if .PageIsSettingsPassword}}active{{end}} item" href="{{AppSubUrl}}/user/settings/password"> <a class="{{if .PageIsSettingsPassword}}active{{end}} item" href="{{AppSubURL}}/user/settings/password">
{{.i18n.Tr "settings.password"}} {{.i18n.Tr "settings.password"}}
</a> </a>
<a class="{{if .PageIsSettingsEmails}}active{{end}} item" href="{{AppSubUrl}}/user/settings/email"> <a class="{{if .PageIsSettingsEmails}}active{{end}} item" href="{{AppSubURL}}/user/settings/email">
{{.i18n.Tr "settings.emails"}} {{.i18n.Tr "settings.emails"}}
</a> </a>
<a class="{{if .PageIsSettingsSSHKeys}}active{{end}} item" href="{{AppSubUrl}}/user/settings/ssh"> <a class="{{if .PageIsSettingsSSHKeys}}active{{end}} item" href="{{AppSubURL}}/user/settings/ssh">
{{.i18n.Tr "settings.ssh_keys"}} {{.i18n.Tr "settings.ssh_keys"}}
</a> </a>
<a class="{{if .PageIsSettingsSecurity}}active{{end}} item" href="{{AppSubUrl}}/user/settings/security"> <a class="{{if .PageIsSettingsSecurity}}active{{end}} item" href="{{AppSubURL}}/user/settings/security">
{{.i18n.Tr "settings.security"}} {{.i18n.Tr "settings.security"}}
</a> </a>
<a class="{{if .PageIsSettingsRepositories}}active{{end}} item" href="{{AppSubUrl}}/user/settings/repositories"> <a class="{{if .PageIsSettingsRepositories}}active{{end}} item" href="{{AppSubURL}}/user/settings/repositories">
{{.i18n.Tr "settings.repos"}} {{.i18n.Tr "settings.repos"}}
</a> </a>
<a class="{{if .PageIsSettingsOrganizations}}active{{end}} item" href="{{AppSubUrl}}/user/settings/organizations"> <a class="{{if .PageIsSettingsOrganizations}}active{{end}} item" href="{{AppSubURL}}/user/settings/organizations">
{{.i18n.Tr "settings.orgs"}} {{.i18n.Tr "settings.orgs"}}
</a> </a>
<a class="{{if .PageIsSettingsApplications}}active{{end}} item" href="{{AppSubUrl}}/user/settings/applications"> <a class="{{if .PageIsSettingsApplications}}active{{end}} item" href="{{AppSubURL}}/user/settings/applications">
{{.i18n.Tr "settings.applications"}} {{.i18n.Tr "settings.applications"}}
</a> </a>
<a class="{{if .PageIsSettingsDelete}}active{{end}} item" href="{{AppSubUrl}}/user/settings/delete"> <a class="{{if .PageIsSettingsDelete}}active{{end}} item" href="{{AppSubURL}}/user/settings/delete">
{{.i18n.Tr "settings.delete"}} {{.i18n.Tr "settings.delete"}}
</a> </a>
</div> </div>

2
templates/user/settings/organizations.tmpl

@ -8,7 +8,7 @@
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "settings.orgs"}} {{.i18n.Tr "settings.orgs"}}
<div class="ui right"> <div class="ui right">
<a class="ui blue tiny button" href="{{AppSubUrl}}/org/create">{{.i18n.Tr "new_org"}}</a> <a class="ui blue tiny button" href="{{AppSubURL}}/org/create">{{.i18n.Tr "new_org"}}</a>
</div> </div>
</h4> </h4>
<div class="ui attached segment orgs {{if .Orgs}}non-empty{{end}}"> <div class="ui attached segment orgs {{if .Orgs}}non-empty{{end}}">

2
templates/user/settings/repositories.tmpl

@ -24,7 +24,7 @@
<i class="octicon octicon-repo"></i> <i class="octicon octicon-repo"></i>
{{end}} {{end}}
</span> </span>
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}"> <a href="{{AppSubURL}}/{{.Owner.Name}}/{{.Name}}">
{{.Owner.Name}}/{{.Name}} {{.Owner.Name}}/{{.Name}}
</a> </a>
<span class="ui text light grey">{{.Size | FileSize}}</span> <span class="ui text light grey">{{.Size | FileSize}}</span>

6
templates/user/settings/security.tmpl

@ -16,14 +16,14 @@
<button class="ui right mini red toggle button delete-button" data-url="{{$.Link}}/two_factor_disable">{{.i18n.Tr "settings.two_factor_disable"}}</button> <button class="ui right mini red toggle button delete-button" data-url="{{$.Link}}/two_factor_disable">{{.i18n.Tr "settings.two_factor_disable"}}</button>
{{else}} {{else}}
<span class="text red">{{.i18n.Tr "settings.two_factor_off"}} <i class="octicon octicon-x"></i></span> <span class="text red">{{.i18n.Tr "settings.two_factor_off"}} <i class="octicon octicon-x"></i></span>
<a class="ui right mini green toggle button" href="{{AppSubUrl}}/user/settings/security/two_factor_enable">{{.i18n.Tr "settings.two_factor_enable"}}</a> <a class="ui right mini green toggle button" href="{{AppSubURL}}/user/settings/security/two_factor_enable">{{.i18n.Tr "settings.two_factor_enable"}}</a>
{{end}} {{end}}
</p> </p>
</div> </div>
{{if .TwoFactor}} {{if .TwoFactor}}
<br> <br>
<p>{{.i18n.Tr "settings.two_factor_view_recovery_codes" AppSubUrl "/user/settings/security/two_factor_recovery_codes" | Safe}}</p> <p>{{.i18n.Tr "settings.two_factor_view_recovery_codes" AppSubURL "/user/settings/security/two_factor_recovery_codes" | Safe}}</p>
<p>{{.i18n.Tr "settings.two_factor_http" AppSubUrl "/user/settings/applications" "https://{token}@try.gogs.io/user/repo.git" | Safe}}</p> <p>{{.i18n.Tr "settings.two_factor_http" AppSubURL "/user/settings/applications" "https://{token}@try.gogs.io/user/repo.git" | Safe}}</p>
{{end}} {{end}}
</div> </div>
</div> </div>

Loading…
Cancel
Save