Browse Source

Golint fixed for modules/setting (#262)

* golint fixed for modules/setting

* typo fixed and renamed UNIXSOCKET to UnixSocket
Lunny Xiao 3 years ago
parent
commit
94da472717

+ 9 - 9
cmd/web.go

@@ -123,7 +123,7 @@ func newMacaron() *macaron.Macaron {
123 123
 		m.Use(gzip.Gziper())
124 124
 	}
125 125
 	if setting.Protocol == setting.FCGI {
126
-		m.SetURLPrefix(setting.AppSubUrl)
126
+		m.SetURLPrefix(setting.AppSubURL)
127 127
 	}
128 128
 	m.Use(macaron.Static(
129 129
 		path.Join(setting.StaticRootPath, "public"),
@@ -158,7 +158,7 @@ func newMacaron() *macaron.Macaron {
158 158
 		localFiles[name] = bindata.MustAsset("conf/locale/" + name)
159 159
 	}
160 160
 	m.Use(i18n.I18n(i18n.Options{
161
-		SubURL:          setting.AppSubUrl,
161
+		SubURL:          setting.AppSubURL,
162 162
 		Files:           localFiles,
163 163
 		CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
164 164
 		Langs:           setting.Langs,
@@ -172,7 +172,7 @@ func newMacaron() *macaron.Macaron {
172 172
 		Interval:      setting.CacheInterval,
173 173
 	}))
174 174
 	m.Use(captcha.Captchaer(captcha.Options{
175
-		SubURL: setting.AppSubUrl,
175
+		SubURL: setting.AppSubURL,
176 176
 	}))
177 177
 	m.Use(session.Sessioner(setting.SessionConfig))
178 178
 	m.Use(csrf.Csrfer(csrf.Options{
@@ -180,7 +180,7 @@ func newMacaron() *macaron.Macaron {
180 180
 		Cookie:     setting.CSRFCookieName,
181 181
 		SetCookie:  true,
182 182
 		Header:     "X-Csrf-Token",
183
-		CookiePath: setting.AppSubUrl,
183
+		CookiePath: setting.AppSubURL,
184 184
 	}))
185 185
 	m.Use(toolbox.Toolboxer(m, toolbox.Options{
186 186
 		HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
@@ -216,7 +216,7 @@ func runWeb(ctx *cli.Context) error {
216 216
 	m.Get("/", ignSignIn, routers.Home)
217 217
 	m.Group("/explore", func() {
218 218
 		m.Get("", func(ctx *context.Context) {
219
-			ctx.Redirect(setting.AppSubUrl + "/explore/repos")
219
+			ctx.Redirect(setting.AppSubURL + "/explore/repos")
220 220
 		})
221 221
 		m.Get("/repos", routers.ExploreRepos)
222 222
 		m.Get("/users", routers.ExploreUsers)
@@ -635,17 +635,17 @@ func runWeb(ctx *cli.Context) error {
635 635
 
636 636
 	// Flag for port number in case first time run conflict.
637 637
 	if ctx.IsSet("port") {
638
-		setting.AppUrl = strings.Replace(setting.AppUrl, setting.HTTPPort, ctx.String("port"), 1)
638
+		setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, ctx.String("port"), 1)
639 639
 		setting.HTTPPort = ctx.String("port")
640 640
 	}
641 641
 
642 642
 	var listenAddr string
643
-	if setting.Protocol == setting.UNIX_SOCKET {
643
+	if setting.Protocol == setting.UnixSocket {
644 644
 		listenAddr = fmt.Sprintf("%s", setting.HTTPAddr)
645 645
 	} else {
646 646
 		listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
647 647
 	}
648
-	log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubUrl)
648
+	log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
649 649
 
650 650
 	var err error
651 651
 	switch setting.Protocol {
@@ -656,7 +656,7 @@ func runWeb(ctx *cli.Context) error {
656 656
 		err = server.ListenAndServeTLS(setting.CertFile, setting.KeyFile)
657 657
 	case setting.FCGI:
658 658
 		err = fcgi.Serve(nil, m)
659
-	case setting.UNIX_SOCKET:
659
+	case setting.UnixSocket:
660 660
 		os.Remove(listenAddr)
661 661
 
662 662
 		var listener *net.UnixListener

+ 3 - 3
models/action.go

@@ -152,8 +152,8 @@ func (a *Action) ShortRepoPath() string {
152 152
 
153 153
 // GetRepoLink returns relative link to action repository.
154 154
 func (a *Action) GetRepoLink() string {
155
-	if len(setting.AppSubUrl) > 0 {
156
-		return path.Join(setting.AppSubUrl, a.GetRepoPath())
155
+	if len(setting.AppSubURL) > 0 {
156
+		return path.Join(setting.AppSubURL, a.GetRepoPath())
157 157
 	}
158 158
 	return "/" + a.GetRepoPath()
159 159
 }
@@ -546,7 +546,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
546 546
 			Ref:        opts.RefFullName,
547 547
 			Before:     opts.OldCommitID,
548 548
 			After:      opts.NewCommitID,
549
-			CompareURL: setting.AppUrl + opts.Commits.CompareURL,
549
+			CompareURL: setting.AppURL + opts.Commits.CompareURL,
550 550
 			Commits:    opts.Commits.ToAPIPayloadCommits(repo.HTMLURL()),
551 551
 			Repo:       apiRepo,
552 552
 			Pusher:     apiPusher,

+ 1 - 1
models/pull.go

@@ -317,7 +317,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
317 317
 		Ref:        git.BRANCH_PREFIX + pr.BaseBranch,
318 318
 		Before:     pr.MergeBase,
319 319
 		After:      pr.MergedCommitID,
320
-		CompareURL: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
320
+		CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
321 321
 		Commits:    ListToPushCommits(l).ToAPIPayloadCommits(pr.BaseRepo.HTMLURL()),
322 322
 		Repo:       pr.BaseRepo.APIFormat(nil),
323 323
 		Pusher:     pr.HeadRepo.MustOwner().APIFormat(),

+ 3 - 3
models/repo.go

@@ -246,7 +246,7 @@ func (repo *Repository) FullName() string {
246 246
 }
247 247
 
248 248
 func (repo *Repository) HTMLURL() string {
249
-	return setting.AppUrl + repo.FullName()
249
+	return setting.AppURL + repo.FullName()
250 250
 }
251 251
 
252 252
 // Arguments that are allowed to be nil: permission
@@ -412,7 +412,7 @@ func (repo *Repository) RelLink() string {
412 412
 }
413 413
 
414 414
 func (repo *Repository) Link() string {
415
-	return setting.AppSubUrl + "/" + repo.FullName()
415
+	return setting.AppSubURL + "/" + repo.FullName()
416 416
 }
417 417
 
418 418
 func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string {
@@ -550,7 +550,7 @@ type CloneLink struct {
550 550
 
551 551
 // ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
552 552
 func ComposeHTTPSCloneURL(owner, repo string) string {
553
-	return fmt.Sprintf("%s%s/%s.git", setting.AppUrl, owner, repo)
553
+	return fmt.Sprintf("%s%s/%s.git", setting.AppURL, owner, repo)
554 554
 }
555 555
 
556 556
 func (repo *Repository) cloneLink(isWiki bool) *CloneLink {

+ 7 - 7
models/user.go

@@ -198,14 +198,14 @@ func (u *User) CanImportLocal() bool {
198 198
 // DashboardLink returns the user dashboard page link.
199 199
 func (u *User) DashboardLink() string {
200 200
 	if u.IsOrganization() {
201
-		return setting.AppSubUrl + "/org/" + u.Name + "/dashboard/"
201
+		return setting.AppSubURL + "/org/" + u.Name + "/dashboard/"
202 202
 	}
203
-	return setting.AppSubUrl + "/"
203
+	return setting.AppSubURL + "/"
204 204
 }
205 205
 
206 206
 // HomeLink returns the user or organization home page link.
207 207
 func (u *User) HomeLink() string {
208
-	return setting.AppSubUrl + "/" + u.Name
208
+	return setting.AppSubURL + "/" + u.Name
209 209
 }
210 210
 
211 211
 // GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
@@ -261,7 +261,7 @@ func (u *User) GenerateRandomAvatar() error {
261 261
 // which includes app sub-url as prefix. However, it is possible
262 262
 // to return full URL if user enables Gravatar-like service.
263 263
 func (u *User) RelAvatarLink() string {
264
-	defaultImgUrl := setting.AppSubUrl + "/img/avatar_default.png"
264
+	defaultImgUrl := setting.AppSubURL + "/img/avatar_default.png"
265 265
 	if u.ID == -1 {
266 266
 		return defaultImgUrl
267 267
 	}
@@ -271,7 +271,7 @@ func (u *User) RelAvatarLink() string {
271 271
 		if !com.IsExist(u.CustomAvatarPath()) {
272 272
 			return defaultImgUrl
273 273
 		}
274
-		return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID)
274
+		return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
275 275
 	case setting.DisableGravatar, setting.OfflineMode:
276 276
 		if !com.IsExist(u.CustomAvatarPath()) {
277 277
 			if err := u.GenerateRandomAvatar(); err != nil {
@@ -279,7 +279,7 @@ func (u *User) RelAvatarLink() string {
279 279
 			}
280 280
 		}
281 281
 
282
-		return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID)
282
+		return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
283 283
 	}
284 284
 	return base.AvatarLink(u.AvatarEmail)
285 285
 }
@@ -288,7 +288,7 @@ func (u *User) RelAvatarLink() string {
288 288
 func (u *User) AvatarLink() string {
289 289
 	link := u.RelAvatarLink()
290 290
 	if link[0] == '/' && link[1] != '/' {
291
-		return setting.AppUrl + strings.TrimPrefix(link, setting.AppSubUrl)[1:]
291
+		return setting.AppURL + strings.TrimPrefix(link, setting.AppSubURL)[1:]
292 292
 	}
293 293
 	return link
294 294
 }

+ 2 - 2
models/webhook_slack.go

@@ -142,7 +142,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
142 142
 }
143 143
 
144 144
 func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) {
145
-	senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName)
145
+	senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
146 146
 	titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index),
147 147
 		fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title))
148 148
 	var text, title, attachmentText string
@@ -164,7 +164,7 @@ func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*S
164 164
 		attachmentText = SlackTextFormatter(p.PullRequest.Body)
165 165
 	case api.HookIssueAssigned:
166 166
 		text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
167
-			SlackLinkFormatter(setting.AppUrl+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName),
167
+			SlackLinkFormatter(setting.AppURL+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName),
168 168
 			titleLink, senderLink)
169 169
 	case api.HookIssueUnassigned:
170 170
 		text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)

+ 1 - 1
modules/base/tool.go

@@ -217,7 +217,7 @@ func AvatarLink(email string) string {
217 217
 		return setting.GravatarSource + HashEmail(email)
218 218
 	}
219 219
 
220
-	return setting.AppSubUrl + "/img/avatar_default.png"
220
+	return setting.AppSubURL + "/img/avatar_default.png"
221 221
 }
222 222
 
223 223
 // Seconds-based time units

+ 4 - 4
modules/context/api.go

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

+ 8 - 8
modules/context/auth.go

@@ -26,7 +26,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
26 26
 	return func(ctx *Context) {
27 27
 		// Cannot view any page before installation.
28 28
 		if !setting.InstallLock {
29
-			ctx.Redirect(setting.AppSubUrl + "/install")
29
+			ctx.Redirect(setting.AppSubURL + "/install")
30 30
 			return
31 31
 		}
32 32
 
@@ -38,14 +38,14 @@ func Toggle(options *ToggleOptions) macaron.Handler {
38 38
 		}
39 39
 
40 40
 		// Check non-logged users landing page.
41
-		if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME {
42
-			ctx.Redirect(setting.AppSubUrl + string(setting.LandingPageURL))
41
+		if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LandingPageHome {
42
+			ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
43 43
 			return
44 44
 		}
45 45
 
46 46
 		// Redirect to dashboard if user tries to visit any non-login page.
47 47
 		if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" {
48
-			ctx.Redirect(setting.AppSubUrl + "/")
48
+			ctx.Redirect(setting.AppSubURL + "/")
49 49
 			return
50 50
 		}
51 51
 
@@ -66,8 +66,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
66 66
 					return
67 67
 				}
68 68
 
69
-				ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
70
-				ctx.Redirect(setting.AppSubUrl + "/user/login")
69
+				ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
70
+				ctx.Redirect(setting.AppSubURL + "/user/login")
71 71
 				return
72 72
 			} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
73 73
 				ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
@@ -79,8 +79,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
79 79
 		// Redirect to log in page if auto-signin info is provided and has not signed in.
80 80
 		if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
81 81
 			len(ctx.GetCookie(setting.CookieUserName)) > 0 {
82
-			ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
83
-			ctx.Redirect(setting.AppSubUrl + "/user/login")
82
+			ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
83
+			ctx.Redirect(setting.AppSubURL + "/user/login")
84 84
 			return
85 85
 		}
86 86
 

+ 1 - 1
modules/context/context.go

@@ -159,7 +159,7 @@ func Contexter() macaron.Handler {
159 159
 			Org: &Organization{},
160 160
 		}
161 161
 		// Compute current URL for real-time change language.
162
-		ctx.Data["Link"] = setting.AppSubUrl + strings.TrimSuffix(ctx.Req.URL.Path, "/")
162
+		ctx.Data["Link"] = setting.AppSubURL + strings.TrimSuffix(ctx.Req.URL.Path, "/")
163 163
 
164 164
 		ctx.Data["PageStartTime"] = time.Now()
165 165
 

+ 1 - 1
modules/context/org.go

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

+ 2 - 2
modules/context/repo.go

@@ -117,7 +117,7 @@ func RetrieveBaseRepo(ctx *Context, repo *models.Repository) {
117 117
 
118 118
 // composeGoGetImport returns go-get-import meta content.
119 119
 func composeGoGetImport(owner, repo string) string {
120
-	return path.Join(setting.Domain, setting.AppSubUrl, owner, repo)
120
+	return path.Join(setting.Domain, setting.AppSubURL, owner, repo)
121 121
 }
122 122
 
123 123
 // earlyResponseForGoGetMeta responses appropriate go-get meta with status 200
@@ -331,7 +331,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
331 331
 
332 332
 		if ctx.Query("go-get") == "1" {
333 333
 			ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
334
-			prefix := setting.AppUrl + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
334
+			prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
335 335
 			ctx.Data["GoDocDirectory"] = prefix + "{/dir}"
336 336
 			ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}"
337 337
 		}

+ 3 - 3
modules/markdown/markdown.go

@@ -135,7 +135,7 @@ func (r *Renderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
135 135
 
136 136
 	// Since this method could only possibly serve one link at a time,
137 137
 	// we do not need to find all.
138
-	if bytes.HasPrefix(link, []byte(setting.AppUrl)) {
138
+	if bytes.HasPrefix(link, []byte(setting.AppURL)) {
139 139
 		m := CommitPattern.Find(link)
140 140
 		if m != nil {
141 141
 			m = bytes.TrimSpace(m)
@@ -225,7 +225,7 @@ func cutoutVerbosePrefix(prefix string) string {
225 225
 		if prefix[i] == '/' {
226 226
 			count++
227 227
 		}
228
-		if count >= 3+setting.AppSubUrlDepth {
228
+		if count >= 3+setting.AppSubURLDepth {
229 229
 			return prefix[:i]
230 230
 		}
231 231
 	}
@@ -279,7 +279,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]strin
279 279
 	for _, m := range ms {
280 280
 		m = m[bytes.Index(m, []byte("@")):]
281 281
 		rawBytes = bytes.Replace(rawBytes, m,
282
-			[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
282
+			[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubURL, m[1:], m)), -1)
283 283
 	}
284 284
 
285 285
 	rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)

+ 3 - 3
modules/markdown/markdown_test.go

@@ -16,7 +16,7 @@ func TestMarkdown(t *testing.T) {
16 16
 			urlPrefix                   = "/prefix"
17 17
 			metas     map[string]string = nil
18 18
 		)
19
-		setting.AppSubUrlDepth = 0
19
+		setting.AppSubURLDepth = 0
20 20
 
21 21
 		Convey("To the internal issue tracker", func() {
22 22
 			Convey("It should not render anything when there are no mentions", func() {
@@ -237,7 +237,7 @@ func TestMarkdown(t *testing.T) {
237 237
 	})
238 238
 
239 239
 	Convey("Rendering an issue URL", t, func() {
240
-		setting.AppUrl = "http://localhost:3000/"
240
+		setting.AppURL = "http://localhost:3000/"
241 241
 		htmlFlags := 0
242 242
 		htmlFlags |= blackfriday.HTML_SKIP_STYLE
243 243
 		htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
@@ -279,7 +279,7 @@ func TestMarkdown(t *testing.T) {
279 279
 	})
280 280
 
281 281
 	Convey("Rendering a commit URL", t, func() {
282
-		setting.AppUrl = "http://localhost:3000/"
282
+		setting.AppURL = "http://localhost:3000/"
283 283
 		htmlFlags := 0
284 284
 		htmlFlags |= blackfriday.HTML_SKIP_STYLE
285 285
 		htmlFlags |= blackfriday.HTML_OMIT_CONTENTS

+ 39 - 28
modules/setting/setting.go

@@ -18,10 +18,10 @@ import (
18 18
 	"time"
19 19
 
20 20
 	"github.com/Unknwon/com"
21
-	_ "github.com/go-macaron/cache/memcache"
21
+	_ "github.com/go-macaron/cache/memcache" // memcache plugin for cache
22 22
 	_ "github.com/go-macaron/cache/redis"
23 23
 	"github.com/go-macaron/session"
24
-	_ "github.com/go-macaron/session/redis"
24
+	_ "github.com/go-macaron/session/redis" // redis plugin for store session
25 25
 	"gopkg.in/ini.v1"
26 26
 	"strk.kbt.io/projects/go/libravatar"
27 27
 
@@ -30,44 +30,51 @@ import (
30 30
 	"code.gitea.io/gitea/modules/user"
31 31
 )
32 32
 
33
+// Scheme describes protocol types
33 34
 type Scheme string
34 35
 
36
+// enumerates all the scheme types
35 37
 const (
36
-	HTTP        Scheme = "http"
37
-	HTTPS       Scheme = "https"
38
-	FCGI        Scheme = "fcgi"
39
-	UNIX_SOCKET Scheme = "unix"
38
+	HTTP       Scheme = "http"
39
+	HTTPS      Scheme = "https"
40
+	FCGI       Scheme = "fcgi"
41
+	UnixSocket Scheme = "unix"
40 42
 )
41 43
 
44
+// LandingPage describes the default page
42 45
 type LandingPage string
43 46
 
47
+// enumerates all the landing page types
44 48
 const (
45
-	LANDING_PAGE_HOME    LandingPage = "/"
46
-	LANDING_PAGE_EXPLORE LandingPage = "/explore"
49
+	LandingPageHome    LandingPage = "/"
50
+	LandingPageExplore LandingPage = "/explore"
47 51
 )
48 52
 
53
+// settings
49 54
 var (
50
-	// Build information should only be set by -ldflags.
55
+	// BuildTime information should only be set by -ldflags.
51 56
 	BuildTime    string
52 57
 	BuildGitHash string
53 58
 
54
-	// App settings
59
+	// AppVer settings
55 60
 	AppVer         string
56 61
 	AppName        string
57
-	AppUrl         string
58
-	AppSubUrl      string
59
-	AppSubUrlDepth int // Number of slashes
62
+	AppURL         string
63
+	AppSubURL      string
64
+	AppSubURLDepth int // Number of slashes
60 65
 	AppPath        string
61 66
 	AppDataPath    string
62 67
 
63 68
 	// Server settings
64 69
 	Protocol             Scheme
65 70
 	Domain               string
66
-	HTTPAddr, HTTPPort   string
71
+	HTTPAddr             string
72
+	HTTPPort             string
67 73
 	LocalURL             string
68 74
 	OfflineMode          bool
69 75
 	DisableRouterLog     bool
70
-	CertFile, KeyFile    string
76
+	CertFile             string
77
+	KeyFile              string
71 78
 	StaticRootPath       string
72 79
 	EnableGzip           bool
73 80
 	LandingPageURL       LandingPage
@@ -242,8 +249,9 @@ var (
242 249
 	}
243 250
 
244 251
 	// I18n settings
245
-	Langs, Names []string
246
-	dateLangs    map[string]string
252
+	Langs     []string
253
+	Names     []string
254
+	dateLangs map[string]string
247 255
 
248 256
 	// Highlight settings are loaded in modules/template/hightlight.go
249 257
 
@@ -386,20 +394,20 @@ please consider changing to GITEA_CUSTOM`)
386 394
 
387 395
 	sec := Cfg.Section("server")
388 396
 	AppName = Cfg.Section("").Key("APP_NAME").MustString("Gogs: Go Git Service")
389
-	AppUrl = sec.Key("ROOT_URL").MustString("http://localhost:3000/")
390
-	if AppUrl[len(AppUrl)-1] != '/' {
391
-		AppUrl += "/"
397
+	AppURL = sec.Key("ROOT_URL").MustString("http://localhost:3000/")
398
+	if AppURL[len(AppURL)-1] != '/' {
399
+		AppURL += "/"
392 400
 	}
393 401
 
394 402
 	// Check if has app suburl.
395
-	url, err := url.Parse(AppUrl)
403
+	url, err := url.Parse(AppURL)
396 404
 	if err != nil {
397
-		log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err)
405
+		log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppURL, err)
398 406
 	}
399 407
 	// Suburl should start with '/' and end without '/', such as '/{subpath}'.
400 408
 	// This value is empty if site does not have sub-url.
401
-	AppSubUrl = strings.TrimSuffix(url.Path, "/")
402
-	AppSubUrlDepth = strings.Count(AppSubUrl, "/")
409
+	AppSubURL = strings.TrimSuffix(url.Path, "/")
410
+	AppSubURLDepth = strings.Count(AppSubURL, "/")
403 411
 
404 412
 	Protocol = HTTP
405 413
 	if sec.Key("PROTOCOL").String() == "https" {
@@ -409,7 +417,7 @@ please consider changing to GITEA_CUSTOM`)
409 417
 	} else if sec.Key("PROTOCOL").String() == "fcgi" {
410 418
 		Protocol = FCGI
411 419
 	} else if sec.Key("PROTOCOL").String() == "unix" {
412
-		Protocol = UNIX_SOCKET
420
+		Protocol = UnixSocket
413 421
 		UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
414 422
 		UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
415 423
 		if err != nil || UnixSocketPermissionParsed > 0777 {
@@ -429,9 +437,9 @@ please consider changing to GITEA_CUSTOM`)
429 437
 
430 438
 	switch sec.Key("LANDING_PAGE").MustString("home") {
431 439
 	case "explore":
432
-		LandingPageURL = LANDING_PAGE_EXPLORE
440
+		LandingPageURL = LandingPageExplore
433 441
 	default:
434
-		LandingPageURL = LANDING_PAGE_HOME
442
+		LandingPageURL = LandingPageHome
435 443
 	}
436 444
 
437 445
 	SSH.RootPath = path.Join(homeDir, ".ssh")
@@ -596,6 +604,7 @@ please consider changing to GITEA_CUSTOM`)
596 604
 	HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
597 605
 }
598 606
 
607
+// Service settings
599 608
 var Service struct {
600 609
 	ActiveCodeLives                int
601 610
 	ResetPwdCodeLives              int
@@ -719,7 +728,7 @@ func newSessionService() {
719 728
 		[]string{"memory", "file", "redis", "mysql"})
720 729
 	SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ")
721 730
 	SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits")
722
-	SessionConfig.CookiePath = AppSubUrl
731
+	SessionConfig.CookiePath = AppSubURL
723 732
 	SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
724 733
 	SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
725 734
 	SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
@@ -744,6 +753,7 @@ type Mailer struct {
744 753
 }
745 754
 
746 755
 var (
756
+	// MailService the global mailer
747 757
 	MailService *Mailer
748 758
 )
749 759
 
@@ -810,6 +820,7 @@ func newWebhookService() {
810 820
 	Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
811 821
 }
812 822
 
823
+// NewServices initializes the services
813 824
 func NewServices() {
814 825
 	newService()
815 826
 	newLogService()

+ 3 - 3
modules/template/template.go

@@ -33,16 +33,16 @@ func NewFuncMap() []template.FuncMap {
33 33
 			return strings.Title(runtime.Version())
34 34
 		},
35 35
 		"UseHTTPS": func() bool {
36
-			return strings.HasPrefix(setting.AppUrl, "https")
36
+			return strings.HasPrefix(setting.AppURL, "https")
37 37
 		},
38 38
 		"AppName": func() string {
39 39
 			return setting.AppName
40 40
 		},
41 41
 		"AppSubUrl": func() string {
42
-			return setting.AppSubUrl
42
+			return setting.AppSubURL
43 43
 		},
44 44
 		"AppUrl": func() string {
45
-			return setting.AppUrl
45
+			return setting.AppURL
46 46
 		},
47 47
 		"AppVer": func() string {
48 48
 			return setting.AppVer

+ 3 - 3
routers/admin/admin.go

@@ -164,7 +164,7 @@ func Dashboard(ctx *context.Context) {
164 164
 		} else {
165 165
 			ctx.Flash.Success(success)
166 166
 		}
167
-		ctx.Redirect(setting.AppSubUrl + "/admin")
167
+		ctx.Redirect(setting.AppSubURL + "/admin")
168 168
 		return
169 169
 	}
170 170
 
@@ -185,7 +185,7 @@ func SendTestMail(ctx *context.Context) {
185 185
 		ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
186 186
 	}
187 187
 
188
-	ctx.Redirect(setting.AppSubUrl + "/admin/config")
188
+	ctx.Redirect(setting.AppSubURL + "/admin/config")
189 189
 }
190 190
 
191 191
 // Config show admin config page
@@ -194,7 +194,7 @@ func Config(ctx *context.Context) {
194 194
 	ctx.Data["PageIsAdmin"] = true
195 195
 	ctx.Data["PageIsAdminConfig"] = true
196 196
 
197
-	ctx.Data["AppUrl"] = setting.AppUrl
197
+	ctx.Data["AppUrl"] = setting.AppURL
198 198
 	ctx.Data["Domain"] = setting.Domain
199 199
 	ctx.Data["OfflineMode"] = setting.OfflineMode
200 200
 	ctx.Data["DisableRouterLog"] = setting.DisableRouterLog

+ 4 - 4
routers/admin/auths.go

@@ -167,7 +167,7 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
167 167
 	log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.Name)
168 168
 
169 169
 	ctx.Flash.Success(ctx.Tr("admin.auths.new_success", form.Name))
170
-	ctx.Redirect(setting.AppSubUrl + "/admin/auths")
170
+	ctx.Redirect(setting.AppSubURL + "/admin/auths")
171 171
 }
172 172
 
173 173
 // EditAuthSource render editing auth source page
@@ -236,7 +236,7 @@ func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
236 236
 	log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, source.ID)
237 237
 
238 238
 	ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
239
-	ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + com.ToStr(form.ID))
239
+	ctx.Redirect(setting.AppSubURL + "/admin/auths/" + com.ToStr(form.ID))
240 240
 }
241 241
 
242 242
 // DeleteAuthSource response for deleting an auth source
@@ -254,7 +254,7 @@ func DeleteAuthSource(ctx *context.Context) {
254 254
 			ctx.Flash.Error(fmt.Sprintf("DeleteSource: %v", err))
255 255
 		}
256 256
 		ctx.JSON(200, map[string]interface{}{
257
-			"redirect": setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"),
257
+			"redirect": setting.AppSubURL + "/admin/auths/" + ctx.Params(":authid"),
258 258
 		})
259 259
 		return
260 260
 	}
@@ -262,6 +262,6 @@ func DeleteAuthSource(ctx *context.Context) {
262 262
 
263 263
 	ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success"))
264 264
 	ctx.JSON(200, map[string]interface{}{
265
-		"redirect": setting.AppSubUrl + "/admin/auths",
265
+		"redirect": setting.AppSubURL + "/admin/auths",
266 266
 	})
267 267
 }

+ 1 - 1
routers/admin/notice.go

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

+ 1 - 1
routers/admin/repos.go

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

+ 5 - 5
routers/admin/users.go

@@ -123,7 +123,7 @@ func NewUserPost(ctx *context.Context, form auth.AdminCrateUserForm) {
123 123
 	}
124 124
 
125 125
 	ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
126
-	ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.ID))
126
+	ctx.Redirect(setting.AppSubURL + "/admin/users/" + com.ToStr(u.ID))
127 127
 }
128 128
 
129 129
 func prepareUserInfo(ctx *context.Context) *models.User {
@@ -225,7 +225,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
225 225
 	log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name)
226 226
 
227 227
 	ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
228
-	ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
228
+	ctx.Redirect(setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"))
229 229
 }
230 230
 
231 231
 // DeleteUser response for deleting a user
@@ -241,12 +241,12 @@ func DeleteUser(ctx *context.Context) {
241 241
 		case models.IsErrUserOwnRepos(err):
242 242
 			ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
243 243
 			ctx.JSON(200, map[string]interface{}{
244
-				"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"),
244
+				"redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
245 245
 			})
246 246
 		case models.IsErrUserHasOrgs(err):
247 247
 			ctx.Flash.Error(ctx.Tr("admin.users.still_has_org"))
248 248
 			ctx.JSON(200, map[string]interface{}{
249
-				"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"),
249
+				"redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
250 250
 			})
251 251
 		default:
252 252
 			ctx.Handle(500, "DeleteUser", err)
@@ -257,6 +257,6 @@ func DeleteUser(ctx *context.Context) {
257 257
 
258 258
 	ctx.Flash.Success(ctx.Tr("admin.users.deletion_success"))
259 259
 	ctx.JSON(200, map[string]interface{}{
260
-		"redirect": setting.AppSubUrl + "/admin/users",
260
+		"redirect": setting.AppSubURL + "/admin/users",
261 261
 	})
262 262
 }

+ 1 - 1
routers/api/v1/repo/key.go

@@ -16,7 +16,7 @@ import (
16 16
 )
17 17
 
18 18
 func composeDeployKeysAPILink(repoPath string) string {
19
-	return setting.AppUrl + "api/v1/repos/" + repoPath + "/keys/"
19
+	return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/"
20 20
 }
21 21
 
22 22
 // ListDeployKeys list all the deploy keys of a repository

+ 1 - 1
routers/api/v1/user/key.go

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

+ 1 - 1
routers/dev/template.go

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

+ 1 - 1
routers/home.go

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

+ 1 - 1
routers/install.go

@@ -89,7 +89,7 @@ func Install(ctx *context.Context) {
89 89
 	form.Domain = setting.Domain
90 90
 	form.SSHPort = setting.SSH.Port
91 91
 	form.HTTPPort = setting.HTTPPort
92
-	form.AppUrl = setting.AppUrl
92
+	form.AppUrl = setting.AppURL
93 93
 	form.LogRootPath = setting.LogRootPath
94 94
 
95 95
 	// E-mail service settings

+ 1 - 1
routers/org/members.go

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

+ 1 - 1
routers/org/org.go

@@ -55,5 +55,5 @@ func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
55 55
 	}
56 56
 	log.Trace("Organization created: %s", org.Name)
57 57
 
58
-	ctx.Redirect(setting.AppSubUrl + "/org/" + form.OrgName + "/dashboard")
58
+	ctx.Redirect(setting.AppSubURL + "/org/" + form.OrgName + "/dashboard")
59 59
 }

+ 2 - 2
routers/org/setting.go

@@ -64,7 +64,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
64 64
 			return
65 65
 		}
66 66
 		// reset ctx.org.OrgLink with new name
67
-		ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + form.Name
67
+		ctx.Org.OrgLink = setting.AppSubURL + "/org/" + form.Name
68 68
 		log.Trace("Organization name changed: %s -> %s", org.Name, form.Name)
69 69
 	}
70 70
 	// In case it's just a case change.
@@ -134,7 +134,7 @@ func SettingsDelete(ctx *context.Context) {
134 134
 			}
135 135
 		} else {
136 136
 			log.Trace("Organization deleted: %s", org.Name)
137
-			ctx.Redirect(setting.AppSubUrl + "/")
137
+			ctx.Redirect(setting.AppSubURL + "/")
138 138
 		}
139 139
 		return
140 140
 	}

+ 6 - 6
routers/repo/commit.go

@@ -194,11 +194,11 @@ func Diff(ctx *context.Context) {
194 194
 	ctx.Data["Diff"] = diff
195 195
 	ctx.Data["Parents"] = parents
196 196
 	ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
197
-	ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitID)
197
+	ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", commitID)
198 198
 	if commit.ParentCount() > 0 {
199
-		ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0])
199
+		ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
200 200
 	}
201
-	ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitID)
201
+	ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
202 202
 	ctx.HTML(200, tplDiff)
203 203
 }
204 204
 
@@ -257,8 +257,8 @@ func CompareDiff(ctx *context.Context) {
257 257
 	ctx.Data["Commit"] = commit
258 258
 	ctx.Data["Diff"] = diff
259 259
 	ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
260
-	ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitID)
261
-	ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitID)
262
-	ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitID)
260
+	ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
261
+	ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
262
+	ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
263 263
 	ctx.HTML(200, tplDiff)
264 264
 }

