Commit Graph

19356 Commits

Author SHA1 Message Date
KN4CK3R
a2651c14ce
Add cache for common package queries (#22491)
This adds a cache for common package queries in `GetPackageDescriptor`.
Code which needs to process a list of packages benefits from this
change. This skips 350 queries in the package integration tests for
example.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-13 09:40:36 +00:00
Tomeamis
4dca869ed1
Allow admins and org owners to change org member public status (#28294)
Allows admins and org owners to change org member public status.

Before, this would return `Error 403: Cannot publicize another member`
despite the fact that the same user could make the same change through
the GUI.

Fixes #28372

---------

Co-authored-by: Tomáš Ženčák <zencak@ica.cz>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-13 08:07:29 +00:00
Kerwin Bryant
d0688cb2b3
Fix span svg layout (#34185) 2025-04-13 12:44:57 +08:00
hiifong
aada0370e7
fix webhook url (#34186)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-13 02:24:32 +00:00
Kerwin Bryant
f4196a8843
Optimize overflow-menu (#34183)
Optimized the overflow-menu:
1. Close the tippy when a menu item inside the tippy is clicked.
2. When a menu item inside the tippy is selected, move the active state
of the menu to the tippy's button.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-13 01:59:36 +00:00
Lunny Xiao
93a2def96b
Move and rename UpdateRepository (#34136) 2025-04-12 18:22:18 +00:00
Kerwin Bryant
5015992db5
Update milestones.tmpl (#34184) 2025-04-12 11:34:42 +08:00
GiteaBot
7a587bc2d3 [skip ci] Updated translations via Crowdin 2025-04-12 00:33:41 +00:00
Lunny Xiao
ae0af8ea5b
Refactor Git Attribute & performance optimization (#34154)
This PR moved git attributes related code to `modules/git/attribute` sub
package and moved language stats related code to
`modules/git/languagestats` sub package to make it easier to maintain.

And it also introduced a performance improvement which use the `git
check-attr --source` which can be run in a bare git repository so that
we don't need to create a git index file. The new parameter need a git
version >= 2.40 . If git version less than 2.40, it will fall back to
previous implementation.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
2025-04-11 21:41:29 +08:00
GiteaBot
d725b78824 [skip ci] Updated translations via Crowdin 2025-04-11 00:34:55 +00:00
Allen Conlon
4a3ab5a2cd
fix(#33711): cross-publish docker images to ghcr.io (#34148)
This PR will cross-publish the release, rc, and nightly images from
`docker.io` to `ghcr.io` as docker hub has imposed rate-limiting

Signed-off-by: Allen Conlon <software@conlon.dev>
2025-04-10 19:39:37 +00:00
Exploding Dragon
4ddf94dee5
refactor organization menu (#33928)
Fix missing items in organization menu.

**Menu**

<details>
<summary>Show</summary>

Before:

![](https://github.com/user-attachments/assets/bcbce97e-84de-44ea-9889-a664979433cd)

After:

![](https://github.com/user-attachments/assets/a169e00f-5212-4733-af9e-e8676ad74376)

</details>

**Packages**

<details>

 keep it consistent with the other pages.

<summary>Show</summary>

Before:

![](https://github.com/user-attachments/assets/170d7b3d-ecac-49b9-8296-44d0b0f2b191)

After:

![](https://github.com/user-attachments/assets/9c3c6915-870c-48cc-8a35-3d615a27d36d)

</details>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-10 12:12:55 -07:00
Thomas E Lackey
fa49cd719f
feat: Add sorting by exclusive labels (issue priority) (#33206)
Fix #2616

This PR adds a new sort option for exclusive labels.

For exclusive labels, a new property is exposed called "order", while in
the UI options are populated automatically in the `Sort` column (see
screenshot below) for each exclusive label scope.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-10 17:18:07 +00:00
Kerwin Bryant
02e49a0f47
Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (#34137)
In the file tree, the icons are not vertically centered, which affects
the overall visual consistency.
Currently, the icons of submodules and symlinks do not adopt the value
of entryIcon, resulting in inconsistent icon display.

before:
![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test
gitea_src_branch_main_README md
(3)](https://github.com/user-attachments/assets/d521b89f-909a-43f9-8f39-787b0243b159)

after:
![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test
gitea_src_branch_main_README md
(2)](https://github.com/user-attachments/assets/4866807f-c890-4709-b595-7086011e5231)

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-04-09 18:10:16 -07:00
ManInDark
fac6b87dd2
bugfix check for alternate ssh host certificate location (#34146)
fixes #34145

Edited all locations to actually be correct.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-04-09 22:21:54 +03:00
Lunny Xiao
4a5af4edca
Cache GPG keys, emails and users when list commits (#34086)
When list commits, some of the commits authors are the same at many
situations. But current logic will always fetch the same GPG keys from
database. This PR will cache the GPG keys, emails and users for the
context so that reducing the database queries.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-09 16:34:38 +00:00
wxiaoguang
f8edc29f5d
Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (#34152)
Fix #32015
2025-04-09 07:52:01 +00:00
Will Kelly
1b2d8df13d
remove hardcoded 'code' string in clone_panel.tmpl (#34153)
This commit replaces the hardcoded string "code" in the clone panel
button with the i18n local for repo.code.
2025-04-09 06:34:50 +00:00
GiteaBot
c0898f7ed9 [skip ci] Updated translations via Crowdin 2025-04-09 00:34:55 +00:00
Lunny Xiao
32b97b3ce8
Uniform all temporary directories and allow customizing temp path (#32352)
This PR uniform all temporary directory usage so that it will be easier
to manage.

Relate to #31792 

- [x] Added a new setting to allow users to configure the global
temporary directory.
- [x] Move all temporary files and directories to be placed under
os.Temp()/gitea.
- [x] `setting.Repository.Local.LocalCopyPath` now will be
`setting.TempPath/local-repo` and the customized path is removed.
```diff
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;[repository.local]
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Path for local repository copy. Defaults to  TEMP_PATH + `local-repo`, this is deprecated and cannot be changed
-;LOCAL_COPY_PATH = local-repo
```

- [x] `setting.Repository.Upload.TempPath` now will be
`settting.TempPath/uploads` and the customized path is removed.
```diff
;[repository.upload]
-;;
-;; Path for uploads. Defaults to TEMP_PATH + `uploads`
-;TEMP_PATH = uploads
```

- [x] `setting.Packages.ChunkedUploadPath` now will be
`settting.TempPath/package-upload` and the customized path is removed.
```diff
;[packages]
-;;
-;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path.
-;CHUNKED_UPLOAD_PATH = package-upload
```

- [x] `setting.SSH.KeyTestPath` now will be
`settting.TempPath/ssh_key_test` and the customized path is removed.
```diff
[server]
-;;
-;; Directory to create temporary files in when testing public keys using ssh-keygen,
-;; default is the system temporary directory.
-;SSH_KEY_TEST_PATH =
```

TODO:
- [ ] setting.PprofDataPath haven't been changed because it may need to
be kept until somebody read it but temp path may be clean up any time.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-08 16:15:28 +00:00
DrMaxNix
fd7c364ca6
Check user/org repo limit instead of doer (#34147)
This PR tries to finally fix the bug mentioned in #30011 and #15504,
where the user repo limit is checked when creating a repo in an
organization.

Fix #30011

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
2025-04-07 23:45:31 -07:00
Lunny Xiao
a100ac3306
Rework create/fork/adopt/generate repository to make sure resources will be cleanup once failed (#31035)
Fix #28144 

To make the resources will be cleanup once failed. All repository
operations now follow a consistent pattern:

- 1. Create a database record for the repository with the status
being_migrated.
- 2. Register a deferred cleanup function to delete the repository and
its related data if the operation fails.
- 3.	Perform the actual Git and database operations step by step.
- 4. Upon successful completion, update the repository’s status to
ready.

The adopt operation is a special case — if it fails, the repository on
disk should not be deleted.
2025-04-07 22:12:54 -07:00
silverwind
90b509aafb
Update JS and PY deps (#34143)
- Update selected dependencies.
- Ran `make svg && git add --all`.
- Tested mermaid and swagger.
- Mark `fileicon` assets as generated so they don't spam the diff.
- Webpack is not upgraded because it has some regression.
2025-04-07 21:42:32 -07:00
wxiaoguang
07c6087878
Fix team permission (#34128)
The `team.access_mode` should be either `none` or `admin/owner`.
For non-admin team, the real permissions are provided by `team_unit`.
2025-04-08 04:15:15 +00:00
GiteaBot
8ca51abadd [skip ci] Updated translations via Crowdin 2025-04-08 00:34:12 +00:00
Bo-Yi Wu
e45450b744
docs: add Chinese translations for README files (#34132)
- Update README.md to include links to Traditional and Simplified
Chinese translations.
- Add README.zh-cn.md file containing the Simplified Chinese version of
the README.
- Add README.zh-tw.md file containing the Traditional Chinese version of
the README.
- Delete README_ZH.md file.

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-07 11:11:48 -07:00
Kerwin Bryant
8c9d2bdee3
Keep file tree view icons consistent with icon theme (#33921)
Fix #33914

before:
![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test
gitea_src_branch_main_
gitmodules](https://github.com/user-attachments/assets/ca50eeff-cc44-4041-b01f-c0c5bdd3b6aa)

after:
![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test
gitea_src_branch_main_README
md](https://github.com/user-attachments/assets/3b87fdbd-81d0-4831-8a74-4dbfcd5b6d91)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-06 19:35:08 +00:00
wxiaoguang
bcc38eb35f
Make markdown render match GitHub's behavior (#34129)
For #2246
2025-04-06 17:34:59 +00:00
wxiaoguang
3fe082a5a3
Remove dead code: RepoRef (#34131)
The RepoRef is a no-op since Refactor ref type (#33242) (Jan 14)
2025-04-06 20:08:10 +03:00
wxiaoguang
e94f8d56f1
Correctly handle submodule view and avoid throwing 500 error (#34121)
Auto-redirect for in-site links, and show 404 for external links
(to avoid open redirect or phishing)
2025-04-06 09:38:08 +00:00
wxiaoguang
a62ed19da6
Use overflow-wrap: anywhere to replace word-break: break-all (#34126) 2025-04-06 17:13:02 +08:00
wxiaoguang
e1c2d05bde
Fix markdown render behaviors (#34122)
* Fix #27645
* Add config options `MATH_CODE_BLOCK_DETECTION`, problematic syntaxes
are disabled by default
* Fix #33639
    * Add config options `RENDER_OPTIONS_*`, old behaviors are kept
2025-04-05 11:56:48 +08:00
wxiaoguang
ee6929d96b
Refactor dropdown ellipsis (#34123)
Remove legacy `truncated-item-container` and `truncated-item-name`.
2025-04-05 03:21:11 +00:00
Lunny Xiao
7a09bc904a
Avoid creating unnecessary temporary cat file sub process (#33942)
Extract from #33934 

In the same goroutine, we should reuse the exist cat file sub process
which exist in `git.Repository` to avoid creating a unnecessary
temporary subprocess.

This PR reuse the exist cate file writer and reader in
`getCommitFromBatchReader`.
It also move `prepareLatestCommitInfo` before creating dataRc which will
hold the writer so other git operation will create a temporary cat file
subprocess.
2025-04-04 16:19:19 -07:00
Mopcho
013b2686fe
Fix discord webhook 400 status code when description limit is exceeded (#34084)
Fixes [#34027](https://github.com/go-gitea/gitea/issues/34027)

Discord does not allow for description bigger than 2048 bytes. If the
description is bigger than that it will throw 400 and the event won't
appear in discord. To fix that, in the createPayload method we now slice
the description to ensure it doesn’t exceed the limit.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-04 18:09:40 +00:00
wxiaoguang
6cee3bfa96
Refactor markup render to fix various path problems (#34114)
* Fix #33972
    * Use consistent path resolving for links and medias.
* No need to make the markup renders to resolve the paths, instead, the
paths are all correctly resolved in the "post process" step.
* Fix #33274
* Since 1.23, all paths starting with "/" are relative to current render
context (for example: the current repo branch)
* Introduce `/:root/path-relative-to-root`, then the path will be
rendered as relative to "ROOT_URL"
2025-04-04 23:45:23 +08:00
GiteaBot
e8b54d9e44 [skip ci] Updated translations via Crowdin 2025-04-04 00:33:58 +00:00
KN4CK3R
8fed70afdc
Fix invalid version in RPM package path (#34112) 2025-04-03 19:00:00 +00:00
ManInDark
f8d549436e
also check default ssh-cert location for host (#34099) (#34100) 2025-04-03 14:34:54 -04:00
wxiaoguang
ba921fd903
Fix markdown frontmatter rendering (#34102)
Fix #34101
2025-04-03 05:48:24 +00:00
Zettat123
f94ee4fd3c
Get changed files based on merge base when checking pull_request actions trigger (#34106)
Fix #33941
2025-04-03 05:13:16 +00:00
Lunny Xiao
45c45934aa
Add last_committer_date and last_author_date for file contents API (#32921)
Fix #32886

Add `last_committer_date` and `last_author_date` in the content API
which is not implemented by Github API v3 at the moment.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-02 21:47:31 -07:00
Lunny Xiao
c27d87a9ac
Refactor Branch struct in package modules/git (#33980)
The `Branch` struct in `modules/git` package is unnecessary. We can just
use a `string` to represent a branch
2025-04-02 17:31:32 +00:00
wxiaoguang
285950a222
Support creating relative link to raw path in markdown (#34105)
Fix #34104
2025-04-03 01:05:43 +08:00
Kemal Zebari
55a69ae4c6
Add new CLI flags to set name and scopes when creating a user with access token (#34080)
Resolves #33474.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-02 22:00:54 +08:00
wxiaoguang
6ed1b26c58
Do not show 500 error when default branch doesn't exist (#34096)
Fix #34090
2025-04-01 21:39:00 -07:00
Lunny Xiao
88352e0b25
Return default avatar url when user id is zero rather than updating database (#34094) 2025-04-02 01:03:27 +00:00
GiteaBot
e2ac789b49 [skip ci] Updated translations via Crowdin 2025-04-02 00:35:16 +00:00
Lunny Xiao
0668cce4e8
Fix return bug (#34093)
Fix https://github.com/go-gitea/gitea/pull/34031/files#r2021927997
2025-04-01 17:36:46 -04:00
Lunny Xiao
92dfec704f
Move ParseCommitWithSSHSignature to service layer (#34087)
No code change.
2025-04-01 16:30:53 +00:00