From afdab9d8d495590f215f9a2a54d925ed72ad75d0 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 12 Sep 2022 11:08:46 +0200 Subject: [PATCH 001/169] Remove fomantic image module (#21145) Remove this small, but unnecessary [module](https://fomantic-ui.com/elements/image.html) and use `img` selector over previous `.image`. Did a few tests, could not notice any visual regression. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH --- modules/templates/helper.go | 6 +- templates/base/head_navbar.tmpl | 2 +- .../repo/issue/view_content/attachments.tmpl | 8 +- templates/repo/release/list.tmpl | 2 +- templates/repo/settings/tags.tmpl | 4 +- templates/status/404.tmpl | 2 +- templates/status/500.tmpl | 2 +- tests/e2e/example.test.e2e.js | 2 +- tests/e2e/utils_e2e.js | 4 +- web_src/fomantic/build/semantic.css | 342 ------------------ web_src/fomantic/semantic.json | 1 - web_src/less/_base.less | 15 +- web_src/less/_explore.less | 2 +- web_src/less/_repository.less | 14 +- web_src/less/_review.less | 6 +- web_src/less/features/gitgraph.less | 2 +- 16 files changed, 32 insertions(+), 382 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 48b62403a0..fd7018a39d 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -631,7 +631,7 @@ func SVG(icon string, others ...interface{}) template.HTML { // Avatar renders user avatars. args: user, size (int), class (string) func Avatar(item interface{}, others ...interface{}) template.HTML { - size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image vm", others...) + size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar vm", others...) switch t := item.(type) { case *user_model.User: @@ -662,7 +662,7 @@ func AvatarByAction(action *activities_model.Action, others ...interface{}) temp // RepoAvatar renders repo avatars. args: repo, size(int), class (string) func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTML { - size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...) + size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar", others...) src := repo.RelAvatarLink() if src != "" { @@ -673,7 +673,7 @@ func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTM // AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string) func AvatarByEmail(email, name string, others ...interface{}) template.HTML { - size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...) + size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar", others...) src := avatars.GenerateEmailAvatarFastLink(email, size*setting.Avatar.RenderedSizeFactor) if src != "" { diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 459beb5515..8cd3b0a4ae 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -5,7 +5,7 @@ {{end}}
- + {{if .IsSigned}} diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index 150779531d..86696ec62b 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -11,9 +11,9 @@ {{if not (containGeneric $.Content .UUID)}} {{$hasThumbnails = true}} {{end}} - {{svg "octicon-file"}} + {{svg "octicon-file"}} {{else}} - {{svg "octicon-desktop-download"}} + {{svg "octicon-desktop-download"}} {{end}} {{.Name}} @@ -26,12 +26,12 @@ {{if $hasThumbnails}}
-
+
{{- range .Attachments -}} {{if FilenameIsImage .Name}} {{if not (containGeneric $.Content .UUID)}} - + {{end}} {{end}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 1f04743eaf..d87d51f26c 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -168,7 +168,7 @@ - {{svg "octicon-package" 16 "mr-2"}}{{.Name}} + {{svg "octicon-package" 16 "mr-2"}}{{.Name}} {{end}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 1c7e915c66..56ce278e58 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -94,14 +94,14 @@ {{$userIDs := .AllowlistUserIDs}} {{range $.Users}} {{if contain $userIDs .ID}} - {{avatar . 26}} {{.GetDisplayName}} + {{avatar . 26}} {{.GetDisplayName}} {{end}} {{end}} {{if $.Owner.IsOrganization}} {{$teamIDs := .AllowlistTeamIDs}} {{range $.Teams}} {{if contain $teamIDs .ID}} - {{.Name}} + {{.Name}} {{end}} {{end}} {{end}} diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl index 571124016b..8dd4cfb8ae 100644 --- a/templates/status/404.tmpl +++ b/templates/status/404.tmpl @@ -2,7 +2,7 @@
{{if .IsRepo}}{{template "repo/header" .}}{{end}}
-

404

+

404


{{.locale.Tr "error404" | Safe}} diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl index 4aaf8f50f0..cdedd947a0 100644 --- a/templates/status/500.tmpl +++ b/templates/status/500.tmpl @@ -1,6 +1,6 @@ {{template "base/head" .}}

-

500

+

500


{{if .ErrorMsg}} diff --git a/tests/e2e/example.test.e2e.js b/tests/e2e/example.test.e2e.js index bd19ceb8fc..b0aa2b7a65 100644 --- a/tests/e2e/example.test.e2e.js +++ b/tests/e2e/example.test.e2e.js @@ -23,7 +23,7 @@ test('Test Register Form', async ({page}, workerInfo) => { await page.click('form button.ui.green.button:visible'); // Make sure we routed to the home page. Else login failed. await expect(page.url()).toBe(`${workerInfo.project.use.baseURL}/`); - await expect(page.locator('.dashboard-navbar span>img.ui.avatar.image')).toBeVisible(); + await expect(page.locator('.dashboard-navbar span>img.ui.avatar')).toBeVisible(); await expect(page.locator('.ui.positive.message.flash-success')).toHaveText('Account was successfully created.'); save_visual(page); diff --git a/tests/e2e/utils_e2e.js b/tests/e2e/utils_e2e.js index b5b9ce2751..50806f851f 100644 --- a/tests/e2e/utils_e2e.js +++ b/tests/e2e/utils_e2e.js @@ -52,8 +52,8 @@ export async function save_visual(page) { fullPage: true, timeout: 20000, mask: [ - page.locator('.dashboard-navbar span>img.ui.avatar.image'), - page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar.image'), + page.locator('.dashboard-navbar span>img.ui.avatar'), + page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar'), ], }); } diff --git a/web_src/fomantic/build/semantic.css b/web_src/fomantic/build/semantic.css index 6ea20c3a8c..dd6637981b 100644 --- a/web_src/fomantic/build/semantic.css +++ b/web_src/fomantic/build/semantic.css @@ -24344,348 +24344,6 @@ i.icon.youtube.play:before { font-family: 'brand-icons'; } -/******************************* - Site Overrides -*******************************/ -/*! - * # Fomantic-UI - Image - * http://github.com/fomantic/Fomantic-UI/ - * - * - * Released under the MIT license - * http://opensource.org/licenses/MIT - * - */ - -/******************************* - Image -*******************************/ - -.ui.image { - position: relative; - display: inline-block; - vertical-align: middle; - max-width: 100%; - background-color: transparent; -} - -img.ui.image { - display: block; -} - -.ui.image svg, -.ui.image img { - display: block; - max-width: 100%; - height: auto; -} - -/******************************* - States -*******************************/ - -.ui.hidden.images, -.ui.ui.hidden.image { - display: none; -} - -.ui.hidden.transition.images, -.ui.hidden.transition.image { - display: block; - visibility: hidden; -} - -.ui.images > .hidden.transition { - display: inline-block; - visibility: hidden; -} - -.ui.disabled.images, -.ui.disabled.image { - cursor: default; - opacity: var(--opacity-disabled); -} - -/******************************* - Variations -*******************************/ - -/*-------------- - Inline - ---------------*/ - -.ui.inline.image, -.ui.inline.image svg, -.ui.inline.image img { - display: inline-block; -} - -/*------------------ - Vertical Aligned - -------------------*/ - -.ui.top.aligned.image, -.ui.top.aligned.image svg, -.ui.top.aligned.image img { - display: inline-block; - vertical-align: top; -} - -.ui.middle.aligned.image, -.ui.middle.aligned.image svg, -.ui.middle.aligned.image img { - display: inline-block; - vertical-align: middle; -} - -.ui.bottom.aligned.image, -.ui.bottom.aligned.image svg, -.ui.bottom.aligned.image img { - display: inline-block; - vertical-align: bottom; -} - -.ui.top.aligned.images .image, -.ui.images .ui.top.aligned.image { - align-self: flex-start; -} - -.ui.middle.aligned.images .image, -.ui.images .ui.middle.aligned.image { - align-self: center; -} - -.ui.bottom.aligned.images .image, -.ui.images .ui.bottom.aligned.image { - align-self: flex-end; -} - -/*-------------- - Rounded - ---------------*/ - -.ui.rounded.images .image, -.ui.rounded.image, -.ui.rounded.images .image > *, -.ui.rounded.image > * { - border-radius: 0.3125em; -} - -/*-------------- - Bordered - ---------------*/ - -.ui.bordered.images .image, -.ui.bordered.images img, -.ui.bordered.images svg, -.ui.bordered.image img, -.ui.bordered.image svg, -img.ui.bordered.image { - border: 1px solid rgba(0, 0, 0, 0.1); -} - -/*-------------- - Circular - ---------------*/ - -.ui.circular.images, -.ui.circular.image { - overflow: hidden; -} - -.ui.circular.images .image, -.ui.circular.image, -.ui.circular.images .image > *, -.ui.circular.image > * { - border-radius: 500rem; -} - -/*-------------- - Fluid - ---------------*/ - -.ui.fluid.images, -.ui.fluid.image, -.ui.fluid.images img, -.ui.fluid.images svg, -.ui.fluid.image svg, -.ui.fluid.image img { - display: block; - width: 100%; - height: auto; -} - -/*-------------- - Avatar - ---------------*/ - -.ui.avatar.images .image, -.ui.avatar.images img, -.ui.avatar.images svg, -.ui.avatar.image img, -.ui.avatar.image svg, -.ui.avatar.image { - margin-right: 0.25em; - display: inline-block; - width: 2em; - height: 2em; - border-radius: 500rem; -} - -/*------------------- - Spaced - --------------------*/ - -.ui.spaced.image { - display: inline-block !important; - margin-left: 0.5em; - margin-right: 0.5em; -} - -.ui[class*="left spaced"].image { - margin-left: 0.5em; - margin-right: 0; -} - -.ui[class*="right spaced"].image { - margin-left: 0; - margin-right: 0.5em; -} - -/*------------------- - Floated - --------------------*/ - -.ui.floated.image, -.ui.floated.images { - float: left; - margin-right: 1em; - margin-bottom: 1em; -} - -.ui.right.floated.images, -.ui.right.floated.image { - float: right; - margin-right: 0; - margin-bottom: 1em; - margin-left: 1em; -} - -.ui.floated.images:last-child, -.ui.floated.image:last-child { - margin-bottom: 0; -} - -.ui.centered.image { - display: block; - margin-left: auto; - margin-right: auto; -} - -.ui.centered.images { - display: flex; - flex-direction: row; - flex-wrap: wrap; - align-items: stretch; - justify-content: center; -} - -/*-------------- - Sizes ----------------*/ - -.ui.medium.images .image, -.ui.medium.images img, -.ui.medium.images svg, -.ui.medium.image { - width: 300px; - height: auto; - font-size: 1rem; -} - -.ui.mini.images .image, -.ui.mini.images img, -.ui.mini.images svg, -.ui.mini.image { - width: 35px; - height: auto; - font-size: 0.78571429rem; -} - -.ui.tiny.images .image, -.ui.tiny.images img, -.ui.tiny.images svg, -.ui.tiny.image { - width: 80px; - height: auto; - font-size: 0.85714286rem; -} - -.ui.small.images .image, -.ui.small.images img, -.ui.small.images svg, -.ui.small.image { - width: 150px; - height: auto; - font-size: 0.92857143rem; -} - -.ui.large.images .image, -.ui.large.images img, -.ui.large.images svg, -.ui.large.image { - width: 450px; - height: auto; - font-size: 1.14285714rem; -} - -.ui.big.images .image, -.ui.big.images img, -.ui.big.images svg, -.ui.big.image { - width: 600px; - height: auto; - font-size: 1.28571429rem; -} - -.ui.huge.images .image, -.ui.huge.images img, -.ui.huge.images svg, -.ui.huge.image { - width: 800px; - height: auto; - font-size: 1.42857143rem; -} - -.ui.massive.images .image, -.ui.massive.images img, -.ui.massive.images svg, -.ui.massive.image { - width: 960px; - height: auto; - font-size: 1.71428571rem; -} - -/******************************* - Groups - *******************************/ - -.ui.images { - font-size: 0; - margin: 0 -0.25rem 0; -} - -.ui.images .image, -.ui.images > img, -.ui.images > svg { - display: inline-block; - margin: 0 0.25rem 0.5rem; -} - -/******************************* - Theme Overrides -*******************************/ - /******************************* Site Overrides *******************************/ diff --git a/web_src/fomantic/semantic.json b/web_src/fomantic/semantic.json index a94adab85c..3c6f3b7435 100644 --- a/web_src/fomantic/semantic.json +++ b/web_src/fomantic/semantic.json @@ -35,7 +35,6 @@ "grid", "header", "icon", - "image", "input", "item", "label", diff --git a/web_src/less/_base.less b/web_src/less/_base.less index bed672a35a..31f71d3c00 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -692,12 +692,9 @@ a.ui.card:hover, border-color: var(--color-secondary); } -.ui.avatar.images .image, -.ui.avatar.images img, -.ui.avatar.images svg, -.ui.avatar.image img, -.ui.avatar.image svg, -.ui.avatar.image, +.ui.avatar img, +.ui.avatar svg, +.ui.avatar.img, .ui.cards > .card img.avatar, .ui.cards > .card .avatar img, .ui.card img.avatar, @@ -758,10 +755,6 @@ a.ui.card:hover, padding-left: 0; } - .brand .ui.mini.image { - width: 30px; - } - .top.menu a.item:hover, .top.menu .dropdown.item:hover, .top.menu .dropdown.item.active { @@ -1686,7 +1679,7 @@ a.ui.label:hover { } } - .ui.avatar.image { + .ui.avatar { height: 18px; width: 18px; display: block; diff --git a/web_src/less/_explore.less b/web_src/less/_explore.less index 3a31fe44d8..b07b33461e 100644 --- a/web_src/less/_explore.less +++ b/web_src/less/_explore.less @@ -75,7 +75,7 @@ padding-top: 25px; } - .ui.avatar.image { + img.ui.avatar { width: 40px; height: 40px; } diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 219597190d..f5be0b34e6 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -846,8 +846,8 @@ display: none; } - .avatar.image, - .avatar.image img { + img.avatar, + .avatar img { width: 20px; height: 20px; margin: 0 .25rem; @@ -908,8 +908,8 @@ line-height: 34px; /* this must be same as .badge height, to avoid overflow */ clear: both; // reset the "float right shabox", in the future, use flexbox instead - > .avatar.image, - > .avatar.image img { + > img.avatar, + > .avatar img { position: relative; top: -2px; } @@ -1125,7 +1125,7 @@ margin-left: 36px; } - .avatar.image { + img.avatar { width: 28px; height: 28px; } @@ -2497,7 +2497,7 @@ #search-user-box { .results { .result { - .image { + img { float: left; margin-right: 8px; width: 2em; @@ -3305,7 +3305,7 @@ td.blob-excerpt { display: flex; margin-bottom: auto; - img.avatar.image { + img.avatar { height: 24px; width: 24px; } diff --git a/web_src/less/_review.less b/web_src/less/_review.less index 2fa8efd67e..e3b88ed928 100644 --- a/web_src/less/_review.less +++ b/web_src/less/_review.less @@ -90,10 +90,10 @@ float: none; margin: 0 .5rem 0 0; flex-shrink: 0; + } - &.image { - margin: 0 !important; - } + img.avatar { + margin: 0 !important; } .comment-content { diff --git a/web_src/less/features/gitgraph.less b/web_src/less/features/gitgraph.less index efb6071e49..f6b1be5ba6 100644 --- a/web_src/less/features/gitgraph.less +++ b/web_src/less/features/gitgraph.less @@ -134,7 +134,7 @@ padding-bottom: 1px; } - .author .ui.avatar.image { + .author img.ui.avatar { width: auto; height: 18px; max-width: none; From defc401b275ae5cbcb983a6685e083e71da9e341 Mon Sep 17 00:00:00 2001 From: Blender Defender Date: Mon, 12 Sep 2022 19:45:14 +0200 Subject: [PATCH 002/169] Make labels clickable in the comments section. (#21137) This commit adds the possibility to click the labels in the message "User added/removed the X label", which will lead to the issues page, filtered by the clicked label. This pull requests aims to fix #19768 _I've tried to follow the contribution guidelines as carefully as possible, but in case I made a mistake: Please correct me._ Co-authored-by: wxiaoguang Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick --- modules/templates/helper.go | 6 +++--- templates/repo/issue/view_content/comments.tmpl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index fd7018a39d..2879d68e3b 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -376,15 +376,15 @@ func NewFuncMap() []template.FuncMap { // the table is NOT sorted with this header return "" }, - "RenderLabels": func(labels []*issues_model.Label) template.HTML { + "RenderLabels": func(labels []*issues_model.Label, repoLink string) template.HTML { html := `` for _, label := range labels { // Protect against nil value in labels - shouldn't happen but would cause a panic if so if label == nil { continue } - html += fmt.Sprintf("
%s
", - label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) + html += fmt.Sprintf("%s ", + repoLink, label.ID, label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) } html += "
" return template.HTML(html) diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 8e0308c2d0..7ed8cf3bde 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -182,11 +182,11 @@ {{template "shared/user/authorlink" .Poster}} {{if and .AddedLabels (not .RemovedLabels)}} - {{$.locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels) $createdStr | Safe}} + {{$.locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels $.RepoLink) $createdStr | Safe}} {{else if and (not .AddedLabels) .RemovedLabels}} - {{$.locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels) $createdStr | Safe}} + {{$.locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels $.RepoLink) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels) (RenderLabels .RemovedLabels) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels $.RepoLink) (RenderLabels .RemovedLabels $.RepoLink) $createdStr | Safe}} {{end}}
From 2854031d870434f4a9f7e5131846eb6a7209ca59 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Mon, 12 Sep 2022 15:52:17 -0500 Subject: [PATCH 003/169] Use form for admin purge user (#21070) Fixes #20998 The basic modal actions were set up for basic confirmation-style modals, however this modal also has a special form input, which instead requires a form in the modal itself. The basic modal actions are indirectly controlled by JS and are simple `
` elements, whereas this requires a ` -
{{.locale.Tr "admin.users.delete_account"}}
+
{{.locale.Tr "admin.users.delete_account"}}
@@ -206,7 +206,6 @@
{{$.CsrfTokenHtml}} -
@@ -214,7 +213,16 @@

{{.locale.Tr "admin.users.purge_help"}}

- {{template "base/delete_modal_actions" .}} +
+
+ {{svg "octicon-x"}} + {{.locale.Tr "modal.no"}} +
+ +
{{template "base/footer" .}} From eaa561145ac276b9ba8b19e1abd86e97f1a05225 Mon Sep 17 00:00:00 2001 From: ya Date: Tue, 13 Sep 2022 12:16:32 +0800 Subject: [PATCH 004/169] Update docs comparison.zh-cn.md (#21035) - Update Chinese translation from comparison.en-us.md Co-authored-by: Lunny Xiao Co-authored-by: 6543 <6543@obermui.de> --- docs/content/doc/features/comparison.zh-cn.md | 174 +++++++++--------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/docs/content/doc/features/comparison.zh-cn.md b/docs/content/doc/features/comparison.zh-cn.md index f0eac22a26..aaf8eb4abc 100644 --- a/docs/content/doc/features/comparison.zh-cn.md +++ b/docs/content/doc/features/comparison.zh-cn.md @@ -31,101 +31,101 @@ _表格中的符号含义:_ #### 主要特性 -| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -|-----------------------|-------|------|-----------|-----------|-----------|-----------|--------------| -| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | -| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | -| 支持多种数据库 | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ | -| 支持多种操作系统 | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | -| 升级简便 | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | -| 支持 Markdown | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 支持 Orgmode | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? | -| 支持 CSV | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? | -| 支持第三方渲染工具 | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? | -| Git 驱动的静态 pages | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Git 驱动的集成化 wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 部署令牌 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 仓库写权限令牌 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ | -| 内置容器 Registry | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 外部 Git 镜像 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | -| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? | -| 内置 CI/CD | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 子组织:组织内的组织 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | +| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| --------------------- | -------------------------------------------------- | ---- | --------- | --------- | --------- | -------------- | ------------ | +| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | +| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | +| 支持多种数据库 | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ | +| 支持多种操作系统 | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | +| 升级简便 | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | +| 支持 Markdown | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 支持 Orgmode | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? | +| 支持 CSV | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? | +| 支持第三方渲染工具 | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? | +| Git 驱动的静态 pages | [✘](https://github.com/go-gitea/gitea/issues/302) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Git 驱动的集成化 wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ | +| 部署令牌 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 仓库写权限令牌 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 内置容器 Registry | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 外部 Git 镜像 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | +| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? | +| 内置 CI/CD | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 子组织:组织内的组织 | [✘](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | #### 代码管理 -| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -|------------------------------------------|-------|------|-----------|-----------|-----------|-----------|--------------| -| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | -| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ⁄ | ✓ | -| 组织里程碑 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 细粒度用户角色 (例如 Code, Issues, Wiki) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 提交人的身份验证 | ⁄ | ✘ | ? | ✓ | ✓ | ✓ | ✘ | -| GPG 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| SSH 签名的提交 | ✓ | ✘ | ✘ | ✘ | ✘ | ? | ? | -| 拒绝未用通过验证的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ | -| 仓库活跃度页面 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 分支管理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 建立新分支 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 在线代码编辑 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 提交的统计图表 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 模板仓库 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ | +| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ---------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ | +| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | +| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 组织里程碑 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 细粒度用户角色 (例如 Code, Issues, Wiki) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 提交人的身份验证 | ⁄ | ✘ | ? | ✓ | ✓ | ✓ | ✘ | +| GPG 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| SSH 签名的提交 | ✓ | ✘ | ✘ | ✘ | ✘ | ? | ? | +| 拒绝未用通过验证的提交 | [✓](https://github.com/go-gitea/gitea/pull/9708) | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 仓库活跃度页面 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 分支管理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 建立新分支 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 在线代码编辑 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 提交的统计图表 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 模板仓库 | [✓](https://github.com/go-gitea/gitea/pull/8768) | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ | -#### Issue 管理 +#### 工单管理 -| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -|----------------------|-------|------|-----------|-----------|-----------|-----------|--------------| -| 跟踪 Issue | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Issue 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 标签 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 跟踪时间 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Issue 可有多个负责人 | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ | -| 关联的 issues | ✘ | ✘ | ⁄ | ✘ | ✓ | ✘ | ✘ | -| 私密 issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 评论反馈 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 锁定讨论 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Issue 批量处理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Issue 看板 | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 从 issues 创建分支 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Issue 搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 全局 Issue 搜索 | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Issue 依赖 | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | -| 通过 Email 创建工单 | [✘](https://github.com/go-gitea/gitea/issues/6226) | [✘](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ | -| Service Desk | [✘](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | ✘ | ✓ | ✘ | ✘ | +| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ------------------- | -------------------------------------------------- | --------------------------------------------- | --------- | ----------------------------------------------------------------------- | --------- | -------------- | ------------ | +| 工单跟踪 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ | +| 工单模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 标签 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 时间跟踪 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 支持多个负责人 | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ | +| 关联的工单 | ✘ | ✘ | ⁄ | [✓](https://docs.gitlab.com/ce/user/project/issues/related_issues.html) | ✓ | ✘ | ✘ | +| 私密工单 | [✘](https://github.com/go-gitea/gitea/issues/3217) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 评论反馈 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 锁定讨论 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 工单批处理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 工单看板 | [✓](https://github.com/go-gitea/gitea/pull/8346) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 从工单创建分支 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 工单搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 工单全局搜索 | [✘](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 工单依赖关系 | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | +| 通过 Email 创建工单 | [✘](https://github.com/go-gitea/gitea/issues/6226) | [✘](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ | +| 服务台 | [✘](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | [✓](https://gitlab.com/groups/gitlab-org/-/epics/3103) | ✓ | ✘ | ✘ | #### Pull/Merge requests -| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -|--------------------------------------|-------|------|-----------|-----------|-----------|-----------|--------------| -| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Squash merging | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | -| Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ | -| 评论 Pull/Merge request 中的某行代码 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 指定 Pull/Merge request 的审核人 | ✓ | ✘ | ⁄ | ✓ | ✓ | ✓ | ✓ | -| 解决 Merge 冲突 | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 限制某些用户的 push 和 merge 权限 | ✓ | ✘ | ✓ | ⁄ | ✓ | ✓ | ✓ | -| 回退某些 commits 或 merge request | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Pull/Merge requests 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 查看 Cherry-picking 的更改 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| 下载 Patch | ✓ | ✘ | ✓ | ✓ | ✓ | / | ✘ | +| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ------------------------------------ | -------------------------------------------------- | ---- | --------- | --------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------ | ------------ | +| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Squash merging | ✓ | ✘ | ✓ | [✓](https://docs.gitlab.com/ce/user/project/merge_requests/squash_and_merge.html) | ✓ | ✓ | ✓ | +| Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ | +| 评论 Pull/Merge request 中的某行代码 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 指定 Pull/Merge request 的审核人 | ✓ | ✘ | ⁄ | ✓ | ✓ | ✓ | ✓ | +| 解决 Merge 冲突 | [✘](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 限制某些用户的 push 和 merge 权限 | ✓ | ✘ | ✓ | ⁄ | ✓ | ✓ | ✓ | +| 回退某些 commits 或 merge request | [✓](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Pull/Merge requests 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 查看 Cherry-picking 的更改 | [✓](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| 下载 Patch | ✓ | ✘ | ✓ | ✓ | ✓ | [/](https://jira.atlassian.com/plugins/servlet/mobile#issue/BCLOUD-8323) | ✘ | #### 第三方集成 -| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -|----------------------------|-------|------|-----------|-----------|-----------|-----------|--------------| -| 支持 Webhook | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 自定义 Git 钩子 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 集成 AD / LDAP | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| 支持多个 LDAP / AD 服务 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | -| LDAP 用户同步 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| SAML 2.0 service provider | [✘](https://github.com/go-gitea/gitea/issues/5512) | [✘](https://github.com/gogs/gogs/issues/1221) | ✓ | ✓ | ✓ | ✓ | ✘ | -| 支持 OpenId 连接 | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ | -| 集成 OAuth 2.0(外部授权) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ | -| 作为 OAuth 2.0 provider | [✓](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 二次验证 (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 集成 Mattermost/Slack | ✓ | ✓ | ⁄ | ✓ | ✓ | ⁄ | ✓ | -| 集成 Discord | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| 集成 Microsoft Teams | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| 显示外部 CI/CD 的状态 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| -------------------------- | -------------------------------------------------- | --------------------------------------------- | --------- | --------- | --------- | --------- | ------------ | +| 支持 Webhook | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 自定义 Git 钩子 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 集成 AD / LDAP | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| 支持多个 LDAP / AD 服务 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | +| LDAP 用户同步 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| SAML 2.0 service provider | [✘](https://github.com/go-gitea/gitea/issues/5512) | [✘](https://github.com/gogs/gogs/issues/1221) | ✓ | ✓ | ✓ | ✓ | ✘ | +| 支持 OpenId 连接 | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ | +| 集成 OAuth 2.0(外部授权) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ | +| 作为 OAuth 2.0 provider | [✓](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 二次验证 (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 集成 Mattermost/Slack | ✓ | ✓ | ⁄ | ✓ | ✓ | ⁄ | ✓ | +| 集成 Discord | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| 集成 Microsoft Teams | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| 显示外部 CI/CD 的状态 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | From 88c2e2436001c868c2583950b5f9eb0516424b7d Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 13 Sep 2022 17:33:37 +0100 Subject: [PATCH 005/169] Add KaTeX rendering to Markdown. (#20571) This PR adds mathematical rendering with KaTeX. The first step is to add a Goldmark extension that detects the latex (and tex) mathematics delimiters. The second step to make this extension only run if math support is enabled. The second step is to then add KaTeX CSS and JS to the head which will load after the dom is rendered. Fix #3445 Signed-off-by: Andrew Thornton Signed-off-by: Andrew Thornton Co-authored-by: silverwind Co-authored-by: Lunny Xiao --- custom/conf/app.example.ini | 3 + .../doc/advanced/config-cheat-sheet.en-us.md | 1 + .../doc/advanced/external-renderers.en-us.md | 3 +- docs/content/doc/features/comparison.en-us.md | 2 + docs/content/page/index.en-us.md | 3 +- go.mod | 2 +- modules/markup/markdown/convertyaml.go | 84 +++++++ modules/markup/markdown/goldmark.go | 15 +- modules/markup/markdown/markdown.go | 20 +- modules/markup/markdown/math/block_node.go | 42 ++++ modules/markup/markdown/math/block_parser.go | 123 ++++++++++ .../markup/markdown/math/block_renderer.go | 43 ++++ modules/markup/markdown/math/inline_node.go | 49 ++++ modules/markup/markdown/math/inline_parser.go | 99 ++++++++ .../markup/markdown/math/inline_renderer.go | 47 ++++ modules/markup/markdown/math/math.go | 108 +++++++++ modules/markup/markdown/meta.go | 96 ++++++-- modules/markup/markdown/meta_test.go | 32 +++ modules/markup/markdown/renderconfig.go | 223 +++++++----------- modules/markup/markdown/renderconfig_test.go | 162 +++++++++++++ modules/markup/sanitizer.go | 4 +- modules/setting/setting.go | 2 + package-lock.json | 39 +++ package.json | 1 + web_src/js/markup/content.js | 2 + web_src/js/markup/math.js | 37 +++ web_src/less/animations.less | 7 + webpack.config.js | 4 + 28 files changed, 1079 insertions(+), 174 deletions(-) create mode 100644 modules/markup/markdown/convertyaml.go create mode 100644 modules/markup/markdown/math/block_node.go create mode 100644 modules/markup/markdown/math/block_parser.go create mode 100644 modules/markup/markdown/math/block_renderer.go create mode 100644 modules/markup/markdown/math/inline_node.go create mode 100644 modules/markup/markdown/math/inline_parser.go create mode 100644 modules/markup/markdown/math/inline_renderer.go create mode 100644 modules/markup/markdown/math/math.go create mode 100644 modules/markup/markdown/renderconfig_test.go create mode 100644 web_src/js/markup/math.js diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 1561a53da0..6e1eca7a62 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1262,6 +1262,9 @@ ROUTER = console ;; List of file extensions that should be rendered/edited as Markdown ;; Separate the extensions with a comma. To render files without any extension as markdown, just put a comma ;FILE_EXTENSIONS = .md,.markdown,.mdown,.mkd +;; +;; Enables math inline and block detection +;ENABLE_MATH = true ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 05cedeb63d..459e42ac24 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -236,6 +236,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a - `CUSTOM_URL_SCHEMES`: Use a comma separated list (ftp,git,svn) to indicate additional URL hyperlinks to be rendered in Markdown. URLs beginning in http and https are always displayed +- `ENABLE_MATH`: **true**: Enables detection of `\(...\)`, `\[...\]`, `$...$` and `$$...$$` blocks as math blocks. ## Server (`server`) diff --git a/docs/content/doc/advanced/external-renderers.en-us.md b/docs/content/doc/advanced/external-renderers.en-us.md index 4e5e72554d..f40c23dd84 100644 --- a/docs/content/doc/advanced/external-renderers.en-us.md +++ b/docs/content/doc/advanced/external-renderers.en-us.md @@ -74,12 +74,13 @@ RENDER_COMMAND = "timeout 30s pandoc +RTS -M512M -RTS -f rst" IS_INPUT_FILE = false ``` -If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizier. The example below will support [KaTeX](https://katex.org/) output from [`pandoc`](https://pandoc.org/). +If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizer. The example below could be used to support server-side [KaTeX](https://katex.org/) rendering output from [`pandoc`](https://pandoc.org/). ```ini [markup.sanitizer.TeX] ; Pandoc renders TeX segments as s with the "math" class, optionally ; with "inline" or "display" classes depending on context. +; - note this is different from the built-in math support in our markdown parser which uses ELEMENT = span ALLOW_ATTR = class REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+ diff --git a/docs/content/doc/features/comparison.en-us.md b/docs/content/doc/features/comparison.en-us.md index 3c2a3f9162..89d92b2565 100644 --- a/docs/content/doc/features/comparison.en-us.md +++ b/docs/content/doc/features/comparison.en-us.md @@ -53,6 +53,8 @@ _Symbols used in table:_ | WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? | | Built-in CI/CD | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Subgroups: groups within groups | [✘](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | +| Mermaid diagrams in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Math syntax in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | ## Code management diff --git a/docs/content/page/index.en-us.md b/docs/content/page/index.en-us.md index 8e2e36223a..c3ee996f0b 100644 --- a/docs/content/page/index.en-us.md +++ b/docs/content/page/index.en-us.md @@ -131,7 +131,8 @@ You can try it out using [the online demo](https://try.gitea.io/). - Environment variables - Command line options - Multi-language support ([21 languages](https://github.com/go-gitea/gitea/tree/main/options/locale)) -- [Mermaid](https://mermaidjs.github.io/) Diagram support +- [Mermaid](https://mermaidjs.github.io/) diagrams in Markdown +- Math syntax in Markdown - Mail service - Notifications - Registration confirmation diff --git a/go.mod b/go.mod index 0e93ea443f..8976900d92 100644 --- a/go.mod +++ b/go.mod @@ -103,6 +103,7 @@ require ( gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 mvdan.cc/xurls/v2 v2.4.0 strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 xorm.io/builder v0.3.11 @@ -290,7 +291,6 @@ require ( gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) diff --git a/modules/markup/markdown/convertyaml.go b/modules/markup/markdown/convertyaml.go new file mode 100644 index 0000000000..3f5ebec908 --- /dev/null +++ b/modules/markup/markdown/convertyaml.go @@ -0,0 +1,84 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package markdown + +import ( + "github.com/yuin/goldmark/ast" + east "github.com/yuin/goldmark/extension/ast" + "gopkg.in/yaml.v3" +) + +func nodeToTable(meta *yaml.Node) ast.Node { + for { + if meta == nil { + return nil + } + switch meta.Kind { + case yaml.DocumentNode: + meta = meta.Content[0] + continue + default: + } + break + } + switch meta.Kind { + case yaml.MappingNode: + return mappingNodeToTable(meta) + case yaml.SequenceNode: + return sequenceNodeToTable(meta) + default: + return ast.NewString([]byte(meta.Value)) + } +} + +func mappingNodeToTable(meta *yaml.Node) ast.Node { + table := east.NewTable() + alignments := []east.Alignment{} + for i := 0; i < len(meta.Content); i += 2 { + alignments = append(alignments, east.AlignNone) + } + + headerRow := east.NewTableRow(alignments) + valueRow := east.NewTableRow(alignments) + for i := 0; i < len(meta.Content); i += 2 { + cell := east.NewTableCell() + + cell.AppendChild(cell, nodeToTable(meta.Content[i])) + headerRow.AppendChild(headerRow, cell) + + if i+1 < len(meta.Content) { + cell = east.NewTableCell() + cell.AppendChild(cell, nodeToTable(meta.Content[i+1])) + valueRow.AppendChild(valueRow, cell) + } + } + + table.AppendChild(table, east.NewTableHeader(headerRow)) + table.AppendChild(table, valueRow) + return table +} + +func sequenceNodeToTable(meta *yaml.Node) ast.Node { + table := east.NewTable() + alignments := []east.Alignment{east.AlignNone} + for _, item := range meta.Content { + row := east.NewTableRow(alignments) + cell := east.NewTableCell() + cell.AppendChild(cell, nodeToTable(item)) + row.AppendChild(row, cell) + table.AppendChild(table, row) + } + return table +} + +func nodeToDetails(meta *yaml.Node, icon string) ast.Node { + details := NewDetails() + summary := NewSummary() + summary.AppendChild(summary, NewIcon(icon)) + details.AppendChild(details, summary) + details.AppendChild(details, nodeToTable(meta)) + + return details +} diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 1750128dec..24f1ab7a01 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -15,7 +15,6 @@ import ( "code.gitea.io/gitea/modules/setting" giteautil "code.gitea.io/gitea/modules/util" - meta "github.com/yuin/goldmark-meta" "github.com/yuin/goldmark/ast" east "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" @@ -32,20 +31,12 @@ type ASTTransformer struct{} // Transform transforms the given AST tree. func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context) { - metaData := meta.GetItems(pc) firstChild := node.FirstChild() createTOC := false ctx := pc.Get(renderContextKey).(*markup.RenderContext) - rc := &RenderConfig{ - Meta: "table", - Icon: "table", - Lang: "", - } - - if metaData != nil { - rc.ToRenderConfig(metaData) - - metaNode := rc.toMetaNode(metaData) + rc := pc.Get(renderConfigKey).(*RenderConfig) + if rc.yamlNode != nil { + metaNode := rc.toMetaNode() if metaNode != nil { node.InsertBefore(node, firstChild, metaNode) } diff --git a/modules/markup/markdown/markdown.go b/modules/markup/markdown/markdown.go index 4ce85dfc31..c0e72fd6ce 100644 --- a/modules/markup/markdown/markdown.go +++ b/modules/markup/markdown/markdown.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/common" + "code.gitea.io/gitea/modules/markup/markdown/math" "code.gitea.io/gitea/modules/setting" giteautil "code.gitea.io/gitea/modules/util" @@ -38,6 +39,7 @@ var ( isWikiKey = parser.NewContextKey() renderMetasKey = parser.NewContextKey() renderContextKey = parser.NewContextKey() + renderConfigKey = parser.NewContextKey() ) type limitWriter struct { @@ -98,7 +100,7 @@ func actualRender(ctx *markup.RenderContext, input io.Reader, output io.Writer) languageStr := string(language) preClasses := []string{"code-block"} - if languageStr == "mermaid" { + if languageStr == "mermaid" || languageStr == "math" { preClasses = append(preClasses, "is-loading") } @@ -120,6 +122,9 @@ func actualRender(ctx *markup.RenderContext, input io.Reader, output io.Writer) } }), ), + math.NewExtension( + math.Enabled(setting.Markdown.EnableMath), + ), meta.Meta, ), goldmark.WithParserOptions( @@ -167,7 +172,18 @@ func actualRender(ctx *markup.RenderContext, input io.Reader, output io.Writer) log.Error("Unable to ReadAll: %v", err) return err } - if err := converter.Convert(giteautil.NormalizeEOL(buf), lw, parser.WithContext(pc)); err != nil { + buf = giteautil.NormalizeEOL(buf) + + rc := &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "", + } + buf, _ = ExtractMetadataBytes(buf, rc) + + pc.Set(renderConfigKey, rc) + + if err := converter.Convert(buf, lw, parser.WithContext(pc)); err != nil { log.Error("Unable to render: %v", err) return err } diff --git a/modules/markup/markdown/math/block_node.go b/modules/markup/markdown/math/block_node.go new file mode 100644 index 0000000000..bd8449babf --- /dev/null +++ b/modules/markup/markdown/math/block_node.go @@ -0,0 +1,42 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import "github.com/yuin/goldmark/ast" + +// Block represents a display math block e.g. $$...$$ or \[...\] +type Block struct { + ast.BaseBlock + Dollars bool + Indent int + Closed bool +} + +// KindBlock is the node kind for math blocks +var KindBlock = ast.NewNodeKind("MathBlock") + +// NewBlock creates a new math Block +func NewBlock(dollars bool, indent int) *Block { + return &Block{ + Dollars: dollars, + Indent: indent, + } +} + +// Dump dumps the block to a string +func (n *Block) Dump(source []byte, level int) { + m := map[string]string{} + ast.DumpHelper(n, source, level, m, nil) +} + +// Kind returns KindBlock for math Blocks +func (n *Block) Kind() ast.NodeKind { + return KindBlock +} + +// IsRaw returns true as this block should not be processed further +func (n *Block) IsRaw() bool { + return true +} diff --git a/modules/markup/markdown/math/block_parser.go b/modules/markup/markdown/math/block_parser.go new file mode 100644 index 0000000000..f865122886 --- /dev/null +++ b/modules/markup/markdown/math/block_parser.go @@ -0,0 +1,123 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + "bytes" + + "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/parser" + "github.com/yuin/goldmark/text" + "github.com/yuin/goldmark/util" +) + +type blockParser struct { + parseDollars bool +} + +// NewBlockParser creates a new math BlockParser +func NewBlockParser(parseDollarBlocks bool) parser.BlockParser { + return &blockParser{ + parseDollars: parseDollarBlocks, + } +} + +// Open parses the current line and returns a result of parsing. +func (b *blockParser) Open(parent ast.Node, reader text.Reader, pc parser.Context) (ast.Node, parser.State) { + line, segment := reader.PeekLine() + pos := pc.BlockOffset() + if pos == -1 || len(line[pos:]) < 2 { + return nil, parser.NoChildren + } + + dollars := false + if b.parseDollars && line[pos] == '$' && line[pos+1] == '$' { + dollars = true + } else if line[pos] != '\\' || line[pos+1] != '[' { + return nil, parser.NoChildren + } + + node := NewBlock(dollars, pos) + + // Now we need to check if the ending block is on the segment... + endBytes := []byte{'\\', ']'} + if dollars { + endBytes = []byte{'$', '$'} + } + idx := bytes.Index(line[pos+2:], endBytes) + if idx >= 0 { + segment.Stop = segment.Start + idx + 2 + reader.Advance(segment.Len() - 1) + segment.Start += 2 + node.Lines().Append(segment) + node.Closed = true + return node, parser.Close | parser.NoChildren + } + + reader.Advance(segment.Len() - 1) + segment.Start += 2 + node.Lines().Append(segment) + return node, parser.NoChildren +} + +// Continue parses the current line and returns a result of parsing. +func (b *blockParser) Continue(node ast.Node, reader text.Reader, pc parser.Context) parser.State { + block := node.(*Block) + if block.Closed { + return parser.Close + } + + line, segment := reader.PeekLine() + w, pos := util.IndentWidth(line, 0) + if w < 4 { + if block.Dollars { + i := pos + for ; i < len(line) && line[i] == '$'; i++ { + } + length := i - pos + if length >= 2 && util.IsBlank(line[i:]) { + reader.Advance(segment.Stop - segment.Start - segment.Padding) + block.Closed = true + return parser.Close + } + } else if len(line[pos:]) > 1 && line[pos] == '\\' && line[pos+1] == ']' && util.IsBlank(line[pos+2:]) { + reader.Advance(segment.Stop - segment.Start - segment.Padding) + block.Closed = true + return parser.Close + } + } + + pos, padding := util.IndentPosition(line, 0, block.Indent) + seg := text.NewSegmentPadding(segment.Start+pos, segment.Stop, padding) + node.Lines().Append(seg) + reader.AdvanceAndSetPadding(segment.Stop-segment.Start-pos-1, padding) + return parser.Continue | parser.NoChildren +} + +// Close will be called when the parser returns Close. +func (b *blockParser) Close(node ast.Node, reader text.Reader, pc parser.Context) { + // noop +} + +// CanInterruptParagraph returns true if the parser can interrupt paragraphs, +// otherwise false. +func (b *blockParser) CanInterruptParagraph() bool { + return true +} + +// CanAcceptIndentedLine returns true if the parser can open new node when +// the given line is being indented more than 3 spaces. +func (b *blockParser) CanAcceptIndentedLine() bool { + return false +} + +// Trigger returns a list of characters that triggers Parse method of +// this parser. +// If Trigger returns a nil, Open will be called with any lines. +// +// We leave this as nil as our parse method is quick enough +func (b *blockParser) Trigger() []byte { + return nil +} diff --git a/modules/markup/markdown/math/block_renderer.go b/modules/markup/markdown/math/block_renderer.go new file mode 100644 index 0000000000..d502065259 --- /dev/null +++ b/modules/markup/markdown/math/block_renderer.go @@ -0,0 +1,43 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + gast "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/renderer" + "github.com/yuin/goldmark/util" +) + +// BlockRenderer represents a renderer for math Blocks +type BlockRenderer struct{} + +// NewBlockRenderer creates a new renderer for math Blocks +func NewBlockRenderer() renderer.NodeRenderer { + return &BlockRenderer{} +} + +// RegisterFuncs registers the renderer for math Blocks +func (r *BlockRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { + reg.Register(KindBlock, r.renderBlock) +} + +func (r *BlockRenderer) writeLines(w util.BufWriter, source []byte, n gast.Node) { + l := n.Lines().Len() + for i := 0; i < l; i++ { + line := n.Lines().At(i) + _, _ = w.Write(util.EscapeHTML(line.Value(source))) + } +} + +func (r *BlockRenderer) renderBlock(w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { + n := node.(*Block) + if entering { + _, _ = w.WriteString(`
`)
+		r.writeLines(w, source, n)
+	} else {
+		_, _ = w.WriteString(`
` + "\n") + } + return gast.WalkContinue, nil +} diff --git a/modules/markup/markdown/math/inline_node.go b/modules/markup/markdown/math/inline_node.go new file mode 100644 index 0000000000..245ff8dab0 --- /dev/null +++ b/modules/markup/markdown/math/inline_node.go @@ -0,0 +1,49 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/util" +) + +// Inline represents inline math e.g. $...$ or \(...\) +type Inline struct { + ast.BaseInline +} + +// Inline implements Inline.Inline. +func (n *Inline) Inline() {} + +// IsBlank returns if this inline node is empty +func (n *Inline) IsBlank(source []byte) bool { + for c := n.FirstChild(); c != nil; c = c.NextSibling() { + text := c.(*ast.Text).Segment + if !util.IsBlank(text.Value(source)) { + return false + } + } + return true +} + +// Dump renders this inline math as debug +func (n *Inline) Dump(source []byte, level int) { + ast.DumpHelper(n, source, level, nil, nil) +} + +// KindInline is the kind for math inline +var KindInline = ast.NewNodeKind("MathInline") + +// Kind returns KindInline +func (n *Inline) Kind() ast.NodeKind { + return KindInline +} + +// NewInline creates a new ast math inline node +func NewInline() *Inline { + return &Inline{ + BaseInline: ast.BaseInline{}, + } +} diff --git a/modules/markup/markdown/math/inline_parser.go b/modules/markup/markdown/math/inline_parser.go new file mode 100644 index 0000000000..0339674b6c --- /dev/null +++ b/modules/markup/markdown/math/inline_parser.go @@ -0,0 +1,99 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + "bytes" + + "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/parser" + "github.com/yuin/goldmark/text" +) + +type inlineParser struct { + start []byte + end []byte +} + +var defaultInlineDollarParser = &inlineParser{ + start: []byte{'$'}, + end: []byte{'$'}, +} + +// NewInlineDollarParser returns a new inline parser +func NewInlineDollarParser() parser.InlineParser { + return defaultInlineDollarParser +} + +var defaultInlineBracketParser = &inlineParser{ + start: []byte{'\\', '('}, + end: []byte{'\\', ')'}, +} + +// NewInlineDollarParser returns a new inline parser +func NewInlineBracketParser() parser.InlineParser { + return defaultInlineBracketParser +} + +// Trigger triggers this parser on $ +func (parser *inlineParser) Trigger() []byte { + return parser.start[0:1] +} + +func isAlphanumeric(b byte) bool { + // Github only cares about 0-9A-Za-z + return (b >= '0' && b <= '9') || (b >= 'A' && b <= 'Z') || (b >= 'a' && b <= 'z') +} + +// Parse parses the current line and returns a result of parsing. +func (parser *inlineParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node { + line, _ := block.PeekLine() + opener := bytes.Index(line, parser.start) + if opener < 0 { + return nil + } + if opener != 0 && isAlphanumeric(line[opener-1]) { + return nil + } + + opener += len(parser.start) + ender := bytes.Index(line[opener:], parser.end) + if ender < 0 { + return nil + } + if len(line) > opener+ender+len(parser.end) && isAlphanumeric(line[opener+ender+len(parser.end)]) { + return nil + } + + block.Advance(opener) + _, pos := block.Position() + node := NewInline() + segment := pos.WithStop(pos.Start + ender) + node.AppendChild(node, ast.NewRawTextSegment(segment)) + block.Advance(ender + len(parser.end)) + + trimBlock(node, block) + return node +} + +func trimBlock(node *Inline, block text.Reader) { + if node.IsBlank(block.Source()) { + return + } + + // trim first space and last space + first := node.FirstChild().(*ast.Text) + if !(!first.Segment.IsEmpty() && block.Source()[first.Segment.Start] == ' ') { + return + } + + last := node.LastChild().(*ast.Text) + if !(!last.Segment.IsEmpty() && block.Source()[last.Segment.Stop-1] == ' ') { + return + } + + first.Segment = first.Segment.WithStart(first.Segment.Start + 1) + last.Segment = last.Segment.WithStop(last.Segment.Stop - 1) +} diff --git a/modules/markup/markdown/math/inline_renderer.go b/modules/markup/markdown/math/inline_renderer.go new file mode 100644 index 0000000000..e4c0f3761d --- /dev/null +++ b/modules/markup/markdown/math/inline_renderer.go @@ -0,0 +1,47 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + "bytes" + + "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/renderer" + "github.com/yuin/goldmark/util" +) + +// InlineRenderer is an inline renderer +type InlineRenderer struct{} + +// NewInlineRenderer returns a new renderer for inline math +func NewInlineRenderer() renderer.NodeRenderer { + return &InlineRenderer{} +} + +func (r *InlineRenderer) renderInline(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { + if entering { + _, _ = w.WriteString(``) + for c := n.FirstChild(); c != nil; c = c.NextSibling() { + segment := c.(*ast.Text).Segment + value := util.EscapeHTML(segment.Value(source)) + if bytes.HasSuffix(value, []byte("\n")) { + _, _ = w.Write(value[:len(value)-1]) + if c != n.LastChild() { + _, _ = w.Write([]byte(" ")) + } + } else { + _, _ = w.Write(value) + } + } + return ast.WalkSkipChildren, nil + } + _, _ = w.WriteString(``) + return ast.WalkContinue, nil +} + +// RegisterFuncs registers the renderer for inline math nodes +func (r *InlineRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { + reg.Register(KindInline, r.renderInline) +} diff --git a/modules/markup/markdown/math/math.go b/modules/markup/markdown/math/math.go new file mode 100644 index 0000000000..7854ac84db --- /dev/null +++ b/modules/markup/markdown/math/math.go @@ -0,0 +1,108 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package math + +import ( + "github.com/yuin/goldmark" + "github.com/yuin/goldmark/parser" + "github.com/yuin/goldmark/renderer" + "github.com/yuin/goldmark/util" +) + +// Extension is a math extension +type Extension struct { + enabled bool + parseDollarInline bool + parseDollarBlock bool +} + +// Option is the interface Options should implement +type Option interface { + SetOption(e *Extension) +} + +type extensionFunc func(e *Extension) + +func (fn extensionFunc) SetOption(e *Extension) { + fn(e) +} + +// Enabled enables or disables this extension +func Enabled(enable ...bool) Option { + value := true + if len(enable) > 0 { + value = enable[0] + } + return extensionFunc(func(e *Extension) { + e.enabled = value + }) +} + +// WithInlineDollarParser enables or disables the parsing of $...$ +func WithInlineDollarParser(enable ...bool) Option { + value := true + if len(enable) > 0 { + value = enable[0] + } + return extensionFunc(func(e *Extension) { + e.parseDollarInline = value + }) +} + +// WithBlockDollarParser enables or disables the parsing of $$...$$ +func WithBlockDollarParser(enable ...bool) Option { + value := true + if len(enable) > 0 { + value = enable[0] + } + return extensionFunc(func(e *Extension) { + e.parseDollarBlock = value + }) +} + +// Math represents a math extension with default rendered delimiters +var Math = &Extension{ + enabled: true, + parseDollarBlock: true, + parseDollarInline: true, +} + +// NewExtension creates a new math extension with the provided options +func NewExtension(opts ...Option) *Extension { + r := &Extension{ + enabled: true, + parseDollarBlock: true, + parseDollarInline: true, + } + + for _, o := range opts { + o.SetOption(r) + } + return r +} + +// Extend extends goldmark with our parsers and renderers +func (e *Extension) Extend(m goldmark.Markdown) { + if !e.enabled { + return + } + + m.Parser().AddOptions(parser.WithBlockParsers( + util.Prioritized(NewBlockParser(e.parseDollarBlock), 701), + )) + + inlines := []util.PrioritizedValue{ + util.Prioritized(NewInlineBracketParser(), 501), + } + if e.parseDollarInline { + inlines = append(inlines, util.Prioritized(NewInlineDollarParser(), 501)) + } + m.Parser().AddOptions(parser.WithInlineParsers(inlines...)) + + m.Renderer().AddOptions(renderer.WithNodeRenderers( + util.Prioritized(NewBlockRenderer(), 501), + util.Prioritized(NewInlineRenderer(), 502), + )) +} diff --git a/modules/markup/markdown/meta.go b/modules/markup/markdown/meta.go index faf92ae2c6..28913fd684 100644 --- a/modules/markup/markdown/meta.go +++ b/modules/markup/markdown/meta.go @@ -5,47 +5,101 @@ package markdown import ( + "bytes" "errors" - "strings" + "unicode" + "unicode/utf8" - "gopkg.in/yaml.v2" + "code.gitea.io/gitea/modules/log" + "gopkg.in/yaml.v3" ) -func isYAMLSeparator(line string) bool { - line = strings.TrimSpace(line) - for i := 0; i < len(line); i++ { - if line[i] != '-' { +func isYAMLSeparator(line []byte) bool { + idx := 0 + for ; idx < len(line); idx++ { + if line[idx] >= utf8.RuneSelf { + r, sz := utf8.DecodeRune(line[idx:]) + if !unicode.IsSpace(r) { + return false + } + idx += sz + continue + } + if line[idx] != ' ' { + break + } + } + dashCount := 0 + for ; idx < len(line); idx++ { + if line[idx] != '-' { + break + } + dashCount++ + } + if dashCount < 3 { + return false + } + for ; idx < len(line); idx++ { + if line[idx] >= utf8.RuneSelf { + r, sz := utf8.DecodeRune(line[idx:]) + if !unicode.IsSpace(r) { + return false + } + idx += sz + continue + } + if line[idx] != ' ' { return false } } - return len(line) > 2 + return true } // ExtractMetadata consumes a markdown file, parses YAML frontmatter, // and returns the frontmatter metadata separated from the markdown content func ExtractMetadata(contents string, out interface{}) (string, error) { - var front, body []string - lines := strings.Split(contents, "\n") - for idx, line := range lines { - if idx == 0 { - // First line has to be a separator - if !isYAMLSeparator(line) { - return "", errors.New("frontmatter must start with a separator line") - } - continue + body, err := ExtractMetadataBytes([]byte(contents), out) + return string(body), err +} + +// ExtractMetadata consumes a markdown file, parses YAML frontmatter, +// and returns the frontmatter metadata separated from the markdown content +func ExtractMetadataBytes(contents []byte, out interface{}) ([]byte, error) { + var front, body []byte + + start, end := 0, len(contents) + idx := bytes.IndexByte(contents[start:], '\n') + if idx >= 0 { + end = start + idx + } + line := contents[start:end] + + if !isYAMLSeparator(line) { + return contents, errors.New("frontmatter must start with a separator line") + } + frontMatterStart := end + 1 + for start = frontMatterStart; start < len(contents); start = end + 1 { + end = len(contents) + idx := bytes.IndexByte(contents[start:], '\n') + if idx >= 0 { + end = start + idx } + line := contents[start:end] if isYAMLSeparator(line) { - front, body = lines[1:idx], lines[idx+1:] + front = contents[frontMatterStart:start] + body = contents[end+1:] break } } if len(front) == 0 { - return "", errors.New("could not determine metadata") + return contents, errors.New("could not determine metadata") } - if err := yaml.Unmarshal([]byte(strings.Join(front, "\n")), out); err != nil { - return "", err + log.Info("%s", string(front)) + + if err := yaml.Unmarshal(front, out); err != nil { + return contents, err } - return strings.Join(body, "\n"), nil + return body, nil } diff --git a/modules/markup/markdown/meta_test.go b/modules/markup/markdown/meta_test.go index 939646f8fd..9332b35b42 100644 --- a/modules/markup/markdown/meta_test.go +++ b/modules/markup/markdown/meta_test.go @@ -56,6 +56,38 @@ func TestExtractMetadata(t *testing.T) { }) } +func TestExtractMetadataBytes(t *testing.T) { + t.Run("ValidFrontAndBody", func(t *testing.T) { + var meta structs.IssueTemplate + body, err := ExtractMetadataBytes([]byte(fmt.Sprintf("%s\n%s\n%s\n%s", sepTest, frontTest, sepTest, bodyTest)), &meta) + assert.NoError(t, err) + assert.Equal(t, bodyTest, body) + assert.Equal(t, metaTest, meta) + assert.True(t, validateMetadata(meta)) + }) + + t.Run("NoFirstSeparator", func(t *testing.T) { + var meta structs.IssueTemplate + _, err := ExtractMetadataBytes([]byte(fmt.Sprintf("%s\n%s\n%s", frontTest, sepTest, bodyTest)), &meta) + assert.Error(t, err) + }) + + t.Run("NoLastSeparator", func(t *testing.T) { + var meta structs.IssueTemplate + _, err := ExtractMetadataBytes([]byte(fmt.Sprintf("%s\n%s\n%s", sepTest, frontTest, bodyTest)), &meta) + assert.Error(t, err) + }) + + t.Run("NoBody", func(t *testing.T) { + var meta structs.IssueTemplate + body, err := ExtractMetadataBytes([]byte(fmt.Sprintf("%s\n%s\n%s", sepTest, frontTest, sepTest)), &meta) + assert.NoError(t, err) + assert.Equal(t, "", body) + assert.Equal(t, metaTest, meta) + assert.True(t, validateMetadata(meta)) + }) +} + var ( sepTest = "-----" frontTest = `name: Test diff --git a/modules/markup/markdown/renderconfig.go b/modules/markup/markdown/renderconfig.go index bef67e9e59..6a3b3a1bde 100644 --- a/modules/markup/markdown/renderconfig.go +++ b/modules/markup/markdown/renderconfig.go @@ -5,159 +5,114 @@ package markdown import ( - "fmt" "strings" + "code.gitea.io/gitea/modules/log" "github.com/yuin/goldmark/ast" - east "github.com/yuin/goldmark/extension/ast" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) // RenderConfig represents rendering configuration for this file type RenderConfig struct { - Meta string - Icon string - TOC bool - Lang string + Meta string + Icon string + TOC bool + Lang string + yamlNode *yaml.Node } -// ToRenderConfig converts a yaml.MapSlice to a RenderConfig -func (rc *RenderConfig) ToRenderConfig(meta yaml.MapSlice) { - if meta == nil { - return +// UnmarshalYAML implement yaml.v3 UnmarshalYAML +func (rc *RenderConfig) UnmarshalYAML(value *yaml.Node) error { + if rc == nil { + rc = &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "", + } } - found := false - var giteaMetaControl yaml.MapItem - for _, item := range meta { - strKey, ok := item.Key.(string) - if !ok { - continue - } - strKey = strings.TrimSpace(strings.ToLower(strKey)) - switch strKey { - case "gitea": - giteaMetaControl = item - found = true - case "include_toc": - val, ok := item.Value.(bool) - if !ok { - continue - } - rc.TOC = val - case "lang": - val, ok := item.Value.(string) - if !ok { - continue - } - val = strings.TrimSpace(val) - if len(val) == 0 { - continue - } - rc.Lang = val - } + rc.yamlNode = value + + type basicRenderConfig struct { + Gitea *yaml.Node `yaml:"gitea"` + TOC bool `yaml:"include_toc"` + Lang string `yaml:"lang"` } - if found { - switch v := giteaMetaControl.Value.(type) { - case string: - switch v { - case "none": - rc.Meta = "none" - case "table": - rc.Meta = "table" - default: // "details" - rc.Meta = "details" - } - case yaml.MapSlice: - for _, item := range v { - strKey, ok := item.Key.(string) - if !ok { - continue - } - strKey = strings.TrimSpace(strings.ToLower(strKey)) - switch strKey { - case "meta": - val, ok := item.Value.(string) - if !ok { - continue - } - switch strings.TrimSpace(strings.ToLower(val)) { - case "none": - rc.Meta = "none" - case "table": - rc.Meta = "table" - default: // "details" - rc.Meta = "details" - } - case "details_icon": - val, ok := item.Value.(string) - if !ok { - continue - } - rc.Icon = strings.TrimSpace(strings.ToLower(val)) - case "include_toc": - val, ok := item.Value.(bool) - if !ok { - continue - } - rc.TOC = val - case "lang": - val, ok := item.Value.(string) - if !ok { - continue - } - val = strings.TrimSpace(val) - if len(val) == 0 { - continue - } - rc.Lang = val - } - } - } + var basic basicRenderConfig + + err := value.Decode(&basic) + if err != nil { + return err } + + if basic.Lang != "" { + rc.Lang = basic.Lang + } + + rc.TOC = basic.TOC + if basic.Gitea == nil { + return nil + } + + var control *string + if err := basic.Gitea.Decode(&control); err == nil && control != nil { + log.Info("control %v", control) + switch strings.TrimSpace(strings.ToLower(*control)) { + case "none": + rc.Meta = "none" + case "table": + rc.Meta = "table" + default: // "details" + rc.Meta = "details" + } + return nil + } + + type giteaControl struct { + Meta string `yaml:"meta"` + Icon string `yaml:"details_icon"` + TOC *yaml.Node `yaml:"include_toc"` + Lang string `yaml:"lang"` + } + + var controlStruct *giteaControl + if err := basic.Gitea.Decode(controlStruct); err != nil || controlStruct == nil { + return err + } + + switch strings.TrimSpace(strings.ToLower(controlStruct.Meta)) { + case "none": + rc.Meta = "none" + case "table": + rc.Meta = "table" + default: // "details" + rc.Meta = "details" + } + + rc.Icon = strings.TrimSpace(strings.ToLower(controlStruct.Icon)) + + if controlStruct.Lang != "" { + rc.Lang = controlStruct.Lang + } + + var toc bool + if err := controlStruct.TOC.Decode(&toc); err == nil { + rc.TOC = toc + } + + return nil } -func (rc *RenderConfig) toMetaNode(meta yaml.MapSlice) ast.Node { +func (rc *RenderConfig) toMetaNode() ast.Node { + if rc.yamlNode == nil { + return nil + } switch rc.Meta { case "table": - return metaToTable(meta) + return nodeToTable(rc.yamlNode) case "details": - return metaToDetails(meta, rc.Icon) + return nodeToDetails(rc.yamlNode, rc.Icon) default: return nil } } - -func metaToTable(meta yaml.MapSlice) ast.Node { - table := east.NewTable() - alignments := []east.Alignment{} - for range meta { - alignments = append(alignments, east.AlignNone) - } - row := east.NewTableRow(alignments) - for _, item := range meta { - cell := east.NewTableCell() - cell.AppendChild(cell, ast.NewString([]byte(fmt.Sprintf("%v", item.Key)))) - row.AppendChild(row, cell) - } - table.AppendChild(table, east.NewTableHeader(row)) - - row = east.NewTableRow(alignments) - for _, item := range meta { - cell := east.NewTableCell() - cell.AppendChild(cell, ast.NewString([]byte(fmt.Sprintf("%v", item.Value)))) - row.AppendChild(row, cell) - } - table.AppendChild(table, row) - return table -} - -func metaToDetails(meta yaml.MapSlice, icon string) ast.Node { - details := NewDetails() - summary := NewSummary() - summary.AppendChild(summary, NewIcon(icon)) - details.AppendChild(details, summary) - details.AppendChild(details, metaToTable(meta)) - - return details -} diff --git a/modules/markup/markdown/renderconfig_test.go b/modules/markup/markdown/renderconfig_test.go new file mode 100644 index 0000000000..1027035cda --- /dev/null +++ b/modules/markup/markdown/renderconfig_test.go @@ -0,0 +1,162 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package markdown + +import ( + "testing" + + "gopkg.in/yaml.v3" +) + +func TestRenderConfig_UnmarshalYAML(t *testing.T) { + tests := []struct { + name string + expected *RenderConfig + args string + }{ + { + "empty", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "", + }, "", + }, + { + "lang", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "test", + }, "lang: test", + }, + { + "metatable", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "", + }, "gitea: table", + }, + { + "metanone", &RenderConfig{ + Meta: "none", + Icon: "table", + Lang: "", + }, "gitea: none", + }, + { + "metadetails", &RenderConfig{ + Meta: "details", + Icon: "table", + Lang: "", + }, "gitea: details", + }, + { + "metawrong", &RenderConfig{ + Meta: "details", + Icon: "table", + Lang: "", + }, "gitea: wrong", + }, + { + "toc", &RenderConfig{ + TOC: true, + Meta: "table", + Icon: "table", + Lang: "", + }, "include_toc: true", + }, + { + "tocfalse", &RenderConfig{ + TOC: false, + Meta: "table", + Icon: "table", + Lang: "", + }, "include_toc: false", + }, + { + "toclang", &RenderConfig{ + Meta: "table", + Icon: "table", + TOC: true, + Lang: "testlang", + }, ` + include_toc: true + lang: testlang +`, + }, + { + "complexlang", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "testlang", + }, ` + gitea: + lang: testlang +`, + }, + { + "complexlang2", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "testlang", + }, ` + lang: notright + gitea: + lang: testlang +`, + }, + { + "complexlang", &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "testlang", + }, ` + gitea: + lang: testlang +`, + }, + { + "complex2", &RenderConfig{ + Lang: "two", + Meta: "table", + TOC: true, + Icon: "smiley", + }, ` + lang: one + include_toc: true + gitea: + details_icon: smiley + meta: table + include_toc: true + lang: two +`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := &RenderConfig{ + Meta: "table", + Icon: "table", + Lang: "", + } + if err := yaml.Unmarshal([]byte(tt.args), got); err != nil { + t.Errorf("RenderConfig.UnmarshalYAML() error = %v", err) + return + } + + if got.Meta != tt.expected.Meta { + t.Errorf("Meta Expected %s Got %s", tt.expected.Meta, got.Meta) + } + if got.Icon != tt.expected.Icon { + t.Errorf("Icon Expected %s Got %s", tt.expected.Icon, got.Icon) + } + if got.Lang != tt.expected.Lang { + t.Errorf("Lang Expected %s Got %s", tt.expected.Lang, got.Lang) + } + if got.TOC != tt.expected.TOC { + t.Errorf("TOC Expected %t Got %t", tt.expected.TOC, got.TOC) + } + }) + } +} diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 57e88fdabc..807a8a7892 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -56,7 +56,7 @@ func createDefaultPolicy() *bluemonday.Policy { policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-block( is-loading)?$`)).OnElements("pre") // For Chroma markdown plugin - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(chroma )?language-[\w-]+$`)).OnElements("code") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(chroma )?language-[\w-]+( display)?( is-loading)?$`)).OnElements("code") // Checkboxes policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input") @@ -83,7 +83,7 @@ func createDefaultPolicy() *bluemonday.Policy { policy.AllowAttrs("class").Matching(regexp.MustCompile(`emoji`)).OnElements("img") // Allow icons, emojis, chroma syntax and keyword markup on span - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji))$|^([a-z][a-z0-9]{0,2})$|^` + keywordClass + `$`)).OnElements("span") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji)|(language-math display)|(language-math inline))$|^([a-z][a-z0-9]{0,2})$|^` + keywordClass + `$`)).OnElements("span") // Allow 'style' attribute on text elements. policy.AllowAttrs("style").OnElements("span", "p") diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 09e510ffa0..1ac13cb5fe 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -344,10 +344,12 @@ var ( EnableHardLineBreakInDocuments bool CustomURLSchemes []string `ini:"CUSTOM_URL_SCHEMES"` FileExtensions []string + EnableMath bool }{ EnableHardLineBreakInComments: true, EnableHardLineBreakInDocuments: false, FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd", ","), + EnableMath: true, } // Admin settings diff --git a/package-lock.json b/package-lock.json index b3597a624e..9e613422d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "font-awesome": "4.7.0", "jquery": "3.6.1", "jquery.are-you-sure": "1.9.0", + "katex": "0.16.2", "less": "4.1.3", "less-loader": "11.0.0", "license-checker-webpack-plugin": "0.2.1", @@ -7750,6 +7751,29 @@ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-5.1.1.tgz", "integrity": "sha512-b+z6yF1d4EOyDgylzQo5IminlUmzSeqR1hs/bzjBNjuGras4FXq/6TrzjxfN0j+TmI0ltJzTNlqXUMCniciwKQ==" }, + "node_modules/katex": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.2.tgz", + "integrity": "sha512-70DJdQAyh9EMsthw3AaQlDyFf54X7nWEUIa5W+rq8XOpEk//w5Th7/8SqFqpvi/KZ2t6MHUj4f9wLmztBmAYQA==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "dependencies": { + "commander": "^8.0.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/katex/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/khroma": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.0.0.tgz", @@ -17717,6 +17741,21 @@ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-5.1.1.tgz", "integrity": "sha512-b+z6yF1d4EOyDgylzQo5IminlUmzSeqR1hs/bzjBNjuGras4FXq/6TrzjxfN0j+TmI0ltJzTNlqXUMCniciwKQ==" }, + "katex": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.2.tgz", + "integrity": "sha512-70DJdQAyh9EMsthw3AaQlDyFf54X7nWEUIa5W+rq8XOpEk//w5Th7/8SqFqpvi/KZ2t6MHUj4f9wLmztBmAYQA==", + "requires": { + "commander": "^8.0.0" + }, + "dependencies": { + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + } + } + }, "khroma": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.0.0.tgz", diff --git a/package.json b/package.json index e2eaec4259..37571c01c2 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "font-awesome": "4.7.0", "jquery": "3.6.1", "jquery.are-you-sure": "1.9.0", + "katex": "0.16.2", "less": "4.1.3", "less-loader": "11.0.0", "license-checker-webpack-plugin": "0.2.1", diff --git a/web_src/js/markup/content.js b/web_src/js/markup/content.js index ef5067fd66..319c229385 100644 --- a/web_src/js/markup/content.js +++ b/web_src/js/markup/content.js @@ -1,10 +1,12 @@ import {renderMermaid} from './mermaid.js'; +import {renderMath} from './math.js'; import {renderCodeCopy} from './codecopy.js'; import {initMarkupTasklist} from './tasklist.js'; // code that runs for all markup content export function initMarkupContent() { renderMermaid(); + renderMath(); renderCodeCopy(); } diff --git a/web_src/js/markup/math.js b/web_src/js/markup/math.js new file mode 100644 index 0000000000..5790a327a5 --- /dev/null +++ b/web_src/js/markup/math.js @@ -0,0 +1,37 @@ +function displayError(el, err) { + const target = targetElement(el); + target.remove('is-loading'); + const errorNode = document.createElement('div'); + errorNode.setAttribute('class', 'ui message error markup-block-error mono'); + errorNode.textContent = err.str || err.message || String(err); + target.before(errorNode); +} + +function targetElement(el) { + // The target element is either the current element if it has the `is-loading` class or the pre that contains it + return el.classList.contains('is-loading') ? el : el.closest('pre'); +} + +export async function renderMath() { + const els = document.querySelectorAll('.markup code.language-math'); + if (!els.length) return; + + const [{default: katex}] = await Promise.all([ + import(/* webpackChunkName: "katex" */'katex'), + import(/* webpackChunkName: "katex" */'katex/dist/katex.css'), + ]); + + for (const el of els) { + const source = el.textContent; + const options = {display: el.classList.contains('display')}; + + try { + const markup = katex.renderToString(source, options); + const tempEl = document.createElement(options.display ? 'p' : 'span'); + tempEl.innerHTML = markup; + targetElement(el).replaceWith(tempEl); + } catch (error) { + displayError(el, error); + } + } +} diff --git a/web_src/less/animations.less b/web_src/less/animations.less index 92a3052a1f..ea31d53bfe 100644 --- a/web_src/less/animations.less +++ b/web_src/less/animations.less @@ -33,6 +33,13 @@ height: var(--height-loading); } +code.language-math.is-loading::after { + padding: 0; + border-width: 2px; + width: 1.25rem; + height: 1.25rem; +} + @keyframes fadein { 0% { opacity: 0; diff --git a/webpack.config.js b/webpack.config.js index 39628df049..3cc65d19d4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -37,6 +37,10 @@ const filterCssImport = (url, ...args) => { if (/(eot|ttf|otf|woff|svg)$/.test(importedFile)) return false; } + if (cssFile.includes('katex') && /(ttf|woff)$/.test(importedFile)) { + return false; + } + if (cssFile.includes('font-awesome') && /(eot|ttf|otf|woff|svg)$/.test(importedFile)) { return false; } From 5933f04094df2baa7e47d3d4372ad2fdfa2b6207 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 14 Sep 2022 13:24:39 +0200 Subject: [PATCH 006/169] Skip dirty check for team forms (#21154) The dirty check is not usefull for these forms. --- templates/org/team/members.tmpl | 2 +- templates/org/team/repositories.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index b9069c90de..ecb7830f18 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -9,7 +9,7 @@ {{template "org/team/navbar" .}} {{if .IsOrganizationOwner}}
-
+ {{.CsrfTokenHtml}}
diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index d4c17d5b00..80bdf7b3db 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -11,7 +11,7 @@ {{if $canAddRemove}}
- + {{.CsrfTokenHtml}}
+
+ +
{{range .PackageDescriptor.Files}}{{if eq .File.LowerName "manifest.json"}}{{.Properties.GetByName "container.digest"}}{{end}}{{end}}
+
From bf325d44120c4a6fc7f67ff1dc25db770247c9a7 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Thu, 15 Sep 2022 15:25:16 +0200 Subject: [PATCH 011/169] Keep path when creating a new branch (#21153) If you are create a new new branch while viewing file or directory, you get redirected to the root of the repo. With this PR, you keep your current path instead of getting redirected to the repo root. --- routers/web/repo/branch.go | 2 +- services/forms/repo_branch_form.go | 1 + templates/repo/branch_dropdown.tmpl | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go index d14ba6cbe9..d1f1255db4 100644 --- a/routers/web/repo/branch.go +++ b/routers/web/repo/branch.go @@ -427,5 +427,5 @@ func CreateBranch(ctx *context.Context) { } ctx.Flash.Success(ctx.Tr("repo.branch.create_success", form.NewBranchName)) - ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName)) + ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName) + "/" + util.PathEscapeSegments(form.CurrentPath)) } diff --git a/services/forms/repo_branch_form.go b/services/forms/repo_branch_form.go index f9262aaede..011926092f 100644 --- a/services/forms/repo_branch_form.go +++ b/services/forms/repo_branch_form.go @@ -16,6 +16,7 @@ import ( // NewBranchForm form for creating a new branch type NewBranchForm struct { NewBranchName string `binding:"Required;MaxSize(100);GitRefName"` + CurrentPath string CreateTag bool } diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 9d1ec10d3c..2010fe261e 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -94,6 +94,9 @@ {{.root.CsrfTokenHtml}} + {{if $.root.TreePath}} + + {{end}}
From d3050e0d01b63fb99bb7656e1b86dc542c7e4873 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 15 Sep 2022 22:57:42 +0200 Subject: [PATCH 012/169] File header tweaks (#21175) - Remove non-matching selector - Set font-size on parent so `.mono` can correctly reduce it Before (font subjectively too big): Screenshot 2022-09-15 at 19 03 56 After: image --- web_src/less/_repository.less | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index f5be0b34e6..57d54a08f6 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -409,10 +409,6 @@ font-size: .5em; } - .file-info { - font-size: 13px; - } - .file-actions { .btn-octicon { line-height: 1; @@ -3051,7 +3047,8 @@ td.blob-excerpt { display: flex; justify-content: space-between; overflow-x: auto; - padding: 8px 12px !important; + padding: 6px 12px !important; + font-size: 13px !important; } .file-info { From bdc4c4c379df517ff24177f948b22906787faf6a Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 16 Sep 2022 00:20:55 +0000 Subject: [PATCH 013/169] [skip ci] Updated translations via Crowdin --- options/locale/locale_pt-PT.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index d0b72fb3ac..34595baa99 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -3092,6 +3092,7 @@ container.details.platform=Plataforma container.details.repository_site=Página web do repositório container.details.documentation_site=Página web da documentação container.pull=Puxar a imagem usando a linha de comandos: +container.digest=Resumo: container.documentation=Para obter mais informações sobre o registo do Container, consulte a documentação. container.multi_arch=S.O. / Arquit. container.layers=Camadas de imagem From 8351172b6e5221290dc5b2c81e159e2eec0b43c8 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 16 Sep 2022 09:19:16 +0200 Subject: [PATCH 014/169] Limit length of repo description and repo url input fields (#21119) Both allow only limited characters. If you input more, you will get a error message. So it make sense to limit the characters of the input fields. Slightly relax the MaxSize of repo's Description and Website --- modules/structs/repo.go | 10 +++++----- services/forms/repo_form.go | 8 ++++---- templates/repo/settings/options.tmpl | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 6a5736898d..d3833105d7 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -111,7 +111,7 @@ type CreateRepoOption struct { // unique: true Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"` // Description of the repository to create - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` // Whether the repository is private Private bool `json:"private"` // Label-Set to use @@ -140,9 +140,9 @@ type EditRepoOption struct { // unique: true Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"` // a short description of the repository. - Description *string `json:"description,omitempty" binding:"MaxSize(255)"` + Description *string `json:"description,omitempty" binding:"MaxSize(2048)"` // a URL with more information about the repository. - Website *string `json:"website,omitempty" binding:"MaxSize(255)"` + Website *string `json:"website,omitempty" binding:"MaxSize(1024)"` // either `true` to make the repository private or `false` to make it public. // Note: you will get a 422 error if the organization restricts changing repository visibility to organization // owners and a non-owner tries to change the value of private. @@ -208,7 +208,7 @@ type GenerateRepoOption struct { // Default branch of the new repository DefaultBranch string `json:"default_branch"` // Description of the repository to create - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` // Whether the repository is private Private bool `json:"private"` // include git content of default branch in template repo @@ -316,7 +316,7 @@ type MigrateRepoOptions struct { LFS bool `json:"lfs"` LFSEndpoint string `json:"lfs_endpoint"` Private bool `json:"private"` - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` Wiki bool `json:"wiki"` Milestones bool `json:"milestones"` Labels bool `json:"labels"` diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 4eb20d297f..c1e9cb3197 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -34,7 +34,7 @@ type CreateRepoForm struct { UID int64 `binding:"Required"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` Private bool - Description string `binding:"MaxSize(255)"` + Description string `binding:"MaxSize(2048)"` DefaultBranch string `binding:"GitRefName;MaxSize(100)"` AutoInit bool Gitignores string @@ -76,7 +76,7 @@ type MigrateRepoForm struct { LFS bool `json:"lfs"` LFSEndpoint string `json:"lfs_endpoint"` Private bool `json:"private"` - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` Wiki bool `json:"wiki"` Milestones bool `json:"milestones"` Labels bool `json:"labels"` @@ -116,8 +116,8 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err // RepoSettingForm form for changing repository settings type RepoSettingForm struct { RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` - Description string `binding:"MaxSize(255)"` - Website string `binding:"ValidUrl;MaxSize(255)"` + Description string `binding:"MaxSize(2048)"` + Website string `binding:"ValidUrl;MaxSize(1024)"` Interval string MirrorAddress string MirrorUsername string diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index a9ceebd446..0214df4514 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -42,11 +42,11 @@ {{end}}
- +
- +
From 548387b2beaaaeb6b1c32c3c6f226b8f53aafecb Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 16 Sep 2022 14:44:00 +0200 Subject: [PATCH 015/169] Show label description in comments section (#21156) The labels in the comment section are currently missing the description that all other labels have. --- modules/templates/helper.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 2879d68e3b..a8e4075248 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -377,17 +377,17 @@ func NewFuncMap() []template.FuncMap { return "" }, "RenderLabels": func(labels []*issues_model.Label, repoLink string) template.HTML { - html := `` + htmlCode := `` for _, label := range labels { // Protect against nil value in labels - shouldn't happen but would cause a panic if so if label == nil { continue } - html += fmt.Sprintf("%s ", - repoLink, label.ID, label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) + htmlCode += fmt.Sprintf("%s ", + repoLink, label.ID, label.ForegroundColor(), label.Color, html.EscapeString(label.Description), RenderEmoji(label.Name)) } - html += "" - return template.HTML(html) + htmlCode += "" + return template.HTML(htmlCode) }, "MermaidMaxSourceCharacters": func() int { return setting.MermaidMaxSourceCharacters From 43c10def6849f0e1ea50a52115360e6be50ad1ab Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sat, 17 Sep 2022 04:45:32 +0200 Subject: [PATCH 016/169] Fix CSV diff for added/deleted files (#21189) Fixes #21184 Regression of #19552 Instead of using `GetBlobByPath` I use the already existing instances. We need more information from #19530 if that error is still present. --- routers/web/repo/compare.go | 36 +++++++++++++++---------------- templates/repo/diff/box.tmpl | 2 +- templates/repo/diff/csv_diff.tmpl | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index e35af31724..e7e68d3c5e 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -112,17 +112,17 @@ func setCsvCompareContext(ctx *context.Context) { Error string } - ctx.Data["CreateCsvDiff"] = func(diffFile *gitdiff.DiffFile, baseCommit, headCommit *git.Commit) CsvDiffResult { - if diffFile == nil || baseCommit == nil || headCommit == nil { + ctx.Data["CreateCsvDiff"] = func(diffFile *gitdiff.DiffFile, baseBlob, headBlob *git.Blob) CsvDiffResult { + if diffFile == nil { return CsvDiffResult{nil, ""} } errTooLarge := errors.New(ctx.Locale.Tr("repo.error.csv.too_large")) - csvReaderFromCommit := func(ctx *markup.RenderContext, c *git.Commit) (*csv.Reader, io.Closer, error) { - blob, err := c.GetBlobByPath(diffFile.Name) - if err != nil { - return nil, nil, err + csvReaderFromCommit := func(ctx *markup.RenderContext, blob *git.Blob) (*csv.Reader, io.Closer, error) { + if blob == nil { + // It's ok for blob to be nil (file added or deleted) + return nil, nil, nil } if setting.UI.CSV.MaxFileSize != 0 && setting.UI.CSV.MaxFileSize < blob.Size() { @@ -138,28 +138,28 @@ func setCsvCompareContext(ctx *context.Context) { return csvReader, reader, err } - baseReader, baseBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, RelativePath: diffFile.OldName}, baseCommit) + baseReader, baseBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, RelativePath: diffFile.OldName}, baseBlob) if baseBlobCloser != nil { defer baseBlobCloser.Close() } - if err == errTooLarge { - return CsvDiffResult{nil, err.Error()} - } if err != nil { - log.Error("CreateCsvDiff error whilst creating baseReader from file %s in commit %s in %s: %v", diffFile.Name, baseCommit.ID.String(), ctx.Repo.Repository.Name, err) - return CsvDiffResult{nil, "unable to load file from base commit"} + if err == errTooLarge { + return CsvDiffResult{nil, err.Error()} + } + log.Error("error whilst creating csv.Reader from file %s in base commit %s in %s: %v", diffFile.Name, baseBlob.ID.String(), ctx.Repo.Repository.Name, err) + return CsvDiffResult{nil, "unable to load file"} } - headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, RelativePath: diffFile.Name}, headCommit) + headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, RelativePath: diffFile.Name}, headBlob) if headBlobCloser != nil { defer headBlobCloser.Close() } - if err == errTooLarge { - return CsvDiffResult{nil, err.Error()} - } if err != nil { - log.Error("CreateCsvDiff error whilst creating headReader from file %s in commit %s in %s: %v", diffFile.Name, headCommit.ID.String(), ctx.Repo.Repository.Name, err) - return CsvDiffResult{nil, "unable to load file from head commit"} + if err == errTooLarge { + return CsvDiffResult{nil, err.Error()} + } + log.Error("error whilst creating csv.Reader from file %s in head commit %s in %s: %v", diffFile.Name, headBlob.ID.String(), ctx.Repo.Repository.Name, err) + return CsvDiffResult{nil, "unable to load file"} } sections, err := gitdiff.CreateCsvDiff(diffFile, baseReader, headReader) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 35b8b3956d..06bc79e97a 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -153,7 +153,7 @@ {{if $isImage}} {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} {{else}} - {{template "repo/diff/csv_diff" dict "file" . "root" $}} + {{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} {{end}}
diff --git a/templates/repo/diff/csv_diff.tmpl b/templates/repo/diff/csv_diff.tmpl index a92ef79301..0f46da306e 100644 --- a/templates/repo/diff/csv_diff.tmpl +++ b/templates/repo/diff/csv_diff.tmpl @@ -1,6 +1,6 @@ - {{$result := call .root.CreateCsvDiff .file .root.BaseCommit .root.HeadCommit}} + {{$result := call .root.CreateCsvDiff .file .blobBase .blobHead}} {{if $result.Error}}
{{$result.Error}}
{{else if $result.Sections}} From 34f736ca04e5cf329d5ba8c562c2ccad3b33d2a6 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sat, 17 Sep 2022 19:54:03 +0800 Subject: [PATCH 017/169] Fix reaction of issues (#21185) Fix #20860. `CommentID` in `FindReactionsOptions` should be -1 to search reactions with zero comment id. https://github.com/go-gitea/gitea/blob/8351172b6e5221290dc5b2c81e159e2eec0b43c8/models/issues/reaction.go#L108-L121 Co-authored-by: Lauris BH --- models/issues/reaction.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/models/issues/reaction.go b/models/issues/reaction.go index 87d6ff4310..e7295c8af8 100644 --- a/models/issues/reaction.go +++ b/models/issues/reaction.go @@ -181,6 +181,10 @@ func createReaction(ctx context.Context, opts *ReactionOptions) (*Reaction, erro Reaction: opts.Type, UserID: opts.DoerID, } + if findOpts.CommentID == 0 { + // explicit search of Issue Reactions where CommentID = 0 + findOpts.CommentID = -1 + } existingR, _, err := FindReactions(ctx, findOpts) if err != nil { @@ -256,16 +260,23 @@ func DeleteReaction(ctx context.Context, opts *ReactionOptions) error { CommentID: opts.CommentID, } - _, err := db.GetEngine(ctx).Where("original_author_id = 0").Delete(reaction) + sess := db.GetEngine(ctx).Where("original_author_id = 0") + if opts.CommentID == -1 { + reaction.CommentID = 0 + sess.MustCols("comment_id") + } + + _, err := sess.Delete(reaction) return err } // DeleteIssueReaction deletes a reaction on issue. func DeleteIssueReaction(doerID, issueID int64, content string) error { return DeleteReaction(db.DefaultContext, &ReactionOptions{ - Type: content, - DoerID: doerID, - IssueID: issueID, + Type: content, + DoerID: doerID, + IssueID: issueID, + CommentID: -1, }) } From 321964155a605900bad1c3c97163bf33b4ae5d65 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 18 Sep 2022 09:31:20 +0800 Subject: [PATCH 018/169] Treat git object mode 40755 as directory (#21195) Git uses 040000 for tree object, but some users may get 040755 for unknown reasons Try to fix #21190 * #21190 --- modules/git/parse_nogogit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/parse_nogogit.go b/modules/git/parse_nogogit.go index 6dc4900992..c8f0f994fc 100644 --- a/modules/git/parse_nogogit.go +++ b/modules/git/parse_nogogit.go @@ -44,7 +44,7 @@ func parseTreeEntries(data []byte, ptree *Tree) ([]*TreeEntry, error) { case "160000": entry.entryMode = EntryModeCommit pos += 14 // skip over "160000 object " - case "040000": + case "040000", "040755": // git uses 040000 for tree object, but some users may get 040755 for unknown reasons entry.entryMode = EntryModeTree pos += 12 // skip over "040000 tree " default: @@ -119,7 +119,7 @@ loop: entry.entryMode = EntryModeSymlink case "160000": entry.entryMode = EntryModeCommit - case "40000": + case "40000", "40755": // git uses 40000 for tree object, but some users may get 40755 for unknown reasons entry.entryMode = EntryModeTree default: log.Debug("Unknown mode: %v", string(mode)) From 395f65c65a4b3d2bb06056b9bba3f4c016ab03e9 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 18 Sep 2022 10:35:24 +0800 Subject: [PATCH 019/169] Remove unnecessary length check for repo's Description & Website (#21194) Follows #21119 The manual length check doesn't make sense nowadays: 1. The length check is already done by form's `binding:MaxSize` (then the manual check is unnecessary) 2. The CreateRepository doesn't have such check (then the manual check is inconsistent) So this PR removes these manual length checks. --- modules/repository/create.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/repository/create.go b/modules/repository/create.go index 7a25323def..966a6a2f21 100644 --- a/modules/repository/create.go +++ b/modules/repository/create.go @@ -10,7 +10,6 @@ import ( "os" "path" "strings" - "unicode/utf8" "code.gitea.io/gitea/models" activities_model "code.gitea.io/gitea/models/activities" @@ -337,13 +336,6 @@ func CheckDaemonExportOK(ctx context.Context, repo *repo_model.Repository) error func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error) { repo.LowerName = strings.ToLower(repo.Name) - if utf8.RuneCountInString(repo.Description) > 255 { - repo.Description = string([]rune(repo.Description)[:255]) - } - if utf8.RuneCountInString(repo.Website) > 255 { - repo.Website = string([]rune(repo.Website)[:255]) - } - e := db.GetEngine(ctx) if _, err = e.ID(repo.ID).AllCols().Update(repo); err != nil { From c87e6a89da05bcf57cc0b60359915efd008f744f Mon Sep 17 00:00:00 2001 From: naoki kuroda <68233204+nnnkkk7@users.noreply.github.com> Date: Sun, 18 Sep 2022 17:13:34 +0900 Subject: [PATCH 020/169] Fix typo (#21201) I fixed typo. --- cmd/serv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/serv.go b/cmd/serv.go index b00c3962f4..06561f348a 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -43,7 +43,7 @@ const ( var CmdServ = cli.Command{ Name: "serv", Usage: "This command should only be called by SSH shell", - Description: `Serv provide access auth for repositories`, + Description: "Serv provides access auth for repositories", Action: runServ, Flags: []cli.Flag{ cli.BoolFlag{ From c5e88fb03d01b929cfcf17c0a817d75572d44023 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 19 Sep 2022 14:02:29 +0200 Subject: [PATCH 021/169] [API] teamSearch show teams with no members if user is admin (#21204) close #21176 --- build/generate-go-licenses.go | 4 +-- models/organization/team.go | 24 +++-------------- modules/markup/markdown/meta.go | 1 + modules/markup/markdown/renderconfig.go | 1 + routers/api/v1/org/team.go | 6 ++++- tests/integration/api_org_test.go | 36 +++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go index fedfdc315e..87c773ed8b 100644 --- a/build/generate-go-licenses.go +++ b/build/generate-go-licenses.go @@ -64,8 +64,8 @@ func main() { } entries = append(entries, LicenseEntry{ - Name: name, - Path: path, + Name: name, + Path: path, LicenseText: string(licenseText), }) } diff --git a/models/organization/team.go b/models/organization/team.go index 2d5ee17272..bd80b1a8c7 100644 --- a/models/organization/team.go +++ b/models/organization/team.go @@ -129,29 +129,11 @@ func SearchTeam(opts *SearchTeamOptions) ([]*Team, int64, error) { if opts.UserID > 0 { sess = sess.Join("INNER", "team_user", "team_user.team_id = team.id") } - - count, err := sess. - Where(cond). - Count(new(Team)) - if err != nil { - return nil, 0, err - } - - if opts.UserID > 0 { - sess = sess.Join("INNER", "team_user", "team_user.team_id = team.id") - } - - if opts.PageSize == -1 { - opts.PageSize = int(count) - } else { - sess = sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) - } + sess = db.SetSessionPagination(sess, opts) teams := make([]*Team, 0, opts.PageSize) - if err = sess. - Where(cond). - OrderBy("lower_name"). - Find(&teams); err != nil { + count, err := sess.Where(cond).OrderBy("lower_name").FindAndCount(&teams) + if err != nil { return nil, 0, err } diff --git a/modules/markup/markdown/meta.go b/modules/markup/markdown/meta.go index 28913fd684..b08121e868 100644 --- a/modules/markup/markdown/meta.go +++ b/modules/markup/markdown/meta.go @@ -11,6 +11,7 @@ import ( "unicode/utf8" "code.gitea.io/gitea/modules/log" + "gopkg.in/yaml.v3" ) diff --git a/modules/markup/markdown/renderconfig.go b/modules/markup/markdown/renderconfig.go index 6a3b3a1bde..003579115f 100644 --- a/modules/markup/markdown/renderconfig.go +++ b/modules/markup/markdown/renderconfig.go @@ -8,6 +8,7 @@ import ( "strings" "code.gitea.io/gitea/modules/log" + "github.com/yuin/goldmark/ast" "gopkg.in/yaml.v3" ) diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index c891d0e122..f3e7834a49 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -759,13 +759,17 @@ func SearchTeam(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) opts := &organization.SearchTeamOptions{ - UserID: ctx.Doer.ID, Keyword: ctx.FormTrim("q"), OrgID: ctx.Org.Organization.ID, IncludeDesc: ctx.FormString("include_desc") == "" || ctx.FormBool("include_desc"), ListOptions: listOptions, } + // Only admin is allowd to search for all teams + if !ctx.Doer.IsAdmin { + opts.UserID = ctx.Doer.ID + } + teams, maxResults, err := organization.SearchTeam(opts) if err != nil { log.Error("SearchTeam failed: %v", err) diff --git a/tests/integration/api_org_test.go b/tests/integration/api_org_test.go index 70bb17bee2..4b8c5c97a8 100644 --- a/tests/integration/api_org_test.go +++ b/tests/integration/api_org_test.go @@ -5,6 +5,7 @@ package integration import ( + "fmt" "net/http" "net/url" "strings" @@ -151,3 +152,38 @@ func TestAPIGetAll(t *testing.T) { assert.Equal(t, "org25", apiOrgList[0].FullName) assert.Equal(t, "public", apiOrgList[0].Visibility) } + +func TestAPIOrgSearchEmptyTeam(t *testing.T) { + onGiteaRun(t, func(*testing.T, *url.URL) { + token := getUserToken(t, "user1") + orgName := "org_with_empty_team" + + // create org + req := NewRequestWithJSON(t, "POST", "/api/v1/orgs?token="+token, &api.CreateOrgOption{ + UserName: orgName, + }) + MakeRequest(t, req, http.StatusCreated) + + // create team with no member + req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/orgs/%s/teams?token=%s", orgName, token), &api.CreateTeamOption{ + Name: "Empty", + IncludesAllRepositories: true, + Permission: "read", + Units: []string{"repo.code", "repo.issues", "repo.ext_issues", "repo.wiki", "repo.pulls"}, + }) + MakeRequest(t, req, http.StatusCreated) + + // case-insensitive search for teams that have no members + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/orgs/%s/teams/search?q=%s&token=%s", orgName, "empty", token)) + resp := MakeRequest(t, req, http.StatusOK) + data := struct { + Ok bool + Data []*api.Team + }{} + DecodeJSON(t, resp, &data) + assert.True(t, data.Ok) + if assert.Len(t, data.Data, 1) { + assert.EqualValues(t, "Empty", data.Data[0].Name) + } + }) +} From d0e3c53815cebea8189afd83bcc6f3d840f3f899 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 19 Sep 2022 14:50:15 +0200 Subject: [PATCH 022/169] Enable fluid page layout on medium size viewports (#21178) Fomantic has abrupt breakpoints at 991px and 768px which leads to variable amounts of wasted screen space below those breakpoints. Instead, enable fluid width for all viewport sizes below 1200px. --- web_src/less/_base.less | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 31f71d3c00..5fc3762e8b 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -737,6 +737,13 @@ a.ui.card:hover, padding-bottom: 80px; } +/* enable fluid page widths for medium size viewports */ +@media @mediaMdAndUp and @mediaLgAndDown { + .ui.ui.ui.container:not(.fluid) { + width: calc(100vw - 3em); + } +} + .following.bar { z-index: 900; left: 0; From 0c51595eedbb68643af73314ae1ab43eb5c95715 Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 20 Sep 2022 00:48:48 +0200 Subject: [PATCH 023/169] Clarify that `ENABLE_SWAGGER` only influences the API docs, not the routes (#21215) Previously, the docs seemed to suggest that you can disable the API completely by setting `ENABLE_SWAGGER=false`. This is not the case. --- custom/conf/app.example.ini | 4 ++-- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 4 ++-- docs/content/doc/advanced/config-cheat-sheet.zh-cn.md | 2 +- docs/content/doc/help/faq.en-us.md | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 6e1eca7a62..0e0822d4c5 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -2153,7 +2153,7 @@ ROUTER = console ;[api] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Enables Swagger. True or false; default is true. +;; Enables the API documentation endpoints (/api/swagger, /api/v1/swagger, …). True or false. ;ENABLE_SWAGGER = true ;; Max number of items in a page ;MAX_RESPONSE_ITEMS = 50 @@ -2161,7 +2161,7 @@ ROUTER = console ;DEFAULT_PAGING_NUM = 30 ;; Default and maximum number of items per page for git trees api ;DEFAULT_GIT_TREES_PER_PAGE = 1000 -;; Default size of a blob returned by the blobs API (default is 10MiB) +;; Default max size of a blob returned by the blobs API (default is 10MiB) ;DEFAULT_MAX_BLOB_SIZE = 10485760 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 459e42ac24..f39c501cbc 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -1015,11 +1015,11 @@ Default templates for project boards: ## API (`api`) -- `ENABLE_SWAGGER`: **true**: Enables /api/swagger, /api/v1/swagger etc. endpoints. True or false; default is true. +- `ENABLE_SWAGGER`: **true**: Enables the API documentation endpoints (`/api/swagger`, `/api/v1/swagger`, …). True or false. - `MAX_RESPONSE_ITEMS`: **50**: Max number of items in a page. - `DEFAULT_PAGING_NUM`: **30**: Default paging number of API. - `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: Default and maximum number of items per page for Git trees API. -- `DEFAULT_MAX_BLOB_SIZE`: **10485760**: Default max size of a blob that can be return by the blobs API. +- `DEFAULT_MAX_BLOB_SIZE`: **10485760** (10MiB): Default max size of a blob that can be returned by the blobs API. ## OAuth2 (`oauth2`) diff --git a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md index 34de3c0324..576007f75b 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md +++ b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md @@ -299,7 +299,7 @@ test01.xls: application/vnd.ms-excel; charset=binary ## API (`api`) -- `ENABLE_SWAGGER`: **true**: 是否启用swagger路由 /api/swagger, /api/v1/swagger etc. endpoints. True 或 false; 默认是 true. +- `ENABLE_SWAGGER`: **true**: 是否启用swagger路由 /api/swagger, /api/v1/swagger etc. endpoints. True 或 false. - `MAX_RESPONSE_ITEMS`: **50**: 一个页面最大的项目数。 - `DEFAULT_PAGING_NUM`: **30**: API中默认分页条数。 - `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: GIT TREES API每页的默认最大项数. diff --git a/docs/content/doc/help/faq.en-us.md b/docs/content/doc/help/faq.en-us.md index 970a6866a6..f71cd734a5 100644 --- a/docs/content/doc/help/faq.en-us.md +++ b/docs/content/doc/help/faq.en-us.md @@ -126,13 +126,13 @@ A "login prohibited" user is a user that is not allowed to log in to Gitea anymo ## What is Swagger? -[Swagger](https://swagger.io/) is what Gitea uses for its API. +[Swagger](https://swagger.io/) is what Gitea uses for its API documentation. -All Gitea instances have the built-in API, though it can be disabled by setting `ENABLE_SWAGGER` to `false` in the `api` section of your `app.ini` +All Gitea instances have the built-in API and there is no way to disable it completely. +You can, however, disable showing its documentation by setting `ENABLE_SWAGGER` to `false` in the `api` section of your `app.ini`. +For more information, refer to Gitea's [API docs]({{< relref "doc/developers/api-usage.en-us.md" >}}). -For more information, refer to Gitea's [API docs]({{< relref "doc/developers/api-usage.en-us.md" >}}) - -[Swagger Example](https://try.gitea.io/api/swagger) +You can see the latest API (for example) on . ## Adjusting your server for public/private use From a196302472d559f04ed9a4387156bedf26b7c55d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 20 Sep 2022 08:53:39 +0800 Subject: [PATCH 024/169] Fix template bug of admin monitor (#21208) Fix #21207 Co-authored-by: Lauris BH --- templates/admin/queue.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/admin/queue.tmpl b/templates/admin/queue.tmpl index 95fd3a5e05..cd50798f80 100644 --- a/templates/admin/queue.tmpl +++ b/templates/admin/queue.tmpl @@ -157,7 +157,7 @@ {{range .Queue.Workers}} - {{.Workers}}{{if .IsFlusher}}{{svg "octicon-sync"}}{{end}} + {{.Workers}}{{if .IsFlusher}}{{svg "octicon-sync"}}{{end}} {{DateFmtLong .Start}} {{if .HasTimeout}}{{DateFmtLong .Timeout}}{{else}}-{{end}} From 1b630ff7cdbb2ec48b67f8e3295c142f5ad77180 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Tue, 20 Sep 2022 09:59:20 +0200 Subject: [PATCH 025/169] Fix user visible check (#21210) Fixes #21206 If user and viewer are equal the method should return true. Also the common organization check was wrong as `count` can never be less then 0. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao --- models/fixtures/access.yml | 12 ++++++ models/fixtures/follow.yml | 5 +++ models/fixtures/org_user.yml | 6 +++ models/fixtures/team.yml | 2 +- models/fixtures/team_user.yml | 6 +++ models/fixtures/user.yml | 24 +++++++++++- models/user/user.go | 4 +- models/user/user_test.go | 53 ++++++++++++++++++++++++++ tests/integration/api_nodeinfo_test.go | 2 +- 9 files changed, 109 insertions(+), 5 deletions(-) diff --git a/models/fixtures/access.yml b/models/fixtures/access.yml index 4027e5fe92..446502843e 100644 --- a/models/fixtures/access.yml +++ b/models/fixtures/access.yml @@ -124,3 +124,15 @@ repo_id: 24 mode: 1 +- + id: 22 + user_id: 31 + repo_id: 27 + mode: 4 + +- + id: 23 + user_id: 31 + repo_id: 28 + mode: 4 + diff --git a/models/fixtures/follow.yml b/models/fixtures/follow.yml index 480fa065c7..b8d35828bf 100644 --- a/models/fixtures/follow.yml +++ b/models/fixtures/follow.yml @@ -12,3 +12,8 @@ id: 3 user_id: 2 follow_id: 8 + +- + id: 4 + user_id: 31 + follow_id: 33 diff --git a/models/fixtures/org_user.yml b/models/fixtures/org_user.yml index e06d94cfcd..d6bbdaa9da 100644 --- a/models/fixtures/org_user.yml +++ b/models/fixtures/org_user.yml @@ -69,3 +69,9 @@ uid: 2 org_id: 17 is_public: true + +- + id: 13 + uid: 31 + org_id: 19 + is_public: true diff --git a/models/fixtures/team.yml b/models/fixtures/team.yml index f6dfd1e9d0..880f49dc90 100644 --- a/models/fixtures/team.yml +++ b/models/fixtures/team.yml @@ -55,7 +55,7 @@ name: Owners authorize: 4 # owner num_repos: 2 - num_members: 1 + num_members: 2 can_create_org_repo: true - diff --git a/models/fixtures/team_user.yml b/models/fixtures/team_user.yml index 8f21164df4..845741effd 100644 --- a/models/fixtures/team_user.yml +++ b/models/fixtures/team_user.yml @@ -87,3 +87,9 @@ org_id: 17 team_id: 9 uid: 29 + +- + id: 16 + org_id: 19 + team_id: 6 + uid: 31 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index 87405bfd26..790156189a 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -345,7 +345,7 @@ avatar_email: user19@example.com num_repos: 2 is_active: true - num_members: 1 + num_members: 2 num_teams: 1 - @@ -572,6 +572,8 @@ avatar: avatar31 avatar_email: user31@example.com num_repos: 0 + num_followers: 0 + num_following: 1 is_active: true - @@ -590,3 +592,23 @@ avatar_email: user30@example.com num_repos: 0 is_active: true + +- + id: 33 + lower_name: user33 + name: user33 + login_name: user33 + full_name: User 33 (Limited Visibility) + email: user33@example.com + passwd_hash_algo: argon2 + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password + type: 0 # individual + salt: ZogKvWdyEx + is_admin: false + visibility: 1 + avatar: avatar33 + avatar_email: user33@example.com + num_repos: 0 + num_followers: 1 + num_following: 0 + is_active: true diff --git a/models/user/user.go b/models/user/user.go index f1df335eb6..32484a487f 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -1267,7 +1267,7 @@ func isUserVisibleToViewerCond(viewer *User) builder.Cond { // IsUserVisibleToViewer check if viewer is able to see user profile func IsUserVisibleToViewer(ctx context.Context, u, viewer *User) bool { - if viewer != nil && viewer.IsAdmin { + if viewer != nil && (viewer.IsAdmin || viewer.ID == u.ID) { return true } @@ -1306,7 +1306,7 @@ func IsUserVisibleToViewer(ctx context.Context, u, viewer *User) bool { return false } - if count < 0 { + if count == 0 { // No common organization return false } diff --git a/models/user/user_test.go b/models/user/user_test.go index 940382cdaf..848c978a9b 100644 --- a/models/user/user_test.go +++ b/models/user/user_test.go @@ -400,3 +400,56 @@ func TestUnfollowUser(t *testing.T) { unittest.CheckConsistencyFor(t, &user_model.User{}) } + +func TestIsUserVisibleToViewer(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) // admin, public + user4 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}) // normal, public + user20 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 20}) // public, same team as user31 + user29 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 29}) // public, is restricted + user31 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 31}) // private, same team as user20 + user33 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 33}) // limited, follows 31 + + test := func(u, viewer *user_model.User, expected bool) { + name := func(u *user_model.User) string { + if u == nil { + return "" + } + return u.Name + } + assert.Equal(t, expected, user_model.IsUserVisibleToViewer(db.DefaultContext, u, viewer), "user %v should be visible to viewer %v: %v", name(u), name(viewer), expected) + } + + // admin viewer + test(user1, user1, true) + test(user20, user1, true) + test(user31, user1, true) + test(user33, user1, true) + + // non admin viewer + test(user4, user4, true) + test(user20, user4, true) + test(user31, user4, false) + test(user33, user4, true) + test(user4, nil, true) + + // public user + test(user4, user20, true) + test(user4, user31, true) + test(user4, user33, true) + + // limited user + test(user33, user33, true) + test(user33, user4, true) + test(user33, user29, false) + test(user33, nil, false) + + // private user + test(user31, user31, true) + test(user31, user4, false) + test(user31, user20, true) + test(user31, user29, false) + test(user31, user33, true) + test(user31, nil, false) +} diff --git a/tests/integration/api_nodeinfo_test.go b/tests/integration/api_nodeinfo_test.go index 76f9105a51..2446acec94 100644 --- a/tests/integration/api_nodeinfo_test.go +++ b/tests/integration/api_nodeinfo_test.go @@ -32,7 +32,7 @@ func TestNodeinfo(t *testing.T) { DecodeJSON(t, resp, &nodeinfo) assert.True(t, nodeinfo.OpenRegistrations) assert.Equal(t, "gitea", nodeinfo.Software.Name) - assert.Equal(t, 23, nodeinfo.Usage.Users.Total) + assert.Equal(t, 24, nodeinfo.Usage.Users.Total) assert.Equal(t, 17, nodeinfo.Usage.LocalPosts) assert.Equal(t, 2, nodeinfo.Usage.LocalComments) }) From 399514453ed13ca457b12b2413c1e68f0f13acc0 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 20 Sep 2022 11:39:00 +0200 Subject: [PATCH 026/169] Configure golangci-lint to show all issues (#21106) golangci by default [limits](https://golangci-lint.run/usage/configuration/#issues-configuration) "same issues" to 3 which can be hindering when many issues are present. Change it to always show all issues. Co-authored-by: Lunny Xiao Co-authored-by: wxiaoguang --- .golangci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 982ab06f0b..0e796a2016 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -40,7 +40,7 @@ linters-settings: stylecheck: checks: ["all", "-ST1005", "-ST1003"] nakedret: - max-func-lines: 0 + max-func-lines: 0 gocritic: disabled-checks: - ifElseChain @@ -86,6 +86,8 @@ linters-settings: - github.com/unknwon/com: "use gitea's util and replacements" issues: + max-issues-per-linter: 0 + max-same-issues: 0 exclude-rules: # Exclude some linters from running on tests files. - path: _test\.go From d9bc6881ef695b20857c8c1f03c69a64f3521d5e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 21 Sep 2022 19:51:10 +0800 Subject: [PATCH 027/169] Make Clone in VSCode link get updated correctly (#21225) Follow #20557, fix #21224 The `clone_script` will update `.js-clone-url` and related elements, so it should be put after these elements. --- templates/repo/home.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index fe5af82d1a..e1aa1c4f3b 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -117,7 +117,6 @@ {{if eq $n 0}}
{{template "repo/clone_buttons" .}} - {{template "repo/clone_script" .}} + {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
{{end}} {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame)}} From 0a9a86b94307fe95661060cdfe36026e296dc69e Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 21 Sep 2022 15:01:18 +0200 Subject: [PATCH 028/169] Respect `REQUIRE_SIGNIN_VIEW` for packages (#20873) Fix #20863 When REQUIRE_SIGNIN_VIEW = true, even with public repositories, you can only see them after you login. The packages should not be accessed without login. Co-authored-by: Lauris BH Co-authored-by: wxiaoguang --- modules/context/package.go | 98 +++++++++++-------- .../integration/api_packages_generic_test.go | 13 +++ 2 files changed, 70 insertions(+), 41 deletions(-) diff --git a/modules/context/package.go b/modules/context/package.go index ad06f4d636..d12bdc4913 100644 --- a/modules/context/package.go +++ b/modules/context/package.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/models/perm" "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/templates" ) @@ -54,47 +55,11 @@ func packageAssignment(ctx *Context, errCb func(int, string, interface{})) { Owner: ctx.ContextUser, } - if ctx.Package.Owner.IsOrganization() { - org := organization.OrgFromUser(ctx.Package.Owner) - - // 1. Get user max authorize level for the org (may be none, if user is not member of the org) - if ctx.Doer != nil { - var err error - ctx.Package.AccessMode, err = org.GetOrgUserMaxAuthorizeLevel(ctx.Doer.ID) - if err != nil { - errCb(http.StatusInternalServerError, "GetOrgUserMaxAuthorizeLevel", err) - return - } - // If access mode is less than write check every team for more permissions - if ctx.Package.AccessMode < perm.AccessModeWrite { - teams, err := organization.GetUserOrgTeams(ctx, org.ID, ctx.Doer.ID) - if err != nil { - errCb(http.StatusInternalServerError, "GetUserOrgTeams", err) - return - } - for _, t := range teams { - perm := t.UnitAccessModeCtx(ctx, unit.TypePackages) - if ctx.Package.AccessMode < perm { - ctx.Package.AccessMode = perm - } - } - } - } - // 2. If authorize level is none, check if org is visible to user - if ctx.Package.AccessMode == perm.AccessModeNone && organization.HasOrgOrUserVisible(ctx, ctx.Package.Owner, ctx.Doer) { - ctx.Package.AccessMode = perm.AccessModeRead - } - } else { - if ctx.Doer != nil && !ctx.Doer.IsGhost() { - // 1. Check if user is package owner - if ctx.Doer.ID == ctx.Package.Owner.ID { - ctx.Package.AccessMode = perm.AccessModeOwner - } else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic || ctx.Package.Owner.Visibility == structs.VisibleTypeLimited { // 2. Check if package owner is public or limited - ctx.Package.AccessMode = perm.AccessModeRead - } - } else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic { // 3. Check if package owner is public - ctx.Package.AccessMode = perm.AccessModeRead - } + var err error + ctx.Package.AccessMode, err = determineAccessMode(ctx) + if err != nil { + errCb(http.StatusInternalServerError, "determineAccessMode", err) + return } packageType := ctx.Params("type") @@ -119,6 +84,57 @@ func packageAssignment(ctx *Context, errCb func(int, string, interface{})) { } } +func determineAccessMode(ctx *Context) (perm.AccessMode, error) { + accessMode := perm.AccessModeNone + + if setting.Service.RequireSignInView && ctx.Doer == nil { + return accessMode, nil + } + + if ctx.Package.Owner.IsOrganization() { + org := organization.OrgFromUser(ctx.Package.Owner) + + // 1. Get user max authorize level for the org (may be none, if user is not member of the org) + if ctx.Doer != nil { + var err error + accessMode, err = org.GetOrgUserMaxAuthorizeLevel(ctx.Doer.ID) + if err != nil { + return accessMode, err + } + // If access mode is less than write check every team for more permissions + if accessMode < perm.AccessModeWrite { + teams, err := organization.GetUserOrgTeams(ctx, org.ID, ctx.Doer.ID) + if err != nil { + return accessMode, err + } + for _, t := range teams { + perm := t.UnitAccessModeCtx(ctx, unit.TypePackages) + if accessMode < perm { + accessMode = perm + } + } + } + } + // 2. If authorize level is none, check if org is visible to user + if accessMode == perm.AccessModeNone && organization.HasOrgOrUserVisible(ctx, ctx.Package.Owner, ctx.Doer) { + accessMode = perm.AccessModeRead + } + } else { + if ctx.Doer != nil && !ctx.Doer.IsGhost() { + // 1. Check if user is package owner + if ctx.Doer.ID == ctx.Package.Owner.ID { + accessMode = perm.AccessModeOwner + } else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic || ctx.Package.Owner.Visibility == structs.VisibleTypeLimited { // 2. Check if package owner is public or limited + accessMode = perm.AccessModeRead + } + } else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic { // 3. Check if package owner is public + accessMode = perm.AccessModeRead + } + } + + return accessMode, nil +} + // PackageContexter initializes a package context for a request. func PackageContexter(ctx gocontext.Context) func(next http.Handler) http.Handler { _, rnd := templates.HTMLRenderer(ctx) diff --git a/tests/integration/api_packages_generic_test.go b/tests/integration/api_packages_generic_test.go index 9fcd2cc797..4c5c0c615c 100644 --- a/tests/integration/api_packages_generic_test.go +++ b/tests/integration/api_packages_generic_test.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/models/packages" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/tests" "github.com/stretchr/testify/assert" @@ -126,6 +127,18 @@ func TestPackageGeneric(t *testing.T) { req := NewRequest(t, "GET", url+"/not.found") MakeRequest(t, req, http.StatusNotFound) }) + + t.Run("RequireSignInView", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + setting.Service.RequireSignInView = true + defer func() { + setting.Service.RequireSignInView = false + }() + + req = NewRequest(t, "GET", url+"/dummy.bin") + MakeRequest(t, req, http.StatusUnauthorized) + }) }) t.Run("Delete", func(t *testing.T) { From acee32ca09ea8573687759ec039a8d480da97127 Mon Sep 17 00:00:00 2001 From: delvh Date: Wed, 21 Sep 2022 19:02:56 +0200 Subject: [PATCH 029/169] Prevent invalid behavior for file reviewing when loading more files (#21230) The problem was that many PR review components loaded by `Show more` received the same ID as previous batches, which confuses browsers (when clicked). All such occurrences should now be fixed. Additionally improved the background of the `viewed` checkbox. Lastly, the `go-licenses.json` was automatically updated. Fixes #21228. Fixes #20681. Co-authored-by: wxiaoguang --- assets/go-licenses.json | 5 +++++ templates/repo/diff/box.tmpl | 18 +++++++++--------- tests/e2e/e2e_test.go | 4 ++-- web_src/less/_review.less | 17 +++++++++++++---- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/assets/go-licenses.json b/assets/go-licenses.json index 535b3dea32..8d129557de 100644 --- a/assets/go-licenses.json +++ b/assets/go-licenses.json @@ -884,6 +884,11 @@ "path": "gopkg.in/yaml.v2/LICENSE", "licenseText": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright {yyyy} {name of copyright owner}\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" }, + { + "name": "gopkg.in/yaml.v3", + "path": "gopkg.in/yaml.v3/LICENSE", + "licenseText": "\nThis project is covered by two different licenses: MIT and Apache.\n\n#### MIT License ####\n\nThe following files were ported to Go from C files of libyaml, and thus\nare still covered by their original MIT license, with the additional\ncopyright staring in 2011 when the project was ported over:\n\n apic.go emitterc.go parserc.go readerc.go scannerc.go\n writerc.go yamlh.go yamlprivateh.go\n\nCopyright (c) 2006-2010 Kirill Simonov\nCopyright (c) 2006-2011 Kirill Simonov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n### Apache License ###\n\nAll the remaining project files are covered by the Apache license:\n\nCopyright (c) 2011-2019 Canonical Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" + }, { "name": "mvdan.cc/xurls/v2", "path": "mvdan.cc/xurls/v2/LICENSE", diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 06bc79e97a..51769eb953 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -57,7 +57,8 @@ {{end}}
- {{range $i, $file := .Diff.Files}} + {{range $file := .Diff.Files}} + {{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}} {{$blobBase := call $.GetBlobByPathForCommit $.BaseCommit $file.OldName}} {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}} {{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}} @@ -93,8 +94,8 @@
{{if $showFileViewToggle}}
- {{svg "octicon-code"}} - {{svg "octicon-file"}} + {{svg "octicon-code"}} + {{svg "octicon-file"}}
{{end}} {{if $file.IsProtected}} @@ -115,15 +116,14 @@ {{if $file.HasChangedSinceLastReview}} {{$.locale.Tr "repo.pulls.has_changed_since_last_review"}} {{end}} -
- - -
+ {{end}}
-
+
{{if or $file.IsIncomplete $file.IsBin}}
{{if $file.IsIncomplete}} @@ -148,7 +148,7 @@ {{end}}
{{if $showFileViewToggle}} -
+
{{if $isImage}} {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index c77c071181..eb2b1d70f8 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -72,8 +72,8 @@ func TestMain(m *testing.M) { os.Exit(exitVal) } -// This should be the only test e2e necessary. It will collect all "*.test.e2e.js" -// files in this directory and build a test for each. +// TestE2e should be the only test e2e necessary. It will collect all "*.test.e2e.js" +// files in this directory and build a test for each. func TestE2e(t *testing.T) { // Find the paths of all e2e test files in test test directory. searchGlob := filepath.Join(filepath.Dir(setting.AppPath), "tests", "e2e", "*.test.e2e.js") diff --git a/web_src/less/_review.less b/web_src/less/_review.less index e3b88ed928..fd18ecb3d3 100644 --- a/web_src/less/_review.less +++ b/web_src/less/_review.less @@ -272,13 +272,22 @@ a.blob-excerpt:hover { } .viewed-file-form { - margin: 0 3px; - padding: 0 3px; - border-radius: 3px; + display: flex; + align-items: center; + border: 1px none; + padding: 4px 8px; + margin: -8px 0; // just like other buttons in the diff box header + border-radius: .285rem; // just like .ui.tiny.button + font-size: .857rem; // just like .ui.tiny.button +} + +.viewed-file-form input { + margin-right: 4px; } .viewed-file-checked-form { - background-color: var(--color-primary-light-4); + background-color: var(--color-primary-light-6); + border: 1px solid var(--color-primary-light-4); } #viewed-files-summary { From f52fe82add25cba5532b6f650cb702f6b31f4aa9 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 21 Sep 2022 22:51:42 +0200 Subject: [PATCH 030/169] Use absolute links in feeds (#21229) fixes #20864 Co-authored-by: wxiaoguang Co-authored-by: techknowlogick --- models/activities/action.go | 5 +++ models/activities/action_test.go | 10 ++++-- routers/web/feed/convert.go | 62 ++++++++++++++++---------------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/models/activities/action.go b/models/activities/action.go index 31ecdedd5b..3c8acb5ba8 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -218,6 +218,11 @@ func (a *Action) GetRepoLink() string { return path.Join(setting.AppSubURL, "/", url.PathEscape(a.GetRepoUserName()), url.PathEscape(a.GetRepoName())) } +// GetRepoAbsoluteLink returns the absolute link to action repository. +func (a *Action) GetRepoAbsoluteLink() string { + return setting.AppURL + url.PathEscape(a.GetRepoUserName()) + "/" + url.PathEscape(a.GetRepoName()) +} + // GetCommentLink returns link to action comment. func (a *Action) GetCommentLink() string { return a.getCommentLink(db.DefaultContext) diff --git a/models/activities/action_test.go b/models/activities/action_test.go index 83fd9ee38d..ac2a3043a6 100644 --- a/models/activities/action_test.go +++ b/models/activities/action_test.go @@ -10,6 +10,7 @@ import ( activities_model "code.gitea.io/gitea/models/activities" "code.gitea.io/gitea/models/db" + issue_model "code.gitea.io/gitea/models/issues" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -20,7 +21,7 @@ import ( func TestAction_GetRepoPath(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}) + repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) action := &activities_model.Action{RepoID: repo.ID} assert.Equal(t, path.Join(owner.Name, repo.Name), action.GetRepoPath()) @@ -28,12 +29,15 @@ func TestAction_GetRepoPath(t *testing.T) { func TestAction_GetRepoLink(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}) + repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) - action := &activities_model.Action{RepoID: repo.ID} + comment := unittest.AssertExistsAndLoadBean(t, &issue_model.Comment{ID: 2}) + action := &activities_model.Action{RepoID: repo.ID, CommentID: comment.ID} setting.AppSubURL = "/suburl" expected := path.Join(setting.AppSubURL, owner.Name, repo.Name) assert.Equal(t, expected, action.GetRepoLink()) + assert.Equal(t, repo.HTMLURL(), action.GetRepoAbsoluteLink()) + assert.Equal(t, comment.HTMLURL(), action.GetCommentLink()) } func TestGetFeeds(t *testing.T) { diff --git a/routers/web/feed/convert.go b/routers/web/feed/convert.go index e16c54b8d8..645d9370d5 100644 --- a/routers/web/feed/convert.go +++ b/routers/web/feed/convert.go @@ -24,27 +24,27 @@ import ( ) func toBranchLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/src/branch/" + util.PathEscapeSegments(act.GetBranch()) + return act.GetRepoAbsoluteLink() + "/src/branch/" + util.PathEscapeSegments(act.GetBranch()) } func toTagLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/src/tag/" + util.PathEscapeSegments(act.GetTag()) + return act.GetRepoAbsoluteLink() + "/src/tag/" + util.PathEscapeSegments(act.GetTag()) } func toIssueLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/issues/" + url.PathEscape(act.GetIssueInfos()[0]) + return act.GetRepoAbsoluteLink() + "/issues/" + url.PathEscape(act.GetIssueInfos()[0]) } func toPullLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/pulls/" + url.PathEscape(act.GetIssueInfos()[0]) + return act.GetRepoAbsoluteLink() + "/pulls/" + url.PathEscape(act.GetIssueInfos()[0]) } func toSrcLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/src/" + util.PathEscapeSegments(act.GetBranch()) + return act.GetRepoAbsoluteLink() + "/src/" + util.PathEscapeSegments(act.GetBranch()) } func toReleaseLink(act *activities_model.Action) string { - return act.GetRepoLink() + "/releases/tag/" + util.PathEscapeSegments(act.GetBranch()) + return act.GetRepoAbsoluteLink() + "/releases/tag/" + util.PathEscapeSegments(act.GetBranch()) } // renderMarkdown creates a minimal markdown render context from an action. @@ -79,17 +79,17 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio title = act.ActUser.DisplayName() + " " switch act.OpType { case activities_model.ActionCreateRepo: - title += ctx.TrHTMLEscapeArgs("action.create_repo", act.GetRepoLink(), act.ShortRepoPath()) - link.Href = act.GetRepoLink() + title += ctx.TrHTMLEscapeArgs("action.create_repo", act.GetRepoAbsoluteLink(), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() case activities_model.ActionRenameRepo: - title += ctx.TrHTMLEscapeArgs("action.rename_repo", act.GetContent(), act.GetRepoLink(), act.ShortRepoPath()) - link.Href = act.GetRepoLink() + title += ctx.TrHTMLEscapeArgs("action.rename_repo", act.GetContent(), act.GetRepoAbsoluteLink(), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() case activities_model.ActionCommitRepo: link.Href = toBranchLink(act) if len(act.Content) != 0 { - title += ctx.TrHTMLEscapeArgs("action.commit_repo", act.GetRepoLink(), link.Href, act.GetBranch(), act.ShortRepoPath()) + title += ctx.TrHTMLEscapeArgs("action.commit_repo", act.GetRepoAbsoluteLink(), link.Href, act.GetBranch(), act.ShortRepoPath()) } else { - title += ctx.TrHTMLEscapeArgs("action.create_branch", act.GetRepoLink(), link.Href, act.GetBranch(), act.ShortRepoPath()) + title += ctx.TrHTMLEscapeArgs("action.create_branch", act.GetRepoAbsoluteLink(), link.Href, act.GetBranch(), act.ShortRepoPath()) } case activities_model.ActionCreateIssue: link.Href = toIssueLink(act) @@ -98,11 +98,11 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio link.Href = toPullLink(act) title += ctx.TrHTMLEscapeArgs("action.create_pull_request", link.Href, act.GetIssueInfos()[0], act.ShortRepoPath()) case activities_model.ActionTransferRepo: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.transfer_repo", act.GetContent(), act.GetRepoLink(), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.transfer_repo", act.GetContent(), act.GetRepoAbsoluteLink(), act.ShortRepoPath()) case activities_model.ActionPushTag: link.Href = toTagLink(act) - title += ctx.TrHTMLEscapeArgs("action.push_tag", act.GetRepoLink(), link.Href, act.GetTag(), act.ShortRepoPath()) + title += ctx.TrHTMLEscapeArgs("action.push_tag", act.GetRepoAbsoluteLink(), link.Href, act.GetTag(), act.ShortRepoPath()) case activities_model.ActionCommentIssue: issueLink := toIssueLink(act) if link.Href == "#" { @@ -140,26 +140,26 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio } title += ctx.TrHTMLEscapeArgs("action.reopen_pull_request", pullLink, act.GetIssueInfos()[0], act.ShortRepoPath()) case activities_model.ActionDeleteTag: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.delete_tag", act.GetRepoLink(), act.GetTag(), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.delete_tag", act.GetRepoAbsoluteLink(), act.GetTag(), act.ShortRepoPath()) case activities_model.ActionDeleteBranch: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.delete_branch", act.GetRepoLink(), html.EscapeString(act.GetBranch()), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.delete_branch", act.GetRepoAbsoluteLink(), html.EscapeString(act.GetBranch()), act.ShortRepoPath()) case activities_model.ActionMirrorSyncPush: srcLink := toSrcLink(act) if link.Href == "#" { link.Href = srcLink } - title += ctx.TrHTMLEscapeArgs("action.mirror_sync_push", act.GetRepoLink(), srcLink, act.GetBranch(), act.ShortRepoPath()) + title += ctx.TrHTMLEscapeArgs("action.mirror_sync_push", act.GetRepoAbsoluteLink(), srcLink, act.GetBranch(), act.ShortRepoPath()) case activities_model.ActionMirrorSyncCreate: srcLink := toSrcLink(act) if link.Href == "#" { link.Href = srcLink } - title += ctx.TrHTMLEscapeArgs("action.mirror_sync_create", act.GetRepoLink(), srcLink, act.GetBranch(), act.ShortRepoPath()) + title += ctx.TrHTMLEscapeArgs("action.mirror_sync_create", act.GetRepoAbsoluteLink(), srcLink, act.GetBranch(), act.ShortRepoPath()) case activities_model.ActionMirrorSyncDelete: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.mirror_sync_delete", act.GetRepoLink(), act.GetBranch(), act.ShortRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.mirror_sync_delete", act.GetRepoAbsoluteLink(), act.GetBranch(), act.ShortRepoPath()) case activities_model.ActionApprovePullRequest: pullLink := toPullLink(act) title += ctx.TrHTMLEscapeArgs("action.approve_pull_request", pullLink, act.GetIssueInfos()[0], act.ShortRepoPath()) @@ -174,16 +174,16 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio if link.Href == "#" { link.Href = releaseLink } - title += ctx.TrHTMLEscapeArgs("action.publish_release", act.GetRepoLink(), releaseLink, act.ShortRepoPath(), act.Content) + title += ctx.TrHTMLEscapeArgs("action.publish_release", act.GetRepoAbsoluteLink(), releaseLink, act.ShortRepoPath(), act.Content) case activities_model.ActionPullReviewDismissed: pullLink := toPullLink(act) title += ctx.TrHTMLEscapeArgs("action.review_dismissed", pullLink, act.GetIssueInfos()[0], act.ShortRepoPath(), act.GetIssueInfos()[1]) case activities_model.ActionStarRepo: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.starred_repo", act.GetRepoLink(), act.GetRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.starred_repo", act.GetRepoAbsoluteLink(), act.GetRepoPath()) case activities_model.ActionWatchRepo: - link.Href = act.GetRepoLink() - title += ctx.TrHTMLEscapeArgs("action.watched_repo", act.GetRepoLink(), act.GetRepoPath()) + link.Href = act.GetRepoAbsoluteLink() + title += ctx.TrHTMLEscapeArgs("action.watched_repo", act.GetRepoAbsoluteLink(), act.GetRepoPath()) default: return nil, fmt.Errorf("unknown action type: %v", act.OpType) } @@ -193,14 +193,14 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio switch act.OpType { case activities_model.ActionCommitRepo, activities_model.ActionMirrorSyncPush: push := templates.ActionContent2Commits(act) - repoLink := act.GetRepoLink() + repoLink := act.GetRepoAbsoluteLink() for _, commit := range push.Commits { if len(desc) != 0 { desc += "\n\n" } desc += fmt.Sprintf("%s\n%s", - html.EscapeString(fmt.Sprintf("%s/commit/%s", act.GetRepoLink(), commit.Sha1)), + html.EscapeString(fmt.Sprintf("%s/commit/%s", act.GetRepoAbsoluteLink(), commit.Sha1)), commit.Sha1, templates.RenderCommitMessage(ctx, commit.Message, repoLink, nil), ) @@ -209,7 +209,7 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio if push.Len > 1 { link = &feeds.Link{Href: fmt.Sprintf("%s/%s", setting.AppSubURL, push.CompareURL)} } else if push.Len == 1 { - link = &feeds.Link{Href: fmt.Sprintf("%s/commit/%s", act.GetRepoLink(), push.Commits[0].Sha1)} + link = &feeds.Link{Href: fmt.Sprintf("%s/commit/%s", act.GetRepoAbsoluteLink(), push.Commits[0].Sha1)} } case activities_model.ActionCreateIssue, activities_model.ActionCreatePullRequest: From 301d84e83a9a1ca81686fbd13be070769b30f2b0 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 23 Sep 2022 00:20:55 +0000 Subject: [PATCH 031/169] [skip ci] Updated translations via Crowdin --- options/locale/locale_sk-SK.ini | 1319 +++++++++++++++++++++++++++++++ 1 file changed, 1319 insertions(+) create mode 100644 options/locale/locale_sk-SK.ini diff --git a/options/locale/locale_sk-SK.ini b/options/locale/locale_sk-SK.ini new file mode 100644 index 0000000000..9c4475ac5c --- /dev/null +++ b/options/locale/locale_sk-SK.ini @@ -0,0 +1,1319 @@ +home=Domov +dashboard=Nástenka +explore=Preskúmať +help=Pomoc +logo=Logo +sign_in=Prihlásiť sa +sign_in_with=Prihlásiť sa pomocou +sign_out=Odhlásiť sa +sign_up=Registrácia +link_account=Prepojiť účet +register=Registrácia +version=Verzia +powered_by=Poháňané %s +page=Stránka +template=Šablóna +language=Jazyk +notifications=Upozornenia +active_stopwatch=Sledovanie času aktivity +create_new=Vytvoriť… +user_profile_and_more=Profil a nastavenia… +signed_in_as=Prihlásený ako +enable_javascript=Táto stránka pracuje lepšie s JavaScript-om. +toc=Obsah +licenses=Licencie +return_to_gitea=Naspäť do Gitea + +username=Používateľské meno +email=E-mailová adresa +password=Heslo +access_token=Prístupový token +re_type=Znova zadajte heslo +captcha=CAPTCHA +twofa=Dvojfaktorová autentifikácia +twofa_scratch=Dvojfaktorový dočasný kód +passcode=Prístupový kód + +webauthn_insert_key=Zadajte bezpečnostný kľúč +webauthn_sign_in=Stlačte tlačidlo na vašom bezpečnostnom kľúči. Ak váš kľúč nemá tlačidlo, vyberte a zasunte ho znova. +webauthn_press_button=Stlačte, prosím, tlačidlo na vašom bezpečnostnom kľúči… +webauthn_use_twofa=Použite kód dvojfaktorového overenia z vášho telefónu +webauthn_error=Nie je možné prečítať váš bezpečnostný kód. +webauthn_unsupported_browser=Váš prehliadač aktuálne nepodporuje WebAuthn. +webauthn_error_unknown=Vyskytla sa neznáma chyba. Skúste to znova. +webauthn_error_insecure=WebAuthn podporuje iba bezpečné spojenia. Na testovanie cez HTTP môžete použiť "localhost" alebo "127.0.0.1" +webauthn_error_unable_to_process=Server nemohol spracovať vašu požiadavku. +webauthn_error_duplicated=Bezpečnostný kľúč nie je pre túto požiadavku povolený. Uistite sa, že kľúč ešte nie je zaregistrovaný. +webauthn_error_empty=Musíte nastaviť meno pre tento kľúč. +webauthn_error_timeout=Vypršal čas na čítanie vašeho kľúča. Znova načítajte túto stránku a skúste to opäť. +webauthn_reload=Znovu načítať + +repository=Repozitár +organization=Organizácia +mirror=Zrkadlo +new_repo=Nový repozitár +new_migrate=Nová migrácia +new_mirror=Nové zrkadlo +new_fork=Nový fork repozitára +new_org=Nová organizácia +new_project=Nový projekt +new_project_board=Nová nástenka projektu +manage_org=Spravovať organizácie +admin_panel=Administrácia +account_settings=Nastavenia účtu +settings=Nastavenia +your_profile=Profil +your_starred=Obľúbené +your_settings=Nastavenia + +all=Všetko +sources=Zdrojové kódy +mirrors=Zrkadlá +collaborative=Spolupráca +forks=Forky + +activities=Aktivity +pull_requests=Pull requesty +issues=Úkoly +milestones=Míľniky + +ok=OK +cancel=Zrušiť +save=Uložiť +add=Pridať +add_all=Pridať všetko +remove=Odstrániť +remove_all=Odstrániť všetko +edit=Upraviť + +copy=Kopírovať +copy_url=Kopírovať URL +copy_branch=Kopírovať meno vetvy +copy_success=Skopírované! +copy_error=Kopírovanie zlyhalo + +write=Zapísať +preview=Náhľad +loading=Načítava sa… + +step1=Krok 1: +step2=Krok 2: + +error=Chyba +error404=Stránka, na ktorú sa pokúšate dostať, buď neexistuje, alebo nemáte oprávnenie na jej zobrazenie. + +never=Nikdy + +rss_feed=RSS kanál + +[error] +occurred=Vyskytla sa chyba +report_message=Ak ste si istí, že toto je chyba v Gitea, prehľadajte problémy na GitHub alebo otvorte nový issue podľa potreby. +missing_csrf=Nesprávna žiadosť: neprítomný CSFR token +invalid_csrf=Nesprávna žiadosť: nesprávny CSFR token +not_found=Nebolo možné nájsť cieľ. +network_error=Chyba siete + +[startpage] +app_desc=Jednoducho prístupný vlastný Git +install=Jednoduchá inštalácia +install_desc=Jednoducho spusťte binárku pre vašu platformu, dodávanú ako Docker, alebo ju získajte ako balík. +platform=Multiplatformový +platform_desc=Gitea beží všade kde je možné preložiť Go: Windows, macOS, Linux, ARM, a podobne. Vyberte si! +lightweight=Ľahká +lightweight_desc=Gitea má minimálne požiadavky a môže bežať na Raspberry Pi. Šetrite energiou vášho stroja! +license=Otvorený zdrojový kód +license_desc=Získajte code.gitea.io/gitea! Pridajte sa k nám a prispejte, aby bol tento projekt ešte lepší. Nehanbite sa byť prispievateľom! + +[install] +install=Inštalácia +title=Východzia konfigurácia +docker_helper=Ak spúšťate Gitea v Docker kontajneri, prečítajte si dokumentáciu pred zmenou akýchkoľvek nastavení. +require_db_desc=Gitea vyžaduje MySQL, PostgreSQL, MSSQL, SQLite3 alebo TiDB (MySQL protokol). +db_title=Nastavenie databázy +db_type=Typ databázy +host=Host +user=Používateľské meno +password=Heslo +db_name=Názov databázy +db_helper=Poznámka pre používateľov MySQL: používajte, prosím, formát uloženia dát InnoDB a pokiaľ používate „utf8mb4“, verzia InnoDB musí byť väčšia než 5.6. +db_schema=Schéma +db_schema_helper=Nechajte prázdne pre predvolené nastavenie ("public"). +ssl_mode=SSL +charset=Znaková sada +path=Cesta +sqlite_helper=Cesta k súboru databázy SQLite3.
Ak spúšťate Gitea ako službu, zadajte absolútnu cestu. +reinstall_error=Pokúšate sa inštalovať do existujúcej databázy Gitea +reinstall_confirm_message=Opätovná inštalácia s existujúcou databázou Gitea môže spôsobiť viacero problémov. Vo väčšine prípadov by ste na spustenie Gitea mali použiť svoj existujúci súbor „app.ini“. Ak viete, čo robíte, potvrďte nasledujúce: +reinstall_confirm_check_1=Údaje zašifrované pomocou SECRET_KEY v app.ini sa môžu stratiť: používatelia sa možno nebudú môcť prihlásiť s 2FA/OTP a zrkadlá možno nebudú fungovať správne. Začiarknutím tohto políčka potvrdzujete, že aktuálny súbor app.ini obsahuje správny kľúč SECRET_KEY. +reinstall_confirm_check_2=Repozitáre a nastavenia možno bude potrebné znova synchronizovať. Začiarknutím tohto políčka potvrdzujete, že hooky pre repozitáre a súbor autorizovaných kľúčov znova zosynchronizujete manuálne. Potvrdzujete, že zabezpečíte, aby boli nastavenia úložiska a zrkadla správne. +reinstall_confirm_check_3=Potvrdzujete, že ste si úplne istí, že táto Gitea beží so správnym umiestnením app.ini a že ste si istí, že ju musíte znova nainštalovať. Potvrdzujete, že beriete na vedomie vyššie uvedené riziká. +err_empty_db_path=Cesta k databáze SQLite3 nesmie byť prázdna. +no_admin_and_disable_registration=Nemôžete zakázať registráciu bez vytvorenia administrátorského účtu. +err_empty_admin_password=Heslo administrátora nemôže byť prázdne. +err_empty_admin_email=E-mail administrátora nemôže byť prázdny. +err_admin_name_is_reserved=Používateľské meno administrátora je neplatné, používateľské meno je rezervované +err_admin_name_pattern_not_allowed=Používateľské meno administrátora je neplatné, používateľské meno zodpovedá vyhradenému vzoru +err_admin_name_is_invalid=Používateľské meno administrátora je neplatné + +general_title=Všeobecné nastavenia +app_name=Názov webu +app_name_helper=Sem môžete zadať meno vašej spoločnosti. +repo_path=Koreňový adresár repozitárov +repo_path_helper=Vzdialené úložiská Git sa uložia do tohto adresára. +lfs_path=Koreňový adresár Git LFS +lfs_path_helper=Súbory sledované systémom Git LFS budú uložené v tomto adresári. Ak chcete deaktivovať, ponechajte prázdne. +run_user=Spustiť ako používateľ +run_user_helper=Zadajte používateľské meno pod ktorým beží Gitea v operačnom systéme. Pozor: tento používateľ musí mať prístup ku koreňovému adresáru repozitára. +domain=Doména serveru +domain_helper=Adresa domény alebo hostiteľa serveru. +ssh_port=Port SSH servera +ssh_port_helper=Číslo portu na ktorom načúva SSH server. Keď ponecháte prázdne, SSH server zakážete. +http_port=HTTP port pre Gitea +http_port_helper=Číslo portu na ktorom počúva webový server Gitea. +app_url=Základná URL Gitea +app_url_helper=Základná adresa pre klonované HTTP(S) URL adresy a e-mailové upozornenia. +log_root_path=Adresár logov +log_root_path_helper=Do tohoto adresára budú uložené súbory protokolu. + +optional_title=Voliteľné nastavenia +email_title=Nastavenia e-mailu +smtp_addr=SMTP Host +smtp_port=SMTP Port +smtp_from=Odoslať e-mail ako +smtp_from_helper=E-mailová adresa ktorú použije Gitea. Zadajte bežnú e-mailovú adresu alebo použite formát "Meno" . +mailer_user=Používateľské meno SMTP +mailer_password=SMTP heslo +register_confirm=Registrácia vyžaduje potvrdenie e-mailu +mail_notify=Povoliť e-mailové upozornenia +server_service_title=Nastavenia servera a ostatných služieb +offline_mode=Povoliť miestny režim +offline_mode_popup=Zakázať siete doručovania obsahu tretích strán a poskytovať celý obsah lokálne. +disable_gravatar=Zakázať Gravatar +disable_gravatar_popup=Zakázať Gravatar a cudzie zdroje avatarov. Ak používateľ nenahrá avatara, použije sa predvolený. +federated_avatar_lookup=Povoliť avatary z verejných zdrojov +federated_avatar_lookup_popup=Povoliť Libavatar na vyhľadávanie avatarov z verejných zdrojov. +disable_registration=Zakázať registráciu +disable_registration_popup=Zakázať registráciu. Nové používateľské účty budú môcť vytvárať iba správci. +allow_only_external_registration_popup=Povoliť registráciu iba skrze externé služby +openid_signin=Povoliť prihlásenie pomocou OpenID +openid_signin_popup=Povoliť používateľovi prihlásenie pomocou OpenID. +openid_signup=Povoliť registráciu pomocou OpenID +openid_signup_popup=Povoliť používateľskú registráciu založenú na OpenID. +enable_captcha=Povoliť CAPTCHA pri registrácii +enable_captcha_popup=Vyžadovať CAPTCHA validáciu pri registrácii používateľa. +require_sign_in_view=Vyžadovať prihlásenie na prezeranie stránok +require_sign_in_view_popup=Povoliť prístup k stránkam iba pre prihlásených používateľov. Návštevníci uvidia iba prihlasovaciu a registračnú stránku. +admin_setting_desc=Vytvorenie správcovského účtu je nepovinné. Prvý zaregistrovaný používateľ sa stane automaticky správcom. +admin_title=Nastavenia administrátorského účtu +admin_name=Používateľské meno administrátora +admin_password=Heslo +confirm_password=Potvrdiť heslo +admin_email=E-mailová adresa +install_btn_confirm=Nainštalovať Gitea +test_git_failed=Nie je možné otestovať príkaz 'git': %v +sqlite3_not_available=Táto verzia Gitea nepodporuje SQLite3. Stiahnite si, prosím, oficiálnu verziu z %s (nie verziu "gobuild"). +invalid_db_setting=Nastavenia databázy sú neplatné: %v +invalid_db_table=Databázová tabuľka '%s' je neplatná: %v +invalid_repo_path=Koreňová cesta repozitára je neplatná: %v +invalid_app_data_path=Cesta k údajom aplikácie je neplatná: %v +run_user_not_match=Používateľské meno pre 'spustiť ako' nie je aktuálne používateľské meno: %s -> %s +internal_token_failed=Nepodarilo sa vygenerovať interný token: %v +secret_key_failed=Nepodarilo sa vygenerovať tajný kľúč: %v +save_config_failed=Nepodarilo sa uložiť konfiguráciu: %v +invalid_admin_setting=Nastavenie administrátorského účtu je neplatné: %v +install_success=Vitajte! Ďakujeme že ste si vybrali Gitea. Veľa zábavy a opatrujte sa! +invalid_log_root_path=Cesta k logom je neplatná: %v +default_keep_email_private=Skrývanie e-mail adries ako predvolené +default_keep_email_private_popup=Predvolene skryť e-mailové adresy nových používateľských účtov. +default_allow_create_organization=Predvolene povoliť vytváranie organizácií +default_allow_create_organization_popup=V predvolenom nastavení povoľte novým používateľským účtom vytvárať organizácie. +default_enable_timetracking=Predvolene povoliť sledovanie času +default_enable_timetracking_popup=Predvolene povoliť sledovanie času pre nové repozitáre. +no_reply_address=Skrytá e-mailová doména +no_reply_address_helper=Doménové meno pre používateľov so skrytou e-mailovou adresou. Napríklad, používateľ s menom 'joe' bude zalogovaný v Git-e ako 'joe@noreply.example.org' ak je skrytá e-mailová doména nastavená na 'noreply.example.org'. +password_algorithm=Hašovací algoritmus hesla +password_algorithm_helper=Nastavte algoritmus hašovania hesla. Algoritmy majú rozličné požiadavky a silu. Algoritmus `argon2` má síce dobré charakteristiky ale používa veľa pamäte a nemusí byť vhodný pre malé systémy. + +[home] +uname_holder=Používateľské meno alebo emailová adresa +password_holder=Heslo +switch_dashboard_context=Prepnúť kontext nástenky +my_repos=Repozitáre +show_more_repos=Zobraziť ďalšie repozitáre… +collaborative_repos=Kolaboratívne repozitáre +my_orgs=Moje organizácie +my_mirrors=Moje zrkadlá +view_home=Zobraziť %s +search_repos=Nájsť repozitár… +filter=Ostatné filtre +filter_by_team_repositories=Filtrovať podľa tímových repozitárov +feed_of=Informačný kanál „%s“ + +show_archived=Archivované +show_both_archived_unarchived=Zobrazujú sa archivované aj nearchivované +show_only_archived=Zobrazuje sa iba archivované +show_only_unarchived=Zobrazuje sa iba nearchivované + +show_private=Súkromné +show_both_private_public=Zobrazuje sa verejné aj súkromné +show_only_private=Zobrazuje sa iba súkromné +show_only_public=Zobrazuje sa iba verejné + +issues.in_your_repos=Vo vašich repozitároch + +[explore] +repos=Repozitáre +users=Používatelia +organizations=Organizácie +search=Hľadať +code=Zdrojový kód +search.fuzzy=Fuzzy +search.match=Zhoda +code_search_unavailable=Vyhľadávanie kódu momentálne nie je dostupné. Kontaktujte, prosím, správcu. +repo_no_results=Nenašli sa zodpovedajúce repozitáre. +user_no_results=Nenašli sa zodpovedajúci používatelia. +org_no_results=Nenašli sa zodpovedajúce organizácie. +code_no_results=Nenašiel sa žiaden zdrojový kód zodpovedajúci hľadanému výrazu. +code_search_results=Výsledky vyhľadávania pre '%s' +code_last_indexed_at=Naposledy indexované %s +relevant_repositories_tooltip=Repozitáre, ktoré sú forkami alebo ktoré nemajú tému, žiadnu ikonu ani popis, sú skryté. +relevant_repositories=Zobrazujú sa iba relevantné repozitáre, zobraziť nefiltrované výsledky. + + +[auth] +create_new_account=Zaregistrovať účet +register_helper_msg=Máte už účet? Prihláste sa teraz! +social_register_helper_msg=Máte už účet? Prepojte ho teraz! +disable_register_prompt=Registrácia je zakázaná. Obráťte sa, prosím, na administrátora stránky. +disable_register_mail=E-mailové potvrdzovanie registrácie je zakázané. +manual_activation_only=Na dokončenie aktivácie kontaktujte správcu webu. +remember_me=Zapamätať si toto zariadenie +forgot_password_title=Zabudnuté heslo +forgot_password=Zabudli ste heslo? +sign_up_now=Potrebujete účet? Zaregistrujte sa teraz. +sign_up_successful=Účet bol úspešne vytvorený. +confirmation_mail_sent_prompt=Na adresu %s bol odoslaný nový potvrdzovací e-mail. Skontrolujte si, prosím, vašu doručenú poštu počas najbližších %s pre dokončenie procesu registrácie. +must_change_password=Aktualizácia vášho hesla +allow_password_change=Vyžiadať od používateľa zmenu hesla (doporučuje sa) +reset_password_mail_sent_prompt=Na adresu %s bol odoslaný potvrdzovací e-mail. Skontrolujte si, prosím, vašu doručenú poštu počas najbližších %s pre dokončenie procesu obnovenia účtu. +active_your_account=Aktivovať účet +account_activated=Účet bol aktivovaný +prohibit_login=Prihlásenie zakázané +prohibit_login_desc=Váš účet má zakázané prihlásenie, kontaktuje, prosím, správcu servera. +resent_limit_prompt=Pred malou chvíľou ste už požiadali o aktivačný email. Počkajte, prosím, 3 minúty a potom skúste znova. +has_unconfirmed_mail=Ahoj %s, tvoja e-mailová adresa (%s) je neoverená. Ak si ešte nedostal potvrdzovací e-mail, alebo je potrebné odoslať nový, klikni, prosím, na tlačidlo nižšie. +resend_mail=Kliknite sem pre opätovné odoslanie aktivačného e-mailu +email_not_associate=Táto e-mailová adresa nie je priradená k žiadnemu účtu. +send_reset_mail=Odoslať e-mail pre obnovenie účtu +reset_password=Obnovenie účtu +invalid_code=Váš potvrdzovací kód je chybný alebo vypršala jeho platnosť. +reset_password_helper=Obnoviť účet +reset_password_wrong_user=Ste prihlásený ako %s, ale odkaz pre obnovenie účtu je pre %s +password_too_short=Heslo nemôže obsahovať menej ako %d znakov. +non_local_account=Externe overovaní používatelia nemôžu aktualizovať svoje heslo prostredníctvom webového rozhrania Gitea. +verify=Overiť +scratch_code=Pomocný kód +use_scratch_code=Použiť pomocný kód +twofa_scratch_used=Použili ste pomocný kód. Boli ste presmerovaní na stránku nastavenia dvojfaktorového overovania, takže môžete odstrániť registráciu vašeho zariadenia alebo vygenerovať nový pomocný kód. +twofa_passcode_incorrect=Váš prístupový kód je nesprávny. Ak ste vaše zariadenie umiestnili nesprávne, použite pomocný kód na prihlásenie. +twofa_scratch_token_incorrect=Váš pomocný kód je nesprávny. +login_userpass=Prihlásiť sa +login_openid=OpenID +oauth_signup_tab=Zaregistrovať nový účet +oauth_signup_title=Dokončiť nový účet +oauth_signup_submit=Dokončiť účet +oauth_signin_tab=Prepojiť s existujúcim účtom +oauth_signin_title=Prihláste sa na overenie prepojeného účtu +oauth_signin_submit=Prepojiť účet +oauth.signin.error=Vyskytla sa chyba počas spracovania vašej autorizačnej žiadosti. Ak chyba pretrváva, kontaktujte, prosím, správcu. +oauth.signin.error.access_denied=Žiadosť o autorizáciu bola zamietnutá. +oauth.signin.error.temporarily_unavailable=Autorizácia zlyhala, pretože overovací server je dočasne nedostupný. Skúste to prosím neskôr. +openid_connect_submit=Pripojiť +openid_connect_title=Pripojiť k existujúcemu účtu +openid_connect_desc=Zvolené OpenID URI je neznáme. Združte s novým účtom tu. +openid_register_title=Vytvoriť nový účet +openid_register_desc=Zvolené OpenID URI je neznáme. Združte s novým účtom tu. +openid_signin_desc=Zadajte vaše OpenID URI. Napríklad: https://anne.me, bob.openid.org.cn alebo gnusocial.net/carry. +disable_forgot_password_mail=Obnovenie účtu je zakázané pretože nie je nastavený e-mail. Kontaktujte, prosím, správcu webu. +disable_forgot_password_mail_admin=Obnovenie účtu je možné iba po nastavení e-mailu. Pre povolenie obnovy účtu nastavte, prosím, e-mail. +email_domain_blacklisted=Nemôžete sa zaregistrovať s vašou e-mailovou adresou. +authorize_application=Autorizovať aplikáciu +authorize_redirect_notice=Ak autorizujete túto aplikáciu, budete presmerovaní na %s. +authorize_application_created_by=Túto aplikáciu vytvoril %s. +authorize_application_description=Ak udelíte prístup, bude možné pristupovať a zapisovať do všetkých vašich informácií o účte, vrátane súkromných repozitárov a organizácií. +authorize_title=Autorizovať „%s“ pre prístup k vášmu účtu? +authorization_failed=Autorizácia zlyhala +authorization_failed_desc=Autorizácia zlyhala pretože sme zistili neplatnú žiadosť. Kontaktujte, prosím, správcu aplikácie ktorou ste sa pokúšali autorizovať. +sspi_auth_failed=SSPI overenie zlyhalo +password_pwned=Zvolené heslo je na zozname ukradnutých hesiel ktoré boli v minulosti odhalené pri narušení verejných dát. Skúste znovu s iným heslom. +password_pwned_err=Nie je možné dokončiť žiadosť na HaveIBeenPwned + +[mail] +view_it_on=Zobraziť na %s +link_not_working_do_paste=Nefunguje? Skúste ho skopírovať a vložiť do svojho prehliadača. +hi_user_x=Ahoj %s, + +activate_account=Aktivujte si svoj účet, prosím +activate_account.title=%s, aktivujte si svoj účet, prosím +activate_account.text_1=Ahoj %[1]s, ďakujeme za registráciu na %[2]s! +activate_account.text_2=Pre aktiváciu vašeho účtu kliknite, prosím, na nasledovný odkaz do %s: + +activate_email=Overte svoju e-mailovú adresu +activate_email.title=%s, overte prosím, svoju e-mailovú adresu +activate_email.text=Pre overenie vašej e-mailovej adresy kliknite, prosím, na nasledovný odkaz do %s: + +register_notify=Vitajte v Gitea +register_notify.title=%[1]s, vitajte v %[2]s +register_notify.text_1=toto je e-mail potvrdzujúci vašu registráciu pre %s! +register_notify.text_2=Teraz sa môžete prihlásiť s používateľským menom: %s. +register_notify.text_3=Ak bol tento účet vytvorený pre vás, nastavte prosím najskôr svoje heslo. + +reset_password=Obnoviť váš účet +reset_password.title=%s, požiadali ste o obnovenie vášho účtu +reset_password.text=Pre obnovenie vašeho účtu kliknite, prosím, na nasledovný odkaz do %s: + +register_success=Registrácia prebehla úspešne + +issue_assigned.pull=@%[1]s vám pridelil pull request %[2] v repozitári %[3]s. +issue_assigned.issue=@%[1]s vám pridelil úkol %[2]s v repozitári %[3]s. + +issue.x_mentioned_you=@%s vás zmienil: +issue.action.force_push=%[1]s vynútil nahranie %[2]s z %[3]s do %[4]s. +issue.action.push_1=@%[1]s nahral %[3]d commit do %[2]s +issue.action.push_n=@%[1]s nahral %[3]d commity do %[2]s +issue.action.close=@%[1]s uzavrel #%[2]d. +issue.action.reopen=@%[1]s znovu otvoril #%[2]d. +issue.action.merge=@%[1]s zlúčil #%[2]d do %[3]s. +issue.action.approve=@%[1]s schválil tento pull request. +issue.action.reject=@%[1]s požadoval zmeny v tomto pull requeste. +issue.action.review=@%[1]s okomentoval tento pull request. +issue.action.review_dismissed=@%[1]s zamietol poslednú recenziu od %[2]s pre tento pull request. +issue.action.ready_for_review=@%[1]s označil tento pull request ako pripravený na revíziu. +issue.action.new=@%[1] vytvoril/a #%[2]d. +issue.in_tree_path=V %s: + +release.new.subject=%s v %s vydané +release.new.text=@%[1]s vydal/a %[2]s v %[3]s +release.title=Názov: %s +release.note=Poznámka: +release.downloads=Sťahovania: +release.download.zip=Zdrojový kód (ZIP) +release.download.targz=Zdrojový kód (TAR.GZ) + +repo.transfer.subject_to=%s by chcel preniesť "%s" do %s +repo.transfer.subject_to_you=%s by chcel preniesť "%s" k vám +repo.transfer.to_you=vy +repo.transfer.body=Ak to chcete prijať alebo odmietnuť, navštívte %s alebo to jednoducho ignorujte. + +repo.collaborator.added.subject=%s vás pridal do %s +repo.collaborator.added.text=Boli ste pridaný ako spolupracovník repozitára: + +[modal] +yes=Áno +no=Nie +modify=Aktualizovať + +[form] +UserName=Používateľské meno +RepoName=Názov repozitára +Email=E-mailová adresa +Password=Heslo +Retype=Znova zadajte heslo +SSHTitle=Názov SSH kľúča +HttpsUrl=HTTPS URL +PayloadUrl=URL nákladu +TeamName=Názov tímu +AuthName=Názov autorizácie +AdminEmail=E-mail administrátora + +NewBranchName=Názov novej vetvy +CommitSummary=Zhrnutie commitu +CommitMessage=Správa ku commitu +CommitChoice=Výber commitu +TreeName=Cesta k súboru +Content=Obsah + +SSPISeparatorReplacement=Oddeľovač +SSPIDefaultLanguage=Predvolený jazyk + +require_error=` nemôže byť prázdne.` +alpha_dash_error=` by mal obsahovať iba alfanumerické znaky, pomlčku ('-') a podčiarkovník ('_').` +alpha_dash_dot_error=` by mal obsahovať iba alfanumerické znaky, pomlčku ('-'), podčiarkovník ('_') a bodku ('.').` +git_ref_name_error=` musí byť správny názov odkazu Git.` +size_error=` musí byť dĺžky %s.` +min_size_error=` musí obsahovať minimálne %s znakov.` +max_size_error=` musí obsahovať maximálne %s znakov.` +email_error=` nie je platná e-mailová adresa.` +url_error=`'%s' nieje platná URL.` +include_error=` musí obsahovať podreťazec '%s'.` +glob_pattern_error=` glob vzor je neplatný: %s.` +regex_pattern_error=` regex vzor je neplatný: %s.` +unknown_error=Neznáma chyba: +captcha_incorrect=Overovací kód CAPTCHA je nesprávny. +password_not_match=Heslá sa nezhodujú. +lang_select_error=Zvoľte jazyk zo zoznamu. + +username_been_taken=Používateľské meno je už obsadené. +username_change_not_local_user=Používatelia overovaní inak ako lokálne si nemôžu zmeniť svoje používateľské meno. +repo_name_been_taken=Meno repozitára sa už používa. +repository_force_private=Je aktivované "Iba súkromne": súkromné repozitáre nesmú byť zverejnené. +repository_files_already_exist=Súbory pre tento repozitár už existujú. Kontaktujte správcu systému. +repository_files_already_exist.adopt=Súbory pre tento repozitár už existujú dajú sa iba prijať. +repository_files_already_exist.delete=Súbory pre tento repozitár už existujú. Musíte ich zmazať. +repository_files_already_exist.adopt_or_delete=Súbory pre tento repozitár už existujú. Buď ich prijmite, alebo zmažte. +visit_rate_limit=Dosiahnutý limit rýchlosti dotazov pri vzdialenom prístupe. +2fa_auth_required=Vzdialený prístup vyžaduje dvojfaktorové overovanie. +org_name_been_taken=Názov organizácie sa už používa. +team_name_been_taken=Názov tímu sa už používa. +team_no_units_error=Povoliť prístup aspoň do jednej sekcie repozitára. +email_been_used=E-mailová adresa sa už používa. +email_invalid=Táto e-mailová adresa je neplatná. +openid_been_used=Adresa OpenID '%s' sa už používa. +username_password_incorrect=Používateľské meno alebo heslo je nesprávne. +password_complexity=Heslo nesplňuje požiadavky na zložitosť: +password_lowercase_one=Aspoň jedno malé písmeno +password_uppercase_one=Aspoň jedno veľké písmeno +password_digit_one=Aspoň jedna číslica +password_special_one=Aspoň jeden špeciálny znak (interpunkcia, zátvorky, úvodzovky, atď.) +enterred_invalid_repo_name=Zadaný názov repozitára je nesprávny. +enterred_invalid_org_name=Zadaný názov organizácie je nesprávny. +enterred_invalid_owner_name=Nové meno vlastníka nie je platné. +enterred_invalid_password=Zadané heslo je nesprávne. +user_not_exist=Tento používateľ neexistuje. +team_not_exist=Tento tím neexistuje. +last_org_owner=Nemôžete odstrániť posledného používateľa z tímu 'vlastníkov'. Musí existovať aspoň jeden vlastník pre organizáciu. +cannot_add_org_to_team=Organizácia nemôže byť pridaná ako člen tímu. + +invalid_ssh_key=Nie je možné overiť váš SSH kľúč: %s +invalid_gpg_key=Nie je možné overiť váš GPG kľúč: %s +invalid_ssh_principal=Neplatná identita: %s +unable_verify_ssh_key=Nie je možné overiť SSH kľúč; znovu skontrolujte chyby. +auth_failed=Overenie zlyhalo: %v + +still_own_repo=Váš účet je vlastníkom jedného alebo viacerých repozitárov; najskôr ich zmažte alebo preveďte. +still_has_org=Váš účet je členom jednej alebo viacerých organizácií; najskôr ich opustite. +still_own_packages=Váš účet je vlastníkom jedného alebo viacerých repozitárov; najskôr ich zmažte alebo preveďte. +org_still_own_repo=Váš účet je stále vlastníkom jedného alebo viacerých repozitárov; najskôr ich zmažte alebo preveďte. +org_still_own_packages=Váš organizácia je vlastníkom jedného alebo viacerých repozitárov; najskôr ich zmažte alebo preveďte. + +target_branch_not_exist=Cieľová vetva neexistuje. + +[user] +change_avatar=Zmeniť svoj avatar… +join_on=Pripojil sa dňa +repositories=Repozitáre +activity=Verejná aktivita +followers=Sledujúci +starred=Obľúbené repozitáre +watched=Sledované repozitáre +projects=Projekty +following=Sledovaní +follow=Sledovať +unfollow=Zrušiť sledovanie +heatmap.loading=Načítanie teplotnej mapy… +user_bio=Životopis +disabled_public_activity=Tento používateľ zákázal verejnú viditeľnosť aktivity. + +form.name_reserved=Toto používateľské meno '%s' je vyhradené. +form.name_pattern_not_allowed=Tento vzor '%s' nie je povolený v mene používateľa. +form.name_chars_not_allowed=Používateľské meno '%s' obsahuje neplatné znaky. + +[settings] +profile=Profil +account=Účet +appearance=Vzhľad +password=Heslo +security=Zabezpečenie +avatar=Avatar +ssh_gpg_keys=SSH / GPG kľúče +social=Sociálne účty +applications=Aplikácie +orgs=Spravovať organizácie +repos=Repozitáre +delete=Zmazať účet +twofa=Dvojfaktorové overenie +account_link=Prepojené účty +organization=Organizácie +uid=Uid +webauthn=Bezpečnostné kľúče + +public_profile=Verejný profil +biography_placeholder=Povedzte nám niečo o sebe +profile_desc=Vaša e-mailová adresa bude použitá pre oznámenia a iné operácie. +password_username_disabled=Externí používatelia nemôžu meniť svoje používateľské meno. Kontaktujte, prosím, svojho administrátora kvôli detailom. +full_name=Celé meno +website=Webová stránka +location=Miesto +update_theme=Aktualizovať tému +update_profile=Aktualizovať profil +update_language=Aktualizovať jazyk +update_language_not_found=Jazyk '%s' nie je dostupný. +update_language_success=Jazyk bol aktualizovaný. +update_profile_success=Váš profil sa aktualizoval. +change_username=Vaše používateľské meno bolo zmenené. +change_username_prompt=Poznámka: zmeny používateľského mena zmenia tiež URL účtu. +change_username_redirect_prompt=Staré používateľské meno bude presmerované až pokiaľ nebude znovu obsadené. +continue=Pokračovať +cancel=Zrušiť +language=Jazyk +ui=Motív +hidden_comment_types=Skryté typy komentárov +comment_type_group_reference=Referencia +comment_type_group_label=Štítok +comment_type_group_milestone=Míľnik +comment_type_group_assignee=Príjemca +comment_type_group_title=Názov +comment_type_group_branch=Vetva +comment_type_group_time_tracking=Sledovanie času +comment_type_group_deadline=Uzávierka +comment_type_group_dependency=Závislosť +comment_type_group_lock=Stav zámku +comment_type_group_review_request=Žiadosť o revíziu +comment_type_group_pull_request_push=Pridané commity +comment_type_group_project=Projekt +comment_type_group_issue_ref=Referenčné číslo úkolu +saved_successfully=Nastavenia úspešne uložené. +privacy=Súkromie +keep_activity_private=Skryť aktivitu z profilovej stránky +keep_activity_private_popup=Nastaviť aktivitu viditeľnú iba pre vás a administrátorov + +lookup_avatar_by_mail=Vyhľadať avatar pomocou e-mailovej adresy +federated_avatar_lookup=Vyhľadanie avatarov z verejných zdrojov +enable_custom_avatar=Použiť užívateľský avatar +choose_new_avatar=Vybrať nový avatar +update_avatar=Aktualizovať avatar +delete_current_avatar=Odstrániť aktuálny avatar +uploaded_avatar_not_a_image=Nahraný súbor nieje obrázok. +uploaded_avatar_is_too_big=Nahraný súbor prekročil maximálnu veľkosť. +update_avatar_success=Váš avatar sa aktualizoval. +update_user_avatar_success=Užívateľov avatar bol aktualizovaný. + +change_password=Aktualizovať heslo +old_password=Aktuálne heslo +new_password=Nové heslo +retype_new_password=Znova zadajte nové heslo +password_incorrect=Aktuálne heslo nie je správne. +change_password_success=Vaše heslo bolo aktualizované. Od teraz sa prihlasujte novým heslom. +password_change_disabled=Externe overovaní používatelia nemôžu aktualizovať svoje heslo prostredníctvom webového rozhrania Gitea. + +emails=E-mailové adresy +manage_emails=Správa e-mailových adries +manage_themes=Nastavenie predvolenej témy +manage_openid=Správa OpenID adries +email_desc=Vaša primárna e-mailová adresa bude použitá pre oznámenia a iné operácie. +theme_desc=Toto bude vaša predvolená téma vzhľadu naprieč stránkou. +primary=Primárny +activated=Aktivovaný +requires_activation=Vyžaduje aktiváciu +primary_email=Nastaviť ako primárny +activate_email=Poslať aktiváciu +activations_pending=Čakajúca aktivácia +delete_email=Odstrániť +email_deletion=Vymazať e-mailovú adresu +email_deletion_desc=E-mailová adresa a pridružené informácie budú z vášho účtu odstránené. Commity Gitu s touto e-mailovou adresou zostanú nezmenené. Pokračovať? +email_deletion_success=E-mailová adresa bola odstránená. +theme_update_success=Vaša téma bola aktualizovaná. +theme_update_error=Vybraná téma vzhľadu neexistuje. +openid_deletion=Odstrániť OpenID adresu +openid_deletion_desc=Pokiaľ odstránite OpenID adresu, nebudete ju môcť použiť k prihláseniu. Pokračovať? +openid_deletion_success=OpenID adresa bola odstránená. +add_new_email=Pridať novú e-mailovú adresu +add_new_openid=Pridať nové OpenID URI +add_email=Pridať e-mailovú adresu +add_openid=Pridať OpenID URI +add_email_confirmation_sent=Na adresu %s bol odoslaný potvrdzovací e-mail. Skontrolujte si, prosím, vašu doručenú poštu počas najbližších %s pre potvrdenie vašej e-mailovej adresy. +add_email_success=Bola pridaná nová e-mailová adresa. +email_preference_set_success=Boli pridané preferencie pre e-mailovú adresu. +add_openid_success=Bola pridaná nová adresa OpenID. +keep_email_private=Skryť e-mailovú adresu +keep_email_private_popup=Vaša e-mailová adresa bola skrytá pred ostatnými používateľmi. +openid_desc=OpenID dovoľuje delegovať overovanie na externého poskytovateľa. + +manage_ssh_keys=Spravovať SSH kľúče +manage_ssh_principals=Spravovať SSH certifikačné identity +manage_gpg_keys=Správa GPG kľúčov +add_key=Pridať kľúč +ssh_desc=Tieto verejné SSH kľúče sú prepojené s vašim účtom. Zodpovedajúce súkromné kľúče umožnia plný prístup k vašim repozitárom. +principal_desc=Tieto SSH certifikačné identity sú prepojené s vašim účtom a umožňujú plný prístup k vašim repozitárom. +gpg_desc=Tieto verejné GPG kľúče sú prepojené s vašim účtom. Uchovajte vaše súkromné kľúče v bezpečí, pretože umožňujú overenie commitov. +ssh_helper=Potrebujete pomoc? Pozrite sa do príručky GitHub-u ako vytvoriť svoje SSH kľúče alebo ako riešiť bežné problémy s ktorými sa môžete stretnúť pri používaní SSH. +gpg_helper=Potrebujete pomoc? Pozrite sa do príručky GitHub-u o GPG. +add_new_key=Pridať SSH kľúč +add_new_gpg_key=Pridať GPG kľúč +key_content_ssh_placeholder=Začína sa s 'ssh-ed25519', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'sk-ecdsa-sha2-nistp256@openssh.com' alebo 'sk-ssh-ed25519@openssh.com' +key_content_gpg_placeholder=Začína sa s '-----BEGIN PGP PUBLIC KEY BLOCK-----' +add_new_principal=Pridať identitu +ssh_key_been_used=Tento SSH kľúč bol na server už pridaný. +ssh_key_name_used=SSH kľúč s rovnakým menom už vo vašom účte existuje. +ssh_principal_been_used=Táto identita bola na server už pridaná. +gpg_key_id_used=Verejný GPG kľúč s rovnakým ID už existuje. +gpg_no_key_email_found=Tento GPG kľúč sa nezhoduje zo žiadnou aktivovanou e-mailovou adresou prepojenou s vašim účtom. Stále ho môžete pridať, ak podpíšete poskytnutý token. +gpg_key_matched_identities=Zhodujúce sa identity: +gpg_key_matched_identities_long=Vložené identity v tomto kľúči zodpovedajú nasledujúcim aktivovaným e-mailovým adresám tohoto používateľa. Commity zodpovedajúce týmto e-mailovým adresám je možné overiť pomocou tohoto kľúča. +gpg_key_verified=Overený kľúč +gpg_key_verified_long=Kľúč bol overený pomocou tokenu a môže byť použitý k overeniu commitov zhodujúcich sa s ľubovoľnou vašou aktivovalo e-mailovou adresou pre tohoto užívateľa naviac k akejkoľvek odpovedajúcej identite tohoto kľúča. +gpg_key_verify=Overiť +gpg_invalid_token_signature=Zadaný GPG kľúč, podpis a token sa nezhodujú alebo je token zastaralý. +gpg_token_required=Musíte zadať podpis pre nižšie uvedený token +gpg_token=Token +gpg_token_help=Podpis môžete vygenerovať pomocou: +gpg_token_code=echo "%s" | gpg -a --default-key %s --detach-sig +gpg_token_signature=Zakódovaný (ASCII) podpis GPG +key_signature_gpg_placeholder=Začína s '-----BEGIN PGP SIGNATURE-----' +verify_gpg_key_success=GPG kľúč '%s' bol overený. +ssh_key_verified=Overený kľúč +ssh_key_verified_long=Kľúč bol overený tokenom a možno ho použiť na overenie commitov zhodujúcich sa so všetkými aktivovanými e-mailovými adresami tohto používateľa. +ssh_key_verify=Overiť +ssh_invalid_token_signature=Zadaný SSH kľúč, podpis alebo token sa nezhodujú alebo je token zastaralý. +ssh_token_required=Musíte zadať podpis pre nižšie uvedený token +ssh_token=Token +ssh_token_help=Podpis môžete vygenerovať pomocou: +ssh_token_signature=Zakódovaný (ASCII) podpis SSH +key_signature_ssh_placeholder=Začína s '-----BEGIN SSH SIGNATURE-----' +verify_ssh_key_success=SSH kľúč '%s' bol overený. +subkeys=Podkľúče +key_id=ID kľúča +key_name=Názov kľúča +key_content=Obsah +principal_content=Obsah +add_key_success=SSH kľúč „%s“ bol pridaný. +add_gpg_key_success=GPG kľúč „%s“ bol pridaný. +add_principal_success=Bol pridaný SSH certifikát identity '%s'. +delete_key=Odstrániť +ssh_key_deletion=Odstrániť SSH kľúč +gpg_key_deletion=Odstrániť GPG kľúč +ssh_principal_deletion=Vymazať SSH certifikačnú identitu +ssh_key_deletion_desc=Odstránenie SSH kľúča zruší jeho prístup k vašemu účtu. Pokračovať? +gpg_key_deletion_desc=Odstránením GPG kľúča zneplatníte overenie commitov, ktoré sú ním podpísané. Pokračovať? +ssh_principal_deletion_desc=Odstránenie SSH certifikátu identity zruší jeho prístup k vašemu účtu. Pokračovať? +ssh_key_deletion_success=SSH kľúč bol odstránený. +gpg_key_deletion_success=GPG kľúč bol odstránený. +ssh_principal_deletion_success=Identita bola odstránená. +add_on=Pridané +valid_until=Platný do +valid_forever=Platný navždy +last_used=Naposledy použité +no_activity=Žiadna nedávna aktivita +can_read_info=Čítanie +can_write_info=Zápis +key_state_desc=Tento kľúč bol použitý behom posledných 7 dní +token_state_desc=Tento token bol použitý behom posledných 7 dní +principal_state_desc=Táto identita bola použitá behom posledných 7 dní +show_openid=Zobraziť v profile +hide_openid=Odstrániť z profilu +ssh_disabled=SSH zakázané +ssh_externally_managed=Tento kľúč SSH je pre tohto používateľa spravovaný externe +manage_social=Spravovať súvisiace sociálne účty +social_desc=Tieto sociálne účty sú prepojené s vaším účtom Gitea. Uistite sa, že ich všetky poznáte, pretože sa dajú použiť na prihlásenie do vášho účtu Gitea. +unbind=Odpojiť +unbind_success=Sociálny účet bol odpojený od vášho účtu Gitea. + +manage_access_token=Správa prístupových tokenov +generate_new_token=Vygenerovať nový token +tokens_desc=Tieto tokeny poskytujú prístup k vášmu účtu pomocou rozhrania Gitea API. +new_token_desc=Aplikácie používajúce token majú úplný prístup k vášmu účtu. +token_name=Názov tokenu +generate_token=Vygenerovať token +generate_token_success=Váš nový token bol vygenerovaný. Skopírujte ho teraz, pretože sa už nebude zobrazovať. +generate_token_name_duplicate=%s už bol použitý ako názov aplikácie. Použite nový. +delete_token=Vymazať +access_token_deletion=Odstrániť prístupový token +access_token_deletion_cancel_action=Zrušiť +access_token_deletion_confirm_action=Vymazať +access_token_deletion_desc=Odstránením tokenu zrušíte prístup k vášmu účtu pre aplikácie, ktoré ho používajú. To nie je možné vrátiť späť. Ďalej? +delete_token_success=Token bol odstránený. Aplikácie, ktoré ho používajú, už nemajú prístup k vášmu účtu. + +manage_oauth2_applications=Správa OAuth2 aplikácií +edit_oauth2_application=Upraviť aplikáciu OAuth2 +oauth2_applications_desc=OAuth2 aplikácie umožňujú aplikáciám tretej strany bezpečne autentifikovať používateľov v tejto inštancii Gitea. +remove_oauth2_application=Odstrániť aplikáciu OAuth2 +remove_oauth2_application_desc=Odstránenie aplikácie OAuth2 zruší prístup všetkým podpísaným prístupovým tokenom. Ďalej? +remove_oauth2_application_success=Aplikácia bola odstránená. +create_oauth2_application=Vytvoriť novú aplikáciu OAuth2 +create_oauth2_application_button=Vytvoriť aplikáciu +create_oauth2_application_success=Úspešne ste vytvorili novú aplikáciu OAuth2. +update_oauth2_application_success=Úspešne ste aktualizovali aplikáciu OAuth2. +oauth2_application_name=Názov aplikácie +oauth2_select_type=Ktorý typ aplikácie sa hodí? +oauth2_redirect_uri=Presmerovanie URI +save_application=Uložiť +oauth2_client_id=ID klienta +oauth2_client_secret=Tajný klientsky kľúč +oauth2_regenerate_secret=Obnoviť tajný kľúč +oauth2_regenerate_secret_hint=Stratili ste svoj tajný kľúč? +oauth2_client_secret_hint=Ak znova navštívite túto stránku, tajný kľúč nebude viditeľný. Prosím, uložte si svoj kľúč. +oauth2_application_edit=Upraviť +oauth2_application_create_description=Aplikácie OAuth2 poskytujú aplikáciám tretích strán prístup k používateľským účtom v tejto inštancii. +oauth2_application_remove_description=Odstránenie aplikácie OAuth2 zabráni v prístupe autorizovaným používateľom v tejto inštancii. Ďalej? + +authorized_oauth2_applications=Autorizované aplikácie OAuth2 +authorized_oauth2_applications_description=Týmto aplikáciám tretích strán ste udelili prístup k vášmu osobnému účtu Gitea. Zrušte prístup pre aplikácie, ktoré už nie sú potrebné. +revoke_key=Odvolať +revoke_oauth2_grant=Odstrániť prístup +revoke_oauth2_grant_description=Zrušenie prístupu tejto aplikáciu tretej strany zabráni tejto aplikácii v prístupe k vašim údajom. Ste si istý? +revoke_oauth2_grant_success=Úspešne ste zrušili prístup. + +twofa_desc=Dvojstupňové overenie pridá ďalšiu vrstvu bezpečnosti k vášmu účtu. +twofa_is_enrolled=Váš účet je momentálne používa dvojfaktorovú autentifikáciu. +twofa_not_enrolled=Váš účet momentálne nepoužíva dvojfaktorovú autentifikáciu. +twofa_disable=Vypnúť dvojfaktorovú autentifikáciu +twofa_scratch_token_regenerate=Obnoviť token +twofa_scratch_token_regenerated=Váš token je teraz %s. Uložte ho na bezpečnom mieste. +twofa_enroll=Povoliť dvojfaktorové overovanie +twofa_disable_note=V prípade potreby môžete zakázať dvojfaktorové overenie. +twofa_disable_desc=Vypnutím dvojfaktorovej autentifikácie bude váš účet menej bezpečný. Ďalej? +regenerate_scratch_token_desc=Ak ste svoj token nesprávne umiestnili alebo ste ho už použili na prihlásenie, môžete ho resetovať tu. +twofa_disabled=Dvojfaktorové overovanie bolo vypnuté. +scan_this_image=Naskenujte tento obrázok pomocou overovacej aplikácie: +or_enter_secret=Alebo zadajte tajný kód: %s +then_enter_passcode=A zadajte prístupový kód zobrazený v aplikácii: +passcode_invalid=Prístupový kód je nesprávny. Skúste to znova. +twofa_enrolled=Váš účet bol zaregistrovaný do dvojfaktorovej autentifikácie. Uložte si token (%s) na bezpečnom mieste, pretože sa zobrazuje iba raz! +twofa_failed_get_secret=Nepodarilo sa získať tajomstvo. + +webauthn_register_key=Pridať bezpečnostný kľúč +webauthn_nickname=Prezývka +webauthn_delete_key=Odstrániť bezpečnostný kľúč +webauthn_delete_key_desc=Ak odstránite bezpečnostný kľúč, už sa s ním nebudete môcť prihlásiť. Ďalej? + +manage_account_links=Spravovať prepojené kontá +manage_account_links_desc=Tieto externé účty sú prepojené s vaším účtom Gitea. +link_account=Pripojiť účet + +orgs_none=Nieste členom žiadnej organizácie. +repos_none=Nevlastníte žiadne repozitáre + +delete_account=Odstrániť môj účet +confirm_delete_account=Potvrdiť odstránenie +delete_account_title=Odstrániť používateľský účet +delete_account_desc=Naozaj chcete natrvalo odstrániť tento účet? + +email_notifications.enable=Povoliť e-mailové upozornenia +email_notifications.onmention=E-mail iba pri zmienke +email_notifications.disable=Vypnúť e-mailové upozornenia +email_notifications.submit=Nastaviť predvoľby e-mailu + +visibility=Viditeľnosť používateľa +visibility.public=Verejný +visibility.public_tooltip=Viditeľné pre všetkých užívateľov +visibility.limited=Obmedzený +visibility.private=Súkromný + +[repo] +new_repo_helper=Repozitár obsahuje všetky súbory projektu vrátane histórie revízií. Máte ho už inde? Migrovať repozitár. +owner=Vlastník +owner_helper=Niektoré organizácie sa nemusia zobraziť v rozbaľovacej ponuke z dôvodu maximálneho limitu počtu repozitárov. +repo_name=Názov repozitára +repo_name_helper=Dobrý názov repozitára sa zvyčajne skladá z krátkych, jedinečných a ľahko zapamätateľných kľúčových slov. +repo_size=Veľkosť repozitára +template=Šablóna +template_select=Vyberte šablónu. +template_helper=Z repozitára vytvoriť šablónu +template_description=Šablóny repozitárov umožňujú používateľom vytvárať nové repozitáre s rovnakou štruktúrou, súbormi a voliteľnými nastaveniami. +visibility=Viditeľnosť +visibility_description=Vidieť ho bude iba vlastník alebo členovia organizácie, ak majú práva. +visibility_helper=Nastaviť repozitár ako súkromný +visibility_helper_forced=Váš správca vynucuje že nové repozitáre musia byť súkromné. +visibility_fork_helper=(Zmena ovplyvní všetky forky.) +fork_repo=Forknúť repozitár +fork_from=Forknúť z +already_forked=Už ste forkli %s +fork_to_different_account=Fork na iný účet +fork_visibility_helper=Viditeľnosť forknutého repozitára nemožno zmeniť. +download_zip=Stiahnuť ZIP +download_tar=Stiahnuť TAR.GZ +download_bundle=Stiahnuť BUNDLE +generate_repo=Generovať repozitár +generate_from=Generovať z +repo_desc=Popis +repo_lang=Jazyk +repo_gitignore_helper=Vyberte .gitignore šablóny. +repo_gitignore_helper_desc=Zo zoznamu šablón pre bežné jazyky vyberte, ktoré súbory sa nemajú sledovať. Typické artefakty generované nástrojmi na vytváranie jednotlivých jazykov sú štandardne zahrnuté v .gitignore. +issue_labels=Štítky úkolov +issue_labels_helper=Vyberte skupinu štítkov úkolov. +license=Licencia +license_helper=Vybrať súbor s licenciou. +license_helper_desc=Licencia určuje, čo ostatní môžu a nemôžu robiť s vaším kódom. Nie ste si istí, ktorý z nich je vhodný pre váš projekt? Pozrite si výber licencie. +readme=README +readme_helper=Vyberte šablónu súboru README. +readme_helper_desc=Toto je miesto, kde môžete napísať úplný popis vášho projektu. +auto_init=Inicializovať repozitár (pridá súbory .gitignore, License a README) +trust_model_helper=Vyberte model dôveryhodnosti na overenie podpisu. Možnosti sú: +trust_model_helper_collaborator=Spolupracovník: Dôverovať podpisom spolupracovníkov +trust_model_helper_committer=Prispievateľ: Dôverovať podpisom, ktoré zodpovedajú prispievateľovi +trust_model_helper_collaborator_committer=Spolupracovník+Prispievateľ: Dôverovať podpisom spolupracovníkov, ktorí zodpovedajú prispievateľovi +trust_model_helper_default=Predvolené: Pre túto inštaláciu použiť predvolený model dôvery +create_repo=Vytvoriť repozitár +default_branch=Východzia vetva +default_branch_helper=Predvolená vetva je základná vetva pre pull requesty a commity. +mirror_prune=Vyčistiť +mirror_interval=Interval zrkadlenia (platné sú 'h', 'm', 's'). 0 na vypnutie periodickej synchronizácie. (Minimálny interval: %s) +mirror_interval_invalid=Interval zrkadlenia nie je platný. +mirror_sync_on_commit=Synchronizovať, keď sú odovzdané commity +mirror_address=Klonovať z URL +mirror_lfs_endpoint=Koncový bod LFS +mirror_lfs_endpoint_desc=Synchronizácia sa pokúsi použiť klonovaciu adresu URL na určenie servera LFS. Môžete tiež zadať vlastný koncový bod, ak sú dáta repozitára LFS uložené niekde inde. +mirror_last_synced=Posledná synchronizácia +mirror_password_placeholder=(Nezmenené) +mirror_password_blank_placeholder=(Nenastavené) +mirror_password_help=Zmenou používateľského mena vymažete uložené heslo. +watchers=Sledujúci +stargazers=Hviezdičky +forks=Forky +pick_reaction=Vyberte si reakciu +reactions_more=a %d ďalších +unit_disabled=Správca stránky zakázal túto sekciu repozitára. +language_other=Iný +adopt_search=Ak chcete vyhľadať neprijaté úložiská, zadajte používateľské meno... (pre vyhľadanie všetkých nechajte prázdne) +adopt_preexisting_label=Prijať súbory +adopt_preexisting=Prijať už existujúce súbory +adopt_preexisting_content=Vytvoriť repozitár z %s +adopt_preexisting_success=Prijaté súbory a vytvorený repozitár z %s +delete_preexisting_label=Vymazať +delete_preexisting=Vymazať už existujúce súbory +delete_preexisting_content=Vymazať súbory v %s +delete_preexisting_success=Vymazané neprijaté súbory v %s + +transfer.accept=Prijať prevod +transfer.accept_desc=Previesť do "%s" +transfer.reject=Odmietnuť prevod +transfer.reject_desc=Zrušiť prevod do "%s" +transfer.no_permission_to_accept=Nemáte povolenie na prijatie + +desc.private=Súkromný +desc.public=Verejný +desc.private_template=Súkromná šablóna +desc.public_template=Šablóna +desc.internal=Interný +desc.internal_template=Interná šablóna +desc.archived=Archivovaný + +template.items=Položky šablóny +template.git_hooks=Git hooky +template.webhooks=Webhooky +template.issue_labels=Štítky úkolov +template.invalid=Vyberte šablónu repozitára + +archive.issue.nocomment=Tento repozitár je archivovaný. Nemôžete komentovať úkoly. + +form.reach_limit_of_creation_1=Už ste dosiahli svoj limit pre %d repozitár. +form.reach_limit_of_creation_n=Už ste dosiahli svoj limit pre %d repozitáre. +form.name_reserved=Repozitár s názvom '%s' je rezervovaný. +form.name_pattern_not_allowed=Vzor '%s' nie je povolený v mene repozitára. + +migrate_options_mirror_helper=Tento repozitár bude zrkadlom +migrate_options_lfs_endpoint.description=Migrácia sa pokúsi použiť váš vzdialený Git na určenie servera LFS. Môžete tiež zadať vlastný koncový bod, ak sú dáta repozitára LFS uložené niekde inde. +migrate_items_issues=Úkoly +migrate_items_pullrequests=Pull requesty +migrate_repo=Migrovať repozitár +migrate.clone_address_desc=HTTP(S) alebo Git 'clone' URL pre klonovanie existujúceho repozitára +migrate.github_token_desc=Sem môžete vložiť jeden alebo viac tokenov oddelených čiarkami, aby sa migrácia zrýchlila z dôvodu limitu rýchlosti rozhrania GitHub API. UPOZORNENIE: Zneužitie tejto funkcie môže porušiť zásady poskytovateľa služieb a viesť k zablokovaniu účtu. +migrate.permission_denied=Nemáte povolené importovať miestne repozitáre. +migrate.migrate_items_options=Na migráciu ďalších položiek je potrebný prístupový token +migrate.migrating_failed.error=Chyba: %s +migrate.migrating_failed_no_addr=Migrácia zlyhala. +migrate.git.description=Migrujte repozitár iba z akejkoľvek služby Git. +migrate.migrating_issues=Migrovanie úkolov + +forked_from=forknuté z +fork_from_self=Repozitár, ktorý vlastníte, nemôžete forknúť. +fork_guest_user=Prihláste sa, aby ste forkli repozitár. +watch_guest_user=Pre sledovanie tohoto repozitára sa prihláste. +unwatch=Už nesledovať +watch=Sledovať +unstar=Zrušiť hviezdičku +star=Hviezdička +fork=Forknúť +download_archive=Stiahnuť repozitár + +no_desc=Bez popisu +quick_guide=Rýchly sprievodca +clone_this_repo=Klonovať tento repozitár +create_new_repo_command=Vytvoriť nový repozitár v príkazovom riadku +push_exist_repo=Odoslanie existujúceho repozitára z príkazového riadku +empty_message=Tento repozitár ešte nemá obsah. +broken_message=Údaje Git, ktoré sú základom tohto úložiska, sa nedajú prečítať. Kontaktujte správcu tejto inštancie alebo odstráňte toto úložisko. + +code=Zdrojový kód +code.desc=Prístup k zdrojovému kódu, súborom, commitom a vetvám. +branch=Vetva +tree=Strom +clear_ref=`Vymazať aktuálnu referenciu`. +filter_branch_and_tag=Filter vetvy alebo tagu +find_tag=Hľadať tag +branches=Vetvy +tags=Tagy +issues=Úkoly +pulls=Pull requesty +project_board=Projekty + +commits=Commitov +commit=Commit + +escape_control_characters=Ošetriť +file_copy_permalink=Kopírovať trvalý odkaz +view_git_blame=Zobraziť Git Blame +video_not_supported_in_browser=Váš prehliadač nepodporuje HTML5 tag 'video'. +audio_not_supported_in_browser=Váš prehliadač nepodporuje HTML5 tag 'audio'. +stored_lfs=Uložené pomocou Git LFS +symbolic_link=Symbolický odkaz +commit_graph=Graf commitov + +editor.preview_changes=Náhľad zmien +editor.edit_this_file=Upraviť súbor +editor.fork_before_edit=Musíte forknúť tento repozitár pre vytvorenie alebo navrhnutie zmeny tohoto súboru. +editor.delete_this_file=Vymazať súbor +editor.or=alebo +editor.cancel_lower=Zrušiť +editor.commit_signed_changes=Odoslať podpísané zmeny +editor.commit_changes=Odoslať zmeny +editor.add=Pridať '%s' +editor.update=Aktualizovať '%s' +editor.delete=Vymazať '%s' +editor.patch=Použiť patch +editor.commit_directly_to_this_branch=Odoslať zmeny revízie priamo do vetvy %s. +editor.cancel=Zrušiť +editor.commit_empty_file_header=Odoslať prázdny súbor +editor.commit_empty_file_text=Súbor, ktorý sa chystáte odoslať, je prázdny. Pokračovať? +editor.cannot_commit_to_protected_branch=Nedá sa vytvoriť commit v chránenej vetve '%s'. +editor.no_commit_to_branch=Nedá sa odoslať priamo do vetvy, pretože: +editor.require_signed_commit=Vetva vyžaduje podpísaný commit + +commits.commits=Commity +commits.no_commits=Žiadne spoločné commity. '%s' a '%s' majú úplne odlišnú históriu. +commits.search=Hľadanie commitov… +commits.search.tooltip=Môžete predradiť kľúčové slová ako „author:“, „committer:“, „after:“ nebo „before:“, napr. „pripojil author:Alice before:2019-04-01“. +commits.find=Hľadať +commits.search_all=Všetky vetvy +commits.author=Autor +commits.message=Správa +commits.date=Dátum +commits.older=Staršie +commits.newer=Novšie +commits.signed_by=Podpísané +commits.signed_by_untrusted_user=Podpísané nedôveryhodným užívateľom +commits.signed_by_untrusted_user_unmatched=Podpísané nedôveryhodným užívateľom, ktorý sa nezhoduje s prispievateľom +commits.gpg_key_id=ID GPG kľúča +commits.ssh_key_fingerprint=odtlačok SSH kľúča + +commit.actions=Akcie +commit.revert=Vrátiť +commit.revert-header=Vrátiť: %s +commit.revert-content=Vyberte vetvu pre návrat na: +commit.cherry-pick=Cherry-pick +commit.cherry-pick-header=Cherry-pick: %s +commit.cherry-pick-content=Vyberte vetvu pre cherry-pick na: + +ext_issues=Prístup k externým úkolom +ext_issues.desc=Odkaz na externé sledovanie úkolov. + +projects=Projekty +projects.title=Názov +projects.new=Nový projekt +projects.deletion=Vymazať projekt +projects.edit=Upraviť projekty +projects.modify=Aktualizovať projekt +projects.type.none=Žiadny +projects.board.new_submit=Poslať +projects.open=Otvoriť +projects.close=Zavrieť +projects.board.assigned_to=Priradené k + +issues.filter_reviewers=Filtrovať revidentov +issues.new=Nový úkol +issues.new.no_reviewers=Žiadni revidenti +issues.new.add_reviewer_title=Požiadať o revíziu +issues.choose.blank_about=Vytvoriť úkol z predvolenej šablóny. +issues.create=Vytvoriť úkol +issues.filter_type.all_issues=Všetky úkoly +issues.filter_type.review_requested=Požiadané o revíziu +issues.filter_sort.mostforks=Najviac forkov +issues.filter_sort.fewestforks=Najmenej forkov +issues.context.reference_issue=Odkázať v novom úkole +issues.closed_at=`uzavrel/a tento úkol %[2]s` +issues.reopened_at=`znovuotvoril/a tento úkol %[2]s` +issues.commit_ref_at=`odkázal na tento úkol z commitu %[2]s` +issues.ref_issue_from=`odkazoval/a na tento úkol %[4]s %[2]s` +issues.ref_closing_from=`odkazoval/a na pull request %[4]s, ktorý uzavrie tento úkol %[2]s` +issues.ref_reopening_from=`odkazoval/a na pull request %[4]s, ktorý znovu otvorí tento úkol %[2]s` +issues.ref_closed_from=`uzavrel/a tento úkol %[4]s %[2]s` +issues.ref_reopened_from=`znovu otvoril/a tento úkol %[4]s %[2]s` +issues.owner=Vlastník +issues.re_request_review=Znovu požiadať o revíziu +issues.is_stale=Od tejto kontroly došlo k zmenám v tomto pull requeste +issues.remove_request_review=Odstrániť žiadosť o revíziu +issues.remove_request_review_block=Nie je možné odstrániť žiadosť o revíziu +issues.dismiss_review=Zamietnuť revíziu +issues.dismiss_review_warning=Naozaj chcete zrušiť túto revíziu? +issues.cancel=Zrušiť +issues.label_open_issues=%d otvorených úkolov +issues.label_deletion_desc=Odstránenie štítka ho odstráni zo všetkých úkolov. Ďalej? +issues.lock.unknown_reason=Nie je možné uzamknúť úkol bez dôvodu. +issues.lock_duplicate=Úkol nie je možné uzamknúť dvakrát. +issues.unlock_error=Nie je možné odomknúť úkol, ktorý nie je uzamknutý. +issues.lock.notice_1=- Ostatní používatelia nemôžu komentovať tento úkol. +issues.lock.notice_3=- Tento úkol môžete v budúcnosti kedykoľvek znova odomknúť. +issues.unlock.notice_1=- Všetci budú môcť znovu komentovať tento úkol. +issues.unlock.notice_2=- Tento úkol môžete v budúcnosti kedykoľvek znova zamknúť. +issues.lock.title=Uzamknúť konverzáciu o tomto úkole. +issues.unlock.title=Odomknúť konverzáciu o tomto úkole. +issues.comment_on_locked=Nemôžete komentovať zamknutý úkol. +issues.delete.title=Vymazať tento úkol? +issues.delete.text=Naozaj chcete odstrániť tento úkol? (Týmto natrvalo odstránite všetok obsah. Ak ho chcete ponechať archivovaný, zvážte radšej jeho zatvorenie.) +issues.tracker_auto_close=Po vyriešení tohto úkolu sa časovač automaticky zastaví +issues.tracking_already_started=`Už ste spustili sledovanie času v inom úkole!` +issues.cancel_tracking=Zahodiť +issues.add_time_cancel=Zrušiť +issues.push_commit_1=pridal/a %d commit %s +issues.push_commits_n=pridal/a %d commity %s +issues.due_date_not_writer=Potrebujete práva na zápis do repozitára pre úpravy termínu dokončenia úkolu. +issues.dependency.cancel=Zrušiť +issues.dependency.pr_closing_blockedby=Zatvorenie tohto pull requestu je blokované nasledujúcimi úkolmi +issues.dependency.issue_closing_blockedby=Zatvorenie tohto úkolu je blokované nasledujúcimi úkolmi +issues.dependency.issue_close_blocks=Tento úkol blokuje uzavretie nasledujúcich úkolov +issues.dependency.pr_close_blocks=Tento pull request blokuje uzavretie nasledujúcich úkolov +issues.dependency.issue_close_blocked=Pred zatvorením tohto úkolu musíte zatvoriť všetky úkoly, ktoré blokujú tento úkol. +issues.review.comment=revidoval %s +issues.review.dismissed=zamietol revíziu od %s %s +issues.review.wait=bol požiadaný o revidovanie %s +issues.review.add_review_request=požiadal o revidovanie od %s %s +issues.review.remove_review_request=odstránil žiadosť o revidovanie na %s %s +issues.review.remove_review_request_self=odmietol revidovať %s +issues.review.review=Revízia +issues.review.reviewers=Revidenti + + +pulls.desc=Povoliť pull requesty a revízie kódu. +pulls.tab_commits=Commity +pulls.data_broken=Tento pull request je nefunkčný z dôvodu chýbajúcich informácií o forku. +pulls.blocked_by_rejection=Tento pull request obsahuje zmeny požadované oficiálnym recenzentom. +pulls.blocked_by_official_review_requests=Tento pull request obsahuje oficiálne žiadosti o revíziu. +pulls.waiting_count_1=%d čakajúca revízia +pulls.waiting_count_n=%d čakajúcich revízií +pulls.wrong_commit_id=ID commitu musí byť ID commitu v cieľovej vetve + +pulls.no_merge_not_ready=Tento pull request nie je pripravený na merge, skontrolujte stav revízie a kontroly stavu. +pulls.rebase_merge_commit_pull_request=Rebase a potom vytvoriť zlučovací commit +pulls.merge_commit_id=ID zlučovacieho commitu + +; %[2]s
%[3]s
+ + + + + +milestones.cancel=Zrušiť + + + + +activity.git_stats_commit_1=%d commit +activity.git_stats_commit_n=%d commity + + +settings.collaboration.owner=Vlastník +settings.hooks=Webhooky +settings.githooks=Git hooky +settings.mirror_settings.mirrored_repository=Zrkadlený repozitár +settings.pulls.allow_merge_commits=Povoliť Commit Merging +settings.pulls.allow_rebase_merge_commit=Povoliť Rebase s explicitnými potvrdeniami commitov (--no-ff) + + +settings.pulls.allow_squash_commits=Povoliť Squash pre merge commity +settings.admin_enable_close_issues_via_commit_in_any_branch=Zavrieť úkol pomocou commitu v inej ako východzej vetve +settings.new_owner_has_same_repo=Nový vlastník už repozitár s rovnakým názvom má. Vyberte, prosím, iné meno. +settings.convert_fork=Konvertovať na bežný repozitár +settings.convert_fork_desc=Tento fork môžete previesť na bežný repozitár. To nie je možné vrátiť späť. +settings.convert_fork_notices_1=Táto operácia skonvertuje fork na bežný repozitár a nedá sa vrátiť späť. +settings.convert_fork_confirm=Konvertovať repozitár +settings.convert_fork_succeed=Fork bol prevedený na bežný repozitár. +settings.transfer=Previesť vlastníctvo +settings.transfer_notices_1=- Ak prenesiete repozitár na užívateľa, stratíte k nemu prístup. +settings.transfer_notices_2=- Prístup k repozitáru si ponecháte, ak ho prevediete na organizáciu, ktorú (spolu)vlastníte. +settings.transfer_owner=Nový vlastník +settings.transfer_started=Tento repozitár bol označený na prenos a čaká na potvrdenie od "%s" +settings.transfer_succeed=Repozitár bol prenesený. +settings.trust_model.collaborator.desc=Platné podpisy spolupracovníkov tohto úložiska budú označené ako "dôveryhodné" - (bez ohľadu na to, či sa zhodujú s prispievateľom alebo nie). V opačnom prípade budú platné podpisy označené ako „nedôveryhodné“, ak sa podpis zhoduje s prispievateľom, a „nezhodujúce sa“, ak nie. +settings.trust_model.committer=Prispievateľ +settings.trust_model.committer.long=Prispievateľ: Dôverovať podpisom, ktoré sa zhodujú s prispievateľmi (toto sa zhoduje s GitHubom a prinúti Gitea podpísané príkazy, aby mali Gitea ako prispievateľa) +settings.trust_model.collaboratorcommitter=Spolupracovník+Prispievateľ +settings.trust_model.collaboratorcommitter.long=Spolupracovník+Prispievateľ: Dôverujte podpisom spolupracovníkov, ktorí zodpovedajú prispievateľovi +settings.trust_model.collaboratorcommitter.desc=Platné podpisy spolupracovníkov tohto repozitára budú označené ako „dôveryhodné“, ak sa zhodujú s prispievateľom. V opačnom prípade budú platné podpisy označené ako „nedôveryhodné“, ak sa podpis zhoduje s prispievateľom, a v opačnom prípade budú „nezhodujúce sa“. To prinúti Giteu, aby bola označená ako autor na podpísaných odovzdaniach so skutočným autorom označeným ako Co-Authored-By: and Co-Committed-By: na konci commitu. Predvolený kľúč Gitea sa musí zhodovať s používateľom v databáze. +settings.wiki_delete_desc=Odstránenie údajov wiki je trvalé a nemožno ho vrátiť späť. +settings.wiki_delete_notices_1=- Natrvalo odstráni a zakáže wiki pre %s. +settings.wiki_deletion_success=Údaje wiki boli vymazané. +settings.delete=Odstrániť tento repozitár +settings.delete_desc=Odstránenie repozitára je trvalé a nemožno ho vrátiť späť. +settings.delete_notices_2=- Táto operácia natrvalo odstráni repozitár %s vrátane kódu, úkolov, komentárov, wiki a nastavení spolupracovníkov. +settings.delete_notices_fork_1=- Forky tohto repozitára sa po vymazaní stanú nezávislými. +settings.deletion_success=Repozitár bol vymazaný. +settings.update_settings_success=Nastavenia repozitára boli aktualizované. +settings.confirm_delete=Vymazať repozitár +settings.add_collaborator_duplicate=Spolupracovník je už pridaný k tomuto repozitáru. +settings.collaborator_deletion_desc=Odstránenie spolupracovníka zruší jeho prístup k tomuto repozitáru. Ďalej? +settings.change_team_access_not_allowed=Zmena prístupu tímu k repozitáru bola obmedzená na vlastníka organizácie +settings.team_not_in_organization=Tím nie je v rovnakej organizácii ako repozitár +settings.add_team_duplicate=Tím už má repozitár +settings.add_team_success=Tím má teraz prístup k repozitáru. +settings.change_team_permission_tip=Oprávnenia tímu sa nastavujú na stránke s nastaveniami tímu a nedajú sa zmeniť pre jednotlivé repozitáre +settings.delete_team_tip=Tento tím má prístup ku všetkým repozitárom a nemožno ho odstrániť +settings.add_webhook=Pridať webhook +settings.add_webhook.invalid_channel_name=Názov kanála webhooku nemôže byť prázdny a nemôže obsahovať iba znak #. +settings.hooks_desc=Webhooky automaticky odosielajú požiadavky HTTP POST na server, keď sa spustia určité udalosti Gitea. Prečítajte si viac v sprievodcovi webhookmi. +settings.webhook_deletion=Odstrániť webhook +settings.webhook_deletion_desc=Odstránením webhooku sa vymažú jeho nastavenia a história doručovania. Ďalej? +settings.webhook_deletion_success=Webhook bol odstránený. +settings.webhook.test_delivery_desc=Otestujte tento webhook pomocou testovacej udalosti. +settings.webhook.replay.description=Zopakujte tento webhook. +settings.add_webhook_desc=Gitea odošle požiadavky POST so špecifikovaným typom obsahu na cieľovú adresu URL. Prečítajte si viac v sprievodcovi webhookmi. +settings.event_header_repository=Udalosti repozitára +settings.event_fork=Fork +settings.event_fork_desc=Repozitár forknutý +settings.event_repository=Repozitár +settings.event_repository_desc=Repozitár vytvorený alebo odstránený. +settings.event_pull_request_review=Pull request bol revidovaný +settings.event_pull_request_review_desc=Pull request schválený, odmietnutý alebo má revízne poznámky. +settings.active_helper=Informácie o spustených udalostiach budú odoslané na túto URL webhooku. +settings.add_hook_success=Webhook bol pridaný. +settings.update_webhook=Aktualizácia Webhooku +settings.update_hook_success=Webhook bol aktualizovaný. +settings.delete_webhook=Odstrániť webhook +settings.slack_token=Token +settings.web_hook_name_gitea=Gitea +settings.packagist_api_token=API token +settings.protect_required_approvals_desc=Umožniť merge iba žiadostiam o natiahnutie s dostatočným počtom pozitívnych revízií. +settings.require_signed_commits=Vyžadovať podpísané commity +settings.block_rejected_reviews=Zablokovať zlúčenie pri zamietavých revíziách +settings.block_rejected_reviews_desc=Zlúčenie nebude možné v prípade že oficiálni revidenti požadujú zmeny, aj keď je k dispozícii dostatok schválení. +settings.block_on_official_review_requests=Blokovať zlúčenie pri oficiálnych žiadostiach o revíziu +settings.block_on_official_review_requests_desc=Zlúčenie nebude možné v prípade že existujú oficiálne žiadosti o revíziu, aj keď je k dispozícii dostatok schválení. +settings.bot_token=Token robota +settings.matrix.access_token=Prístupový token +settings.lfs_findcommits=Hľadať commity +settings.lfs_lfs_file_no_commits=Pre tento súbor LFS sa nenašli žiadne commity + +diff.commit=commit +diff.comment.start_review=Začať revíziu +diff.review=Revízia +diff.review.header=Odoslať revíziu +diff.review.placeholder=Revízna poznámka +diff.committed_by=odovzdal + +release.ahead.commits=%d commitov +release.cancel=Zrušiť + +branch.delete_branch_has_new_commits=Vetva '%s' nemôže byť vymazaná, pretože po zlúčení boli pridané nové commity. + + + + + + +[org] +lower_repositories=repozitáre + + +settings.visibility.private=Súkromná ​​(viditeľné iba pre členov organizácie) +settings.visibility.private_shortname=Súkromný + +settings.hooks_desc=Pridajte webhooky, ktoré sa spustia nad všetkými repozitármi v rámci tejto organizácie. + + +members.private=Skrytý +members.private_helper=zviditeľniť +members.owner=Vlastník + +teams.owners_permission_desc=Vlastníci majú úplný prístup ku všetkým repozitárom a majú prístup správcu tejto organizácie. +teams.repositories=Repozitáre týmu +teams.specific_repositories=Konkrétne repozitáre +teams.specific_repositories_helper=Členovia budú mať prístup iba k úložiskám, ktoré sú vyslovene pridané do tímu. Výber tejto možnosti neodstráni automaticky repozitáre, ktoré už boli pridané pomocou položky Všetky repozitáre. +teams.all_repositories=Všetky repozitáre +teams.all_repositories_helper=Tím má prístup ku všetkým repozitárom. Výberom tejto možnosti pridáte do tímu všetky existujúce repozitáre. +teams.all_repositories_read_permission_desc=Tomuto tímu je pridelený prístup na čítanie ku všetkým repozitárom: členovia môžu prezerať a klonovať repozitáre. +teams.all_repositories_write_permission_desc=Tomuto tímu je pridelený prístup na Zápis do všetkých repozitárov: členovia môžu prezerať a nahrávať do repozitárov. +teams.all_repositories_admin_permission_desc=Tomuto tímu je pridelený Admin prístup ku všetkým repozitárom: členovia môžu prezerať, nahrávať do repozitárov a pridávať do nich spolupracovníkov. + +[admin] +repositories=Repozitáre +hooks=Webhooky + +dashboard.statistic_info=Databáza Gitea obsahuje %d používateľov, %d organizácií, %d verejných kľúčov, %d repozitárov, %d sledovaní, %d hviezd, %d akcií, %d prístupov, %d issues, %d komentárov, %d sociálnych účtov, %d nasledovaní, %d mirrorov, %d vydaní, %d zdrojov prihlásení, %d webhookov, %d míľnikov, %d štítkov, %d hook úloh, %d tímov, %d aktualizačných úloh, %d príloh. +dashboard.delete_generated_repository_avatars=Odstrániť vygenerované avatary repozitárov + + + + +repos.owner=Vlastník +repos.private=Súkromný +repos.forks=Forky + +packages.owner=Vlastník +packages.repository=Repozitár + +defaulthooks=Defaultné webhooky +defaulthooks.desc=Webhooky automaticky odosielajú požiadavky HTTP POST na server, keď sa spustia určité udalosti Gitea. Tu definované webhooky sú predvolené a skopírujú sa do všetkých nových repozitárov. Prečítajte si viac v sprievodcovi webhookmi. +defaulthooks.add_webhook=Pridať defaultný webhook +defaulthooks.update_webhook=Aktualizovať defaultný webhook + +systemhooks=Systémové webhooky +systemhooks.desc=Webhooky automaticky odosielajú požiadavky HTTP POST na server, keď sa spustia určité udalosti Gitea. Tu definované webhooky budú pôsobiť na všetky repozitáre v systéme, takže zvážte akékoľvek dôsledky na výkon, ktoré to môže mať. Prečítajte si viac v sprievodcovi webhookmi. +systemhooks.add_webhook=Pridať systémový webhook +systemhooks.update_webhook=Aktualizovať defaultný webhook + +auths.enabled=Povolené +auths.oauth2_tokenURL=Token URL +auths.sspi_default_language=Predvolený jazyk používateľa +auths.sspi_default_language_helper=Predvolený jazyk pre používateľov automaticky vytvorený metódou SSPI auth. Ak uprednostňujete automatické zisťovanie jazyka, nechajte pole prázdne. + +config.app_ver=Verzia Gitea +config.app_url=Základná URL Gitea + +config.ssh_enabled=Povolené + +config.lfs_enabled=Povolené + + +config.default_keep_email_private=Skrývanie e-mail adries ako predvolené + +config.webhook_config=Nastavenie webhooku + +config.mailer_enabled=Povolené +config.mailer_enable_helo=Povolené HELO + +config.oauth_enabled=Povolené + + + + + + +monitor.process.cancel=Zrušiť proces +monitor.queue.review=Konfigurácia revidovania +monitor.queue.review_add=Revidovať/Pridať revidentov + + + + +[action] +compare_commits=Porovnať %d commitov +compare_commits_general=Porovnať commity +review_dismissed=`odmietnutá revízia od %[4]s pre %[3]s#%[2]s` + +[tool] + +[dropzone] + +[notification] + +[gpg] +error.no_committer_account=Žiadny účet nie je prepojený s e-mailovou adresou prispievateľa +error.not_signed_commit=Nie je podpísaný commit + +[units] + +[packages] +conan.details.repository=Repozitár +container.details.repository_site=Stránka repozitára +pub.details.repository_site=Stránka repozitára + From 3f9e323ecd519efc94a472502085100728900d3f Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 23 Sep 2022 05:00:29 +0200 Subject: [PATCH 032/169] Various CSS tweaks (#21244) - Remove arc-green specific rules and instead fix the colors in the base rules. - Make file table row border visible on arc-green. - Remove remnants of fomantic accordeon module that was removed. --- web_src/fomantic/theme.config.less | 1 - web_src/less/_base.less | 55 +++++++++++++- web_src/less/_form.less | 2 +- web_src/less/_repository.less | 10 +-- web_src/less/themes/theme-arc-green.less | 92 +----------------------- 5 files changed, 61 insertions(+), 99 deletions(-) diff --git a/web_src/fomantic/theme.config.less b/web_src/fomantic/theme.config.less index 15f3bd58a7..b92399409d 100644 --- a/web_src/fomantic/theme.config.less +++ b/web_src/fomantic/theme.config.less @@ -50,7 +50,6 @@ @table : 'default'; /* Modules */ -@accordion : 'default'; @calendar : 'default'; @checkbox : 'default'; @dimmer : 'default'; diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 5fc3762e8b..3c0b24a634 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -135,7 +135,7 @@ --color-light: #00000006; --color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled))); --color-light-border: #0000001d; - --color-hover: #0000000f; + --color-hover: #0000000c; --color-active: #00000014; --color-menu: #ffffff; --color-card: #ffffff; @@ -157,6 +157,7 @@ --color-reaction-active-bg: var(--color-primary-alpha-20); --color-tooltip-bg: #000000f0; --color-tooltip-text: #ffffff; + --color-header-bar: #ffffff; /* backgrounds */ --checkbox-mask-checked: url('data:image/svg+xml;utf8,'); --checkbox-mask-indeterminate: url('data:image/svg+xml;utf8,'); @@ -294,6 +295,29 @@ a.commit-statuses-trigger { text-decoration: none !important; } +.ui.search > .results { + background: var(--color-body); + border-color: var(--color-secondary); +} + +.ui.search > .results .result { + background: var(--color-body); +} + +.ui.search > .results .result .title { + color: var(--color-text-dark); +} + +.ui.search > .results .result .image { + width: auto; + height: auto; +} + +.ui.search > .results .result:hover, +.ui.category.search > .results .category .result:hover { + background: var(--color-hover); +} + .unselectable { -webkit-touch-callout: none; -webkit-user-select: none; @@ -318,6 +342,11 @@ a.commit-statuses-trigger { color: var(--color-text-light-2); } +.ui.divider:not(.vertical,.horizontal) { + border-top-color: var(--color-secondary) !important; + border-bottom: none !important; +} + .page-content { margin-top: 15px; } @@ -449,6 +478,11 @@ a.commit-statuses-trigger { color: var(--color-text-light-2); } +.ui.list .list > .item > .content, +.ui.list > .item > .content { + color: var(--color-text); +} + .ui.secondary.menu .dropdown.item:hover, .ui.secondary.menu .link.item:hover, .ui.secondary.menu a.item:hover { @@ -656,10 +690,20 @@ a.ui.card:hover, .ui.table { color: var(--color-text); - background: var(--color-body); + background: var(--color-box-body); border-color: var(--color-secondary); } +.ui.table th, +.ui.table td { + transition: none; +} + +.ui.table > tr > td, +.ui.table > tbody > tr > td { + border-top-color: var(--color-secondary-alpha-50); +} + .ui.ui.selectable.table > tbody > tr:hover, .ui.table tbody tr td.selectable:hover { color: var(--color-text); @@ -672,6 +716,11 @@ a.ui.card:hover, color: var(--color-text); } +.ui.table > thead > tr > th { + background: var(--color-box-header); + color: var(--color-text); +} + .ui.modal { background: var(--color-body); } @@ -750,7 +799,7 @@ a.ui.card:hover, margin: 0 !important; &.light { - background: var(--color-body); + background: var(--color-header-bar); border-bottom: 1px solid var(--color-secondary); } diff --git a/web_src/less/_form.less b/web_src/less/_form.less index b59c9bb52f..08e1f324b4 100644 --- a/web_src/less/_form.less +++ b/web_src/less/_form.less @@ -134,7 +134,7 @@ textarea:focus, .form { .help { - color: #999999; + color: var(--color-secondary-dark-5); padding-bottom: .6em; display: inline-block; } diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 57d54a08f6..44e9a0430e 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -384,7 +384,7 @@ } tr:hover { - background-color: #ffffee; + background-color: var(--color-hover); } tr.has-parent a { @@ -3013,9 +3013,9 @@ tbody.commit-list { } .tag-code, -.tag-code td { - background-color: #f0f9ff; - border-color: #f1f8ff !important; +.tag-code td, +.tag-code .blob-excerpt { + background-color: var(--color-box-body-highlight); vertical-align: middle; } @@ -3031,7 +3031,7 @@ tbody.commit-list { } td.blob-excerpt { - background-color: #fafafa; + background-color: var(--color-secondary-alpha-30); } .issue-keyword { diff --git a/web_src/less/themes/theme-arc-green.less b/web_src/less/themes/theme-arc-green.less index 2cbb979074..754177d603 100644 --- a/web_src/less/themes/theme-arc-green.less +++ b/web_src/less/themes/theme-arc-green.less @@ -94,7 +94,7 @@ /* target-based colors */ --color-body: #383c4a; --color-box-header: #404652; - --color-box-body: #303440; + --color-box-body: #2a2e3a; --color-box-body-highlight: #353945; --color-text-dark: #dbe0ea; --color-text: #bbc0ca; @@ -105,7 +105,7 @@ --color-footer: #2e323e; --color-timeline: #4c525e; --color-input-text: #d5dbe6; - --color-input-background: #292d39; + --color-input-background: #232933; --color-input-border: #454a57; --color-input-border-hover: #505667; --color-navbar: #2a2e3a; @@ -132,25 +132,13 @@ --color-caret: var(--color-text); /* should ideally be --color-text-dark, see #15651 */ --color-reaction-bg: #ffffff12; --color-reaction-active-bg: var(--color-primary-alpha-40); + --color-header-bar: #2e323e; } ::-webkit-calendar-picker-indicator { filter: invert(.8); } -.ui.horizontal.segments > .segment { - background-color: #383c4a; -} - -.following.bar.light { - background: #2e323e; - border-color: var(--color-secondary-alpha-40); -} - -.following.bar .top.menu a.item:hover { - color: #fff; -} - .ui.red.label, .ui.red.labels .label { background-color: #7d3434 !important; @@ -163,10 +151,6 @@ background-color: #936e00 !important; } -.ui.accordion .title:not(.ui) { - color: #dbdbdb; -} - .ui.green.label, .ui.green.labels .label, .ui.basic.green.label { @@ -183,19 +167,6 @@ a.ui.basic.green.label:hover { color: #fff !important; } -.ui.divider:not(.vertical,.horizontal) { - border-bottom-color: var(--color-secondary); - border-top-color: transparent; -} - -.form .help { - color: #7f8699; -} - -.ui .text.light.grey { - color: #7f8699 !important; -} - .ui.form .fields.error .field textarea, .ui.form .fields.error .field select, .ui.form .fields.error .field input:not([type]), @@ -257,45 +228,6 @@ a.ui.basic.green.label:hover { background-color: #a0cc75; } -.ui.search > .results { - background: #383c4a; - border-color: var(--color-secondary); -} - -.ui.search > .results .result:hover, -.ui.category.search > .results .category .result:hover { - background: var(--color-secondary); -} - -.ui.search > .results .result .title { - color: #dbdbdb; -} - -.ui.table > thead > tr > th { - background: var(--color-secondary); - color: #dbdbdb !important; -} - -.repository.file.list #repo-files-table tr { - background: #2a2e3a; -} - -.repository.file.list #repo-files-table tr:hover { - background-color: #393d4a !important; -} - -.overflow.menu .items .item { - color: #9d9d9d; -} - -.overflow.menu .items .item:hover { - color: #dbdbdb; -} - -.ui.list > .item > .content { - color: var(--color-secondary-dark-6) !important; -} - .repository .navbar .active.item, .repository .navbar .active.item:hover { border-color: transparent !important; @@ -305,20 +237,6 @@ a.ui.basic.green.label:hover { border-color: var(--color-secondary); } -.tag-code, -.tag-code td { - background: #353945 !important; - -} -.tag-code td.lines-num { - background-color: #3a3e4c !important; -} - -.tag-code td.lines-type-marker, -td.blob-hunk { - color: #dbdbdb !important; -} - .ui.red.button, .ui.red.buttons .button { background-color: #7d3434; @@ -344,10 +262,6 @@ td.blob-hunk { border-color: var(--color-secondary) !important; } -td.blob-excerpt { - background-color: rgba(0, 0, 0, .15); -} - .lines-code.active, .lines-code .active { background: #534d1b !important; From 10228387d20ce94c8f6e628f70b598e1583b4ccc Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Fri, 23 Sep 2022 13:23:24 +0800 Subject: [PATCH 033/169] Added search input field to issue filter (#20623) Added search input field to issue filter for label and milestone and assignee Co-authored-by: wxiaoguang --- templates/repo/issue/list.tmpl | 12 ++++++++++++ templates/repo/issue/milestone_issues.tmpl | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 8e8c256c59..5b25d664e6 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -45,6 +45,10 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
- {{if $.IsSplitStyle}} - {{template "repo/diff/section_split" dict "file" . "root" $}} - {{else}} - {{template "repo/diff/section_unified" dict "file" . "root" $}} +
+ {{if $showFileViewToggle}} +
+ {{svg "octicon-code"}} + {{svg "octicon-file"}} +
{{end}} -
- {{end}} -
- {{if $showFileViewToggle}} -
- - {{if $isImage}} - {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} - {{else}} - {{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} + {{if $file.IsProtected}} + {{$.locale.Tr "repo.diff.protected"}} {{end}} -
+ {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} + {{$.locale.Tr "repo.unescape_control_characters"}} + + {{end}} + {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} + {{if $file.IsDeleted}} + {{$.locale.Tr "repo.diff.view_file"}} + {{else}} + {{$.locale.Tr "repo.diff.view_file"}} + {{end}} + {{end}} + {{if and $.IsSigned $.PageIsPullFiles (not $.IsArchived)}} + {{if $file.HasChangedSinceLastReview}} + {{$.locale.Tr "repo.pulls.has_changed_since_last_review"}} + {{end}} + + {{end}} +
+ +
+
+ {{if or $file.IsIncomplete $file.IsBin}} +
+ {{if $file.IsIncomplete}} + {{if $file.IsIncompleteLineTooLong}} + {{$.locale.Tr "repo.diff.file_suppressed_line_too_long"}} + {{else}} + {{$.locale.Tr "repo.diff.file_suppressed"}} + {{$.locale.Tr "repo.diff.load"}} + {{end}} + {{else}} + {{$.locale.Tr "repo.diff.bin_not_shown"}} + {{end}} +
+ {{else}} + + {{if $.IsSplitStyle}} + {{template "repo/diff/section_split" dict "file" . "root" $}} + {{else}} + {{template "repo/diff/section_unified" dict "file" . "root" $}} + {{end}} +
+ {{end}} +
+ {{if $showFileViewToggle}} +
+ + {{if $isImage}} + {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} + {{else}} + {{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} + {{end}} +
+
+ {{end}}
- {{end}} -
-
- {{end}} +
+ {{end}} - {{if .Diff.IsIncomplete}} -
-

- {{$.locale.Tr "repo.diff.too_many_files"}} - {{.locale.Tr "repo.diff.show_more"}} -

+ {{if .Diff.IsIncomplete}} +
+

+ {{$.locale.Tr "repo.diff.too_many_files"}} + {{.locale.Tr "repo.diff.show_more"}} +

+
+ {{end}}
- {{end}}
{{if not $.Repository.IsArchived}} diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 029e7717a4..e0e6837203 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}}
{{template "repo/header" .}} -
+

{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl index 18fa100dcf..2cb5abcb36 100644 --- a/templates/repo/diff/options_dropdown.tmpl +++ b/templates/repo/diff/options_dropdown.tmpl @@ -1,7 +1,7 @@