+ 1 - 1
routers/repo/editor.go

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

+ 3 - 3
routers/repo/issue.go

@@ -123,8 +123,8 @@ func Issues(ctx *context.Context) {
123 123
 
124 124
 	// Must sign in to see issues about you.
125 125
 	if viewType != "all" && !ctx.IsSigned {
126
-		ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
127
-		ctx.Redirect(setting.AppSubUrl + "/user/login")
126
+		ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
127
+		ctx.Redirect(setting.AppSubURL + "/user/login")
128 128
 		return
129 129
 	}
130 130
 
@@ -651,7 +651,7 @@ func ViewIssue(ctx *context.Context) {
651 651
 	ctx.Data["NumParticipants"] = len(participants)
652 652
 	ctx.Data["Issue"] = issue
653 653
 	ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))
654
-	ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login?redirect_to=" + ctx.Data["Link"].(string)
654
+	ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string)
655 655
 	ctx.HTML(200, tplIssueView)
656 656
 }
657 657
 

+ 8 - 8
routers/repo/pull.go

@@ -107,7 +107,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
107 107
 
108 108
 	repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
109 109
 	if has {
110
-		ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
110
+		ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
111 111
 		return
112 112
 	}
113 113
 
@@ -136,7 +136,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
136 136
 	}
137 137
 
138 138
 	log.Trace("Repository forked[%d]: %s/%s", forkRepo.ID, ctxUser.Name, repo.Name)
