Commit Graph

20434 Commits

Author SHA1 Message Date
GiteaBot
eb020a9d27 [skip ci] Updated translations via Crowdin 2026-03-09 00:49:16 +00:00
silverwind
a52617b816 Clean up refreshViewedFilesSummary (#36868)
1. Use `textContent` instead of `innerHTML` to fix
https://github.com/go-gitea/gitea/security/code-scanning/170.
2. Clean up surrounding code to remove unnecessary `if` checks on
elements that are guaranteed to exist.

---------

Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-03-08 20:49:07 +00:00
Copilot
80c57ec126 Remove util.URLJoin and replace all callers with direct path concatenation (#36867)
`util.URLJoin` was deprecated with unclear semantics (path normalization
via `url.Parse`/`ResolveReference` that surprised callers). This removes
it entirely and replaces all usages with straightforward `"/"` string
concatenation.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
2026-03-09 02:30:54 +08:00
silverwind
23a5bc5e64 Optimize Docker build with dependency layer caching (#36864)
1. Copy dependency manifests before the full source copy so that
dependency installation gets its own cached layer. When only source code
changes, the dependency layers are reused.
2. Remove the `GOPROXY=direct` override which was bypassing the Go
module proxy, causing build failures when git servers are unreachable.
The Go default (`https://proxy.golang.org,direct`) is now used instead.

---------

Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
2026-03-08 15:58:21 +00:00
wxiaoguang
6f8ab6aaaf Fix URLJoin, markup render link reoslving, sign-in/up/linkaccount page common data (#36861)
The logic of "URLJoin" is unclear and it is often abused.

Also:
* Correct the `resolveLinkRelative` behavior
* Fix missing "PathEscape" in `ToTag`
* Fix more FIXMEs, and add new FIXMEs for newly found problems
* Refactor "auth page common template data"
2026-03-08 15:57:37 +00:00
silverwind
0724344a8a Fix CodeQL code scanning alerts (#36858)
Fixes 10 CodeQL code scanning alerts:

- Change `NewPagination`/`SetLinkHeader` to accept `int64` for total
count, clamping internally to fix incorrect-integer-conversion alerts
([#110](https://github.com/go-gitea/gitea/security/code-scanning/110),
[#114](https://github.com/go-gitea/gitea/security/code-scanning/114),
[#115](https://github.com/go-gitea/gitea/security/code-scanning/115),
[#116](https://github.com/go-gitea/gitea/security/code-scanning/116))
- Use `strconv.Atoi()` in `htmlrenderer.go` to avoid int64 intermediate
([#105](https://github.com/go-gitea/gitea/security/code-scanning/105),
[#106](https://github.com/go-gitea/gitea/security/code-scanning/106))
- Clamp regex match indices in `escape_stream.go` to fix
allocation-size-overflow
([#161](https://github.com/go-gitea/gitea/security/code-scanning/161),
[#162](https://github.com/go-gitea/gitea/security/code-scanning/162),
[#163](https://github.com/go-gitea/gitea/security/code-scanning/163))
- Cap slice pre-allocation in `GetIssueDependencies`
([#181](https://github.com/go-gitea/gitea/security/code-scanning/181))

---------

Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-08 14:35:50 +00:00
wxiaoguang
3f1ef703d5 Refactor auth middleware (#36848)
Principles: let the caller decide what it needs, but not let the
framework (middleware) guess what it should do.

Then a lot of hacky code can be removed. And some FIXMEs can be fixed.

This PR introduces a new kind of middleware: "PreMiddleware", it will be
executed before all other middlewares on the same routing level, then a
route can declare its options for other middlewares.

By the way, allow the workflow badge to be accessed by Basic or OAuth2
auth.

Fixes: https://github.com/go-gitea/gitea/pull/36830
Fixes: https://github.com/go-gitea/gitea/issues/36859
2026-03-08 17:59:46 +08:00
github-actions[bot]
a0996cb229 Update Nix flake (#36857)
Automated changes by the
[update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock)
GitHub Action.

```
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/dd9b079' (2026-02-27)
  → 'github:nixos/nixpkgs/aca4d95' (2026-03-06)
```

### Running GitHub Actions on this PR

GitHub Actions will not run workflows on pull requests which are opened
by a GitHub Action.

**To run GitHub Actions workflows on this PR, close and re-open this
pull request.**

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-08 07:04:28 +00:00
silverwind
6e7bc1e635 Update JS deps (#36850)
Gets rid of all open vulns except
https://github.com/microsoft/monaco-editor/issues/5248. Cursorly tested,
works.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-03-08 07:29:27 +01:00
silverwind
130e34994f Load mentionValues asynchronously (#36739)
Eliminate a few database queries on all issue and pull request pages by
moving mention autocomplete data to async JSON endpoints fetched
on-demand when the user types `@`.

See https://github.com/go-gitea/gitea/pull/36739#issuecomment-3963184858
for the full table of affected pages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-07 12:37:37 -08:00
GiteaBot
f250138f57 [skip ci] Updated translations via Crowdin 2026-03-07 00:46:12 +00:00
wxiaoguang
2ce71629c3 Fix dbfs error handling (#36844)
Add tests for opening non-existing files.
2026-03-07 00:28:46 +08:00
Lunny Xiao
f3bdcc58af Fix OAuth2 authorization code expiry and reuse handling (#36797)
- set OAuth2 authorization code `ValidUntil` on creation and add expiry
checks during exchange
- return a specific error when codes are invalidated twice to prevent
concurrent reuse
- add unit tests covering validity timestamps, expiration, and double
invalidation

---
Generate by a coding agent with Codex 5.2

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-06 05:00:44 +00:00
Lunny Xiao
57b5ed3f25 Fix org permission API visibility checks for hidden members and private orgs (#36798)
- fix wrong parameter of HasOrgOrUserVisible in
routers/api/v1/org/org.go
- add integration tests covering the bug fix
- merge permissions API tests

---
Generated by a coding agent with Codex 5.2
2026-03-05 20:32:15 -08:00
Michael Hoang
c710ce34fb Fix non-admins unable to automerge PRs from forks (#36833)
Make `handlePullRequestAutoMerge` correctly check the
permissions of the merging user against pr.BaseRepo.

---------

Co-authored-by: Michael Hoang <enzime@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-03-06 00:03:12 +00:00
Lunny Xiao
9c2c9c5a00 upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (#36837) 2026-03-05 13:42:47 -08:00
Lunny Xiao
833304ac15 Fix dump release asset bug (#36799) 2026-03-05 20:30:57 +00:00
Théo LUDWIG
9fe5b70e3e build(deps): update material-icon-theme v5.32.0 (#36832)
Updated https://github.com/material-extensions/vscode-material-icon-theme to
v5.32.0 and ran `make svg && git add --all`
2026-03-05 11:51:26 -08:00
Lunny Xiao
99b0bf7324 Fix bug to check whether user can update pull request branch or rebase branch (#36465)
When checking whether a user can update a pull request branch or perform
an update via rebase, a maintainer should inherit the pull request
author’s permissions if Allow maintainer edits is enabled.

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-05 11:31:34 -08:00
Lunny Xiao
723ce3579f Fix forwarded proto handling for public URL detection (#36810)
Normalize `X-Forwarded-Proto` related headers to accept only `http`/`https`

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-06 00:31:52 +08:00
ChristopherHX
867c4af481 Fix artifacts v4 backend upload problems (#36805)
* Use base64.RawURLEncoding to avoid equal sign
  * using the nodejs package they seem to get lost
* Support uploads with unspecified length
* Support uploads with a single named blockid
  * without requiring a blockmap

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-05 16:49:01 +01:00
Lunny Xiao
5d87bb3d45 Add a git grep search timeout (#36809) 2026-03-04 12:11:42 -08:00
Tyrone Yeh
79ae9ea97b fix(repo): unify DEFAULT_SHOW_FULL_NAME output in templates and dropdown (#36597)
The design of DefaultShowFullName has some problems, which make the UI
inconsistent, see the new comment in code

This PR does a clean up for various legacy problems, and clarify some
"user name display" behaviors.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-04 21:23:17 +08:00
Lunny Xiao
315b947740 Harden render iframe open-link handling (#36811)
This PR hardens the handling of the “open-link” action in render iframes
(external rendering iframes). It prevents iframes from triggering unsafe
or unintended redirects or opening new windows via postMessage.

Additionally, it improves iframe height reporting to reduce scrollbar
and height mismatch issues, and adds unit test coverage.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-03 23:15:33 -08:00
GiteaBot
b874e0d8e5 [skip ci] Updated translations via Crowdin 2026-03-04 00:47:08 +00:00
OptionalValue
484eacb7bf fix: /repos/{owner}/{repo}/actions/{runs,jobs} requiring owner permissions (#36818)
Resolves #36268

The REST endpoints:

`/repos/{owner}/{repo}/actions/runs`
`/repos/{owner}/{repo}/actions/jobs`

currently require repository/organisation owner permissions, even though
in GitHub they only need simple "read" permissions on the repo.
In the web interface this is implemented correctly, where anyone with
"read" permissions can see the list of action runs.

---------

Co-authored-by: Leonard Immel <l.immel@lipowsky.de>
2026-03-03 11:23:27 -08:00
Copilot
93e3be3018 Fix CRAN package version validation to allow more than 4 version components (#36813)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
2026-03-04 01:56:38 +08:00
silverwind
761b9d439b Fix API not persisting pull request unit config when has_pull_requests is not set (#36718)
The `PATCH /api/v1/repos/{owner}/{repo}` endpoint silently ignores pull
request config fields (like `default_delete_branch_after_merge`,
`allow_squash_merge`, etc.) unless `has_pull_requests: true` is also
included in the request body. This is because the entire PR unit config
block was gated behind `if opts.HasPullRequests != nil`.

This PR restructures the logic so that PR config options are applied
whenever the pull request unit already exists on the repo, without
requiring `has_pull_requests` to be explicitly set. A new unit is only
created when `has_pull_requests: true` is explicitly sent.

Fixes https://github.com/go-gitea/gitea/issues/36466
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-03-02 22:08:53 +00:00
Nicolas
054eb6d8a5 feat: Add Actions API rerun endpoints for runs and jobs (#36768)
This PR adds official REST API endpoints to rerun Gitea Actions workflow
runs and individual jobs:

* POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/rerun
* POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/jobs/{job_id}/rerun

It reuses the existing rerun behavior from the web UI and exposes it
through stable API routes.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-03-02 21:34:06 +00:00
Lunny Xiao
56f23f623a Fix bug when pushing mirror with wiki (#36795)
Fix #36736
2026-03-02 20:58:07 +00:00
Adam Majer
37f6f7f6d4 Pull Request Pusher should be the author of the merge (#36581)
In manual merge detected changes, the pushing user should be the
de-facto author of the merge, not the committer. For ff-only merges, the
author (PR owner) often have nothing to do with the merger. Similarly,
even if a merge commit exists, it does not indicate that the merge
commit author is the merger. This is especially true if the merge commit
is a ff-only merge on a given branch.
    
If pusher is for some reason unavailable, we fall back to the old method
of using committer or owning organization as the author.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-02 20:05:58 +00:00
Lunny Xiao
0e0daa8afe Delete non-exist branch should return 404 (#36694)
Fix #36682

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-02 11:08:16 -08:00
Lunny Xiao
716a800f50 Remove API registration-token (#36801)
Replace #36793

---------

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2026-03-02 10:31:42 -08:00
silverwind
7889b78c87 Add background and run count to actions list page (#36707)
Use flex-container layout and wrap the actions runs list with `ui top
attached header` and `ui attached segment` to add a background. Display
the total workflow run count in the header.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:40:49 +00:00
silverwind
08254cf126 Enable docker layer caching for dry-run and nightly container builds (#36738)
Enable Docker BuildKit layer caching for the dry-run and nightly
container build workflows using GHCR registry cache.

- **Dry-run** (`pull-docker-dryrun.yml`): adds `cache-from`, read-only,
PRs can't write cache
- **Nightly** (`release-nightly.yml`): adds `cache-from` and `cache-to`
to both read and write cach

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:18:46 +00:00
silverwind
c3b1e7372e Add admin badge to navbar avatar (#36790)
Replace the standalone site admin icon in the navbar with a
Discord-style shield badge on the user avatar.

<img width="278" height="73" alt="image"
src="https://github.com/user-attachments/assets/0b074006-30b9-43c6-8ef2-2120e32e139a"
/>


Fixes: https://github.com/go-gitea/gitea/issues/35904

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 20:48:47 +00:00
ChristopherHX
bc9817b317 WorkflowDispatch api optionally return runid (#36706)
Implements
https://github.blog/changelog/2026-02-19-workflow-dispatch-api-now-returns-run-ids

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-01 11:58:16 -08:00
Lunny Xiao
553277b0be upgrade minimatch (#36760) 2026-03-01 10:56:32 -08:00
Zettat123
5b8c8e724f Add never option to PUBLIC_URL_DETECTION configuration (#36785)
Follow up #34250

Docs: https://gitea.com/gitea/docs/pulls/353

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-01 18:33:47 +00:00
wxiaoguang
2c624d4deb Refactor avatar package, support default avatar fallback (#36788)
* Fix #34715
2026-03-01 13:32:35 +00:00
wxiaoguang
1592576fa5 Mark unused&immature activitypub as "not implemented" (#36789)
After many years, "activitypub" is still "in progress" and no real
progress for end users. So it is not mature.

Temporarily mark the endpoints as "501 not implemented",
and wait until the whole design is stable and usable.
2026-03-01 12:59:49 +00:00
shafi-VM
e3cf360154 Add “Copy Source” to markup comment menu (#36726)
Any user with **read access** to a comment can now copy its raw markdown
source via the `···` context menu — no edit permission required.

Closes #36722.

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 09:11:25 +00:00
github-actions[bot]
3ee7a87c8a Update Nix flake (#36787) 2026-03-01 07:56:23 +00:00
Nikita Vakula
649ebeb120 Implements OIDC RP-Initiated Logout (#36724)
At logout time, if the user authenticated via OIDC, we look up the
provider's `end_session_endpoint` (already discovered by Goth from the
OIDC metadata) and redirect there with `client_id` and
`post_logout_redirect_uri`.

Non-OIDC OAuth2 providers (GitHub, GitLab, etc.) are unaffected — they
fall back to local-only logout.

Fix #14270 

---------

Signed-off-by: Nikita Vakula <nikita.vakula@alpsalpine.com>
Co-authored-by: Nikita Vakula <nikita.vakula@alpsalpine.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-01 06:28:26 +00:00
Jim Paris
f02f419173 Fix README symlink resolution in subdirectories like .github (#36775)
Fixes #36774.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-01 05:33:08 +00:00
GiteaBot
48a3a47741 [skip ci] Updated translations via Crowdin 2026-03-01 00:55:03 +00:00
Nicolas
dae2d32186 Correct spelling (#36783)
I was testing typos-cli and fixed some misspelled wording here.
All changes are internal — no public API fields, database columns,
locale keys, or migration names are affected.
2026-02-28 11:23:20 -08:00
xiaox
3b250ba04e refactor: replace legacy tw-flex utility classes with flex-text-block/inline (#36778)
## Summary

Replace combinations of `tw-flex tw-items-center` (with optional
`tw-gap-*`) with semantic `flex-text-block` or `flex-text-inline`
classes across 15 template files.

This follows the refactoring direction outlined in #35015 ("Refactor
legacy `tw-flex tw-items-center tw-gap-xx` to `flex-text-block` or
`flex-text-inline`").

## Changes

### Replacement rules applied:
- `tw-flex tw-items-center tw-gap-2` → `flex-text-block` (both have
`gap: 0.5rem`)
- `tw-flex tw-items-center tw-gap-1` → `flex-text-inline` (both have
`gap: 0.25rem`)
- `tw-flex tw-items-center` (no explicit gap) → `flex-text-block` where
the element is block-level and children benefit from the default gap
- `tw-flex tw-items-center` (inline context, e.g. `<a>`, `<span>`) →
`flex-text-inline`

### Files modified (15):
- `templates/admin/config.tmpl` — config page dt elements
- `templates/admin/repo/unadopted.tmpl` — unadopted repo list items
- `templates/base/head_navbar.tmpl` — active stopwatch popup
- `templates/org/header.tmpl` — org header action buttons
- `templates/org/home.tmpl` — member/team count links
- `templates/org/settings/labels.tmpl` — labels page header
- `templates/repo/branch/list.tmpl` — branch list header
- `templates/repo/commits_table.tmpl` — commits table header
- `templates/repo/diff/box.tmpl` — diff detail box
- `templates/repo/diff/new_review.tmpl` — review form header
- `templates/repo/issue/card.tmpl` — issue card unpin button
- `templates/repo/issue/view_content/attachments.tmpl` — attachment file
size
- `templates/repo/migrate/migrate.tmpl` — migration service cards
- `templates/shared/user/org_profile_avatar.tmpl` — org profile header
- `templates/webhook/new.tmpl` — webhook type dropdown text

### What was NOT changed:
- Elements with `tw-justify-between` or `tw-justify-center` (these need
additional classes)
- Elements whose children use explicit margins (`tw-mr-*`, `tw-ml-*`)
that would conflict with the gap from flex-text classes
- Fomantic UI form elements with special layout requirements

## Notes
- This PR was created with AI assistance (Claude). All changes were
reviewed individually to ensure semantic correctness and zero unintended
visual changes.
- No functional changes — purely CSS class refactoring.

Closes: part of #35015

Signed-off-by: xiaox315 <xiaox315@users.noreply.github.com>
Co-authored-by: xiaox315 <xiaox315@users.noreply.github.com>
2026-02-28 14:03:25 +01:00
silverwind
2e00b2f0bb Fix no-content message not rendering after comment edit (#36733)
When non-empty comment content edited is deleted, it would render a
empty comment body:

<img width="355" height="85" alt="image"
src="https://github.com/user-attachments/assets/3ab9d241-2668-435d-a584-afda2a5b7586"
/>

Fix it so it renders the same placeholder HTML that the server sends for
empty content before edits:

<img width="356" height="109" alt="image"
src="https://github.com/user-attachments/assets/3b54ccde-f7ec-466d-a887-418f4a906d05"
/>
2026-02-27 22:23:21 +00:00
yshyuk
b24780b3a3 Fix typos and grammar in English locale (#36751)
Fix several English locale issues as suggested in #35015:

- Rename `enterred` to `entered` in locale keys
(`form.enterred_invalid_*`)
  and update all Go source references accordingly
- Fix subject-verb agreement in `oauth2_applications_desc` and
  `oauth2_application_create_description`
- Improve awkward phrasing in `startpage.license_desc`

Only `locale_en-US.json` is modified; other locales are managed by
Crowdin.

Ref #35015

---------

Signed-off-by: yshyuk <dbsrbtkd94@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:25:23 +00:00