aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-06 17:13:53 -0400
committerUnknwon <u@gogs.io>2017-04-06 17:13:53 -0400
commit0e271799f2ec744332761cd87fe0d96f4d9653e0 (patch)
treea49a9609b8b37e972a60b505b2e3900922e55497 /routers
parent3c0de1713367ffecfe4606ad0553a550f568e74d (diff)
Refactoring: rename and simplify pkg/tool functions
Diffstat (limited to 'routers')
-rw-r--r--routers/install.go2
-rw-r--r--routers/repo/commit.go4
-rw-r--r--routers/repo/http.go2
-rw-r--r--routers/repo/pull.go2
-rw-r--r--routers/repo/repo.go2
-rw-r--r--routers/user/setting.go2
6 files changed, 7 insertions, 7 deletions
diff --git a/routers/install.go b/routers/install.go
index 2f482e45..2f94dc09 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -344,7 +344,7 @@ func InstallPost(ctx *context.Context, f form.Install) {
cfg.Section("log").Key("ROOT_PATH").SetValue(f.LogRootPath)
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
- secretKey, err := tool.GetRandomString(15)
+ secretKey, err := tool.RandomString(15)
if err != nil {
ctx.RenderWithErr(ctx.Tr("install.secret_key_failed", err), INSTALL, &f)
return
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 19803dc6..9723b7f1 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -165,7 +165,7 @@ func Diff(ctx *context.Context) {
ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName
ctx.Data["IsImageFile"] = commit.IsImageFile
- ctx.Data["Title"] = commit.Summary() + " · " + tool.ShortSha(commitID)
+ ctx.Data["Title"] = commit.Summary() + " · " + tool.ShortSHA1(commitID)
ctx.Data["Commit"] = commit
ctx.Data["Author"] = models.ValidateCommitWithEmail(commit)
ctx.Data["Diff"] = diff
@@ -228,7 +228,7 @@ func CompareDiff(ctx *context.Context) {
ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName
ctx.Data["IsImageFile"] = commit.IsImageFile
- ctx.Data["Title"] = "Comparing " + tool.ShortSha(beforeCommitID) + "..." + tool.ShortSha(afterCommitID) + " · " + userName + "/" + repoName
+ ctx.Data["Title"] = "Comparing " + tool.ShortSHA1(beforeCommitID) + "..." + tool.ShortSHA1(afterCommitID) + " · " + userName + "/" + repoName
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 256ca16f..786fa542 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -232,7 +232,7 @@ func ComposeHookEnvs(opts ComposeHookEnvsOptions) []string {
ENV_AUTH_USER_NAME + "=" + opts.AuthUser.Name,
ENV_AUTH_USER_EMAIL + "=" + opts.AuthUser.Email,
ENV_REPO_OWNER_NAME + "=" + opts.OwnerName,
- ENV_REPO_OWNER_SALT_MD5 + "=" + tool.EncodeMD5(opts.OwnerSalt),
+ ENV_REPO_OWNER_SALT_MD5 + "=" + tool.MD5(opts.OwnerSalt),
ENV_REPO_ID + "=" + com.ToStr(opts.RepoID),
ENV_REPO_NAME + "=" + opts.RepoName,
ENV_REPO_CUSTOM_HOOKS_PATH + "=" + path.Join(opts.RepoPath, "custom_hooks"),
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 6d420121..6ff313b7 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -738,7 +738,7 @@ func TriggerTask(ctx *context.Context) {
if ctx.Written() {
return
}
- if secret != tool.EncodeMD5(owner.Salt) {
+ if secret != tool.MD5(owner.Salt) {
ctx.Error(404)
log.Trace("TriggerTask [%s/%s]: invalid secret", owner.Name, repo.Name)
return
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 2781da9a..bdc471fe 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -323,7 +323,7 @@ func Download(ctx *context.Context) {
return
}
- archivePath = path.Join(archivePath, tool.ShortSha(commit.ID.String())+ext)
+ archivePath = path.Join(archivePath, tool.ShortSHA1(commit.ID.String())+ext)
if !com.IsFile(archivePath) {
if err := commit.CreateArchive(archivePath, archiveType); err != nil {
ctx.Handle(500, "Download -> CreateArchive "+archivePath, err)
diff --git a/routers/user/setting.go b/routers/user/setting.go
index 9083454a..b9c70d64 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -123,7 +123,7 @@ func SettingsPost(ctx *context.Context, f form.UpdateProfile) {
func UpdateAvatarSetting(ctx *context.Context, f form.Avatar, ctxUser *models.User) error {
ctxUser.UseCustomAvatar = f.Source == form.AVATAR_LOCAL
if len(f.Gravatar) > 0 {
- ctxUser.Avatar = tool.EncodeMD5(f.Gravatar)
+ ctxUser.Avatar = tool.MD5(f.Gravatar)
ctxUser.AvatarEmail = f.Gravatar
}