139
-	ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
139
+	ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
140 140
 }
141 141
 
142 142
 func checkPullInfo(ctx *context.Context) *models.Issue {
@@ -376,9 +376,9 @@ func ViewPullFiles(ctx *context.Context) {
376 376
 	ctx.Data["Username"] = pull.HeadUserName
377 377
 	ctx.Data["Reponame"] = pull.HeadRepo.Name
378 378
 	ctx.Data["IsImageFile"] = commit.IsImageFile
379
-	ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", endCommitID)
380
-	ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", startCommitID)
381
-	ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", endCommitID)
379
+	ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", endCommitID)
380
+	ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", startCommitID)
381
+	ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", endCommitID)
382 382
 	ctx.Data["RequireHighlightJS"] = true
383 383
 
384 384
 	ctx.HTML(200, tplPullFiles)
@@ -581,9 +581,9 @@ func PrepareCompareDiff(
581 581
 	ctx.Data["IsImageFile"] = headCommit.IsImageFile
582 582
 
583 583
 	headTarget := path.Join(headUser.Name, repo.Name)
584
-	ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID)
585
-	ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
586
-	ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", headCommitID)
584
+	ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", headCommitID)
585
+	ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
586
+	ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", headCommitID)
587 587
 	return false
588 588
 }
589 589
 

+ 2 - 2
routers/repo/repo.go

@@ -134,7 +134,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
134 134
 	})
