From 0fd8cba6396a45040c4d7986af4f8a1fbf136592 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 28 Apr 2024 21:02:38 +0800 Subject: [PATCH 001/338] Fix documentation build problems because of MDX syntax conflicts (#30744) (#30745) Backport #30744 by @lunny Documentation building has encountered a problem like below. This is because MDX syntax doesn't allow `{customPath}`, we have to use \`{customPath}\` ``` Error: Can't render static file for pathname "/next/administration/config-cheat-sheet" at generateStaticFile (/workspace/gitea/gitea-docusaurus/node_modules/@docusaurus/core/lib/ssg.js:119:15) at runNextTicks (node:internal/process/task_queues:60:5) at process.processImmediate (node:internal/timers:449:9) at async /workspace/gitea/gitea-docusaurus/node_modules/p-map/index.js:57:22 { [cause]: ReferenceError: CustomPath is not defined at _createMdxContent (server.bundle.js:4406:106) at MDXContent (server.bundle.js:10745:8) at Uc (server.bundle.js:264171:44) at Xc (server.bundle.js:264173:253) at Z (server.bundle.js:264179:89) at Yc (server.bundle.js:264182:98) at $c (server.bundle.js:264181:140) at Z (server.bundle.js:264179:345) at Xc (server.bundle.js:264177:231) at Z (server.bundle.js:264179:89) ``` Co-authored-by: Lunny Xiao --- docs/content/administration/config-cheat-sheet.en-us.md | 4 ++-- docs/content/administration/config-cheat-sheet.zh-cn.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/administration/config-cheat-sheet.en-us.md b/docs/content/administration/config-cheat-sheet.en-us.md index 7bf23c9b99..5066e0f879 100644 --- a/docs/content/administration/config-cheat-sheet.en-us.md +++ b/docs/content/administration/config-cheat-sheet.en-us.md @@ -214,9 +214,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a - `SITEMAP_PAGING_NUM`: **20**: Number of items that are displayed in a single subsitemap. - `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph. - `CODE_COMMENT_LINES`: **4**: Number of line of codes shown for a code comment. -- `DEFAULT_THEME`: **gitea-auto**: Set the default theme for the Gitea installation, custom themes could be provided by "{CustomPath}/public/assets/css/theme-*.css". +- `DEFAULT_THEME`: **gitea-auto**: Set the default theme for the Gitea installation, custom themes could be provided by `{CustomPath}/public/assets/css/theme-*.css`. - `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page. -- `THEMES`: **_empty_**: All available themes by "{CustomPath}/public/assets/css/theme-*.css". Allow users select personalized themes. +- `THEMES`: **_empty_**: All available themes by `{CustomPath}/public/assets/css/theme-*.css`. Allow users select personalized themes. - `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB) - `AMBIGUOUS_UNICODE_DETECTION`: **true**: Detect ambiguous unicode characters in file contents and show warnings on the UI - `REACTIONS`: All available reactions users can choose on issues/prs and comments diff --git a/docs/content/administration/config-cheat-sheet.zh-cn.md b/docs/content/administration/config-cheat-sheet.zh-cn.md index 0d08a5e51b..3bb31d3d71 100644 --- a/docs/content/administration/config-cheat-sheet.zh-cn.md +++ b/docs/content/administration/config-cheat-sheet.zh-cn.md @@ -212,9 +212,9 @@ menu: - `SITEMAP_PAGING_NUM`: **20**: 在单个子SiteMap中显示的项数。 - `GRAPH_MAX_COMMIT_NUM`: **100**: 提交图中显示的最大commit数量。 - `CODE_COMMENT_LINES`: **4**: 在代码评论中能够显示的最大代码行数。 -- `DEFAULT_THEME`: **gitea-auto**: 在Gitea安装时候设置的默认主题,自定义的主题可以通过 "{CustomPath}/public/assets/css/theme-*.css" 提供。 +- `DEFAULT_THEME`: **gitea-auto**: 在Gitea安装时候设置的默认主题,自定义的主题可以通过 `{CustomPath}/public/assets/css/theme-*.css` 提供。 - `SHOW_USER_EMAIL`: **true**: 用户的电子邮件是否应该显示在`Explore Users`页面中。 -- `THEMES`: **_empty_**: 所有可用的主题(由 "{CustomPath}/public/assets/css/theme-*.css" 提供)。允许用户选择个性化的主题, +- `THEMES`: **_empty_**: 所有可用的主题(由 `{CustomPath}/public/assets/css/theme-*.css` 提供)。允许用户选择个性化的主题, - `MAX_DISPLAY_FILE_SIZE`: **8388608**: 能够显示文件的最大大小(默认为8MiB)。 - `REACTIONS`: 用户可以在问题(Issue)、Pull Request(PR)以及评论中选择的所有可选的反应。 这些值可以是表情符号别名(例如::smile:)或Unicode表情符号。 From bb7d36d7518b7e69c1aec3cb47584b85d3a43959 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Mon, 29 Apr 2024 07:51:42 +0800 Subject: [PATCH 002/338] Gitea with first upper case + typos (#30739) (#30747) Backport #30739 by @mainboarder * Corrected gitea to Gitea * fixed some typos Co-authored-by: mainboarder --- docs/content/usage/repo-mirror.en-us.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/usage/repo-mirror.en-us.md b/docs/content/usage/repo-mirror.en-us.md index 8804a8885a..9d23159890 100644 --- a/docs/content/usage/repo-mirror.en-us.md +++ b/docs/content/usage/repo-mirror.en-us.md @@ -58,7 +58,7 @@ The repository now gets mirrored periodically to the remote repository. You can To set up a mirror from Gitea to GitHub, you need to follow these steps: -1. Create a [GitHub personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the *public_repo* box checked. Also check the **workflow** checkbox in case your repo using act for continuous integration. +1. Create a [GitHub personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the *public_repo* box checked. Also check the **workflow** checkbox in case your repo uses GitHub Actions for continuous integration. 2. Create a repository with that name on GitHub. Unlike Gitea, GitHub does not support creating repositories by pushing to the remote. You can also use an existing remote repo if it has the same commit history as your Gitea repo. 3. In the settings of your Gitea repo, fill in the **Git Remote Repository URL**: `https://github.com//.git`. 4. Fill in the **Authorization** fields with your GitHub username and the personal access token as **Password**. @@ -91,10 +91,10 @@ The repository pushes shortly thereafter. To force a push, select the **Synchron ### Mirror an existing ssh repository -Currently gitea supports no ssh push mirrors. You can work around this by adding a `post-receive` hook to your gitea repository that pushes manually. +Currently Gitea supports no ssh push mirrors. You can work around this by adding a `post-receive` hook to your Gitea repository that pushes manually. -1. Make sure the user running gitea has access to the git repo you are trying to mirror to from shell. -2. On the Webinterface at the repository settings > git hooks add a post-receive hook for the mirror. I.e. +1. Make sure the user running Gitea has access to the git repo you are trying to mirror to from shell. +2. On the web interface at the repository settings > git hooks add a post-receive hook for the mirror. I.e. ``` #!/usr/bin/env bash From d07019f539c475466748fbf730d7f270a92fdb8b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 29 Apr 2024 08:23:35 +0800 Subject: [PATCH 003/338] Fix nil dereference on error (#30740) (#30746) Backport #30740 manually Co-authored-by: Chongyi Zheng --- routers/api/actions/artifacts.go | 7 ++++--- routers/web/repo/actions/view.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/routers/api/actions/artifacts.go b/routers/api/actions/artifacts.go index 3e717b8d8f..5bd004bd37 100644 --- a/routers/api/actions/artifacts.go +++ b/routers/api/actions/artifacts.go @@ -466,14 +466,15 @@ func (ar artifactRoutes) downloadArtifact(ctx *ArtifactContext) { log.Error("Error getting artifact: %v", err) ctx.Error(http.StatusInternalServerError, err.Error()) return - } else if !exist { + } + if !exist { log.Error("artifact with ID %d does not exist", artifactID) ctx.Error(http.StatusNotFound, fmt.Sprintf("artifact with ID %d does not exist", artifactID)) return } if artifact.RunID != runID { - log.Error("Error dismatch runID and artifactID, task: %v, artifact: %v", runID, artifactID) - ctx.Error(http.StatusBadRequest, err.Error()) + log.Error("Error mismatch runID and artifactID, task: %v, artifact: %v", runID, artifactID) + ctx.Error(http.StatusBadRequest) return } diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 3909a64be6..12909bddd5 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -504,7 +504,7 @@ func getRunJobs(ctx *context_module.Context, runIndex, jobIndex int64) (*actions return nil, nil } if len(jobs) == 0 { - ctx.Error(http.StatusNotFound, err.Error()) + ctx.Error(http.StatusNotFound) return nil, nil } From 6c86034e0fe8d848891af31c8b61793e33605c36 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Tue, 30 Apr 2024 05:19:44 +0800 Subject: [PATCH 004/338] Fix all rounded borders, change affected tab menus to pills (#30707) (#30769) Backport #30707 by @silverwind Fixes https://github.com/go-gitea/gitea/issues/30673, all 23 issues. Notes: - Tab bar menus had to change to pills because of unsolvable issue with the border-radius as tab bar renders a overlapping border onto the box below. And I think pills look better. - Added padding to code editor empty preview message - Hide monaco's built-in blue focus border, we don't need it and it never showed before either. - Label add menu is simplified, removing the nested segment. Screenshot 2024-04-25 at 22 26 19 Screenshot 2024-04-25 at 22 28 00 Screenshot 2024-04-25 at 22 36 53 Screenshot 2024-04-25 at 22 56 09 Screenshot 2024-04-25 at 22 57 12 Co-authored-by: silverwind Co-authored-by: wxiaoguang --- routers/web/repo/editor.go | 6 ++-- templates/org/team/members.tmpl | 4 +-- templates/org/team/navbar.tmpl | 2 +- templates/org/team/repositories.tmpl | 2 +- templates/repo/commit_page.tmpl | 2 +- templates/repo/editor/diff_preview.tmpl | 6 ++++ templates/repo/editor/edit.tmpl | 8 ++--- templates/repo/editor/patch.tmpl | 4 +-- .../issue/labels/label_load_template.tmpl | 33 +++++++++---------- templates/repo/tag/list.tmpl | 2 ++ .../notification_subscriptions.tmpl | 4 +-- templates/user/settings/account.tmpl | 2 +- templates/user/settings/applications.tmpl | 2 +- .../applications_oauth2_edit_form.tmpl | 2 +- .../settings/applications_oauth2_list.tmpl | 2 +- templates/user/settings/security/openid.tmpl | 2 +- web_src/css/features/codeeditor.css | 5 +++ web_src/css/modules/card.css | 1 + web_src/css/modules/menu.css | 20 +++++++++++ web_src/css/modules/modal.css | 2 ++ web_src/css/modules/segment.css | 8 ++++- web_src/css/repo.css | 18 ++++++++++ web_src/css/repo/list-header.css | 19 ----------- web_src/js/features/codeeditor.js | 1 + web_src/js/features/repo-editor.js | 18 +++++----- 25 files changed, 107 insertions(+), 68 deletions(-) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 474f7ff1da..474d7503e4 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -419,11 +419,9 @@ func DiffPreviewPost(ctx *context.Context) { return } - if diff.NumFiles == 0 { - ctx.PlainText(http.StatusOK, ctx.Locale.TrString("repo.editor.no_changes_to_show")) - return + if diff.NumFiles != 0 { + ctx.Data["File"] = diff.Files[0] } - ctx.Data["File"] = diff.Files[0] ctx.HTML(http.StatusOK, tplEditDiffPreview) } diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 7e9a59a6bf..5433f01530 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -8,7 +8,7 @@
{{template "org/team/navbar" .}} {{if .IsOrganizationOwner}} -
+
{{.CsrfTokenHtml}} @@ -21,7 +21,7 @@
{{end}} -
+
{{range .Team.Members}}
diff --git a/templates/org/team/navbar.tmpl b/templates/org/team/navbar.tmpl index 8f2571e1f6..9704f63f6f 100644 --- a/templates/org/team/navbar.tmpl +++ b/templates/org/team/navbar.tmpl @@ -1,4 +1,4 @@ -
{{end}} -
+
{{range .Team.Repos}}
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 938d93b323..b8195ac544 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -139,7 +139,7 @@ {{end}} {{template "repo/commit_load_branches_and_tags" .}}
-
+
{{if .Author}} {{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}} diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl index e2e922be34..fd543a5ab9 100644 --- a/templates/repo/editor/diff_preview.tmpl +++ b/templates/repo/editor/diff_preview.tmpl @@ -1,3 +1,4 @@ +{{if .File}}
@@ -9,3 +10,8 @@
+{{else}} +
+ {{ctx.Locale.Tr "repo.editor.no_changes_to_show"}} +
+{{end}} diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index d52e5a047a..ae3f12669c 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -26,14 +26,14 @@
-