From dac15b2a2b32d664fd09d7b17aa45ed538be0aa6 Mon Sep 17 00:00:00 2001 From: Gusted Date: Fri, 5 Nov 2021 16:08:44 +0100 Subject: [PATCH 1/7] feat: Allow multiple tags on comments - Allow for multiples tags(Currently Poster + {Owner, Writer}). - Utilize the Poster tag within the commentTag function and remove the checking from templates. - Use bitwise on CommentTags to enable specific tags. - Don't show poster tag(view_content.tmpl) on the initial issue comment. --- models/issue_comment.go | 26 ++++++++++ routers/web/repo/issue.go | 42 +++++++++------- templates/repo/issue/view_content.tmpl | 13 +++-- .../repo/issue/view_content/comments.tmpl | 48 +++++++++---------- 4 files changed, 83 insertions(+), 46 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 0ae9140f0cc7b..79454efa7da6a 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -116,6 +116,32 @@ const ( CommentTagOwner ) +// EnableTag enable a specific tag on the CommentTag. +func (ct CommentTag) EnableTag(tag CommentTag) CommentTag { + ct |= (1 << tag) + return ct +} + +func stringToCommentTag(tag string) CommentTag { + switch tag { + case "Poster": + return CommentTagPoster + case "Writer": + return CommentTagWriter + case "Owner": + return CommentTagOwner + default: + return CommentTagNone + } +} + +// HasTag returns if a certain tag is enabled on the CommentTag. +func (ct CommentTag) HasTag(checkTag string) bool { + checkCommentTag := stringToCommentTag(checkTag) + bitValue := ct & (1 << checkCommentTag) + return (bitValue > 0) +} + // Comment represents a comment in commit and issue page. type Comment struct { ID int64 `xorm:"pk autoincr"` diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 0816d413400c5..d6184fdbc72ef 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1020,32 +1020,40 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu if err != nil { return models.CommentTagNone, err } - if perm.IsOwner() { - if !poster.IsAdmin { - return models.CommentTagOwner, nil - } - ok, err := models.IsUserRealRepoAdmin(repo, poster) - if err != nil { - return models.CommentTagNone, err - } + // By default the poster has no tags. + pCommentTag := models.CommentTagNone - if ok { - return models.CommentTagOwner, nil - } + // Check if the poster is owner of the repo. + if perm.IsOwner() { + // If the poster isn't a admin, enable the owner Tag. + if !poster.IsAdmin { + pCommentTag = pCommentTag.EnableTag(models.CommentTagOwner) + } else { - if ok, err = repo.IsCollaborator(poster.ID); ok && err == nil { - return models.CommentTagWriter, nil + // Otherwise check if poster is the real repo admin. + ok, err := models.IsUserRealRepoAdmin(repo, poster) + if err != nil { + return models.CommentTagNone, err + } + if ok { + pCommentTag = pCommentTag.EnableTag(models.CommentTagOwner) + } } + } - return models.CommentTagNone, err + // Is the poster can write code to the repo, enable Writer tag. + // Only enable this if the poster doesn't have the owner tag already. + if !pCommentTag.HasTag("Owner") && perm.CanWrite(models.UnitTypeCode) { + pCommentTag = pCommentTag.EnableTag(models.CommentTagWriter) } - if perm.CanWrite(models.UnitTypeCode) { - return models.CommentTagWriter, nil + // If the poster is the actual poster of the issue, enable Poster tag. + if issue.IsPoster(poster.ID) { + pCommentTag = pCommentTag.EnableTag(models.CommentTagPoster) } - return models.CommentTagNone, nil + return pCommentTag, nil } func getBranchData(ctx *context.Context, issue *models.Issue) { diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 9ad6bee6515ad..ba3640d1cbc2d 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -50,13 +50,16 @@
{{if not $.Repository.IsArchived}} {{if gt .Issue.ShowTag 0}} -
- {{if eq .Issue.ShowTag 2}} + {{if (.Issue.ShowTag.HasTag "Writer")}} +
{{$.i18n.Tr "repo.issues.collaborator"}} - {{else if eq .Issue.ShowTag 3}} +
+ {{end}} + {{if (.Issue.ShowTag.HasTag "Owner")}} +
{{$.i18n.Tr "repo.issues.owner"}} - {{end}} -
+
+ {{end}} {{end}} {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 51d1e093c86d2..24681fef6ddf2 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -44,18 +44,19 @@
{{if not $.Repository.IsArchived}} - {{if or (and (eq .PosterID .Issue.PosterID) (eq .Issue.OriginalAuthorID 0)) (and (eq .Issue.OriginalAuthorID .OriginalAuthorID) (not (eq .OriginalAuthorID 0))) }} + {{if (.ShowTag.HasTag "Poster")}}
{{$.i18n.Tr "repo.issues.poster"}}
{{end}} - {{if gt .ShowTag 0}} + {{if (.ShowTag.HasTag "Writer")}}
- {{if eq .ShowTag 2}} - {{$.i18n.Tr "repo.issues.collaborator"}} - {{else if eq .ShowTag 3}} - {{$.i18n.Tr "repo.issues.owner"}} - {{end}} + {{$.i18n.Tr "repo.issues.collaborator"}} +
+ {{end}} + {{if (.ShowTag.HasTag "Owner")}} +
+ {{$.i18n.Tr "repo.issues.owner"}}
{{end}} {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} @@ -549,24 +550,23 @@
- {{if not $.Repository.IsArchived}} - {{if or (and (eq .PosterID $.Issue.PosterID) (eq $.Issue.OriginalAuthorID 0)) (eq $.Issue.OriginalAuthorID .OriginalAuthorID) }} -
- {{$.i18n.Tr "repo.issues.poster"}} -
- {{end}} - {{if gt .ShowTag 0}} -
- {{if eq .ShowTag 2}} - {{$.i18n.Tr "repo.issues.collaborator"}} - {{else if eq .ShowTag 3}} - {{$.i18n.Tr "repo.issues.owner"}} - {{end}} -
- {{end}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{if (.ShowTag.HasTag "Poster")}} +
+ {{$.i18n.Tr "repo.issues.poster"}} +
+ {{end}} + {{if (.ShowTag.HasTag "Writer")}} +
+ {{$.i18n.Tr "repo.issues.collaborator"}} +
+ {{end}} + {{if (.ShowTag.HasTag "Owner")}} +
+ {{$.i18n.Tr "repo.issues.owner"}} +
{{end}} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
From 6eb3f649eb5e0bd49a6830bfafae65e827fa5fdc Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 6 Nov 2021 14:32:11 +0100 Subject: [PATCH 2/7] Change parameters naming --- models/issue_comment.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 79454efa7da6a..4b48dd33eb519 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -117,8 +117,8 @@ const ( ) // EnableTag enable a specific tag on the CommentTag. -func (ct CommentTag) EnableTag(tag CommentTag) CommentTag { - ct |= (1 << tag) +func (ct CommentTag) EnableTag(withTag CommentTag) CommentTag { + ct |= (1 << withTag) return ct } @@ -136,8 +136,8 @@ func stringToCommentTag(tag string) CommentTag { } // HasTag returns if a certain tag is enabled on the CommentTag. -func (ct CommentTag) HasTag(checkTag string) bool { - checkCommentTag := stringToCommentTag(checkTag) +func (ct CommentTag) HasTag(compareTag string) bool { + checkCommentTag := stringToCommentTag(compareTag) bitValue := ct & (1 << checkCommentTag) return (bitValue > 0) } From 1551d15c3cc28ffa50afc2f60e649e64e87c0094 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 7 Nov 2021 14:21:52 +0100 Subject: [PATCH 3/7] Change function name --- models/issue_comment.go | 6 +++--- routers/web/repo/issue.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 4b48dd33eb519..ef6fcb1b6f9bc 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -116,9 +116,9 @@ const ( CommentTagOwner ) -// EnableTag enable a specific tag on the CommentTag. -func (ct CommentTag) EnableTag(withTag CommentTag) CommentTag { - ct |= (1 << withTag) +// WithTag enable a specific tag on the CommentTag. +func (ct CommentTag) WithTag(tag CommentTag) CommentTag { + ct |= (1 << tag) return ct } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index d6184fdbc72ef..d41bd758c39b1 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1028,7 +1028,7 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu if perm.IsOwner() { // If the poster isn't a admin, enable the owner Tag. if !poster.IsAdmin { - pCommentTag = pCommentTag.EnableTag(models.CommentTagOwner) + pCommentTag = pCommentTag.WithTag(models.CommentTagOwner) } else { // Otherwise check if poster is the real repo admin. @@ -1037,7 +1037,7 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu return models.CommentTagNone, err } if ok { - pCommentTag = pCommentTag.EnableTag(models.CommentTagOwner) + pCommentTag = pCommentTag.WithTag(models.CommentTagOwner) } } } @@ -1045,12 +1045,12 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu // Is the poster can write code to the repo, enable Writer tag. // Only enable this if the poster doesn't have the owner tag already. if !pCommentTag.HasTag("Owner") && perm.CanWrite(models.UnitTypeCode) { - pCommentTag = pCommentTag.EnableTag(models.CommentTagWriter) + pCommentTag = pCommentTag.WithTag(models.CommentTagWriter) } // If the poster is the actual poster of the issue, enable Poster tag. if issue.IsPoster(poster.ID) { - pCommentTag = pCommentTag.EnableTag(models.CommentTagPoster) + pCommentTag = pCommentTag.WithTag(models.CommentTagPoster) } return pCommentTag, nil From aa4599b025c34782195c45c5e46c0910232c3e43 Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 9 Nov 2021 07:50:54 +0100 Subject: [PATCH 4/7] refactor variable wording --- routers/web/repo/issue.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index d41bd758c39b1..012ce4e9ae05e 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1021,14 +1021,14 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu return models.CommentTagNone, err } - // By default the poster has no tags. - pCommentTag := models.CommentTagNone + // By default the comment has no tags. + commentTag := models.CommentTagNone // Check if the poster is owner of the repo. if perm.IsOwner() { // If the poster isn't a admin, enable the owner Tag. if !poster.IsAdmin { - pCommentTag = pCommentTag.WithTag(models.CommentTagOwner) + commentTag = commentTag.WithTag(models.CommentTagOwner) } else { // Otherwise check if poster is the real repo admin. @@ -1037,23 +1037,23 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu return models.CommentTagNone, err } if ok { - pCommentTag = pCommentTag.WithTag(models.CommentTagOwner) + commentTag = commentTag.WithTag(models.CommentTagOwner) } } } // Is the poster can write code to the repo, enable Writer tag. // Only enable this if the poster doesn't have the owner tag already. - if !pCommentTag.HasTag("Owner") && perm.CanWrite(models.UnitTypeCode) { - pCommentTag = pCommentTag.WithTag(models.CommentTagWriter) + if !commentTag.HasTag("Owner") && perm.CanWrite(models.UnitTypeCode) { + commentTag = commentTag.WithTag(models.CommentTagWriter) } // If the poster is the actual poster of the issue, enable Poster tag. if issue.IsPoster(poster.ID) { - pCommentTag = pCommentTag.WithTag(models.CommentTagPoster) + commentTag = commentTag.WithTag(models.CommentTagPoster) } - return pCommentTag, nil + return commentTag, nil } func getBranchData(ctx *context.Context, issue *models.Issue) { From 2054b2cab148add91e36255f4dc13de7e42320dc Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 9 Nov 2021 12:00:17 +0100 Subject: [PATCH 5/7] Merge 'master' branch into 'tags-comments' branch --- .revive.toml | 1 + MAINTAINERS | 1 + cmd/admin.go | 55 +++++-- cmd/admin_auth_ldap.go | 23 ++- cmd/admin_auth_ldap_test.go | 9 +- cmd/cmd.go | 9 +- cmd/convert.go | 5 +- cmd/doctor.go | 10 +- cmd/dump.go | 5 +- cmd/dump_repo.go | 5 +- cmd/migrate.go | 5 +- cmd/migrate_storage.go | 5 +- custom/conf/app.example.ini | 1 + .../doc/advanced/config-cheat-sheet.en-us.md | 2 +- .../git_helper_for_declarative_test.go | 3 +- models/branches.go | 2 +- models/branches_test.go | 25 +++ models/db/engine.go | 55 ++----- models/fixtures/u2f_registration.yml | 2 +- models/fixtures/user.yml | 16 ++ models/issue.go | 15 +- models/issue_test.go | 40 +++++ models/login/twofactor.go | 6 + models/login/u2f.go | 5 + models/login/u2f_test.go | 2 +- models/org.go | 2 +- models/user.go | 19 ++- models/user_test.go | 4 +- modules/convert/convert.go | 3 +- modules/doctor/doctor.go | 9 +- modules/migrations/gitea_uploader.go | 5 +- modules/ssh/ssh.go | 3 +- options/locale/locale_bg-BG.ini | 2 - options/locale/locale_cs-CZ.ini | 4 - options/locale/locale_de-DE.ini | 4 - options/locale/locale_el-GR.ini | 4 - options/locale/locale_en-US.ini | 9 +- options/locale/locale_es-ES.ini | 4 - options/locale/locale_fa-IR.ini | 4 - options/locale/locale_fi-FI.ini | 2 - options/locale/locale_fr-FR.ini | 4 - options/locale/locale_hu-HU.ini | 4 - options/locale/locale_id-ID.ini | 4 - options/locale/locale_it-IT.ini | 4 - options/locale/locale_ja-JP.ini | 4 - options/locale/locale_ko-KR.ini | 4 - options/locale/locale_lv-LV.ini | 4 - options/locale/locale_ml-IN.ini | 2 - options/locale/locale_nl-NL.ini | 4 - options/locale/locale_pl-PL.ini | 4 - options/locale/locale_pt-BR.ini | 8 +- options/locale/locale_pt-PT.ini | 8 +- options/locale/locale_ru-RU.ini | 4 - options/locale/locale_sv-SE.ini | 4 - options/locale/locale_tr-TR.ini | 4 - options/locale/locale_uk-UA.ini | 4 - options/locale/locale_zh-CN.ini | 4 - options/locale/locale_zh-TW.ini | 8 +- routers/api/v1/repo/transfer.go | 3 +- routers/init.go | 6 +- routers/install/install.go | 4 +- routers/web/repo/issue.go | 4 +- routers/web/user/auth.go | 45 ++++-- routers/web/user/setting/security.go | 24 ++- services/gitdiff/gitdiff.go | 12 +- services/gitdiff/gitdiff_test.go | 19 +++ templates/user/auth/u2f.tmpl | 8 +- templates/user/settings/security_twofa.tmpl | 2 +- templates/user/settings/security_u2f.tmpl | 42 +++-- web_src/js/features/common-global.js | 4 +- web_src/js/features/comp/ImagePaste.js | 6 +- web_src/js/features/comp/SearchUserBox.js | 2 +- web_src/js/features/comp/WebHookEditor.js | 2 +- web_src/js/features/diff.js | 24 --- web_src/js/features/dropzone.js | 1 - web_src/js/features/heatmap.js | 4 +- web_src/js/features/imagediff.js | 2 +- web_src/js/features/lastcommitloader.js | 40 ----- web_src/js/features/notification.js | 4 +- web_src/js/features/repo-commit.js | 41 +++++ web_src/js/features/repo-diff.js | 25 +++ web_src/js/features/repo-editor.js | 82 +++++----- .../features/{gitgraph.js => repo-graph.js} | 2 +- ...ntent-history.js => repo-issue-content.js} | 2 +- web_src/js/features/repo-legacy.js | 4 +- .../{migration.js => repo-migration.js} | 2 +- .../{projects.js => repo-projects.js} | 16 +- web_src/js/features/repo-settings.js | 4 +- web_src/js/features/stopwatch.js | 4 +- web_src/js/index.js | 147 +++++++++--------- web_src/js/markup/content.js | 4 +- 91 files changed, 589 insertions(+), 469 deletions(-) delete mode 100644 web_src/js/features/diff.js delete mode 100644 web_src/js/features/lastcommitloader.js rename web_src/js/features/{gitgraph.js => repo-graph.js} (99%) rename web_src/js/features/{issue-content-history.js => repo-issue-content.js} (98%) rename web_src/js/features/{migration.js => repo-migration.js} (97%) rename web_src/js/features/{projects.js => repo-projects.js} (97%) diff --git a/.revive.toml b/.revive.toml index 74743d5ef4d4f..499a4051a1283 100644 --- a/.revive.toml +++ b/.revive.toml @@ -23,3 +23,4 @@ warningCode = 1 [rule.unexported-return] [rule.indent-error-flow] [rule.errorf] +[rule.duplicated-imports] diff --git a/MAINTAINERS b/MAINTAINERS index 926a308d1eb6c..e3357f7b8fe44 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -45,3 +45,4 @@ Janis Estelmann (@KN4CK3R) Steven Kriegler (@justusbunsi) Jimmy Praet (@jpraet) Leon Hofmeister (@delvh) +Gusted 0 { - sess.In("issue.id", opts.IssueIDs) + if len(issueIDs) > 0 { + sess.In("issue.id", issueIDs) } if len(opts.Labels) > 0 && opts.Labels != "0" { @@ -1583,13 +1582,13 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats, } var err error - stats.OpenCount, err = countSession(opts). + stats.OpenCount, err = countSession(opts, issueIDs). And("issue.is_closed = ?", false). Count(new(Issue)) if err != nil { return stats, err } - stats.ClosedCount, err = countSession(opts). + stats.ClosedCount, err = countSession(opts, issueIDs). And("issue.is_closed = ?", true). Count(new(Issue)) return stats, err @@ -2116,7 +2115,7 @@ func (issue *Issue) ResolveMentionsByVisibility(ctx context.Context, doer *User, } // UpdateIssuesMigrationsByType updates all migrated repositories' issues from gitServiceType to replace originalAuthorID to posterID -func UpdateIssuesMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, posterID int64) error { +func UpdateIssuesMigrationsByType(gitServiceType api.GitServiceType, originalAuthorID string, posterID int64) error { _, err := db.GetEngine(db.DefaultContext).Table("issue"). Where("repo_id IN (SELECT id FROM repository WHERE original_service_type = ?)", gitServiceType). And("original_author_id = ?", originalAuthorID). @@ -2129,7 +2128,7 @@ func UpdateIssuesMigrationsByType(gitServiceType structs.GitServiceType, origina } // UpdateReactionsMigrationsByType updates all migrated repositories' reactions from gitServiceType to replace originalAuthorID to posterID -func UpdateReactionsMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, userID int64) error { +func UpdateReactionsMigrationsByType(gitServiceType api.GitServiceType, originalAuthorID string, userID int64) error { _, err := db.GetEngine(db.DefaultContext).Table("reaction"). Where("original_author_id = ?", originalAuthorID). And(migratedIssueCond(gitServiceType)). diff --git a/models/issue_test.go b/models/issue_test.go index 8894d8020176c..9df91aeb9944b 100644 --- a/models/issue_test.go +++ b/models/issue_test.go @@ -435,3 +435,43 @@ func TestResourceIndex(t *testing.T) { } wg.Wait() } + +func TestCorrectIssueStats(t *testing.T) { + assert.NoError(t, db.PrepareTestDatabase()) + + // Because the condition is to have chunked database look-ups, + // We have to more issues than `maxQueryParameters`, we will insert. + // maxQueryParameters + 10 issues into the testDatabase. + // Each new issues will have a constant description "Bugs are nasty" + // Which will be used later on. + + issueAmount := maxQueryParameters + 10 + + var wg sync.WaitGroup + for i := 0; i < issueAmount; i++ { + wg.Add(1) + go func(i int) { + testInsertIssue(t, fmt.Sprintf("Issue %d", i+1), "Bugs are nasty", 0) + wg.Done() + }(i) + } + wg.Wait() + + // Now we will get all issueID's that match the "Bugs are nasty" query. + total, ids, err := SearchIssueIDsByKeyword("Bugs are nasty", []int64{1}, issueAmount, 0) + + // Just to be sure. + assert.NoError(t, err) + assert.EqualValues(t, issueAmount, total) + + // Now we will call the GetIssueStats with these IDs and if working, + // get the correct stats back. + issueStats, err := GetIssueStats(&IssueStatsOptions{ + RepoID: 1, + IssueIDs: ids, + }) + + // Now check the values. + assert.NoError(t, err) + assert.EqualValues(t, issueStats.OpenCount, issueAmount) +} diff --git a/models/login/twofactor.go b/models/login/twofactor.go index 1c4d2734fca02..acb5e1b2d50ec 100644 --- a/models/login/twofactor.go +++ b/models/login/twofactor.go @@ -136,6 +136,12 @@ func GetTwoFactorByUID(uid int64) (*TwoFactor, error) { return twofa, nil } +// HasTwoFactorByUID returns the two-factor authentication token associated with +// the user, if any. +func HasTwoFactorByUID(uid int64) (bool, error) { + return db.GetEngine(db.DefaultContext).Where("uid=?", uid).Exist(&TwoFactor{}) +} + // DeleteTwoFactorByID deletes two-factor authentication token by given ID. func DeleteTwoFactorByID(id, userID int64) error { cnt, err := db.GetEngine(db.DefaultContext).ID(id).Delete(&TwoFactor{ diff --git a/models/login/u2f.go b/models/login/u2f.go index 05d39cc05ec1d..8cea98463f115 100644 --- a/models/login/u2f.go +++ b/models/login/u2f.go @@ -115,6 +115,11 @@ func GetU2FRegistrationsByUID(uid int64) (U2FRegistrationList, error) { return getU2FRegistrationsByUID(db.GetEngine(db.DefaultContext), uid) } +// HasU2FRegistrationsByUID returns whether a given user has U2F registrations +func HasU2FRegistrationsByUID(uid int64) (bool, error) { + return db.GetEngine(db.DefaultContext).Where("user_id = ?", uid).Exist(&U2FRegistration{}) +} + func createRegistration(e db.Engine, userID int64, name string, reg *u2f.Registration) (*U2FRegistration, error) { raw, err := reg.MarshalBinary() if err != nil { diff --git a/models/login/u2f_test.go b/models/login/u2f_test.go index 32505b62a67dc..8f5cea61508a5 100644 --- a/models/login/u2f_test.go +++ b/models/login/u2f_test.go @@ -29,7 +29,7 @@ func TestGetU2FRegistrationByID(t *testing.T) { func TestGetU2FRegistrationsByUID(t *testing.T) { assert.NoError(t, db.PrepareTestDatabase()) - res, err := GetU2FRegistrationsByUID(1) + res, err := GetU2FRegistrationsByUID(32) assert.NoError(t, err) assert.Len(t, res, 1) diff --git a/models/org.go b/models/org.go index 8cba485a89fc2..d2801a30cee96 100644 --- a/models/org.go +++ b/models/org.go @@ -412,7 +412,7 @@ func GetUsersWhoCanCreateOrgRepo(orgID int64) ([]*User, error) { func getUsersWhoCanCreateOrgRepo(e db.Engine, orgID int64) ([]*User, error) { users := make([]*User, 0, 10) - return users, db.GetEngine(db.DefaultContext). + return users, e. Join("INNER", "`team_user`", "`team_user`.uid=`user`.id"). Join("INNER", "`team`", "`team`.id=`team_user`.team_id"). Where(builder.Eq{"team.can_create_org_repo": true}.Or(builder.Eq{"team.authorize": AccessModeOwner})). diff --git a/models/user.go b/models/user.go index 3ce23ef2ed534..dde5d0e180f59 100644 --- a/models/user.go +++ b/models/user.go @@ -131,14 +131,21 @@ type User struct { // Maximum repository creation limit, -1 means use global default MaxRepoCreation int `xorm:"NOT NULL DEFAULT -1"` - // Permissions - IsActive bool `xorm:"INDEX"` // Activate primary email - IsAdmin bool - IsRestricted bool `xorm:"NOT NULL DEFAULT false"` + // IsActive true: primary email is activated, user can access Web UI and Git SSH. + // false: an inactive user can only log in Web UI for account operations (ex: activate the account by email), no other access. + IsActive bool `xorm:"INDEX"` + // the user is a Gitea admin, who can access all repositories and the admin pages. + IsAdmin bool + // true: the user is only allowed to see organizations/repositories that they has explicit rights to. + // (ex: in private Gitea instances user won't be allowed to see even organizations/repositories that are set as public) + IsRestricted bool `xorm:"NOT NULL DEFAULT false"` + AllowGitHook bool AllowImportLocal bool // Allow migrate repository by local path AllowCreateOrganization bool `xorm:"DEFAULT true"` - ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"` + + // true: the user is not allowed to log in Web UI. Git/SSH access could still be allowed (please refer to Git/SSH access related code/documents) + ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"` // Avatar Avatar string `xorm:"VARCHAR(2048) NOT NULL"` @@ -468,7 +475,7 @@ func (u *User) isVisibleToUser(e db.Engine, viewer *User) bool { } // Now we need to check if they in some organization together - count, err := db.GetEngine(db.DefaultContext).Table("team_user"). + count, err := e.Table("team_user"). Where( builder.And( builder.Eq{"uid": viewer.ID}, diff --git a/models/user_test.go b/models/user_test.go index 2dcca20346b61..3f3536dafaa90 100644 --- a/models/user_test.go +++ b/models/user_test.go @@ -147,13 +147,13 @@ func TestSearchUsers(t *testing.T) { } testUserSuccess(&SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}}, - []int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30}) + []int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32}) testUserSuccess(&SearchUserOptions{ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolFalse}, []int64{9}) testUserSuccess(&SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, - []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 28, 29, 30}) + []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 28, 29, 30, 32}) testUserSuccess(&SearchUserOptions{Keyword: "user1", OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, []int64{1, 10, 11, 12, 13, 14, 15, 16, 18}) diff --git a/modules/convert/convert.go b/modules/convert/convert.go index 3c309a82f861d..2960f7741abae 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -15,7 +15,6 @@ import ( "code.gitea.io/gitea/models/login" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/services/webhook" @@ -158,7 +157,7 @@ func ToVerification(c *git.Commit) *api.PayloadCommitVerification { commitVerification.Payload = c.Signature.Payload } if verif.SigningUser != nil { - commitVerification.Signer = &structs.PayloadUser{ + commitVerification.Signer = &api.PayloadUser{ Name: verif.SigningUser.Name, Email: verif.SigningUser.Email, } diff --git a/modules/doctor/doctor.go b/modules/doctor/doctor.go index 9a05e828f4beb..6451788f9df4b 100644 --- a/modules/doctor/doctor.go +++ b/modules/doctor/doctor.go @@ -5,6 +5,7 @@ package doctor import ( + "context" "fmt" "sort" "strings" @@ -42,12 +43,12 @@ func (w *wrappedLevelLogger) Log(skip int, level log.Level, format string, v ... }, v...)...) } -func initDBDisableConsole(disableConsole bool) error { +func initDBDisableConsole(ctx context.Context, disableConsole bool) error { setting.NewContext() setting.InitDBConfig() setting.NewXORMLogService(disableConsole) - if err := db.InitEngine(); err != nil { + if err := db.InitEngine(ctx); err != nil { return fmt.Errorf("models.SetEngine: %v", err) } return nil @@ -57,7 +58,7 @@ func initDBDisableConsole(disableConsole bool) error { var Checks []*Check // RunChecks runs the doctor checks for the provided list -func RunChecks(logger log.Logger, autofix bool, checks []*Check) error { +func RunChecks(ctx context.Context, logger log.Logger, autofix bool, checks []*Check) error { wrappedLogger := log.LevelLoggerLogger{ LevelLogger: &wrappedLevelLogger{logger}, } @@ -67,7 +68,7 @@ func RunChecks(logger log.Logger, autofix bool, checks []*Check) error { if !dbIsInit && !check.SkipDatabaseInitialization { // Only open database after the most basic configuration check setting.EnableXORMLog = false - if err := initDBDisableConsole(true); err != nil { + if err := initDBDisableConsole(ctx, true); err != nil { logger.Error("Error whilst initializing the database: %v", err) logger.Error("Check if you are using the right config file. You can use a --config directive to specify one.") return nil diff --git a/modules/migrations/gitea_uploader.go b/modules/migrations/gitea_uploader.go index 62e8924e5447e..d62ce80c77f35 100644 --- a/modules/migrations/gitea_uploader.go +++ b/modules/migrations/gitea_uploader.go @@ -20,7 +20,6 @@ import ( "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/migrations/base" - "code.gitea.io/gitea/modules/repository" repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" @@ -111,7 +110,7 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate } r.DefaultBranch = repo.DefaultBranch - r, err = repository.MigrateRepositoryGitData(g.ctx, owner, r, base.MigrateOptions{ + r, err = repo_module.MigrateRepositoryGitData(g.ctx, owner, r, base.MigrateOptions{ RepoName: g.repoName, Description: repo.Description, OriginalURL: repo.OriginalURL, @@ -341,7 +340,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { // SyncTags syncs releases with tags in the database func (g *GiteaLocalUploader) SyncTags() error { - return repository.SyncReleasesWithTags(g.repo, g.gitRepo) + return repo_module.SyncReleasesWithTags(g.repo, g.gitRepo) } // CreateIssues creates issues diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 909ed32c5ecfe..5f19dd4a5c7ef 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -17,6 +17,7 @@ import ( "os" "os/exec" "path/filepath" + "strconv" "strings" "sync" "syscall" @@ -264,7 +265,7 @@ func sshConnectionFailed(conn net.Conn, err error) { // Listen starts a SSH server listens on given port. func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) { srv := ssh.Server{ - Addr: fmt.Sprintf("%s:%d", host, port), + Addr: net.JoinHostPort(host, strconv.Itoa(port)), PublicKeyHandler: publicKeyHandler, Handler: sessionHandler, ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig { diff --git a/options/locale/locale_bg-BG.ini b/options/locale/locale_bg-BG.ini index d642e64b164b2..4519983c3d27d 100644 --- a/options/locale/locale_bg-BG.ini +++ b/options/locale/locale_bg-BG.ini @@ -129,7 +129,6 @@ lfs_path=Git LFS основна директория lfs_path_helper=Файловете, проследявани от Git LFS ще бъдат съхранявани в тази директория. Оставете празно, за да го изключите. run_user=Изпълни като потребителско име run_user_helper=Въведете името на акаунта, под който ще се стартира Gitea. Този акаунт трябва да има достъп до директорията с хранилищата. -domain=Домейн на SSH сървъра ssh_port=SSH сървър порт ssh_port_helper=Номер на порт, на който слуша SSH сървъра. Оставете празно, за да забраните. http_port=Gitea HTTP Listen Порт @@ -1141,7 +1140,6 @@ config.reverse_auth_user=Потребителско име при обратно config.ssh_config=SSH конфигурация config.ssh_enabled=Активен -config.ssh_domain=Домейн на сървъра config.ssh_port=Порт config.ssh_listen_port=Порт за слушане config.ssh_root_path=Основен път diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 376f0f771ed9a..a0250c4abe4bf 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -149,8 +149,6 @@ lfs_path=Kořenový adresář Git LFS lfs_path_helper=V tomto adresáři budou uloženy soubory, které jsou sledovány Git LFS. Pokud ponecháte prázdné, LFS zakážete. run_user=Spustit jako uživatel run_user_helper=Zadejte uživatelské jméno, pod kterým Gitea běží v operačním systému. Pozor: tento uživatel musí mít přístup ke kořenovému adresáři repozitářů. -domain=Doména SSH serveru -domain_helper=Doména nebo adresa hostitele pro URL použité pro SSH klonování. ssh_port=Port SSH serveru ssh_port_helper=Číslo portu, na kterém SSH server naslouchá. Když ponecháte prázdné, SSH server zakážete. http_port=Port, na kterém Gitea naslouchá HTTP protokolu @@ -2438,7 +2436,6 @@ config.app_ver=Verze Gitea config.app_url=Základní URL Gitea config.custom_conf=Cesta ke konfiguračnímu souboru config.custom_file_root_path=Kořenový adresář vlastních souborů -config.domain=Doména SSH serveru config.offline_mode=Lokální režim config.disable_router_log=Vypnout log směrovače config.run_user=Spustit jako uživatel @@ -2454,7 +2451,6 @@ config.reverse_auth_user=Uživatel obráceného ověření config.ssh_config=Nastavení SSH config.ssh_enabled=Zapnutý config.ssh_start_builtin_server=Použít vestavěný server -config.ssh_domain=Doména serveru config.ssh_port=Port config.ssh_listen_port=Port pro naslouchání config.ssh_root_path=Kořenová cesta diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index d3e6c0e595569..01aeba5a37d70 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -149,8 +149,6 @@ lfs_path=Git-LFS-Wurzelpfad lfs_path_helper=In diesem Verzeichnis werden die Dateien von Git LFS abgespeichert. Leer lassen, um LFS zu deaktivieren. run_user=Ausführen als run_user_helper=Gib den Betriebssystem-Benutzernamen ein, unter welchem Gitea laufen soll. Beachte, dass dieser Nutzer Zugriff auf den Repository-Ordner haben muss. -domain=SSH-Server-Domain -domain_helper=Domain oder Host-Adresse für die SSH-URL. ssh_port=SSH-Server-Port ssh_port_helper=Der Port deines SSH-Servers. Leer lassen, um SSH zu deaktivieren. http_port=Gitea-HTTP-Listen-Port @@ -2490,7 +2488,6 @@ config.app_ver=Gitea-Version config.app_url=Gitea-Basis-URL config.custom_conf=Konfigurations-Datei-Pfad config.custom_file_root_path=Benutzerdefinierter Root Pfad -config.domain=SSH-Server-Domain config.offline_mode=Lokaler Modus config.disable_router_log=Router-Log deaktivieren config.run_user=Ausführen als @@ -2506,7 +2503,6 @@ config.reverse_auth_user=Nutzer bei Reverse-Authentifizierung config.ssh_config=SSH-Konfiguration config.ssh_enabled=Aktiviert config.ssh_start_builtin_server=Eingebauten Server verwenden -config.ssh_domain=Server-Domain config.ssh_port=Port config.ssh_listen_port=Listen-Port config.ssh_root_path=Wurzelverzeichnis diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 4c5104a7a8f3f..a024ee657b83e 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -149,8 +149,6 @@ lfs_path=Ριζική Διαδρομή Git LFS lfs_path_helper=Τα αρχεία που παρακολουθούνται από το Git LFS θα αποθηκεύονται σε αυτόν τον φάκελο. Αφήστε κενό για να το απενεργοποιήσετε. run_user=Εκτέλεση Σαν Χρήστη run_user_helper=Εισάγετε το όνομα χρήστη του λειτουργικού συστήματος με το οποίο εκτελείται το Gitea. Σημειώστε ότι αυτός ο χρήστης πρέπει να έχει πρόσβαση στο φάκελο των αποθετηρίων. -domain=Όνομα Τομέα Διακομιστή SSH -domain_helper=Όνομα τομέα ή διεύθυνση διακομιστή τα URL κλωνοποίησης μέσω SSH. ssh_port=Θύρα της υπηρεσίας SSH ssh_port_helper=Αριθμός θύρας που ακούει η υπηρεσία SSH. Αφήστε κενό για να το απενεργοποιήσετε. http_port=Η HTTP θύρα που ακούει το Gitea @@ -2541,7 +2539,6 @@ config.app_ver=Έκδοση Gitea config.app_url=Βασικό URL Του Gitea config.custom_conf=Διαδρομή Αρχείου Ρυθμίσεων config.custom_file_root_path=Προσαρμοσμένη Βασική Διαδρομή Αρχείου -config.domain=Domain Διακομιστή SSH config.offline_mode=Τοπική Λειτουργία config.disable_router_log=Απενεργοποίηση Καταγραφής Δρομολογητή config.run_user=Εκτέλεση Σαν Χρήστη @@ -2557,7 +2554,6 @@ config.reverse_auth_user=Χρήστης ΑντίστροφηςΠιστοποίη config.ssh_config=Ρύθμιση SSH config.ssh_enabled=Ενεργοποιημένο config.ssh_start_builtin_server=Χρήση Ενσωματωμένου Διακομιστή -config.ssh_domain=Domain Διακομιστή config.ssh_port=Θύρα config.ssh_listen_port=Θύρα Ακρόασης config.ssh_root_path=Ριζική Διαδρομή diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c1762799ebcfc..2632531e2fb54 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -149,8 +149,8 @@ lfs_path = Git LFS Root Path lfs_path_helper = Files tracked by Git LFS will be stored in this directory. Leave empty to disable. run_user = Run As Username run_user_helper = Enter the operating system username that Gitea runs as. Note that this user must have access to the repository root path. -domain = SSH Server Domain -domain_helper = Domain or host address for SSH clone URLs. +domain = Server Domain +domain_helper = Domain or host address for the server. ssh_port = SSH Server Port ssh_port_helper = Port number your SSH server listens on. Leave empty to disable. http_port = Gitea HTTP Listen Port @@ -714,7 +714,6 @@ twofa_enrolled = Your account has been enrolled into two-factor authentication. twofa_failed_get_secret = Failed to get secret. u2f_desc = Security keys are hardware devices containing cryptographic keys. They can be used for two-factor authentication. Security keys must support the FIDO U2F standard. -u2f_require_twofa = Your account must be enrolled in two-factor authentication to use security keys. u2f_register_key = Add Security Key u2f_nickname = Nickname u2f_press_button = Press the button on your security key to register it. @@ -2547,7 +2546,7 @@ config.app_ver = Gitea Version config.app_url = Gitea Base URL config.custom_conf = Configuration File Path config.custom_file_root_path = "Custom File Root Path" -config.domain = SSH Server Domain +config.domain = Server Domain config.offline_mode = Local Mode config.disable_router_log = Disable Router Log config.run_user = Run As Username @@ -2563,7 +2562,7 @@ config.reverse_auth_user = Reverse Authentication User config.ssh_config = SSH Configuration config.ssh_enabled = Enabled config.ssh_start_builtin_server = Use Built-In Server -config.ssh_domain = Server Domain +config.ssh_domain = SSH Server Domain config.ssh_port = Port config.ssh_listen_port = Listen Port config.ssh_root_path = Root Path diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 12fa085cb89ae..c9a40f67f1d39 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -149,8 +149,6 @@ lfs_path=Ruta raíz de Git LFS lfs_path_helper=Los archivos almacenados con Git LFS se almacenarán en este directorio. Déjelo vacío para deshabilitarlo. run_user=Ejecutar como usuario run_user_helper=Introduzca el nombre de usuario del sistema operativo sobre el que está ejecutando Gitea. Tenga en cuenta que este usuario debe tener acceso a la ruta a la raíz de los repositorios. -domain=Dominio del servidor SSH -domain_helper=Dominio o dirección del host para URLs de clonación vía SSH. ssh_port=Puerto de servidor SSH ssh_port_helper=Número de puerto en el que está escuchando su servidor SSH. Déjelo vacío para deshabilitarlo. http_port=Puerto de escucha HTTP de Gitea @@ -2535,7 +2533,6 @@ config.app_ver=Versión de Gitea config.app_url=URL base de Gitea config.custom_conf=Ruta del fichero de configuración config.custom_file_root_path=Ruta raíz de los archivos personalizada -config.domain=Dominio del servidor SSH config.offline_mode=Modo offline config.disable_router_log=Deshabilitar Log del Router config.run_user=Ejecutar como usuario @@ -2551,7 +2548,6 @@ config.reverse_auth_user=Autenticación Inversa de Usuario config.ssh_config=Configuración SSH config.ssh_enabled=Habilitado config.ssh_start_builtin_server=Utilizar servidor integrado -config.ssh_domain=Dominio del servidor config.ssh_port=Puerto config.ssh_listen_port=Puerto de escucha config.ssh_root_path=Ruta raíz diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index ae72d6fc4c75e..cceab71448a64 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -138,8 +138,6 @@ lfs_path=مسیر Git LFS lfs_path_helper=فایل هایی که توسط Git LFS دنبال میشوند در این پوشه ذخیره خواهند شد. درصورت خالی بودن فیلد این قابلیت غیرفعال خواهد بود. run_user=اجرا به عنوان نام کاربری run_user_helper=نام کاربری ای که گیتی با آن اجرا میشود را وارد کنید. توجه کنید که کاربر باید به پوشه ریشه مخزن دسترسی داشته باشد. -domain=دامنه سرور SSH -domain_helper=آدرس دامنه یا میزبان برای SSH کلون آدرس ها. ssh_port=پورت SSH سرور ssh_port_helper=شماره درگاهی که سرور SSH گوش می دهد. برای غیر فعال کردن خالی بگذارید. http_port=پورت HTTP گیتی @@ -1962,7 +1960,6 @@ config.app_ver=نسخه‌ی GitGo config.app_url=آدرس پایه گیتی config.custom_conf=مسیر پرونده پیکربندی config.custom_file_root_path=مسیر ریشه‌ی پرونده سفارشی -config.domain=دامنه سرور SSH config.offline_mode=شیوه محلی config.disable_router_log=غیرفعال کردن گزارش مسیریاب config.run_user=اجرا به عنوان نام کاربری @@ -1978,7 +1975,6 @@ config.reverse_auth_user=شیوه ی احرازهویت معکوس config.ssh_config=پیکربندی SSH config.ssh_enabled=فعال شده config.ssh_start_builtin_server=استفاده از ساخته سرور -config.ssh_domain=دامنه سرور config.ssh_port=درگاه (پورت) config.ssh_listen_port=گوش دادن به پورت config.ssh_root_path=مسیر ریشه diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index 34221b76baddf..a44d99a9bf216 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -129,8 +129,6 @@ lfs_path=Git LFS -juuripolku lfs_path_helper=Git LFS:n ylläpitämät tiedostot tullaan tallentamaan tähän hakemistoon. Jätä tyhjäksi kytkeäksesi toiminnon pois. run_user=Aja käyttäjänä run_user_helper=Anna käyttäjätunnus, jona Giteaa ajetaan. Käyttäjällä on oltava oikeudet repositorioiden juuripolkuun. -domain=SSH-palvelimen osoite (hostname) -domain_helper=Domain tai osoite SSH-klooniosoitteille. ssh_port=SSH-palvelimen portti ssh_port_helper=Porttinumero, jossa SSH-palvelimesi kuuntelee. Jätä tyhjäksi kytkeäksesi pois. http_port=Gitean HTTP-kuunteluportti diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 95d3e9a62c567..f2d7be400af24 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -149,8 +149,6 @@ lfs_path=Répertoire racine Git LFS lfs_path_helper=Les fichiers suivis par Git LFS seront stockés dans ce dossier. Laissez vide pour désactiver LFS. run_user=Exécuter avec le compte d'un autre utilisateur run_user_helper=Veuillez entrer le nom d'utilisateur système exécutant Gitea. Cet utilisateur doit avoir accès au dossier racine des dépôts. -domain=Domaine du serveur SSH -domain_helper=Domaine ou adresse de l'hôte pour les URLs de clonage par SSH. ssh_port=Port du serveur SSH ssh_port_helper=Port d'écoute du serveur SSH. Laissez le vide pour le désactiver. http_port=Port d'écoute HTTP de Gitea @@ -2336,7 +2334,6 @@ config.app_ver=Version de Gitea config.app_url=URL de base de Gitea config.custom_conf=Chemin du fichier de configuration config.custom_file_root_path=Emplacement personnalisé du fichier racine -config.domain=Domaine du serveur SSH config.offline_mode=Mode hors-ligne config.disable_router_log=Désactiver la Journalisation du Routeur config.run_user=Exécuter avec l'utilisateur @@ -2352,7 +2349,6 @@ config.reverse_auth_user=Annuler l'Authentification de l'Utilisateur config.ssh_config=Configuration SSH config.ssh_enabled=Activé config.ssh_start_builtin_server=Utiliser le serveur incorporé -config.ssh_domain=Domaine du serveur config.ssh_port=Port config.ssh_listen_port=Port d'écoute config.ssh_root_path=Emplacement racine diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini index dd206cce28ce4..dd5bda81e208e 100644 --- a/options/locale/locale_hu-HU.ini +++ b/options/locale/locale_hu-HU.ini @@ -137,8 +137,6 @@ lfs_path=LFS Gyökérkönyvtár lfs_path_helper=A fájlok amiket Git LFS-el elmentesz ebbe a könyvtárba kerülnek. Hagyd üresen az LFS kikapcsolásához. run_user=Futtatás mint run_user_helper=Kérem adja meg azt az operációs rendszerbeli felhasználónevét, amelynek nevébena Gitea fut. Vegye figyelembe, hogy ennek a felhasználónak rendelkeznie kell a hozzáféréssel a gyökérkönyvtárhoz. -domain=SSH szerver Domain -domain_helper=Domain vagy állomás cím SSH klón url-hez. ssh_port=SSH szerver port ssh_port_helper=SSH port amit az ön szervere használni fog. Hagyja üresen a kikapcsoláshoz. http_port=Gitea HTTP Figyelő Port @@ -1602,7 +1600,6 @@ config.app_ver=Gitea Verzió config.app_url=A Gitea alapértelmezett címe config.custom_conf=Konfigurációs fájl elérési útja config.custom_file_root_path=Egyedi fájlok gyökérútvonala -config.domain=SSH szerver Domain config.offline_mode=Helyi mód config.disable_router_log=Útválasztás naplózásának letiltása config.run_user=Futtatás mint @@ -1618,7 +1615,6 @@ config.reverse_auth_user=Visszafelé hitelesítés felhasználója config.ssh_config=SSH Konfiguráció config.ssh_enabled=Engedélyezett config.ssh_start_builtin_server=Beépített szerver használata -config.ssh_domain=Szerver Domain config.ssh_port=Port config.ssh_listen_port=Figyelő port config.ssh_root_path=Gyökérkönyvtár diff --git a/options/locale/locale_id-ID.ini b/options/locale/locale_id-ID.ini index c579e2cd9f98a..e55cf214eaaa7 100644 --- a/options/locale/locale_id-ID.ini +++ b/options/locale/locale_id-ID.ini @@ -131,8 +131,6 @@ lfs_path=Path Akar Git LFS lfs_path_helper=Berkas yang tersimpan dengan Git LFS akan disimpan ke direktori ini. Biarkan kosong untuk menonaktifkan LFS. run_user=Jalankan Sebagai Nama Pengguna run_user_helper=Masukkan nama pengguna sistem operasi yang menjalankan Gitea. Perhatikan bahwa pengguna ini harus memiliki akses ke path akar dari repositori. -domain=SSH Server Domain -domain_helper=Alamat domain atau host untuk URL klon SSH. ssh_port=Port Server SSH ssh_port_helper=Nomor port server SSH anda. Biarkan kosong untuk menonaktifkan. http_port=Port HTTP Gitea @@ -1213,7 +1211,6 @@ auths.delete_auth_title=Menghapus Otentikasi Sumber config.server_config=Pengaturan Server config.app_ver=Versi Gitea config.custom_conf=Jalur berkas konfigurasi -config.domain=Domain SSH Server config.disable_router_log=Menonaktifkan router log config.run_mode=Jalankan mode config.git_version=Versi Git @@ -1225,7 +1222,6 @@ config.reverse_auth_user=Mengembalikan pengguna otentikasi config.ssh_config=Konfigurasi SSH config.ssh_enabled=Aktif -config.ssh_domain=Domain Server config.ssh_port=Port config.ssh_listen_port=Listen Port config.ssh_root_path=Path Induk diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index b371cb6f51ddb..c9dfb90bd4255 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -144,8 +144,6 @@ lfs_path=Percorso radice di Git LFS lfs_path_helper=I file trovati da Git LFS saranno salvati in questa directory. Lasciare vuoto per disattivare. run_user=Esegui come Nome utente run_user_helper=Inserisci il nome utente del sistema operativo su cui Gitea viene eseguito. Nota che l'utente deve avere accesso al percorso radice dei repository. -domain=Dominio Server SSH -domain_helper=Dominio o nome host per SSH clone URLs. ssh_port=Porta Server SSH ssh_port_helper=Numero di porta in ascolto sul server SSH. Lasciare vuoto per disattivare. http_port=Porta in ascolto HTTP Gitea @@ -2180,7 +2178,6 @@ config.app_ver=Versione Gitea config.app_url=URL di base di Gitea config.custom_conf=Percorso file di configurazione config.custom_file_root_path=Percorso Root File Personalizzato -config.domain=Dominio Server SSH config.offline_mode=Modalità locale config.disable_router_log=Disattivare Log del Router config.run_user=Esegui come Nome utente @@ -2196,7 +2193,6 @@ config.reverse_auth_user=Autenticazione Utente Inversa config.ssh_config=Configurazione SSH config.ssh_enabled=Attivo config.ssh_start_builtin_server=Usa il server integrato -config.ssh_domain=Dominio Server config.ssh_port=Porta config.ssh_listen_port=Porta in ascolto config.ssh_root_path=Percorso Root diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 6310c9291be62..83925890df91f 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -149,8 +149,6 @@ lfs_path=Git LFSルートパス lfs_path_helper=Git LFSで管理するファイルが、このディレクトリに保存されます。 空欄にするとGit LFSを無効にします。 run_user=実行ユーザー名 run_user_helper=Giteaを実行するユーザーを、オペレーティングシステムのユーザー名で入力します。 このユーザーはリポジトリルートパスへのアクセス権を持っている必要があります。 -domain=SSHサーバーのドメイン -domain_helper=SSHのクローンURLに使うドメインまたはホストアドレス。 ssh_port=SSHサーバーのポート ssh_port_helper=SSHサーバーが使うポート番号。 空の場合はSSHサーバーを無効にします。 http_port=Gitea HTTPポート @@ -2547,7 +2545,6 @@ config.app_ver=Giteaのバージョン config.app_url=GiteaのベースURL config.custom_conf=設定ファイルのパス config.custom_file_root_path=カスタムファイルのルートパス -config.domain=SSHサーバーのドメイン config.offline_mode=ローカルモード config.disable_router_log=ルーターのログが無効 config.run_user=実行ユーザー名 @@ -2563,7 +2560,6 @@ config.reverse_auth_user=リバース認証ユーザー config.ssh_config=SSH設定 config.ssh_enabled=有効 config.ssh_start_builtin_server=ビルトインサーバーを使用 -config.ssh_domain=サーバードメイン config.ssh_port=ポート config.ssh_listen_port=待受ポート config.ssh_root_path=ルートパス diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini index 281630660a9a5..de636038c8400 100644 --- a/options/locale/locale_ko-KR.ini +++ b/options/locale/locale_ko-KR.ini @@ -127,8 +127,6 @@ lfs_path=Git LFS 루트 경로 lfs_path_helper=Git LFS에 저장된 파일들은 이 디렉토리에 저장됩니다. LFS를 사용하지 않는다면 빈칸으로 남겨주세요. run_user=실행 사용자명 run_user_helper=Gitea 를 실행할 시스템 사용자명을 넣으세요. 시스템 사용자는 레포지토리 루트 경로에 대한 권한이 필요합니다. -domain=SSH 서버 도메인 -domain_helper=SSH clone URL 에 대한 도메인 또는 호스트 주소 ssh_port=SSH 서버 포트 ssh_port_helper=SSH 서버가 실행되고 있는 포트를 입력하세요. 비워둘 경우 SSH를 사용하지 않습니다. http_port=Gitea HTTP 수신 포트 @@ -1428,7 +1426,6 @@ config.app_name=사이트 제목 config.app_ver=Gitea 버전 config.app_url=Gitea의 기본 URL config.custom_conf=설정 파일 경로 -config.domain=SSH 서버 도메인 config.offline_mode=로컬 모드 config.disable_router_log=라우터 로그 비활성화 config.run_user=실행 사용자명 @@ -1444,7 +1441,6 @@ config.reverse_auth_user=역방향 사용자 인증 config.ssh_config=SSH 설정 config.ssh_enabled=활성화됨 config.ssh_start_builtin_server=빌트-인 서버 사용 -config.ssh_domain=서버 도메인 config.ssh_port=포트 config.ssh_listen_port=수신 대기 포트 config.ssh_root_path=최상위 경로 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index b44bad9b09d7b..bf6cfca0565b5 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -149,8 +149,6 @@ lfs_path=Git LFS glabāšanas vieta lfs_path_helper=Faili, kas pievienoti Git LFS, tiks glabāti šajā direktorijā. Atstājiet tukšu, lai atspējotu. run_user=Izpildes lietotājs run_user_helper=Norādiet operētājsistēmas lietotājvārdu ar kuru tiks izpildīts Gitea process. Ņemiet vērā, ka lietotājam ir jābūt rakstīšanas tiesībām repozitoriju glabāšanas vietai. -domain=SSH servera domēns -domain_helper=Domēns vai saimniekdatora adrese SSH klonēšanas URL. ssh_port=SSH servera ports ssh_port_helper=Porta numurs, kuru SSH serveris klausīsies. Atstājiet tukšu, lai atspējotu. http_port=Gitea HTTP klausīšanās ports @@ -2463,7 +2461,6 @@ config.app_ver=Gitea versija config.app_url=Gitea pamata URL config.custom_conf=Konfigurācijas faila ceļš config.custom_file_root_path=Pielāgoto failu pamata ceļš -config.domain=SSH servera domēns config.offline_mode=Bezsaistes režīms config.disable_router_log=Atspējot maršrutētāja žurnalizēšanu config.run_user=Izpildes lietotājs @@ -2479,7 +2476,6 @@ config.reverse_auth_user=Reversā lietotāja autentifikācija config.ssh_config=SSH konfigurācija config.ssh_enabled=Iespējots config.ssh_start_builtin_server=Izmantot iebūvēto serveri -config.ssh_domain=Servera domēns config.ssh_port=Ports config.ssh_listen_port=Klausīšanās ports config.ssh_root_path=Saknes ceļš diff --git a/options/locale/locale_ml-IN.ini b/options/locale/locale_ml-IN.ini index efe15567333d1..e4db9182964ad 100644 --- a/options/locale/locale_ml-IN.ini +++ b/options/locale/locale_ml-IN.ini @@ -112,8 +112,6 @@ lfs_path=Git LFS റൂട്ട് പാത്ത് lfs_path_helper=Git LFS ട്രാക്കുചെയ്ത ഫയലുകൾ ഈ ഡയറക്ടറിയിൽ സൂക്ഷിക്കും. പ്രവർത്തനരഹിതമാക്കാൻ ഈ കളം ശൂന്യമായി വിടുക. run_user=ഉപയോക്താവായി പ്രവര്‍ത്തിപ്പിക്കുക run_user_helper=ഗിറ്റീ പ്രവർത്തിക്കുന്ന ഓപ്പറേറ്റിംഗ് സിസ്റ്റത്തിന്റെ ഉപയോക്തൃനാമം നല്കുക. ഈ ഉപയോക്താവിന് സംഭരണിയുടെ റൂട്ട് പാത്തിലേക്ക് പ്രവേശനം ഉണ്ടായിരിക്കണം. -domain=SSH സെർവർ ഡൊമെയ്ൻ -domain_helper=SSH ക്ലോൺ URL- കൾക്കായുള്ള ഡൊമെയ്ൻ അല്ലെങ്കിൽ ഹോസ്റ്റ് വിലാസം. ssh_port=SSH സെർവർ പോര്‍ട്ട് ssh_port_helper=നിങ്ങളുടെ SSH സെർവർ ശ്രവിക്കുന്ന പോർട്ട് നമ്പർ നല്‍കുക. പ്രവർത്തനരഹിതമാക്കാൻ കളം ശൂന്യമായി വിടുക. http_port=ഗിറ്റീ എച്ച്ടിടിപി ശ്രവിയ്ക്കുന്ന പോർട്ട് diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 2b8c7bc2d05bc..db1a043872a8b 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -144,8 +144,6 @@ lfs_path=Git LFS root pad lfs_path_helper=Bestanden bijgehouden door Git LFS zullenworden opgeslagen in deze map. Laat leeg om uit te schakelen. run_user=Uitvoeren als gebruiker run_user_helper=Geef de gebruikersnaam van het besturingssysteem waarop Gitea wordt uitgevoerd. Realiseer u dat deze gebruiker toegang tot het pad van de hoofdmap moet hebben. -domain=SSH server-domein -domain_helper=Domein of ip-adres voor SSH kloon URLs. ssh_port=SSH server-poort ssh_port_helper=Nummer van de poort die uw SSH-server gebruikt. Laat dit veld leeg om de SSH functie uit te schakelen. http_port=Gitea HTTP-poort @@ -2193,7 +2191,6 @@ config.app_ver=Gitea versie config.app_url=Gitea basis URL config.custom_conf=Configuratiebestandspad config.custom_file_root_path=Hoofdmap voor aangepaste bestanden -config.domain=SSH server-domein config.offline_mode=Lokale modus config.disable_router_log=Router-log uitschakelen config.run_user=Uitvoeren als gebruiker @@ -2209,7 +2206,6 @@ config.reverse_auth_user=Omgekeerde verificatie gebruiker config.ssh_config=SSH-configuratie config.ssh_enabled=Ingeschakeld config.ssh_start_builtin_server=Gebruik de ingebouwde server -config.ssh_domain=Server-domein config.ssh_port=Poort config.ssh_listen_port=Luister op poort config.ssh_root_path=Root-pad diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 8aff815ab1e2d..2a6c6e4cfd43d 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -138,8 +138,6 @@ lfs_path=Ścieżka główna Git LFS lfs_path_helper=W tym katalogu będą przechowywane pliki śledzone za pomocą Git LFS. Pozostaw puste, aby wyłączyć LFS. run_user=Uruchom jako nazwa użytkownika run_user_helper=Wprowadź nazwę użytkownika systemu operacyjnego, na którym uruchomiona jest Gitea. Pamiętaj, że ten użytkownik musi mieć uprawnienia do katalogu głównego repozytorium. -domain=Domena serwera SSH -domain_helper=Domena lub adres hosta dla adresów URL klonowania przez SSH. ssh_port=Port serwera SSH ssh_port_helper=Numer portu, na którym nasłuchuje Twój serwer SSH. Pozostaw puste, aby wyłączyć. http_port=Port nasłuchiwania HTTP Gitea @@ -2096,7 +2094,6 @@ config.app_ver=Wersja Gitea config.app_url=Podstawowy adres URL Gitea config.custom_conf=Ścieżka do pliku konfiguracyjnego config.custom_file_root_path=Ścieżka główna plików niestandardowych -config.domain=Domena serwera SSH config.offline_mode=Tryb lokalny config.disable_router_log=Wyłącz dziennik routera config.run_user=Uruchom jako nazwa użytkownika @@ -2112,7 +2109,6 @@ config.reverse_auth_user=Użytkownik odwrotnego proxy config.ssh_config=Konfiguracja SSH config.ssh_enabled=Włączone config.ssh_start_builtin_server=Wykorzystaj wbudowany serwer -config.ssh_domain=Domena serwera config.ssh_port=Port config.ssh_listen_port=Port nasłuchiwania config.ssh_root_path=Ścieżka do katalogu głównego diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index 862c69489ac45..46a8124c07e03 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -149,8 +149,8 @@ lfs_path=Caminho raiz do Git LFS lfs_path_helper=Os arquivos armazenados com o Git LFS serão armazenados neste diretório. Deixe em branco para desabilitar. run_user=Executar como nome de usuário run_user_helper=Digite o nome de usuário do sistema operacional que o Gitea 'executa como'. Observe que esse usuário deve ter acesso ao caminho da raiz do repositório. -domain=Domínio do servidor SSH -domain_helper=Domínio ou endereço do servidor para URLs clone do SSH. +domain=Domínio do servidor +domain_helper=Domínio ou endereço de host para o servidor. ssh_port=Porta do servidor SSH ssh_port_helper=Número da porta que seu servidor SSH está usando. Deixe em branco para desabilitar. http_port=Porta HTTP de uso do Gitea @@ -2240,7 +2240,7 @@ config.app_ver=Versão do Gitea config.app_url=URL base do Gitea config.custom_conf=Caminho do Arquivo de Configuração config.custom_file_root_path=Caminho raiz para arquivo personalizado -config.domain=Domínio do servidor SSH +config.domain=Domínio do servidor config.offline_mode=Modo local config.disable_router_log=Desabilitar o Log do roteador config.run_user=Executar como nome de usuário @@ -2256,7 +2256,7 @@ config.reverse_auth_user=Usuário de autenticação reversa config.ssh_config=Configuração de SSH config.ssh_enabled=Habilitado config.ssh_start_builtin_server=Usar o servidor embutido -config.ssh_domain=Domínio do servidor +config.ssh_domain=Domínio do servidor SSH config.ssh_port=Porta config.ssh_listen_port=Porta de escuta config.ssh_root_path=Caminho da raiz diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 862469d6fa361..da91f07e7f315 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -149,8 +149,8 @@ lfs_path=Localização do Git LFS lfs_path_helper=Os ficheiros rastreados pelo Git LFS serão armazenados nesta pasta. Deixe em branco para desabilitar. run_user=Executar com este utilizador run_user_helper=Insira o nome de utilizador do sistema operativo que vai executar o Gitea. Note que esse utilizador tem que ter acesso à localização base dos repositórios. -domain=Domínio do servidor SSH -domain_helper=Domínio ou endereço do servidor para URLs de clonagem SSH. +domain=Domínio do servidor +domain_helper=Domínio ou endereço do servidor. ssh_port=Porto do servidor SSH ssh_port_helper=O número do porto que o seu servidor SSH usa. Deixe em branco para desabilitar. http_port=Porto de escuta HTTP do Gitea @@ -2534,7 +2534,7 @@ config.app_ver=Versão do Gitea config.app_url=URL base do Gitea config.custom_conf=Caminho do ficheiro de configuração config.custom_file_root_path=Localização dos ficheiros personalizados -config.domain=Domínio do servidor SSH +config.domain=Domínio do servidor config.offline_mode=Modo local config.disable_router_log=Desabilitar registos do encaminhador config.run_user=Executa com este nome de utilizador @@ -2550,7 +2550,7 @@ config.reverse_auth_user=Utilizador de autenticação reversa config.ssh_config=Configuração SSH config.ssh_enabled=Habilitado config.ssh_start_builtin_server=Usar servidor integrado -config.ssh_domain=Domínio do servidor +config.ssh_domain=Domínio do servidor SSH config.ssh_port=Porto config.ssh_listen_port=Porto de escuta config.ssh_root_path=Localização base diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index ccec0a81cf7e9..f948f2ecd71d5 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -149,8 +149,6 @@ lfs_path=Корневой путь Git LFS lfs_path_helper=В этой папке будут храниться файлы Git LFS. Оставьте пустым, чтобы отключить LFS. run_user=Запуск от имени пользователя run_user_helper=Введите имя пользователя операционной системы, под которым работает Gitea. Обратите внимание, что этот пользователь должен иметь доступ к корневому пути репозиториев. -domain=Домен SSH сервера -domain_helper=Влияет на URL-адреса для клонирования по SSH. ssh_port=Порт SSH сервера ssh_port_helper=Номер порта, который использует SSH сервер. Оставьте пустым, чтобы отключить SSH. http_port=Gitea HTTP порт @@ -2510,7 +2508,6 @@ config.app_ver=Версия Gitea config.app_url=Базовый URL-адрес Gitea config.custom_conf=Путь к файлу конфигурации config.custom_file_root_path=Пользовательский путь до папки с файлами -config.domain=Домен SSH сервера config.offline_mode=Локальный режим config.disable_router_log=Отключение журнала маршрутизатора config.run_user=Запуск от имени пользователя @@ -2526,7 +2523,6 @@ config.reverse_auth_user=Имя пользователя для авториза config.ssh_config=Конфигурация SSH config.ssh_enabled=SSH включён config.ssh_start_builtin_server=Использовать встроенный сервер -config.ssh_domain=Домен config.ssh_port=Порт config.ssh_listen_port=Прослушиваемый порт config.ssh_root_path=Корневой путь diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index a8462892b73bf..4474541a3b743 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -140,8 +140,6 @@ lfs_path=LFS Rotsökväg lfs_path_helper=Filer hanterade av Git LFS kommer att sparas i denna mapp. Lämna tom för att avaktivera. run_user=Kör som användarnamn run_user_helper=Ange operativsystemets användarnamn som Gitea ska köras under. Denna användare måste ha tillgång till utvecklingskatalogens rotsökväg. -domain=SSH-Serverdomän -domain_helper=Domän- eller hostadress för SSH-kloningslänkar. ssh_port=SSH-serverport ssh_port_helper=Portnumret som din SSH-server lyssnar på. Lämna tom för att inaktivera. http_port=Gitea HTTP-lyssningsport @@ -1964,7 +1962,6 @@ config.app_name=Sajtens namn config.app_ver=Gitea Version config.app_url=Gitea Bas-URL config.custom_conf=Konfigurationsfil -config.domain=SSH-Serverdomän config.offline_mode=Offlineläge config.disable_router_log=Avaktivera Router Loggning config.run_user=Kör som användarnamn @@ -1980,7 +1977,6 @@ config.reverse_auth_user=Motsatt autentiserings användare config.ssh_config=SSH-konfiguration config.ssh_enabled=Aktiverad config.ssh_start_builtin_server=Använd inbyggd Server -config.ssh_domain=Serverdomän config.ssh_port=Port config.ssh_listen_port=Lyssningsport config.ssh_root_path=Rotsökväg diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index bd0d29b53cf46..f10f886e47b96 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -149,8 +149,6 @@ lfs_path=Git LFS Kök Yolu lfs_path_helper=Git LFS tarafından izlenen dosyalar bu dizinde saklanacaktır. LFS'yi devre dışı bırakmak için boş bırakın. run_user=Şu Kullanıcı Olarak Çalıştır run_user_helper=Gitea'nin çalışacağı, işletim sistemi kullanıcı adını giriniz. Bu kullanıcının depo kök yoluna erişiminin olması gerektiğini unutmayın. -domain=SSH Sunucusu Alan Adı -domain_helper=SSH kopyalama URL'leri için alan adı veya sunucu adresi. ssh_port=SSH Sunucu Portu ssh_port_helper=SSH sunucusunun dinleyeceği port numarası. Etkisizleştimek için boş bırakın. http_port=Gitea HTTP Dinleme Portu @@ -2453,7 +2451,6 @@ config.app_ver=Gitea Sürümü config.app_url=Gitea Taban URL'si config.custom_conf=Yapılandırma Dosyası Yolu config.custom_file_root_path=Özel Dosya Kök Yolu -config.domain=SSH Sunucusu Etki Alanı config.offline_mode=Yerel Kip config.disable_router_log=Yönlendirici Log'larını Devre Dışı Bırak config.run_user=Şu Kullanıcı Olarak Çalıştır @@ -2469,7 +2466,6 @@ config.reverse_auth_user=Tersine Yetkilendirme Kullanıcısı config.ssh_config=SSH Yapılandırması config.ssh_enabled=Aktif config.ssh_start_builtin_server=Yerleşik Sunucuyu Kullan -config.ssh_domain=Sunucu Alan Adı config.ssh_port=Bağlantı Noktası config.ssh_listen_port=Port'u Dinle config.ssh_root_path=Kök Yol diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index c161d0d8f2cbd..7fe48bcb85eb5 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -147,8 +147,6 @@ lfs_path=Кореневої шлях Git LFS lfs_path_helper=У цій папці будуть зберігатися файли Git LFS. Залиште порожнім, щоб вимкнути LFS. run_user=Запуск від імені Користувача run_user_helper=Введіть ім'я користувача операційної системи, під яким працює Gitea. Зверніть увагу, що цей користувач повинен бути доступ до кореневого шляху репозиторія. -domain=Домен SSH сервера -domain_helper=Домен або хост-адреса для клонування через SSH - впливає на URL-адресу. ssh_port=Порт SSH сервера ssh_port_helper=Номер порту, який використовує SSH сервер. Залиште порожнім, щоб вимкнути SSH. http_port=Gitea HTTP порт @@ -2442,7 +2440,6 @@ config.app_ver=Версія Gitea config.app_url=Базова URL-адреса Gitea config.custom_conf=Шлях до файлу конфігурації config.custom_file_root_path=Шлях до файлу користувача -config.domain=Домен SSH сервера config.offline_mode=Локальний режим config.disable_router_log=Вимкнути логування роутеру config.run_user=Запуск від імені Користувача @@ -2458,7 +2455,6 @@ config.reverse_auth_user=Ім'я користувача для авториза config.ssh_config=Конфігурація SSH config.ssh_enabled=Увімкнено config.ssh_start_builtin_server=Використовувати вбудований сервер -config.ssh_domain=Домен сервера config.ssh_port=Порт config.ssh_listen_port=Порт що прослуховується config.ssh_root_path=Шлях до кореню diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index e5aa21db11e86..58eb91371b437 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -149,8 +149,6 @@ lfs_path=LFS根目录 lfs_path_helper=存储为Git LFS的文件将被存储在此目录。留空禁用LFS run_user=以用户名运行 run_user_helper=输入 Gitea 运行的操作系统用户名。请注意, 此用户必须具有对存储库根路径的访问权限。 -domain=SSH 服务域名 -domain_helper=用于 SSH 克隆的域名或主机地址。 ssh_port=SSH 服务端口 ssh_port_helper=SSH 服务器的端口号,为空则禁用它。 http_port=HTTP 服务端口 @@ -2541,7 +2539,6 @@ config.app_ver=Gitea版本 config.app_url=Gitea 基本 URL config.custom_conf=配置文件路径 config.custom_file_root_path=自定义文件根路径 -config.domain=SSH 服务域名 config.offline_mode=离线模式 config.disable_router_log=关闭路由日志 config.run_user=以用户名运行 @@ -2557,7 +2554,6 @@ config.reverse_auth_user=反向代理认证 config.ssh_config=SSH 配置 config.ssh_enabled=启用 config.ssh_start_builtin_server=使用内置 SSH 服务器 -config.ssh_domain=SSH 服务域名 config.ssh_port=端口 config.ssh_listen_port=监听端口 config.ssh_root_path=根目录 diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index f5f153af48786..921d662a53875 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -149,8 +149,8 @@ lfs_path=Git LFS 根目錄 lfs_path_helper=以 Git LFS 儲存檔案時會被儲存在此目錄中。請留空以停用 LFS 功能。 run_user=以使用者名稱執行 run_user_helper=輸入 Gitea 執行的作業系統使用者名稱。請注意,此使用者必須擁有存儲庫根目錄的存取權限。 -domain=SSH 伺服器域名 -domain_helper=用於 SSH Clone 的域名或主機位置。 +domain=伺服器域名 +domain_helper=伺服器的域名或主機位置。 ssh_port=SSH 伺服器埠 ssh_port_helper=SSH 伺服器使用的埠號,留空以停用此設定。 http_port=Gitea HTTP 埠 @@ -2547,7 +2547,7 @@ config.app_ver=Gitea 版本 config.app_url=Gitea 基本 URL config.custom_conf=設定檔案路徑 config.custom_file_root_path=自訂檔案根目錄 -config.domain=SSH 伺服器域名 +config.domain=伺服器域名 config.offline_mode=本地模式 config.disable_router_log=關閉路由日誌 config.run_user=以使用者名稱執行 @@ -2563,7 +2563,7 @@ config.reverse_auth_user=反向代理認證 config.ssh_config=SSH 組態 config.ssh_enabled=已啟用 config.ssh_start_builtin_server=使用內建的伺服器 -config.ssh_domain=伺服器域名 +config.ssh_domain=SSH 伺服器域名 config.ssh_port=連接埠 config.ssh_listen_port=監聽埠 config.ssh_root_path=根路徑 diff --git a/routers/api/v1/repo/transfer.go b/routers/api/v1/repo/transfer.go index 2e052aa4ff23a..c13a2e4857360 100644 --- a/routers/api/v1/repo/transfer.go +++ b/routers/api/v1/repo/transfer.go @@ -12,7 +12,6 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/web" repo_service "code.gitea.io/gitea/services/repository" @@ -65,7 +64,7 @@ func Transfer(ctx *context.APIContext) { } if newOwner.Type == models.UserTypeOrganization { - if !ctx.User.IsAdmin && newOwner.Visibility == structs.VisibleTypePrivate && !newOwner.HasMemberWithUserID(ctx.User.ID) { + if !ctx.User.IsAdmin && newOwner.Visibility == api.VisibleTypePrivate && !newOwner.HasMemberWithUserID(ctx.User.ID) { // The user shouldn't know about this organization ctx.Error(http.StatusNotFound, "", "The new owner does not exist or cannot be found") return diff --git a/routers/init.go b/routers/init.go index a4f5f606bac53..1e2b7a02f65cf 100644 --- a/routers/init.go +++ b/routers/init.go @@ -6,8 +6,10 @@ package routers import ( "context" + "net" "reflect" "runtime" + "strconv" "strings" "code.gitea.io/gitea/models" @@ -155,7 +157,9 @@ func GlobalInit(ctx context.Context) { if setting.SSH.StartBuiltinServer { ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs) - log.Info("SSH server started on %s:%d. Cipher list (%v), key exchange algorithms (%v), MACs (%v)", setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs) + log.Info("SSH server started on %s. Cipher list (%v), key exchange algorithms (%v), MACs (%v)", + net.JoinHostPort(setting.SSH.ListenHost, strconv.Itoa(setting.SSH.ListenPort)), + setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs) } else { ssh.Unused() } diff --git a/routers/install/install.go b/routers/install/install.go index e38b51fb7e7a9..837467056dc13 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -198,7 +198,7 @@ func SubmitInstall(ctx *context.Context) { setting.Database.SSLMode = form.SSLMode setting.Database.Charset = form.Charset setting.Database.Path = form.DbPath - + setting.Database.LogSQL = !setting.IsProd setting.PasswordHashAlgo = form.PasswordAlgorithm if (setting.Database.Type == "sqlite3") && @@ -209,7 +209,7 @@ func SubmitInstall(ctx *context.Context) { } // Set test engine. - if err = db.InitInstallEngineWithMigration(ctx, migrations.Migrate); err != nil { + if err = db.InitEngineWithMigration(ctx, migrations.Migrate); err != nil { if strings.Contains(err.Error(), `Unknown database type: sqlite3`) { ctx.Data["Err_DbType"] = true ctx.RenderWithErr(ctx.Tr("install.sqlite3_not_available", "https://docs.gitea.io/en-us/install-from-binary/"), tplInstall, &form) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 012ce4e9ae05e..43f59548a4427 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1042,9 +1042,9 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu } } - // Is the poster can write code to the repo, enable Writer tag. + // Is the poster can write issues or pulls to the repo, enable the Writer tag. // Only enable this if the poster doesn't have the owner tag already. - if !commentTag.HasTag("Owner") && perm.CanWrite(models.UnitTypeCode) { + if !commentTag.HasTag("Owner") && perm.CanWriteIssuesOrPulls(issue.IsPull) { commentTag = commentTag.WithTag(models.CommentTagWriter) } diff --git a/routers/web/user/auth.go b/routers/web/user/auth.go index 21d48e98341a8..55f304a7cb625 100644 --- a/routers/web/user/auth.go +++ b/routers/web/user/auth.go @@ -211,38 +211,58 @@ func SignInPost(ctx *context.Context) { return } - // If this user is enrolled in 2FA, we can't sign the user in just yet. + // If this user is enrolled in 2FA TOTP, we can't sign the user in just yet. // Instead, redirect them to the 2FA authentication page. - _, err = login.GetTwoFactorByUID(u.ID) + hasTOTPtwofa, err := login.HasTwoFactorByUID(u.ID) if err != nil { - if login.IsErrTwoFactorNotEnrolled(err) { - handleSignIn(ctx, u, form.Remember) - } else { - ctx.ServerError("UserSignIn", err) - } + ctx.ServerError("UserSignIn", err) return } - // User needs to use 2FA, save data and redirect to 2FA page. + // Check if the user has u2f registration + hasU2Ftwofa, err := login.HasU2FRegistrationsByUID(u.ID) + if err != nil { + ctx.ServerError("UserSignIn", err) + return + } + + if !hasTOTPtwofa && !hasU2Ftwofa { + // No two factor auth configured we can sign in the user + handleSignIn(ctx, u, form.Remember) + return + } + + // User will need to use 2FA TOTP or U2F, save data if err := ctx.Session.Set("twofaUid", u.ID); err != nil { ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err) return } + if err := ctx.Session.Set("twofaRemember", form.Remember); err != nil { ctx.ServerError("UserSignIn: Unable to set twofaRemember in session", err) return } + + if hasTOTPtwofa { + // User will need to use U2F, save data + if err := ctx.Session.Set("totpEnrolled", u.ID); err != nil { + ctx.ServerError("UserSignIn: Unable to set u2fEnrolled in session", err) + return + } + } + if err := ctx.Session.Release(); err != nil { ctx.ServerError("UserSignIn: Unable to save session", err) return } - regs, err := login.GetU2FRegistrationsByUID(u.ID) - if err == nil && len(regs) > 0 { + // If we have U2F redirect there first + if hasU2Ftwofa { ctx.Redirect(setting.AppSubURL + "/user/u2f") return } + // Fallback to 2FA ctx.Redirect(setting.AppSubURL + "/user/two_factor") } @@ -406,6 +426,11 @@ func U2F(ctx *context.Context) { return } + // See whether TOTP is also available. + if ctx.Session.Get("totpEnrolled") != nil { + ctx.Data["TOTPEnrolled"] = true + } + ctx.HTML(http.StatusOK, tplU2F) } diff --git a/routers/web/user/setting/security.go b/routers/web/user/setting/security.go index 53f672282d1a2..65e9790d47725 100644 --- a/routers/web/user/setting/security.go +++ b/routers/web/user/setting/security.go @@ -55,23 +55,17 @@ func DeleteAccountLink(ctx *context.Context) { } func loadSecurityData(ctx *context.Context) { - enrolled := true - _, err := login.GetTwoFactorByUID(ctx.User.ID) + enrolled, err := login.HasTwoFactorByUID(ctx.User.ID) if err != nil { - if login.IsErrTwoFactorNotEnrolled(err) { - enrolled = false - } else { - ctx.ServerError("SettingsTwoFactor", err) - return - } + ctx.ServerError("SettingsTwoFactor", err) + return } - ctx.Data["TwofaEnrolled"] = enrolled - if enrolled { - ctx.Data["U2FRegistrations"], err = login.GetU2FRegistrationsByUID(ctx.User.ID) - if err != nil { - ctx.ServerError("GetU2FRegistrationsByUID", err) - return - } + ctx.Data["TOTPEnrolled"] = enrolled + + ctx.Data["U2FRegistrations"], err = login.GetU2FRegistrationsByUID(ctx.User.ID) + if err != nil { + ctx.ServerError("GetU2FRegistrationsByUID", err) + return } tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{UserID: ctx.User.ID}) diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index f843bc4dcf9dc..614f8104ecaf2 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -839,7 +839,12 @@ parsingLoop: case strings.HasPrefix(line, "--- "): // Handle ambiguous filenames if curFile.IsAmbiguous { - if len(line) > 6 && line[4] == 'a' { + // The shortest string that can end up here is: + // "--- a\t\n" without the qoutes. + // This line has a len() of 7 but doesn't contain a oldName. + // So the amount that the line need is at least 8 or more. + // The code will otherwise panic for a out-of-bounds. + if len(line) > 7 && line[4] == 'a' { curFile.OldName = line[6 : len(line)-1] if line[len(line)-2] == '\t' { curFile.OldName = curFile.OldName[:len(curFile.OldName)-1] @@ -1194,6 +1199,11 @@ func readFileName(rd *strings.Reader) (string, bool) { _ = rd.UnreadByte() if char == '"' { fmt.Fscanf(rd, "%q ", &name) + if len(name) == 0 { + log.Error("Reader has no file name: %v", rd) + return "", true + } + if name[0] == '\\' { name = name[1:] } diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go index d69d0c01d8df8..6decb59b64b5a 100644 --- a/services/gitdiff/gitdiff_test.go +++ b/services/gitdiff/gitdiff_test.go @@ -541,3 +541,22 @@ func TestDiffToHTML_14231(t *testing.T) { assertEqual(t, expected, output) } + +func TestNoCrashes(t *testing.T) { + type testcase struct { + gitdiff string + } + + tests := []testcase{ + { + gitdiff: "diff --git \n--- a\t\n", + }, + { + gitdiff: "diff --git \"0\n", + }, + } + for _, testcase := range tests { + // It shouldn't crash, so don't care about the output. + ParsePatch(setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, strings.NewReader(testcase.gitdiff)) + } +} diff --git a/templates/user/auth/u2f.tmpl b/templates/user/auth/u2f.tmpl index 2013d149377d9..8b04866bbcae7 100644 --- a/templates/user/auth/u2f.tmpl +++ b/templates/user/auth/u2f.tmpl @@ -12,9 +12,11 @@

{{.i18n.Tr "u2f_sign_in"}}

{{.i18n.Tr "u2f_press_button"}}
-
- {{.i18n.Tr "u2f_use_twofa"}} -
+ {{if .TOTPEnrolled}} +
+ {{.i18n.Tr "u2f_use_twofa"}} +
+ {{end}} diff --git a/templates/user/settings/security_twofa.tmpl b/templates/user/settings/security_twofa.tmpl index f48b2f4cb2270..3d6804d9c67da 100644 --- a/templates/user/settings/security_twofa.tmpl +++ b/templates/user/settings/security_twofa.tmpl @@ -3,7 +3,7 @@

{{.i18n.Tr "settings.twofa_desc"}}

- {{if .TwofaEnrolled}} + {{if .TOTPEnrolled}}

{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}

{{.CsrfTokenHtml}} diff --git a/templates/user/settings/security_u2f.tmpl b/templates/user/settings/security_u2f.tmpl index 8fe01d8c70156..a2ff6c2212dd8 100644 --- a/templates/user/settings/security_u2f.tmpl +++ b/templates/user/settings/security_u2f.tmpl @@ -3,32 +3,28 @@

{{.i18n.Tr "settings.u2f_desc" | Str2html}}

- {{if .TwofaEnrolled}} -
- {{range .U2FRegistrations}} -
-
- -
-
- {{.Name}} -
+
+ {{range .U2FRegistrations}} +
+
+ +
+
+ {{.Name}}
- {{end}} -
-
- {{.CsrfTokenHtml}} -
- -
- + {{end}} +
+
+ {{.CsrfTokenHtml}} +
+ +
- {{else}} - {{.i18n.Tr "settings.u2f_require_twofa"}} - {{end}} + +
{{if not $.Repository.IsArchived}} - {{if gt .Issue.ShowTag 0}} - {{if (.Issue.ShowTag.HasTag "Writer")}} + {{if gt .Issue.ShowRole 0}} + {{if (.Issue.ShowRole.HasRole "Writer")}}
{{$.i18n.Tr "repo.issues.collaborator"}}
{{end}} - {{if (.Issue.ShowTag.HasTag "Owner")}} + {{if (.Issue.ShowRole.HasRole "Owner")}}
{{$.i18n.Tr "repo.issues.owner"}}
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 24681fef6ddf2..57ec007bed03a 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -44,17 +44,17 @@
{{if not $.Repository.IsArchived}} - {{if (.ShowTag.HasTag "Poster")}} + {{if (.ShowRole.HasRole "Poster")}}
{{$.i18n.Tr "repo.issues.poster"}}
{{end}} - {{if (.ShowTag.HasTag "Writer")}} + {{if (.ShowRole.HasRole "Writer")}}
{{$.i18n.Tr "repo.issues.collaborator"}}
{{end}} - {{if (.ShowTag.HasTag "Owner")}} + {{if (.ShowRole.HasRole "Owner")}}
{{$.i18n.Tr "repo.issues.owner"}}
@@ -550,17 +550,17 @@
- {{if (.ShowTag.HasTag "Poster")}} + {{if (.ShowRole.HasRole "Poster")}}
{{$.i18n.Tr "repo.issues.poster"}}
{{end}} - {{if (.ShowTag.HasTag "Writer")}} + {{if (.ShowRole.HasRole "Writer")}}
{{$.i18n.Tr "repo.issues.collaborator"}}
{{end}} - {{if (.ShowTag.HasTag "Owner")}} + {{if (.ShowRole.HasRole "Owner")}}
{{$.i18n.Tr "repo.issues.owner"}}
From b5eee8026eff9d20290cdba2a6088a40c2f4aac8 Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 10 Nov 2021 15:39:40 +0100 Subject: [PATCH 7/7] `tag` -> `role` --- routers/web/repo/issue.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index de29f78e156d3..c70d6e6ff49e8 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1256,7 +1256,7 @@ func ViewIssue(ctx *context.Context) { } var ( - tag models.RoleDescriptor + role models.RoleDescriptor ok bool marked = make(map[int64]models.RoleDescriptor) comment *models.Comment @@ -1338,9 +1338,9 @@ func ViewIssue(ctx *context.Context) { return } // Check tag. - tag, ok = marked[comment.PosterID] + role, ok = marked[comment.PosterID] if ok { - comment.ShowRole = tag + comment.ShowRole = role continue } @@ -1437,9 +1437,9 @@ func ViewIssue(ctx *context.Context) { for _, lineComments := range codeComments { for _, c := range lineComments { // Check tag. - tag, ok = marked[c.PosterID] + role, ok = marked[c.PosterID] if ok { - c.ShowRole = tag + c.ShowRole = role continue }