135 135
 	if err == nil {
136 136
 		log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
137
-		ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
137
+		ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
138 138
 		return
139 139
 	}
140 140
 
@@ -208,7 +208,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
208 208
 	})
209 209
 	if err == nil {
210 210
 		log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName)
211
-		ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
211
+		ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + form.RepoName)
212 212
 		return
213 213
 	}
214 214
 

+ 6 - 6
routers/repo/setting.go

@@ -194,7 +194,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
194 194
 		}
195 195
 		log.Trace("Repository converted from mirror to regular: %s/%s", ctx.Repo.Owner.Name, repo.Name)
196 196
 		ctx.Flash.Success(ctx.Tr("repo.settings.convert_succeed"))
197
-		ctx.Redirect(setting.AppSubUrl + "/" + ctx.Repo.Owner.Name + "/" + repo.Name)
197
+		ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name)
198 198
 
199 199
 	case "transfer":
200 200
 		if !ctx.Repo.IsOwner() {
@@ -233,7 +233,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
233 233
 		}
234 234
 		log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
235 235
 		ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
236
-		ctx.Redirect(setting.AppSubUrl + "/" + newOwner + "/" + repo.Name)
236
+		ctx.Redirect(setting.AppSubURL + "/" + newOwner + "/" + repo.Name)
237 237
 
