mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Compare commits
	
		
			15 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					7e084341fe | ||
| 
						 | 
					7d75eede04 | ||
| 
						 | 
					3db98bef99 | ||
| 
						 | 
					484fe075f4 | ||
| 
						 | 
					de3216ee55 | ||
| 
						 | 
					353d88a42e | ||
| 
						 | 
					a17fce31a9 | ||
| 
						 | 
					71e1ebfa60 | ||
| 
						 | 
					afe9d2cadd | ||
| 
						 | 
					012e45a4c1 | ||
| 
						 | 
					d25ff0d695 | ||
| 
						 | 
					6eaebda1b5 | ||
| 
						 | 
					6100935a77 | ||
| 
						 | 
					6de75224de | ||
| 
						 | 
					9086916eb7 | 
							
								
								
									
										18
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -4,6 +4,24 @@ 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.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
 | 
			
		||||
 
 | 
			
		||||
@@ -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")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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=设置是你可以管理仓库设置的地方
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -319,6 +319,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
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
		})
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 | 
			
		||||
					<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>
 | 
			
		||||
					<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>
 | 
			
		||||
					<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>
 | 
			
		||||
 | 
			
		||||
					<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>
 | 
			
		||||
								{{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}}
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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