Commit Graph

5182 Commits (main)

Author SHA1 Message Date
wxiaoguang 6b8b580218
Refactor container and UI (#34736) 2025-06-16 16:27:01 +08:00
Kerwin Bryant bbee652e29
Prevent duplicate form submissions when creating forks (#34714)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-06-16 04:19:16 +00:00
ChristopherHX c9505a26b9
Improve instance wide ssh commit signing (#34341)
* Signed SSH commits can look in the UI like on GitHub, just like gpg keys today in Gitea
* SSH format can be added in gitea config
* SSH Signing worked before with DEFAULT_TRUST_MODEL=committer

`TRUSTED_SSH_KEYS` can be a list of additional ssh public key contents
to trust for every user of this instance

Closes #34329
Related #31392

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-11 10:32:55 +00:00
wxiaoguang 1610a63bfd
Fix commit message rendering and some UI problems (#34680)
* Fix #34679
* Fix #34676
* Fix #34674
* Fix #34526
2025-06-10 23:20:32 +08:00
Lunny Xiao 6d0b24064a
Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562)
Extract from #34531 

## Move Commit status state to a standalone package

Move the state from `structs` to `commitstatus` package. It also
introduce `CommitStatusStates` so that the combine function could be
used from UI and API logic.

## Combined commit status Changed

This PR will follow Github's combined commit status. Before this PR,
every commit status could be a combined one.
According to
https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference
> Additionally, a combined state is returned. The state is one of:
> failure if any of the contexts report as error or failure
> pending if there are no statuses or a context is pending
> success if the latest status for all contexts is success

This PR will follow that rule and remove the `NoBetterThan` logic. This
also fixes the inconsistent between UI and API. In the API convert
package, it has implemented this which is different from the UI. It also
fixed the missing `URL` and `CommitURL` in the API.

## `CalcCommitStatus` return nil if there is no commit statuses

The behavior of `CalcCommitStatus` is changed. If the parameter commit
statuses is empty, it will return nil. The reference places should check
the returned value themselves.
2025-06-09 04:05:33 +00:00
silverwind aa2b3b2b1f
Misc CSS fixes (#34638)
1. apply [`text-wrap:
balance`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap#balance)
to various places making the text wrapping nicer, moving
`empty-placeholder` CSS to base because it's not repo-specific.

<img width="537" alt="Screenshot 2025-06-07 at 15 09 00"
src="https://github.com/user-attachments/assets/8b37d031-269d-4ab3-ba59-2ac469c431e4"
/>
<img width="514" alt="Screenshot 2025-06-07 at 15 11 16"
src="https://github.com/user-attachments/assets/27a63117-be1d-4797-80f7-9ed14cca41dc"
/>
<img width="346" alt="Screenshot 2025-06-07 at 15 22 26"
src="https://github.com/user-attachments/assets/2f371384-0330-4a00-bb79-bc3c50ba5c91"
/>

2. fix overflow-related bug on actions run list, before:

<img width="302" alt="Screenshot 2025-06-07 at 15 26 26"
src="https://github.com/user-attachments/assets/d6607eeb-288b-4e81-a770-45a421c9c68c"
/>

After:
<img width="299" alt="Screenshot 2025-06-07 at 15 26 59"
src="https://github.com/user-attachments/assets/b0ddb66f-d4fe-4711-8ed9-eca08ce608f3"
/>
2025-06-07 19:57:07 +02:00
Kemal Zebari 47d69b7749
Validate hex colors when creating/editing labels (#34623)
Resolves #34618.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-07 11:25:08 +03:00
TheFox0x7 b38f2d31fd
add codecommit to supported services in api docs (#34626) 2025-06-07 03:31:34 +00:00
NorthRealm 3f7dbbdaf1
Small fix in Pull Requests page (#34612) 2025-06-06 02:10:42 +00:00
wxiaoguang e8d8984f7c
Fix some trivial problems (#34579) 2025-06-02 15:22:43 +00:00
badhezi d5bbaee64e
Retain issue sort type when a keyword search is introduced (#34559)
Fixes #34523
2025-06-02 08:14:16 +00:00
badhezi 0cec4b84e2
Fix actions skipped commit status indicator (#34507)
Addresses https://github.com/go-gitea/gitea/issues/34500

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-28 11:36:21 -04:00
NorthRealm 4cb0c641ce
Add "View workflow file" to Actions list page (#34538)
This PR adds "View workflow file" to Actions list page, and replaces the
redundant link.

Related #34530

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-28 20:30:00 +08:00
Markus Amshove 50d9565088
Add sort option recentclose for issues and pulls (#34525)
closes #34171 

Adds a new sort option `recentclose` for issues and pull requests which
will return items in a descending order of when they were closed
2025-05-26 16:37:38 +00:00
Bo-Yi Wu 11ee7ff3bf
fix: return 201 Created for CreateVariable API responses (#34517)
- Change CreateVariable API response status from 204 No Content to 201
Created
- Update related integration tests to expect 201 Created instead of 204
No Content

## ⚠️ BREAKING ⚠️

Change the response status code of the Create Variable API under both
Org and Repo levels to `201` instead of 204.

API SDK: https://gitea.com/gitea/go-sdk/pulls/713

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2025-05-26 12:12:49 -04:00
NorthRealm 9b295e984a
Actions list (#34530)
Closes #34524

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-26 20:02:47 +08:00
Lunny Xiao b595f81b79
Performance optimization for tags synchronization (#34355)
The tags synchronization is very slow for a non-mirror repository with
many tags especially forking. This PR make all repositories' tags
synchronization use the same function and remove the low performance
synchronization function. The commit count of tag now will not be stored
into database when syncing. Since the commits count will always be read
from cache or git data, the `NumCommits` in the release table will be
updated for the first read from git data.
2025-05-22 13:54:42 -07:00
a1012112796 28dec9a27d
ui: add a default tab on repo header when migrating (#34503)
Signed-off-by: a1012112796 <1012112796@qq.com>
2025-05-20 11:14:18 -04:00
Bo-Yi Wu d06eb8d801
feat(api): add date range filtering to commit retrieval endpoints (#34497)
- Add support for filtering commits by date range via new "since" and
"until" parameters
- Update API endpoints and command logic to handle the new parameters
for fetching commits within given dates
- Extend API documentation and Swagger specs to describe the new "since"
and "until" query parameters
- Refactor related function signatures and implementations to accept and
pass "since" and "until" values

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-05-19 18:57:58 -07:00
Adam Majer 9cfcc079c7
Export repo's manual merge settings (#34502) 2025-05-19 13:08:00 -04:00
NorthRealm 1e2f3514b9
Add endpoint deleting workflow run (#34337)
Add endpoint deleting workflow run
Resolves #26219

/claim #26219

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-13 19:18:13 +00:00
badhezi 4011e2245b
Fix releases sidebar navigation link (#34436)
Resolves https://github.com/go-gitea/gitea/issues/34435
2025-05-12 16:10:40 -04:00
wxiaoguang 179068fddb
Refactor commit message rendering and fix bugs (#34412)
Fix #34398, fix #33308

Remove all `repo.ComposeCommentMetas` from templates,
only use `repo` to render commit message.
2025-05-09 20:42:35 +08:00
wxiaoguang f63822fe64
Fix autofocus behavior (#34397)
The "autofocus" was abused or misbehaved:

1. When users visit a page but they are not going to change a field,
then the field shouldn't get "autofocus"
* the "auth" / "user" page: in most cases, users do not want to change
the names
    * see also the GitHub's "settings" page behavior.
2. There shouldn't be duplicate "autofocus" inputs in most cases, only
the first one focuses
3. When a panel is shown, the "autofocus" should get focus
    * "add ssh key" panel

This PR fixes all these problems and by the way remove duplicate
"isElemHidden" function.
2025-05-08 18:26:18 +00:00
GWDx 71a1187209
Fix incorrect divergence cache after switching default branch (#34370)
Issue: After switching the default branch, other branches are still
compared against the old default branch due to outdated divergence
cache.

Change: Clear the divergence cache in SetRepoDefaultBranch to ensure
correct comparisons against the new default branch.

Fixes #34369
2025-05-08 18:00:29 +00:00
NorthRealm 4c611bf280
Add a button editing action secret (#34348)
Add a button editing action secret
Closes #34190

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-08 17:11:43 +00:00
Kerwin Bryant bbfc21e74f
Fix "The sidebar of the repository file list does not have a fixed height #34298" (#34321)
There is a known issue where scrolling to the bottom of the page is
affected by unknown elements in the footer area:

24145f8110/templates/base/footer.tmpl (L11-L18)

![after](https://github.com/user-attachments/assets/4cdbce32-d22e-4907-a78b-c8e301017fac)
2025-05-07 21:33:30 +00:00
NorthRealm 6b2c506e05
Grey out expired artifact on Artifacts list (#34314)
Grey out expired artifact on Artifacts list.

![1](https://github.com/user-attachments/assets/79c00e39-29f5-4264-b7b2-7ed638ab71c1)

![2](https://github.com/user-attachments/assets/686b745f-d6d7-4921-8e1b-3472ac8b6c17)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-05-05 21:53:17 -07:00
Lunny Xiao 62f73491f3
Use lfs label for lfs file rather than a long description (#34363)
Before


![image](https://github.com/user-attachments/assets/ed6c9221-5a6a-4717-8178-e5528fd180bf)

After


![image](https://github.com/user-attachments/assets/baa94350-ead4-46bf-b4b7-1bfd3aa5dcac)
2025-05-05 00:07:29 +03:00
bytedream cbb2e52911
Fix repo search input height (#34330)
before:

![before](https://github.com/user-attachments/assets/1abdcb8a-d005-4f35-8d2e-1581fde26e0c)

after:

![after](https://github.com/user-attachments/assets/41dab645-c5a7-4c45-9215-1340fb411130)


The difference is minimal, only a few pixels above and beneath, but it
stands out when switching fast between the tabs on the explore route.
2025-05-01 20:41:54 +00:00
Tobias Balle-Petersen 3e49fba578
feat: return time of last usage for public keys and access tokens in the api (#34323)
In the Gitea GUI, the user can see the time that _AccessTokens_ and
_PublicKeys_ were last used. This information is not returned by the
_/users/{username}/tokens_ and _/user/keys_ endpoints in the API. This
PR adds the missing data.

The time of last usage for for _tokens_ & _keys_ seem to be stored in
the _Updated_ field of the structs internally. For consistency, I have
used the name _updated_at_ for the new field returned by the _API_.
However, for the _API_ user, I don't think that name reflects the data
returned, as I believe it is the time of last usage. I propose that we
use the name _last_used_at_ instead. Let's hear reviewers opinion on
that.

* PublicKey
  1. _last_used_at_: string($date-time)
* AccessToken
  1. _created_at_: string($date-time) (for parity with public keys)
  2. _last_used_at_: string($date-time)

Fix #34313
2025-05-01 21:42:17 +03:00
wxiaoguang ba5c3f8087
Fix some dropdown problems on the issue sidebar (#34308)
Also fix #34300
2025-04-30 02:00:36 +00:00
Kerwin Bryant 1f52304f90
Fix button alignments (#34307)
Continue with #34206.
2025-04-29 16:57:47 +00:00
Kerwin Bryant 2b76993415
support the open-icon of folder (#34168)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-28 19:51:32 -07:00
wxiaoguang 0148d03f21
Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187)
Fix #880

Design:

1. A global setting `security.TWO_FACTOR_AUTH`.
* To support org-level config, we need to introduce a better "owner
setting" system first (in the future)
2. A user without 2FA can login and may explore, but can NOT read or
write to any repositories via API/web.
3. Keep things as simple as possible.
* This option only aggressively suggest users to enable their 2FA at the
moment, it does NOT guarantee that users must have 2FA before all other
operations, it should be good enough for real world use cases.
* Some details and tests could be improved in the future since this
change only adds a check and seems won't affect too much.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-04-28 15:31:59 -07:00
Kerwin Bryant 533b8b2d3d
Fix button alignments (#34276)
Continue with #34206.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-04-27 19:39:03 +00:00
Lunny Xiao 0376c09fc2
Update token creation API swagger documentation (#34288)
Fix #34231
2025-04-27 05:32:15 +00:00
Brecht Van Lommel a9343896f4
Option to delay conflict checking of old pull requests until page view (#27779)
`[repository.pull-request] DELAY_CHECK_FOR_INACTIVE_DAYS` is a new
setting to delay the mergeable check for pull requests that have been
inactive for the specified number of days.

This avoids potentially long delays for big repositories with many pull
requests. and reduces system load overall when there are many
repositories or pull requests.

When viewing the PR, checking will start immediately and the PR merge
box will automatically reload when complete. Accessing the PR through
the API will also start checking immediately.

The default value of `7` provides a balance between system load, and
keeping behavior similar to what it was before both for users and API
access. With `0` all conflict checking will be delayed, while `-1`
always checks immediately to restore the previous behavior.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-24 19:26:57 +00:00
wxiaoguang e625250ffc
Fix various trivial frontend problems (#34263)
1. Fix #20606
2. Fix #34246
3. Fix missing spaces, fix misspells, no visual change.
4. Fix missing "not-mobile", fix #34265

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-04-24 09:11:54 +08:00
wxiaoguang b758241f28
Fix runner list tmpl (#34270)
Fix  #34269

And fix some layout problems.
2025-04-23 15:34:18 +00:00
Kerwin Bryant c2c04ffff7
Add fullscreen mode as a more efficient operation way to view projects (#34081)
Maybe fix #33482, maybe fix #34015

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-23 13:42:22 +08:00
wxiaoguang 4832cb9e27
Display when a release attachment was uploaded (#34261)
Fix #34260
2025-04-22 23:03:49 +08:00
badhezi 1b1d53ab89
Fix Set Email Preference dropdown and button placement (#34255)
Resolves https://github.com/go-gitea/gitea/issues/34209

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-22 10:24:29 +00:00
Kerwin Bryant 714245844f
Update compare.tmpl (#34251)
before:

![1745215925689](https://github.com/user-attachments/assets/36a02f59-b23e-444c-b00a-dd69b81dd910)

after:

![1745215793514](https://github.com/user-attachments/assets/d3f7c228-923a-40bd-9f4c-353947478d0f)
2025-04-21 23:14:38 +00:00
Denys Konovalov 9a071a596f
Add API endpoint to request contents of multiple files simultaniously (#34139)
Adds an API POST endpoint under `/repos/{owner}/{repo}/file-contents`
which receives a list of paths and returns a list of the contents of
these files.

This API endpoint will be helpful for applications like headless CMS
(reference: https://github.com/sveltia/sveltia-cms/issues/198) which
need to retrieve a large number of files by reducing the amount of
needed API calls.

Close #33495

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-22 01:20:11 +08:00
YaFou e947f309b1
Add API routes to lock and unlock issues (#34165)
This pull request adds a GitHub-compatible API endpoint to lock and
unlock an issue.

The following routes exist now:
- `PUT /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to lock an issue
- `DELETE /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to unlock an issue

Fixes #33677
Fixes #20012

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-21 00:43:43 +00:00
wxiaoguang c9aa9068b3
Fix various UI problems (#34243)
Also fix #34242
2025-04-19 08:43:22 +00:00
D eda6d65818
markup: improve code block readability and isolate copy button (#34009)
Fix #33197

Improve the rendering of code blocks in markdown content 
for better readability and UI stability across screen sizes.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-19 05:53:39 +00:00
Kerwin Bryant aeb7005245
Optimize the calling code of queryElems (#34235) 2025-04-19 08:17:07 +08:00
ChristopherHX 21b43fce08
Actions Runner rest api (#33873)
Implements runner apis based on
https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-organization

- Add Post endpoints for registration-token, google/go-github revealed
this as problem
  - We should deprecate Get Endpoints, leaving them for compatibility
- Get endpoint of admin has api path /admin/runners/registration-token
that feels wrong, /admin/actions/runners/registration-token seems more
consistent with user/org/repo api
- Get Runner Api
- List Runner Api
- Delete Runner Api

- Tests admin / user / org / repo level endpoints

Related to #33750 (implements point 1 and 2)
Via needs discovered in #32461, this runner api is needed to allow
cleanup of runners that are deallocated without user interaction.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-18 15:22:41 +00:00