238 238
 	case "delete":
239 239
 		if !ctx.Repo.IsOwner() {
@@ -314,7 +314,7 @@ func Collaboration(ctx *context.Context) {
314 314
 func CollaborationPost(ctx *context.Context) {
315 315
 	name := strings.ToLower(ctx.Query("collaborator"))
316 316
 	if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
317
-		ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
317
+		ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
318 318
 		return
319 319
 	}
320 320
 
@@ -322,7 +322,7 @@ func CollaborationPost(ctx *context.Context) {
322 322
 	if err != nil {
323 323
 		if models.IsErrUserNotExist(err) {
324 324
 			ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
325
-			ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
325
+			ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
326 326
 		} else {
327 327
 			ctx.Handle(500, "GetUserByName", err)
328 328
 		}
@@ -332,7 +332,7 @@ func CollaborationPost(ctx *context.Context) {
332 332
 	// Organization is not allowed to be added as a collaborator.
333 333
 	if u.IsOrganization() {
334 334
 		ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
335
-		ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
335
+		ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
336 336
 		return
337 337
 	}
338 338
 
@@ -353,7 +353,7 @@ func CollaborationPost(ctx *context.Context) {
353 353
 	}
354 354
 
355 355
 	ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success"))
356
-	ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
356
+	ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
357 357
 }
358 358
 
359 359
 // ChangeCollaborationAccessMode response for changing access of a collaboration

+ 19 - 19
routers/user/auth.go

@@ -44,8 +44,8 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
44 44
 	defer func() {
45 45
 		if !isSucceed {
46 46
 			log.Trace("auto-login cookie cleared: %s", uname)
47
-			ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
48
-			ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
47
+			ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
48
+			ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
49 49
 		}
50 50
 	}()
51 51
 
@@ -65,7 +65,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
65 65
 	isSucceed = true
66 66
 	ctx.Session.Set("uid", u.ID)
67 67
 	ctx.Session.Set("uname", u.Name)
68
-	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
68
+	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
69 69
 	return true, nil
70 70
 }
71 71
 
@@ -82,17 +82,17 @@ func SignIn(ctx *context.Context) {
82 82
 
83 83
 	redirectTo := ctx.Query("redirect_to")
84 84
 	if len(redirectTo) > 0 {
85
-		ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl)
85
+		ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL)
86 86
 	} else {
87 87
 		redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to"))
88 88
 	}
89 89
 
90 90
 	if isSucceed {
91 91
 		if len(redirectTo) > 0 {
92
-			ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
92
+			ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
93 93
 			ctx.Redirect(redirectTo)
94 94
 		} else {
95
-			ctx.Redirect(setting.AppSubUrl + "/")
95
+			ctx.Redirect(setting.AppSubURL + "/")
96 96
 		}
97 97
 		return
98 98
 	}
@@ -121,16 +121,16 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
121 121
 
122 122
 	if form.Remember {
123 123
 		days := 86400 * setting.LogInRememberDays
124
-		ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl)
124
+		ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubURL)
125 125
 		ctx.SetSuperSecureCookie(base.EncodeMD5(u.Rands+u.Passwd),
126
-			setting.CookieRememberName, u.Name, days, setting.AppSubUrl)
126
+			setting.CookieRememberName, u.Name, days, setting.AppSubURL)
127 127
 	}
