Commit Graph

5126 Commits

Author SHA1 Message Date
bytedream
18a673bad1
Restore form inputs on organization create error (#34201)
Keeps the entered inputs when the "organization create" request
returns an error.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-15 08:21:51 +00:00
Kerwin Bryant
421d0e5849
Align User Details Page Header Layout with Design Specifications (#34192) 2025-04-15 01:16:33 -04:00
Rowan Bohde
c57304ac3f
Add middleware for request prioritization (#33951)
This adds a middleware for overload protection that is intended to help protect against malicious scrapers.
It does this via [`codel`](https://github.com/bohde/codel), which will perform the following:

1. Limit the number of in-flight requests to some user-defined max
2. When in-flight requests have reached their begin queuing requests.
    Logged-in requests having priority above logged-out requests
3. Once a request has been queued for too long,
    it has a probabilistic chance to be rejected based on how overloaded the entire system is.

When a server experiences more traffic than it can handle,
this keeps latency low for logged-in users and rejects just
enough requests from logged-out users to not overload the service.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-04-14 16:25:48 +02:00
Kerwin Bryant
3a9fcac11b
Update protected_branch.tmpl (#34193)
Show correct message for new/edit. Add "required" to rule name.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-14 13:41:00 +00:00
KN4CK3R
bec9233c29
Add package version api endpoints (#34173)
Fixes #33544

Adds two new api endpoints to list a versions of a package and to get
the latest version of a package by API.

⚠️ BREAKING ⚠️ 
the `size` field for this endpoint changes from `Size` to `size`.
2025-04-13 20:00:44 +00:00
wxiaoguang
34349c085c
Fix incorrect file links (#34189)
Fix #34188

The name "FileName" is ambiguous: sometimes it is "base name without
path", sometimes it is "full name with path".

The ambiguous name causes various problems.

This PR clarifies the usage: `FileTreePath`: the full name with path.
2025-04-13 12:27:31 -07:00
Kerwin Bryant
d0688cb2b3
Fix span svg layout (#34185) 2025-04-13 12:44:57 +08:00
Kerwin Bryant
5015992db5
Update milestones.tmpl (#34184) 2025-04-12 11:34:42 +08: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
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
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
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
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
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
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
bytedream
56e42be36d
Add flat-square action badge style (#34062)
Adds the `flat-square` style to action badges. Styles can be selected by
adding `?style=<style>` to the badge endpoint. If no style query is
given, or if the query is invalid, the style defaults to `flat`.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-01 09:42:10 +00:00
Simon Priet
342432e52a
fix(#34076):replace assgniee translation key (#34077)
Fix the typo on the `filter_assginee_no_assigne` key used in
translations.

The typo itself doesn't produce a bug (as it's there both on the code
and on the locales)

Side Note: Github UI is not the best to bulk change this :/ Squashing
commits on the PR should be adequate.

Closes #34076 .

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-03-31 19:11:15 +00:00
Kerwin Bryant
741b53eb30
[Fix] Resolve the problem of commit_statuses not being loaded at the top - right when switching files from the file tree (#34079)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-31 18:39:08 +00:00
wxiaoguang
b59705fa34
Add a config option to block "expensive" pages for anonymous users (#34024)
Fix #33966

```
;; User must sign in to view anything.
;; It could be set to "expensive" to block anonymous users accessing some pages which consume a lot of resources,
;; for example: block anonymous AI crawlers from accessing repo code pages.
;; The "expensive" mode is experimental and subject to change.
;REQUIRE_SIGNIN_VIEW = false
```
2025-03-30 05:26:19 +00:00
yp05327
5023238088
Add descriptions for private repo public access settings and improve the UI (#34057)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-29 21:24:27 +08:00
wxiaoguang
cddd19efc8
Add anonymous access support for private/unlisted repositories (#34051)
Follow #33127

Fix #8649, fix #639

This is a complete solution. A repo unit could be set to:

* Anonymous read (non-signed-in user)
* Everyone read (signed-in user)
* Everyone write (wiki-only)
2025-03-29 13:26:41 +08:00
Lunny Xiao
49899070cd
Hide activity contributors, recent commits and code frequrency left tabs if there is no code permission (#34053)
When a team have no code unit permission of a repository, the member of
the team should not view activity contributors, recent commits and code
frequrency.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-28 21:04:40 -07:00
bytedream
bf9500b3f2
Update action status badge layout (#34018)
The current action status badge are looking different from most other
badges renders, which is especially noticeable when using them along
with other badges. This PR updates the action badges to match the
commonly used badges from other providers.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-28 15:12:47 +00:00
Kerwin Bryant
b542769102
Adjust the layout of the toolbar on the Issues/Projects page (#33667)
On the list page, labels and milestones do not serve as a switch-tab.
Instead, they function as page navigation. The switch-tab is only
appropriate for use on the labels and milestones pages.

And fix projects page layout.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-28 07:55:12 +00:00
TheFox0x7
053592d847
fix org repo creation being limited by user limits (#34030)
fixes an issue where user is unable to create new repository in
organization via UI if repository limits are in place and user has
exhausted them for their own namespace.

closes: https://github.com/go-gitea/gitea/issues/15504

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-27 13:16:17 +00:00
Lunny Xiao
0c6957ef8d
Download actions job logs from API (#33858)
Related to #33709, #31416

It's similar with
https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run--code-samples.

This use `job_id` as path parameter which is consistent with Github's
APIs.

---------

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-26 11:30:52 -07:00
wxiaoguang
d28a7f9fea
Fix dropdown delegating and some UI problems (#34014)
The old logic is incomplete. See the comment for the improved logic.

Fix #34011

And more fixes:

1. use empty "alt" for images, otherwise the width is not right when the
image fails to load
2. remove the "dropdown icon" patch, because it has been clearly done in
"dropdown.js" now
3. remove the "dropdown filtered item" patch, added a clear callback,
and improve the logic
4. fix global init when a node is removed and added back gain (eg: the
"cherry pick" dialog with a dropdown)
2025-03-26 02:51:22 +00:00
wxiaoguang
41c946a66f
Prepare common tmpl functions in a middleware (#33957)
Fix the TODO in `routers/web/web.go`, and avoid the unnecessary
`GetActiveStopwatch` SQL query in non-related route handlers.
2025-03-25 06:17:58 +00:00
wxiaoguang
b1e326d09e
Auto expand "New PR" form (#33971)
Follow GitHub's behavior: use `?expand=1` to expand the "New PR" form
2025-03-24 14:28:02 +00:00
Lunny Xiao
30ee082e48
Only use prev and next buttons for pagination on user dashboard (#33981)
The pagination on the user dashboard sounds unnecessary, this will
change it to a prev/next buttons. For instances with around `10 million`
records in the action table, this option affects how the user dashboard
is loaded on first visit.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-03-23 19:52:43 +00:00
wxiaoguang
279473f467
Fix oauth2 auth and UI (#33961) 2025-03-21 20:50:39 +08:00
Andreas Svanberg
0da7318cf3
Allow filtering issues by any assignee (#33343)
This is the opposite of the "No assignee" filter, it will match all
issues that have at least one assignee.

Before
![Before
change](https://github.com/user-attachments/assets/4aea194b-9add-4a84-8d6b-61bfd8d9e58e)

After
![After change with any
filter](https://github.com/user-attachments/assets/99f1205d-ba9f-4a0a-a60b-cc1a0c0823fe)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-21 04:25:36 +00:00
Kerwin Bryant
dcbf6c2d13
Optimize Layout Styles of Filelist (#33920)
Align items

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-19 00:59:33 +08:00
John Smith
8f051d598c
Added Description Field for Secrets and Variables (#33526)
Fixes #33484

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-17 19:24:54 +00:00
wxiaoguang
fdaf1cca65
Defer captcha script loading (#33919)
Fix #33899
2025-03-17 15:21:04 +00:00
Kerwin Bryant
e1feb438a4
Fix file tree issues (#33916) 2025-03-17 14:55:15 +00:00
wxiaoguang
9d89dfe142
Remove unused or abused styles (#33918)
* `top aligned` => `tw-align-top`
* label list: it was broken, this PR fixes it
* reference link: simplified
* settings/repos: not affected
2025-03-17 22:11:24 +08:00
silverwind
1ea5216f4a
Replace text-align classes with tailwind (#33905)
Small refactor to remove these CSS classes in favor of tailwind.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-16 12:08:16 +00:00
Lunny Xiao
10513df1bf
Add missing translation (#33900) 2025-03-15 18:55:58 +00:00
ChristopherHX
7e8168f555
Fix cannot delete runners via the modal dialog (#33895)
delete-button and show-modal class are conflicting

Closes #33894
2025-03-15 09:45:37 -07:00
Kerwin Bryant
92f997ce6b
Add file tree to file view page (#32721)
Resolve #29328

This pull request introduces a file tree on the left side when reviewing
files of a repository.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-15 16:26:49 +08:00
wxiaoguang
b094f9b75d
Improve repo commit view (#33877)
Fix #24623

Major changes:

1. Redirect `/owner/repo/blob/*` requests to `/owner/repo/src/commit/*`
(like GitHub)
2. Add a "view file diff" link (see screenshot below)
3. Refactor "AssertHTMLElement" to generic, now we can accurately assert
existence or number.
4. Add more tests

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
2025-03-14 07:45:11 +00:00
wxiaoguang
d879ec6d92
Fine tune push mirror UI (#33866) 2025-03-14 00:03:21 +00:00
wxiaoguang
403775e74e
Improve issue & code search (#33860)
Each "indexer" should provide the "search modes" they support by
themselves. And we need to remove the "fuzzy" search for code.
2025-03-13 11:07:48 +08:00
ChristopherHX
651ef66966
Add workflow_job webhook (#33694)
Provide external Integration information about the Queue lossly based on
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=completed#workflow_job

Naming conflicts between GitHub & Gitea are here, Blocked => Waiting,
Waiting => Queued

Rationale Enhancement for ephemeral runners management #33570
2025-03-11 10:40:38 -07:00