mirror of
https://github.com/go-gitea/gitea
synced 2026-02-09 23:28:09 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6f9ebfeb9 | ||
|
|
14de28b876 | ||
|
|
e4120bbc89 | ||
|
|
37abfcaf8a | ||
|
|
c719841f0d | ||
|
|
f9e150002e | ||
|
|
2f4f2852fc | ||
|
|
b25a571bc9 | ||
|
|
f9bbed028c | ||
|
|
7e084341fe | ||
|
|
7d75eede04 | ||
|
|
3db98bef99 | ||
|
|
484fe075f4 | ||
|
|
de3216ee55 | ||
|
|
353d88a42e | ||
|
|
a17fce31a9 | ||
|
|
71e1ebfa60 | ||
|
|
afe9d2cadd | ||
|
|
012e45a4c1 | ||
|
|
d25ff0d695 | ||
|
|
6eaebda1b5 | ||
|
|
6100935a77 | ||
|
|
6de75224de | ||
|
|
9086916eb7 |
@@ -4,6 +4,36 @@ This changelog goes through all the changes that have been made in each release
|
||||
without substantial changes to our git log; to see the highlights of what has
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
|
||||
## [1.15.10](https://github.com/go-gitea/gitea/releases/tag/v1.15.10) - 2022-01-14
|
||||
|
||||
* BUGFIXES
|
||||
* Fix inconsistent PR comment counts (#18260) (#18261)
|
||||
* Fix release link broken (#18252) (#18253)
|
||||
* Fix update user from site administration page bug (#18250) (#18251)
|
||||
* Set HeadCommit when creating tags (#18116) (#18173)
|
||||
* Use correct translation key for error messages due to max repo limits (#18135 & #18153) (#18152)
|
||||
* Fix purple color in suggested label colors (#18241) (#18242)
|
||||
* SECURITY
|
||||
* Bump mermaid from 8.10.1 to 8.13.8 (#18198) (#18206)
|
||||
|
||||
## [1.15.9](https://github.com/go-gitea/gitea/releases/tag/v1.15.9) - 2021-12-30
|
||||
|
||||
* BUGFIXES
|
||||
* Fix wrong redirect on org labels (#18128) (#18134)
|
||||
* Fix: unstable sort skips/duplicates issues across pages (#18094) (#18095)
|
||||
* Revert "Fix delete u2f keys bug (#18042)" (#18107)
|
||||
* Migrating wiki don't require token, so we should move it out of the require form (#17645) (#18104)
|
||||
* Prevent NPE if gitea uploader fails to open url (#18080) (#18101)
|
||||
* Reset locale on login (#17734) (#18100)
|
||||
* Correctly handle failed migrations (#17575) (#18099)
|
||||
* Instead of using routerCtx just escape the url before routing (#18086) (#18098)
|
||||
* Quote references to the user table in consistency checks (#18072) (#18073)
|
||||
* Add NotFound handler (#18062) (#18067)
|
||||
* Ensure that git repository is closed before transfer (#18049) (#18057)
|
||||
* Use common sessioner for API and web routes (#18114)
|
||||
* TRANSLATION
|
||||
* Fix code search result hint on zh-CN (#18053)
|
||||
|
||||
## [1.15.8](https://github.com/go-gitea/gitea/releases/tag/v1.15.8) - 2021-12-20
|
||||
|
||||
* BUGFIXES
|
||||
|
||||
@@ -33,6 +33,7 @@ func TestLinksNoLogin(t *testing.T) {
|
||||
"/user/forgot_password",
|
||||
"/api/swagger",
|
||||
"/user2/repo1",
|
||||
"/user2/repo1/",
|
||||
"/user2/repo1/projects",
|
||||
"/user2/repo1/projects/1",
|
||||
"/assets/img/404.png",
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestSignOut(t *testing.T) {
|
||||
session.MakeRequest(t, req, http.StatusFound)
|
||||
|
||||
// try to view a private repo, should fail
|
||||
req = NewRequest(t, "GET", "/user2/repo2/")
|
||||
req = NewRequest(t, "GET", "/user2/repo2")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// invalidate cached cookies for user2, for subsequent tests
|
||||
|
||||
+18
-10
@@ -1145,17 +1145,17 @@ type IssuesOptions struct {
|
||||
func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64) {
|
||||
switch sortType {
|
||||
case "oldest":
|
||||
sess.Asc("issue.created_unix")
|
||||
sess.Asc("issue.created_unix").Asc("issue.id")
|
||||
case "recentupdate":
|
||||
sess.Desc("issue.updated_unix")
|
||||
sess.Desc("issue.updated_unix").Desc("issue.created_unix").Desc("issue.id")
|
||||
case "leastupdate":
|
||||
sess.Asc("issue.updated_unix")
|
||||
sess.Asc("issue.updated_unix").Asc("issue.created_unix").Asc("issue.id")
|
||||
case "mostcomment":
|
||||
sess.Desc("issue.num_comments")
|
||||
sess.Desc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
|
||||
case "leastcomment":
|
||||
sess.Asc("issue.num_comments")
|
||||
sess.Asc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
|
||||
case "priority":
|
||||
sess.Desc("issue.priority")
|
||||
sess.Desc("issue.priority").Desc("issue.created_unix").Desc("issue.id")
|
||||
case "nearduedate":
|
||||
// 253370764800 is 01/01/9999 @ 12:00am (UTC)
|
||||
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
||||
@@ -1163,17 +1163,25 @@ func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64
|
||||
"WHEN issue.deadline_unix = 0 AND (milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL) THEN 253370764800 " +
|
||||
"WHEN milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
||||
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
||||
"ELSE issue.deadline_unix END ASC")
|
||||
"ELSE issue.deadline_unix END ASC").
|
||||
Desc("issue.created_unix").
|
||||
Desc("issue.id")
|
||||
case "farduedate":
|
||||
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
||||
OrderBy("CASE " +
|
||||
"WHEN milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
||||
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
||||
"ELSE issue.deadline_unix END DESC")
|
||||
"ELSE issue.deadline_unix END DESC").
|
||||
Desc("issue.created_unix").
|
||||
Desc("issue.id")
|
||||
case "priorityrepo":
|
||||
sess.OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 ELSE 2 END, issue.created_unix DESC")
|
||||
sess.OrderBy("CASE " +
|
||||
"WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 " +
|
||||
"ELSE 2 END ASC").
|
||||
Desc("issue.created_unix").
|
||||
Desc("issue.id")
|
||||
default:
|
||||
sess.Desc("issue.created_unix")
|
||||
sess.Desc("issue.created_unix").Desc("issue.id")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -762,13 +762,12 @@ func updateCommentInfos(e *xorm.Session, opts *CreateCommentOptions, comment *Co
|
||||
}
|
||||
}
|
||||
fallthrough
|
||||
case CommentTypeReview:
|
||||
fallthrough
|
||||
case CommentTypeComment:
|
||||
if _, err = e.Exec("UPDATE `issue` SET num_comments=num_comments+1 WHERE id=?", opts.Issue.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fallthrough
|
||||
case CommentTypeReview:
|
||||
// Check attachments
|
||||
attachments, err := getAttachmentsByUUIDs(e, opts.Attachments)
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -1095,7 +1095,7 @@ func updateUser(e Engine, u *User, changePrimaryEmail bool) error {
|
||||
if _, err := e.Insert(&emailAddress); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if _, err := e.ID(emailAddress).Cols("is_primary").Update(&EmailAddress{
|
||||
} else if _, err := e.ID(emailAddress.ID).Cols("is_primary").Update(&EmailAddress{
|
||||
IsPrimary: true,
|
||||
}); err != nil {
|
||||
return err
|
||||
|
||||
@@ -223,6 +223,9 @@ func APIAuth(authMethod auth.Auth) func(*APIContext) {
|
||||
// Get user from session if logged in.
|
||||
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
||||
if ctx.User != nil {
|
||||
if ctx.Locale.Language() != ctx.User.Language {
|
||||
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||
}
|
||||
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
||||
ctx.IsSigned = true
|
||||
ctx.Data["IsSigned"] = ctx.IsSigned
|
||||
|
||||
@@ -642,6 +642,9 @@ func Auth(authMethod auth.Auth) func(*Context) {
|
||||
return func(ctx *Context) {
|
||||
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
||||
if ctx.User != nil {
|
||||
if ctx.Locale.Language() != ctx.User.Language {
|
||||
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||
}
|
||||
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
||||
ctx.IsSigned = true
|
||||
ctx.Data["IsSigned"] = ctx.IsSigned
|
||||
@@ -670,9 +673,6 @@ func Contexter() func(next http.Handler) http.Handler {
|
||||
var startTime = time.Now()
|
||||
var link = setting.AppSubURL + strings.TrimSuffix(req.URL.EscapedPath(), "/")
|
||||
|
||||
chiCtx := chi.RouteContext(req.Context())
|
||||
chiCtx.RoutePath = req.URL.EscapedPath()
|
||||
|
||||
var ctx = Context{
|
||||
Resp: NewResponse(resp),
|
||||
Cache: mc.GetCache(),
|
||||
|
||||
@@ -159,13 +159,13 @@ func checkDBConsistency(logger log.Logger, autofix bool) error {
|
||||
"lfs_lock", "repository", "lfs_lock.repo_id=repository.id"),
|
||||
// find collaborations without users
|
||||
genericOrphanCheck("Collaborations without existing user",
|
||||
"collaboration", "user", "collaboration.user_id=user.id"),
|
||||
"collaboration", "user", "collaboration.user_id=`user`.id"),
|
||||
// find collaborations without repository
|
||||
genericOrphanCheck("Collaborations without existing repository",
|
||||
"collaboration", "repository", "collaboration.repo_id=repository.id"),
|
||||
// find access without users
|
||||
genericOrphanCheck("Access entries without existing user",
|
||||
"access", "user", "access.user_id=user.id"),
|
||||
"access", "user", "access.user_id=`user`.id"),
|
||||
// find access without repository
|
||||
genericOrphanCheck("Access entries without existing repository",
|
||||
"access", "repository", "access.repo_id=repository.id"),
|
||||
|
||||
@@ -58,6 +58,9 @@ func runMigrateTask(t *models.Task) (err error) {
|
||||
t.EndTime = timeutil.TimeStampNow()
|
||||
t.Status = structs.TaskStatusFailed
|
||||
t.Message = err.Error()
|
||||
// Ensure that the repo loaded before we zero out the repo ID from the task - thus ensuring that we can delete it
|
||||
_ = t.LoadRepo()
|
||||
|
||||
t.RepoID = 0
|
||||
if err := t.UpdateCols("status", "errors", "repo_id", "end_time"); err != nil {
|
||||
log.Error("Task UpdateCols failed: %v", err)
|
||||
|
||||
@@ -92,7 +92,7 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var task = models.Task{
|
||||
var task = &models.Task{
|
||||
DoerID: doer.ID,
|
||||
OwnerID: u.ID,
|
||||
Type: structs.TaskTypeMigrateRepo,
|
||||
@@ -100,7 +100,7 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
||||
PayloadContent: string(bs),
|
||||
}
|
||||
|
||||
if err := models.CreateTask(&task); err != nil {
|
||||
if err := models.CreateTask(task); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -128,5 +128,5 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &task, nil
|
||||
return task, nil
|
||||
}
|
||||
|
||||
+4
-1
@@ -31,7 +31,10 @@ func Open(uriStr string) (io.ReadCloser, error) {
|
||||
switch strings.ToLower(u.Scheme) {
|
||||
case "http", "https":
|
||||
f, err := http.Get(uriStr)
|
||||
return f.Body, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f.Body, nil
|
||||
case "file":
|
||||
return os.Open(u.Path)
|
||||
default:
|
||||
|
||||
@@ -896,11 +896,12 @@ migrate.migrate = Migrate From %s
|
||||
migrate.migrating = Migrating from <b>%s</b> ...
|
||||
migrate.migrating_failed = Migrating from <b>%s</b> failed.
|
||||
migrate.migrating_failed.error = Error: %s
|
||||
migrate.github.description = Migrating data from Github.com or Github Enterprise.
|
||||
migrate.git.description = Migrating or Mirroring git data from Git services
|
||||
migrate.gitlab.description = Migrating data from GitLab.com or Self-Hosted gitlab server.
|
||||
migrate.gitea.description = Migrating data from Gitea.com or Self-Hosted Gitea server.
|
||||
migrate.gogs.description = Migrating data from notabug.org or other Self-Hosted Gogs server.
|
||||
migrate.github.description = Migrate data from github.com or other Github instances.
|
||||
migrate.git.description = Migrate a repository only from any Git service.
|
||||
migrate.gitlab.description = Migrate data from gitlab.com or other GitLab instances.
|
||||
migrate.gitea.description = Migrate data from gitea.com or other Gitea instances.
|
||||
migrate.gogs.description = Migrate data from notabug.org or other Gogs instances.
|
||||
migrate.onedev.description = Migrate data from code.onedev.io or other OneDev instances.
|
||||
migrate.migrating_git = Migrating Git Data
|
||||
migrate.migrating_topics = Migrating Topics
|
||||
migrate.migrating_milestones = Migrating Milestones
|
||||
|
||||
@@ -630,8 +630,8 @@ last_used=上次使用在
|
||||
no_activity=没有最近活动
|
||||
can_read_info=读取
|
||||
can_write_info=写入
|
||||
key_state_desc=7 天内使用过该密钥
|
||||
token_state_desc=7 天内使用过该密钥
|
||||
key_state_desc=7 天内使用过该密钥
|
||||
token_state_desc=7 天内使用过该密钥
|
||||
principal_state_desc=7 天内使用过该规则
|
||||
show_openid=在个人信息上显示
|
||||
hide_openid=在个人信息上隐藏
|
||||
@@ -808,7 +808,7 @@ watchers=关注者
|
||||
stargazers=称赞者
|
||||
forks=派生仓库
|
||||
pick_reaction=选择你的表情
|
||||
reactions_more=再加载 %d
|
||||
reactions_more=再加载 %d
|
||||
unit_disabled=站点管理员已禁用此仓库单元。
|
||||
language_other=其它
|
||||
adopt_search=输入用户名以搜索未被收录的仓库... (留空以查找全部)
|
||||
@@ -1611,7 +1611,7 @@ search=搜索
|
||||
search.search_repo=搜索仓库...
|
||||
search.fuzzy=模糊
|
||||
search.match=匹配
|
||||
search.results=在 <a href="%s"> %s </a> 中搜索 "%s" 的结果
|
||||
search.results=在 <a href="%[2]s"> %[3]s </a> 中搜索 "%[1]s" 的结果
|
||||
|
||||
settings=设置
|
||||
settings.desc=设置是你可以管理仓库设置的地方
|
||||
|
||||
Generated
+749
-330
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -22,7 +22,7 @@
|
||||
"less": "4.1.1",
|
||||
"less-loader": "8.1.1",
|
||||
"license-checker-webpack-plugin": "0.2.1",
|
||||
"mermaid": "8.10.1",
|
||||
"mermaid": "8.13.8",
|
||||
"mini-css-extract-plugin": "1.6.0",
|
||||
"monaco-editor": "0.24.0",
|
||||
"monaco-editor-webpack-plugin": "3.1.0",
|
||||
|
||||
+2
-13
@@ -87,7 +87,6 @@ import (
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
"gitea.com/go-chi/session"
|
||||
"github.com/go-chi/cors"
|
||||
)
|
||||
|
||||
@@ -547,20 +546,10 @@ func bind(obj interface{}) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// Routes registers all v1 APIs routes to web application.
|
||||
func Routes() *web.Route {
|
||||
func Routes(sessioner func(next http.Handler) http.Handler) *web.Route {
|
||||
var m = web.NewRoute()
|
||||
|
||||
m.Use(session.Sessioner(session.Options{
|
||||
Provider: setting.SessionConfig.Provider,
|
||||
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
||||
CookieName: setting.SessionConfig.CookieName,
|
||||
CookiePath: setting.SessionConfig.CookiePath,
|
||||
Gclifetime: setting.SessionConfig.Gclifetime,
|
||||
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
||||
Secure: setting.SessionConfig.Secure,
|
||||
SameSite: setting.SessionConfig.SameSite,
|
||||
Domain: setting.SessionConfig.Domain,
|
||||
}))
|
||||
m.Use(sessioner)
|
||||
m.Use(securityHeaders())
|
||||
if setting.CORSConfig.Enabled {
|
||||
m.Use(cors.Handler(cors.Options{
|
||||
|
||||
@@ -96,6 +96,11 @@ func Transfer(ctx *context.APIContext) {
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Repo.GitRepo != nil {
|
||||
ctx.Repo.GitRepo.Close()
|
||||
ctx.Repo.GitRepo = nil
|
||||
}
|
||||
|
||||
if err := repo_service.StartRepositoryTransfer(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
|
||||
if models.IsErrRepoTransferInProgress(err) {
|
||||
ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
|
||||
|
||||
@@ -22,6 +22,9 @@ func Middlewares() []func(http.Handler) http.Handler {
|
||||
var handlers = []func(http.Handler) http.Handler{
|
||||
func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||
// First of all escape the URL RawPath to ensure that all routing is done using a correctly escaped URL
|
||||
req.URL.RawPath = req.URL.EscapedPath()
|
||||
|
||||
next.ServeHTTP(context.NewResponse(resp), req)
|
||||
})
|
||||
},
|
||||
|
||||
+16
-2
@@ -40,6 +40,8 @@ import (
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
"code.gitea.io/gitea/services/repository"
|
||||
"code.gitea.io/gitea/services/webhook"
|
||||
|
||||
"gitea.com/go-chi/session"
|
||||
)
|
||||
|
||||
// NewServices init new services
|
||||
@@ -144,8 +146,20 @@ func NormalRoutes() *web.Route {
|
||||
r.Use(middle)
|
||||
}
|
||||
|
||||
r.Mount("/", web_routers.Routes())
|
||||
r.Mount("/api/v1", apiv1.Routes())
|
||||
sessioner := session.Sessioner(session.Options{
|
||||
Provider: setting.SessionConfig.Provider,
|
||||
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
||||
CookieName: setting.SessionConfig.CookieName,
|
||||
CookiePath: setting.SessionConfig.CookiePath,
|
||||
Gclifetime: setting.SessionConfig.Gclifetime,
|
||||
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
||||
Secure: setting.SessionConfig.Secure,
|
||||
SameSite: setting.SessionConfig.SameSite,
|
||||
Domain: setting.SessionConfig.Domain,
|
||||
})
|
||||
|
||||
r.Mount("/", web_routers.Routes(sessioner))
|
||||
r.Mount("/api/v1", apiv1.Routes(sessioner))
|
||||
r.Mount("/api/internal", private.Routes())
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func DeleteLabel(ctx *context.Context) {
|
||||
func InitializeLabels(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.InitializeLabelsForm)
|
||||
if ctx.HasError() {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/labels")
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/labels")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,14 @@ func handleMigrateError(ctx *context.Context, owner *models.User, err error, nam
|
||||
case migrations.IsTwoFactorAuthError(err):
|
||||
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
|
||||
case models.IsErrReachLimitOfRepo(err):
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
|
||||
var msg string
|
||||
maxCreationLimit := owner.MaxCreationLimit()
|
||||
if maxCreationLimit == 1 {
|
||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
||||
} else {
|
||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
|
||||
}
|
||||
ctx.RenderWithErr(msg, tpl, form)
|
||||
case models.IsErrRepoAlreadyExist(err):
|
||||
ctx.Data["Err_RepoName"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)
|
||||
|
||||
@@ -158,7 +158,14 @@ func Create(ctx *context.Context) {
|
||||
func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
|
||||
switch {
|
||||
case models.IsErrReachLimitOfRepo(err):
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
|
||||
var msg string
|
||||
maxCreationLimit := owner.MaxCreationLimit()
|
||||
if maxCreationLimit == 1 {
|
||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
||||
} else {
|
||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
|
||||
}
|
||||
ctx.RenderWithErr(msg, tpl, form)
|
||||
case models.IsErrRepoAlreadyExist(err):
|
||||
ctx.Data["Err_RepoName"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)
|
||||
@@ -319,6 +326,11 @@ func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
|
||||
}
|
||||
|
||||
if accept {
|
||||
if ctx.Repo.GitRepo != nil {
|
||||
ctx.Repo.GitRepo.Close()
|
||||
ctx.Repo.GitRepo = nil
|
||||
}
|
||||
|
||||
if err := repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -533,7 +533,12 @@ func SettingsPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if !ctx.Repo.Owner.CanCreateRepo() {
|
||||
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation", ctx.User.MaxCreationLimit()))
|
||||
maxCreationLimit := ctx.Repo.Owner.MaxCreationLimit()
|
||||
if maxCreationLimit == 1 {
|
||||
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
|
||||
} else {
|
||||
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit))
|
||||
}
|
||||
ctx.Redirect(repo.Link() + "/settings")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -619,6 +619,13 @@ func Home(ctx *context.Context) {
|
||||
if ctx.Repo.Repository.IsBeingCreated() {
|
||||
task, err := models.GetMigratingTask(ctx.Repo.Repository.ID)
|
||||
if err != nil {
|
||||
if models.IsErrTaskDoesNotExist(err) {
|
||||
ctx.Data["Repo"] = ctx.Repo
|
||||
ctx.Data["CloneAddr"] = ""
|
||||
ctx.Data["Failed"] = true
|
||||
ctx.HTML(http.StatusOK, tplMigrating)
|
||||
return
|
||||
}
|
||||
ctx.ServerError("models.GetMigratingTask", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -584,6 +584,10 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
|
||||
|
||||
middleware.SetLocaleCookie(ctx.Resp, u.Language, 0)
|
||||
|
||||
if ctx.Locale.Language() != u.Language {
|
||||
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||
}
|
||||
|
||||
// Clear whatever CSRF has right now, force to generate a new one
|
||||
middleware.DeleteCSRFCookie(ctx.Resp)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
@@ -16,6 +17,12 @@ import (
|
||||
func TaskStatus(ctx *context.Context) {
|
||||
task, opts, err := models.GetMigratingTaskByID(ctx.ParamsInt64("task"), ctx.User.ID)
|
||||
if err != nil {
|
||||
if models.IsErrTaskDoesNotExist(err) {
|
||||
ctx.JSON(http.StatusNotFound, map[string]interface{}{
|
||||
"error": "task `" + strconv.FormatInt(ctx.ParamsInt64("task"), 10) + "` does not exist",
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||
"err": err,
|
||||
})
|
||||
|
||||
+7
-13
@@ -39,7 +39,6 @@ import (
|
||||
_ "code.gitea.io/gitea/modules/session"
|
||||
|
||||
"gitea.com/go-chi/captcha"
|
||||
"gitea.com/go-chi/session"
|
||||
"github.com/NYTimes/gziphandler"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/go-chi/cors"
|
||||
@@ -71,7 +70,7 @@ func CorsHandler() func(next http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
// Routes returns all web routes
|
||||
func Routes() *web.Route {
|
||||
func Routes(sessioner func(next http.Handler) http.Handler) *web.Route {
|
||||
routes := web.NewRoute()
|
||||
|
||||
routes.Use(public.AssetsHandler(&public.Options{
|
||||
@@ -80,17 +79,7 @@ func Routes() *web.Route {
|
||||
CorsHandler: CorsHandler(),
|
||||
}))
|
||||
|
||||
routes.Use(session.Sessioner(session.Options{
|
||||
Provider: setting.SessionConfig.Provider,
|
||||
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
||||
CookieName: setting.SessionConfig.CookieName,
|
||||
CookiePath: setting.SessionConfig.CookiePath,
|
||||
Gclifetime: setting.SessionConfig.Gclifetime,
|
||||
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
||||
Secure: setting.SessionConfig.Secure,
|
||||
SameSite: setting.SessionConfig.SameSite,
|
||||
Domain: setting.SessionConfig.Domain,
|
||||
}))
|
||||
routes.Use(sessioner)
|
||||
|
||||
routes.Use(Recovery())
|
||||
|
||||
@@ -1036,4 +1025,9 @@ func RegisterRoutes(m *web.Route) {
|
||||
if setting.API.EnableSwagger {
|
||||
m.Get("/swagger.v1.json", SwaggerV1Json)
|
||||
}
|
||||
m.NotFound(func(w http.ResponseWriter, req *http.Request) {
|
||||
ctx := context.GetContext(req)
|
||||
ctx.NotFound("", nil)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -69,13 +69,17 @@ func createTag(gitRepo *git.Repository, rel *models.Release, msg string) (bool,
|
||||
created = true
|
||||
rel.LowerTagName = strings.ToLower(rel.TagName)
|
||||
|
||||
commits := repository.NewPushCommits()
|
||||
commits.HeadCommit = repository.CommitToPushCommit(commit)
|
||||
commits.CompareURL = rel.Repo.ComposeCompareURL(git.EmptySHA, commit.ID.String())
|
||||
|
||||
notification.NotifyPushCommits(
|
||||
rel.Publisher, rel.Repo,
|
||||
&repository.PushUpdateOptions{
|
||||
RefFullName: git.TagPrefix + rel.TagName,
|
||||
OldCommitID: git.EmptySHA,
|
||||
NewCommitID: commit.ID.String(),
|
||||
}, repository.NewPushCommits())
|
||||
}, commits)
|
||||
notification.NotifyCreateRef(rel.Publisher, rel.Repo, "tag", git.TagPrefix+rel.TagName)
|
||||
rel.CreatedUnix = timeutil.TimeStampNow()
|
||||
}
|
||||
|
||||
@@ -115,13 +115,22 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
delTags = append(delTags, tagName)
|
||||
notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName)
|
||||
} else { // is new tag
|
||||
newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("gitRepo.GetCommit: %v", err)
|
||||
}
|
||||
|
||||
commits := repo_module.NewPushCommits()
|
||||
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
|
||||
commits.CompareURL = repo.ComposeCompareURL(git.EmptySHA, opts.NewCommitID)
|
||||
|
||||
notification.NotifyPushCommits(
|
||||
pusher, repo,
|
||||
&repo_module.PushUpdateOptions{
|
||||
RefFullName: git.TagPrefix + tagName,
|
||||
OldCommitID: git.EmptySHA,
|
||||
NewCommitID: opts.NewCommitID,
|
||||
}, repo_module.NewPushCommits())
|
||||
}, commits)
|
||||
|
||||
addTags = append(addTags, tagName)
|
||||
notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<a class="color" style="background-color:#006b75" data-color-hex="#006b75"></a>
|
||||
<a class="color" style="background-color:#207de5" data-color-hex="#207de5"></a>
|
||||
<a class="color" style="background-color:#0052cc" data-color-hex="#0052cc"></a>
|
||||
<a class="color" style="background-color:#53e917" data-color-hex="#53e917"></a>
|
||||
<a class="color" style="background-color:#5319e7" data-color-hex="#5319e7"></a>
|
||||
<a class="color" style="background-color:#f6c6c7" data-color-hex="#f6c6c7"></a>
|
||||
<a class="color" style="background-color:#fad8c7" data-color-hex="#fad8c7"></a>
|
||||
<a class="color" style="background-color:#fef2c0" data-color-hex="#fef2c0"></a>
|
||||
|
||||
@@ -26,19 +26,16 @@
|
||||
|
||||
{{template "repo/migrate/options" .}}
|
||||
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div id="migrate_items">
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="migrate_items">
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
@@ -61,6 +58,13 @@
|
||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@@ -26,19 +26,15 @@
|
||||
|
||||
{{template "repo/migrate/options" .}}
|
||||
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div id="migrate_items">
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="migrate_items">
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
@@ -61,6 +57,13 @@
|
||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@@ -26,19 +26,15 @@
|
||||
|
||||
{{template "repo/migrate/options" .}}
|
||||
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div id="migrate_items">
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="migrate_items">
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
@@ -61,6 +57,13 @@
|
||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@@ -26,19 +26,16 @@
|
||||
|
||||
{{template "repo/migrate/options" .}}
|
||||
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div id="migrate_items">
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="migrate_items">
|
||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
@@ -50,6 +47,13 @@
|
||||
<label>{{.i18n.Tr "repo.migrate_items_issues" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<div class="ui checkbox">
|
||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Gogs do not support it
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
<p id="repo_migrating_progress_message"></p>
|
||||
</div>
|
||||
<div id="repo_migrating_failed" hidden>
|
||||
<p>{{.i18n.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
|
||||
{{if .CloneAddr}}
|
||||
<p>{{.i18n.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
|
||||
{{else}}
|
||||
<p>{{.i18n.Tr "repo.migrate.migrating_failed" "<nil>" | Safe}}</p>
|
||||
{{end}}
|
||||
<p id="repo_migrating_failed_error"></p>
|
||||
</div>
|
||||
{{if and .Failed .Permission.IsAdmin}}
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{.Target}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
|
||||
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{if .Target}}{{.Target}}{{else}}{{$.DefaultBranch}}{{end}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
|
||||
</p>
|
||||
<div class="download">
|
||||
{{if $.Permission.CanRead $.UnitTypeCode}}
|
||||
@@ -135,7 +135,7 @@
|
||||
<span class="time">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
|
||||
{{end}}
|
||||
{{if not .IsDraft}}
|
||||
| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{.Target}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span>
|
||||
| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{if .Target}}{{.Target}}{{else}}{{$.DefaultBranch}}{{end}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span>
|
||||
{{end}}
|
||||
</p>
|
||||
<div class="markup desc">
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Content}}
|
||||
<div class="content">
|
||||
<div class="markup content">
|
||||
{{.RenderedContent|Str2html}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{{range .U2FRegistrations}}
|
||||
<div class="item">
|
||||
<div class="right floated content">
|
||||
<button class="ui red tiny button delete-button" modal-id="delete-registration" data-url="{{$.Link}}/u2f/delete" data-id="{{.ID}}">
|
||||
<button class="ui red tiny button delete-button" id="delete-registration" data-url="{{$.Link}}/u2f/delete" data-id="{{.ID}}">
|
||||
{{$.i18n.Tr "settings.delete_key"}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -2959,8 +2959,8 @@ $(() => {
|
||||
function showDeletePopup() {
|
||||
const $this = $(this);
|
||||
let filter = '';
|
||||
if ($this.attr('modal-id')) {
|
||||
filter += `#${$this.attr('modal-id')}`;
|
||||
if ($this.attr('id')) {
|
||||
filter += `#${$this.attr('id')}`;
|
||||
}
|
||||
|
||||
const dialog = $(`.delete.modal${filter}`);
|
||||
|
||||
@@ -135,7 +135,6 @@ textarea:focus,
|
||||
.form {
|
||||
.help {
|
||||
color: #999999;
|
||||
padding-top: .6em;
|
||||
padding-bottom: .6em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user