128 128
 
129 129
 	ctx.Session.Set("uid", u.ID)
130 130
 	ctx.Session.Set("uname", u.Name)
131 131
 
132 132
 	// Clear whatever CSRF has right now, force to generate a new one
133
-	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
133
+	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
134 134
 
135 135
 	// Register last login
136 136
 	u.SetLastLogin()
@@ -140,12 +140,12 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
140 140
 	}
141 141
 
142 142
 	if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 {
143
-		ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
143
+		ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
144 144
 		ctx.Redirect(redirectTo)
145 145
 		return
146 146
 	}
147 147
 
148
-	ctx.Redirect(setting.AppSubUrl + "/")
148
+	ctx.Redirect(setting.AppSubURL + "/")
149 149
 }
150 150
 
151 151
 // SignOut sign out from login status
@@ -155,10 +155,10 @@ func SignOut(ctx *context.Context) {
155 155
 	ctx.Session.Delete("socialId")
156 156
 	ctx.Session.Delete("socialName")
157 157
 	ctx.Session.Delete("socialEmail")
158
-	ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
159
-	ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
160
-	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
161
-	ctx.Redirect(setting.AppSubUrl + "/")
158
+	ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
159
+	ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
160
+	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
161
+	ctx.Redirect(setting.AppSubURL + "/")
162 162
 }
163 163
 
164 164
 // SignUp render the register page
@@ -255,7 +255,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
255 255
 		return
256 256
 	}
257 257
 
258
-	ctx.Redirect(setting.AppSubUrl + "/user/login")
258
+	ctx.Redirect(setting.AppSubURL + "/user/login")
259 259
 }
260 260
 
261 261
 // Activate render activate user page
@@ -303,7 +303,7 @@ func Activate(ctx *context.Context) {
303 303
 
304 304
 		ctx.Session.Set("uid", user.ID)
305 305
 		ctx.Session.Set("uname", user.Name)
306
-		ctx.Redirect(setting.AppSubUrl + "/")
306
+		ctx.Redirect(setting.AppSubURL + "/")
307 307
 		return
308 308
 	}
309 309
 
@@ -326,7 +326,7 @@ func ActivateEmail(ctx *context.Context) {
326 326
 		ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
327 327
 	}
328 328
 
329
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
329
+	ctx.Redirect(setting.AppSubURL + "/user/settings/email")
330 330
 	return
331 331
 }
332 332
 
@@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *context.Context) {
437 437
 		}
438 438
 
439 439
 		log.Trace("User password reset: %s", u.Name)
440
-		ctx.Redirect(setting.AppSubUrl + "/user/login")
440
+		ctx.Redirect(setting.AppSubURL + "/user/login")
441 441
 		return
442 442
 	}
443 443
 

+ 1 - 1
routers/user/home.go

@@ -390,5 +390,5 @@ func Email2User(ctx *context.Context) {
390 390
 		}
391 391
 		return
392 392
 	}
393
-	ctx.Redirect(setting.AppSubUrl + "/user/" + u.Name)
393
+	ctx.Redirect(setting.AppSubURL + "/user/" + u.Name)
394 394
 }

+ 19 - 19
routers/user/setting.go

@@ -52,16 +52,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
52 52
 			switch {
53 53
 			case models.IsErrUserAlreadyExist(err):
54 54
 				ctx.Flash.Error(ctx.Tr("newName_been_taken"))
55
-				ctx.Redirect(setting.AppSubUrl + "/user/settings")
55
+				ctx.Redirect(setting.AppSubURL + "/user/settings")
56 56
 			case models.IsErrEmailAlreadyUsed(err):
57 57
 				ctx.Flash.Error(ctx.Tr("form.email_been_used"))
58
-				ctx.Redirect(setting.AppSubUrl + "/user/settings")
58
+				ctx.Redirect(setting.AppSubURL + "/user/settings")
59 59
 			case models.IsErrNameReserved(err):
60 60
 				ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
61
-				ctx.Redirect(setting.AppSubUrl + "/user/settings")
61
+				ctx.Redirect(setting.AppSubURL + "/user/settings")
62 62
 			case models.IsErrNamePatternNotAllowed(err):
63 63
 				ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
64
-				ctx.Redirect(setting.AppSubUrl + "/user/settings")
64
+				ctx.Redirect(setting.AppSubURL + "/user/settings")
65 65
 			default:
66 66
 				ctx.Handle(500, "ChangeUserName", err)
67 67
 			}
@@ -101,7 +101,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
101 101
 
102 102
 	log.Trace("User settings updated: %s", ctx.User.Name)
103 103
 	ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
104
-	ctx.Redirect(setting.AppSubUrl + "/user/settings")
104
+	ctx.Redirect(setting.AppSubURL + "/user/settings")
105 105
 }
106 106
 
107 107
 // UpdateAvatarSetting update user's avatar
@@ -162,7 +162,7 @@ func SettingsAvatarPost(ctx *context.Context, form auth.AvatarForm) {
162 162
 		ctx.Flash.Success(ctx.Tr("settings.update_avatar_success"))
163 163
 	}
164 164
 
165
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
165
+	ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
166 166
 }
167 167
 
168 168
 // SettingsDeleteAvatar render delete avatar page
@@ -171,7 +171,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
171 171
 		ctx.Flash.Error(err.Error())
172 172
 	}
173 173
 
174
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
174
+	ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
175 175
 }
176 176
 
177 177
 // SettingsPassword render change user's password page
@@ -207,7 +207,7 @@ func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
207 207
 		ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
208 208
 	}
209 209
 
210
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
210
+	ctx.Redirect(setting.AppSubURL + "/user/settings/password")
211 211
 }
212 212
 
213 213
 // SettingsEmails render user's emails page
@@ -238,7 +238,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
238 238
 		}
239 239
 
240 240
 		log.Trace("Email made primary: %s", ctx.User.Name)
241
-		ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
241
+		ctx.Redirect(setting.AppSubURL + "/user/settings/email")
242 242
 		return
243 243
 	}
244 244
 
@@ -282,7 +282,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
282 282
 	}
283 283
 
284 284
 	log.Trace("Email address added: %s", email.Email)
285
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
285
+	ctx.Redirect(setting.AppSubURL + "/user/settings/email")
286 286
 }
287 287
 
288 288
 // DeleteEmail reponse for delete user's email
@@ -295,7 +295,7 @@ func DeleteEmail(ctx *context.Context) {
295 295
 
296 296
 	ctx.Flash.Success(ctx.Tr("settings.email_deletion_success"))
297 297
 	ctx.JSON(200, map[string]interface{}{
298
-		"redirect": setting.AppSubUrl + "/user/settings/email",
298
+		"redirect": setting.AppSubURL + "/user/settings/email",
299 299
 	})
300 300
 }
301 301
 
@@ -337,7 +337,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
337 337
 			ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
338 338
 		} else {
339 339
 			ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
340
-			ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
340
+			ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
341 341
 			return
342 342
 		}
343 343
 	}
@@ -358,7 +358,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
358 358
 	}
359 359
 
360 360
 	ctx.Flash.Success(ctx.Tr("settings.add_key_success", form.Title))
361
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
361
+	ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
362 362
 }
363 363
 
364 364
 // DeleteSSHKey response for delete user's SSH key
@@ -370,7 +370,7 @@ func DeleteSSHKey(ctx *context.Context) {
370 370
 	}
371 371
 
372 372
 	ctx.JSON(200, map[string]interface{}{
373
-		"redirect": setting.AppSubUrl + "/user/settings/ssh",
373
+		"redirect": setting.AppSubURL + "/user/settings/ssh",
374 374
 	})
375 375
 }
376 376
 
@@ -417,7 +417,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
417 417
 	ctx.Flash.Success(ctx.Tr("settings.generate_token_succees"))
418 418
 	ctx.Flash.Info(t.Sha1)
419 419
 
420
-	ctx.Redirect(setting.AppSubUrl + "/user/settings/applications")
420
+	ctx.Redirect(setting.AppSubURL + "/user/settings/applications")
421 421
 }
422 422
 
423 423
 // SettingsDeleteApplication response for delete user access token
@@ -429,7 +429,7 @@ func SettingsDeleteApplication(ctx *context.Context) {
429 429
 	}
430 430
 
431 431
 	ctx.JSON(200, map[string]interface{}{
432
-		"redirect": setting.AppSubUrl + "/user/settings/applications",
432
+		"redirect": setting.AppSubURL + "/user/settings/applications",
433 433
 	})
434 434
 }
435 435
 
@@ -452,16 +452,16 @@ func SettingsDelete(ctx *context.Context) {
452 452
 			switch {
453 453
 			case models.IsErrUserOwnRepos(err):
454 454
 				ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
455
-				ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
455
+				ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
456 456
 			case models.IsErrUserHasOrgs(err):
457 457
 				ctx.Flash.Error(ctx.Tr("form.still_has_org"))
458
-				ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
458
+				ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
459 459
 			default:
460 460
 				ctx.Handle(500, "DeleteUser", err)
461 461
 			}
462 462
 		} else {
463 463
 			log.Trace("Account deleted: %s", ctx.User.Name)
464
-			ctx.Redirect(setting.AppSubUrl + "/")
464
+			ctx.Redirect(setting.AppSubURL + "/")
465 465
 		}
466 466
 		return
467 467
 	}