]> source.dussan.org Git - gitea.git/log
gitea.git
6 months agouse existing oauth grant for public client (#31015) (#31041) release/v1.21
Giteabot [Tue, 21 May 2024 17:33:00 +0000 (01:33 +0800)]
use existing oauth grant for public client (#31015) (#31041)

Backport #31015 by @denyskon

Do not try to create a new authorization grant when one exists already,
thus preventing a DB-related authorization issue.

Fix https://github.com/go-gitea/gitea/pull/30790#issuecomment-2118812426

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
6 months agoMove reverproxyauth before session so the header will not be ignored even if user...
Giteabot [Sun, 12 May 2024 02:26:01 +0000 (10:26 +0800)]
Move reverproxyauth before session so the header will not be ignored even if user has login (#27821) (#30947)

Backport #27821 by @lunny

When a user logout and then login another user, the reverseproxy auth
should be checked before session otherwise the old user is still login.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
6 months agoUpdate issue indexer after merging a PR (#30715) (#30910)
Zettat123 [Thu, 9 May 2024 07:15:34 +0000 (15:15 +0800)]
Update issue indexer after merging a PR (#30715) (#30910)

Backport #30715
Fix #30684

6 months agoFix network error when open/close organization/individual projects and redirect to...
yp05327 [Thu, 9 May 2024 06:44:43 +0000 (15:44 +0900)]
Fix network error when open/close organization/individual projects and redirect to project page (#30387) (#30911)

Backport #30387
Fix #30901

6 months agoPerform Newest sort type correctly when sorting issues (#30644) (#30847)
Giteabot [Fri, 3 May 2024 08:52:18 +0000 (16:52 +0800)]
Perform Newest sort type correctly when sorting issues (#30644) (#30847)

Backport #30644 by kemzeb

Should resolve #30642.

Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
6 months agoPrevent automatic OAuth grants for public clients (#30790) (#30835)
Giteabot [Thu, 2 May 2024 18:39:48 +0000 (02:39 +0800)]
Prevent automatic OAuth grants for public clients (#30790) (#30835)

Backport #30790 by archer-321

This commit forces the resource owner (user) to always approve OAuth 2.0
authorization requests if the client is public (e.g. native
applications).

As detailed in [RFC 6749 Section
10.2](https://www.rfc-editor.org/rfc/rfc6749.html#section-10.2),

> The authorization server SHOULD NOT process repeated authorization
requests automatically (without active resource owner interaction)
without authenticating the client or relying on other measures to ensure
that the repeated request comes from the original client and not an
impersonator.

With the implementation prior to this patch, attackers with access to
the redirect URI (e.g., the loopback interface for
`git-credential-oauth`) can get access to the user account without any
user interaction if they can redirect the user to the
`/login/oauth/authorize` endpoint somehow (e.g., with `xdg-open` on
Linux).

Fixes #25061.

Co-authored-by: Archer <archer@beezig.eu>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
6 months agoUpgrade binding to fix bug (#30742)
Lunny Xiao [Thu, 2 May 2024 11:01:16 +0000 (19:01 +0800)]
Upgrade binding to fix bug (#30742)

Fix #30518

6 months agoDon't have `redis-cluster` as possible cache/session adapter in docs (#30794) (#30806)
Kemal Zebari [Wed, 1 May 2024 22:24:38 +0000 (15:24 -0700)]
Don't have `redis-cluster` as possible cache/session adapter in docs (#30794) (#30806)

6 months agoGet repo assignees and reviewers should ignore deactivated users (#30770) (#30783)
6543 [Tue, 30 Apr 2024 13:20:34 +0000 (15:20 +0200)]
Get repo assignees and reviewers should ignore deactivated users (#30770) (#30783)

Backport https://github.com/go-gitea/gitea/pull/30770

If an user is deactivated, it should not be in the list of users who are
suggested to be assigned or review-requested.

old assignees or reviewers are not affected.

---
*Sponsored by Kithara Software GmbH*

6 months agoFix duplicate status check contexts (#30660) (#30776)
Zettat123 [Tue, 30 Apr 2024 08:01:57 +0000 (16:01 +0800)]
Fix duplicate status check contexts (#30660) (#30776)

Backport #30660.

Caused by #30076.

There may be some duplicate status check contexts when setting status
checks for a branch protection rule. The duplicate contexts should be
removed.

Before:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/97f4de2d-4868-47a3-8a99-5a180f9ac0a3"
width="600px" />

After:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/ff7289c5-9793-4090-ba31-e8cb3c85f8a3"
width="600px" />

6 months agoSuppress browserslist warning in webpack target (#30571) (#30727)
Giteabot [Sat, 27 Apr 2024 14:06:06 +0000 (22:06 +0800)]
Suppress browserslist warning in webpack target (#30571) (#30727)

Backport #30571 by @silverwind

1. Set
[`BROWSERSLIST_IGNORE_OLD_DATA`](https://github.com/browserslist/browserslist/blob/c6ddf7b3870a4585822d06ec77e8dd2401b8e1ed/node.js#L400)
to avoid warning on outdated browserslist data which the end user can
likely not do anything about and which is currently visible in the v1.21
branch.
2. Suppress all command echoing and add a "Running webpack..." message
in place.

Warning in question was this:

```
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
```

Co-authored-by: silverwind <me@silverwind.io>
6 months agoUpdate mermaid and its dependencies (#30714)
silverwind [Sat, 27 Apr 2024 07:30:14 +0000 (09:30 +0200)]
Update mermaid and its dependencies (#30714)

Update mermaid and its dependencies on v1.21. Should fix
https://github.com/go-gitea/gitea/issues/30596 because it includes the
fixed version of the `cytoscape` indirect dependency.

6 months agoUpdate generate-images dependencies and rebuild (#30689)
silverwind [Thu, 25 Apr 2024 16:30:33 +0000 (18:30 +0200)]
Update generate-images dependencies and rebuild (#30689)

This upgrades `generate-images.js` on v1.21 to the latest version from
main branch and I ran it which generated some minor diff in the SVGs. It
fixes one issue mentioned in
https://github.com/go-gitea/gitea/issues/30596#issuecomment-2075483451
by removing `--no-package-lock`.

6 months agoInterpolate runs-on with variables when scheduling tasks(#30640) (#30672)
sillyguodong [Wed, 24 Apr 2024 20:37:05 +0000 (04:37 +0800)]
Interpolate runs-on with variables when scheduling tasks(#30640) (#30672)

backport: #30640

Co-authored-by: Giteabot <teabot@gitea.io>
6 months agoAdd a db consistency check to remove runners that do not belong to a repository ...
Zettat123 [Wed, 24 Apr 2024 00:08:06 +0000 (08:08 +0800)]
Add a db consistency check to remove runners that do not belong to a repository (#30614) (#30653)

Backport #30614

6 months agoDOC: in ssh forwarding, user git must be allowed to run docker (#29634)
Christoph Lange [Tue, 23 Apr 2024 18:08:58 +0000 (20:08 +0200)]
DOC: in ssh forwarding, user git must be allowed to run docker (#29634)

Added to doc for rootless Docker installation: for SSH passthrough, the
ssh user (git) has to be able to run docker.

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
6 months agoFix wrong table name (#30557) (#30652)
Lunny Xiao [Tue, 23 Apr 2024 09:44:31 +0000 (17:44 +0800)]
Fix wrong table name (#30557) (#30652)

Backport #30557

The table name should be `oauth2_application` but `o_auth2_application`

Caused by

https://github.com/go-gitea/gitea/pull/21316/files#diff-9610efbc608a41f1f2eaff5790423f0a187906f6ff0beb23a5e8d18366cc2ccfR38

6 months agoShow more settings for empty repositories (#29130) (#30635)
Lunny Xiao [Tue, 23 Apr 2024 09:15:44 +0000 (17:15 +0800)]
Show more settings for empty repositories (#29130) (#30635)

Fix #30620
Manullay Backport #29130

Shows more settings for empty repositories (Fixes #29060)

Co-authored-by: Tim-Nicas Oelschläger <72873130+zokkis@users.noreply.github.com>
6 months agoFix queue test (#30646) (#30650)
wxiaoguang [Tue, 23 Apr 2024 08:30:32 +0000 (16:30 +0800)]
Fix queue test (#30646) (#30650)

Backport #30553 and #30646

6 months agoUse maintained gziphandler (#30592) (#30638)
Lunny Xiao [Tue, 23 Apr 2024 02:39:27 +0000 (10:39 +0800)]
Use maintained gziphandler (#30592) (#30638)

Replace #27894
Backport #30592

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoEnable npm cache on `setup-node` action (#30577) (#30590)
Lunny Xiao [Mon, 22 Apr 2024 06:27:13 +0000 (14:27 +0800)]
Enable npm cache on `setup-node` action (#30577) (#30590)

Backport #30577

Enable npm dependency cache in
[setup-node](https://github.com/actions/setup-node). This should work
reliably and across branches as well.

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoUse action user as the trigger user of schedules (#30581) (#30609)
Giteabot [Sat, 20 Apr 2024 02:46:17 +0000 (10:46 +0800)]
Use action user as the trigger user of schedules (#30581) (#30609)

Backport #30581 by @yp05327

Follow https://github.com/go-gitea/gitea/pull/30357

When user push to default branch, the schedule trigger user will be the
user.
When disable then enable action units in settings, the schedule trigger
user will be action user.
When repo is a mirror, the schedule trigger user will be action user. (
before it will return error, fixed by #30357)

As scheduled job is a cron, the trigger user should be action user from
Gitea, not a real user.

Co-authored-by: yp05327 <576951401@qq.com>
7 months agoFix commit file status parser (#30602) (#30606)
Giteabot [Fri, 19 Apr 2024 15:16:02 +0000 (23:16 +0800)]
Fix commit file status parser (#30602) (#30606)

Backport #30602 by wxiaoguang

Try to fix  #30492

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoFix HEAD method for robots.txt (#30603) (#30604)
Giteabot [Fri, 19 Apr 2024 14:43:50 +0000 (22:43 +0800)]
Fix HEAD method for robots.txt (#30603) (#30604)

Backport #30603 by wxiaoguang

Fix #30601

7 months agoFix project description rendering for org (#30587) (#30599)
wxiaoguang [Fri, 19 Apr 2024 13:28:18 +0000 (21:28 +0800)]
Fix project description rendering for org (#30587) (#30599)

Backport #30587

Manually tested with 1.21:

![image](https://github.com/go-gitea/gitea/assets/2114189/fbe9a2c9-0563-4d69-bcdb-8e5e41f288a1)

7 months agoFix changelog (1.21) (#30583)
wxiaoguang [Fri, 19 Apr 2024 10:20:09 +0000 (18:20 +0800)]
Fix changelog (1.21) (#30583)

7 months agoAvoid importing `modules/web/middleware` in `modules/session` (#30584) (#30588)
Giteabot [Fri, 19 Apr 2024 07:18:11 +0000 (15:18 +0800)]
Avoid importing `modules/web/middleware` in `modules/session` (#30584) (#30588)

Backport #30584 by @wolfogre

Related to #30375.

It doesn't make sense to import `modules/web/middleware` and
`modules/setting` in `modules/web/session` since the last one is more
low-level.

And it looks like a workaround to call `DeleteLegacySiteCookie` in
`RegenerateSession`, so maybe we could reverse the importing by
registering hook functions.

Co-authored-by: Jason Song <i@wolfogre.com>
7 months agoFixup app.example.ini for task section, which is now queue.task (#30555) (#30562)
Giteabot [Thu, 18 Apr 2024 13:15:50 +0000 (21:15 +0800)]
Fixup app.example.ini for task section, which is now queue.task (#30555) (#30562)

Backport #30555 by xor-gate

Config section `[task]` has been deprecated in favor of `[queue.task]`

Co-authored-by: Jerry Jacobs <xor-gate@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoDisable enter key for accepting code completion in Monaco (#30548) (#30558)
Giteabot [Thu, 18 Apr 2024 09:38:24 +0000 (17:38 +0800)]
Disable enter key for accepting code completion in Monaco (#30548) (#30558)

Backport #30548 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: silverwind <me@silverwind.io>
7 months agoFix empty field login_name in API response JSON when creating user (#30511) (#30532)
yp05327 [Wed, 17 Apr 2024 09:06:12 +0000 (18:06 +0900)]
Fix empty field login_name in API response JSON when creating user (#30511) (#30532)

Backport #30511
Fix ci error in #30515

7 months agoFix cache bug (#30510) v1.21.11
Lunny Xiao [Tue, 16 Apr 2024 02:59:15 +0000 (10:59 +0800)]
Fix cache bug (#30510)

Cache cannot be disabled from v1.22. So it still maybe `nil` in v1.21,
we have to check whether cache is `nil`.

7 months agoUpdate 1.21.11 changelog (#30403)
Lunny Xiao [Tue, 16 Apr 2024 02:10:47 +0000 (10:10 +0800)]
Update 1.21.11 changelog (#30403)

Add #30394 into changelog

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: yp05327 <576951401@qq.com>
7 months agoFix code owners will not be mentioned when a pull request comes from a forked reposit...
Lunny Xiao [Tue, 16 Apr 2024 00:27:01 +0000 (08:27 +0800)]
Fix code owners will not be mentioned when a pull request comes from a forked repository (#30476) (#30497)

Backport #30476
Fix #30277
Caused by #29783

7 months agoFix commit status cache which missed target_url (#30426) (#30445)
Lunny Xiao [Mon, 15 Apr 2024 07:43:20 +0000 (15:43 +0800)]
Fix commit status cache which missed target_url (#30426) (#30445)

Fix #30421
Backport #30426

Co-authored-by: Jason Song <i@wolfogre.com>
7 months agoAvoid losing token when updating mirror settings (#30429) (#30466)
Lunny Xiao [Mon, 15 Apr 2024 03:29:42 +0000 (11:29 +0800)]
Avoid losing token when updating mirror settings (#30429) (#30466)

Fix #30416.
Backport #30429

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of

https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

Co-authored-by: Jason Song <i@wolfogre.com>
7 months agoChange the default maxPerPage for gitbucket (#30392) (#30471)
Lunny Xiao [Sun, 14 Apr 2024 12:42:50 +0000 (20:42 +0800)]
Change the default maxPerPage for gitbucket (#30392) (#30471)

Backport #30392

This patch improves the migration from gitbucket to gitea.

The gitbucket uses it's own internal perPage value (= 25) for paging and
ignore per_page arguments in the requested URL. This cause gitea to
migrate only 25 issues and 25 PRs from gitbucket repository. This may
not happens on old gitbucket. But recent gitbucket 4.40 or 4.38.4 has
this problem.

This patch change to use this internally hardcoded perPage of gitbucket
as gitea's maxPerPage numer when migrating from gitbucket. There are
several perPage values in gitbucket like 25 for Isseus/PRs and 10 for
Releases. Some of those API doesn't support paging yet. It sounds
difficult to implement, but using the minimum number among them worked
out very well. So, I use 10 in this patch.

Brief descriptions of problems and this patch are also available in
https://github.com/go-gitea/gitea/issues/30316.

In addition, I'm not sure what kind of test cases are possible to write
here. It's a test for migration, so it requires testing gitbucket server
and gitea server, I guess. Please let me know if it is possible to write
such test cases here. Thanks!

Co-authored-by: Kazushi (Jam) Marukawa <jam@pobox.com>
7 months agoFix mirror error when mirror repo is empty (#30432) (#30467)
yp05327 [Sun, 14 Apr 2024 12:18:06 +0000 (21:18 +0900)]
Fix mirror error when mirror repo is empty (#30432) (#30467)

Backport #30432
Fix https://github.com/go-gitea/gitea/issues/30424

ps: convert `gitrepo.OpenRepository` to `git.OpenRepository`
remove `ctx` from `checkAndUpdateEmptyRepository`

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agofix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30468)
Giteabot [Sun, 14 Apr 2024 11:45:51 +0000 (19:45 +0800)]
fix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30468)

Backport #30375 by @jtran

Cookies may exist on "/subpath" and "/subpath/" for some legacy reasons
(eg: changed CookiePath behavior in code). The legacy cookie should be
removed correctly.

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Kyle D <kdumontnu@gmail.com>
7 months agoUse db.ListOptions directly instead of Paginator interface to make iteasier to use...
Lunny Xiao [Sat, 13 Apr 2024 17:44:57 +0000 (01:44 +0800)]
Use db.ListOptions directly instead of Paginator interface to make iteasier to use and fix performance of /pulls and /issues (#29990) (#30447)

backport #29990

This PR uses `db.ListOptions` instead of `Paginor` to make the code
simpler.
And it also fixed the performance problem when viewing /pulls or
/issues. Before the counting in fact will also do the search.

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoUpgrade go-sqlite to v1.14.22 (#30462)
Lunny Xiao [Sat, 13 Apr 2024 13:33:50 +0000 (21:33 +0800)]
Upgrade go-sqlite to v1.14.22 (#30462)

7 months agoFix rename branch 500 when the target branch is deleted but exist in database (#30430...
Giteabot [Fri, 12 Apr 2024 15:09:16 +0000 (23:09 +0800)]
Fix rename branch 500 when the target branch is deleted but exist in database (#30430) (#30437)

Backport #30430 by @lunny

Fix #30428

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
7 months agoCheck the token's owner and repository when registering a runner (#30406) (#30412)
Zettat123 [Thu, 11 Apr 2024 11:29:53 +0000 (19:29 +0800)]
Check the token's owner and repository when registering a runner (#30406) (#30412)

Backport #30406

Fix #30378

7 months agoAvoid user does not exist error when detecting schedule actions when the commit autho...
Giteabot [Thu, 11 Apr 2024 07:39:27 +0000 (15:39 +0800)]
Avoid user does not exist error when detecting schedule actions when the commit author is an external user  (#30357) (#30408)

Backport #30357 by @yp05327

![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76)

When repo is a mirror, and commit author is an external user, then
`GetUserByEmail` will return error.

reproduce/test:
- mirror Gitea to your instance
- disable action and enable it again, this will trigger
`DetectAndHandleSchedules`

ps: also follow #24706, it only fixed normal runs, not scheduled runs.

Co-authored-by: yp05327 <576951401@qq.com>
7 months agoUpdate actions variables documents (#30394) (#30404)
Giteabot [Thu, 11 Apr 2024 04:04:21 +0000 (12:04 +0800)]
Update actions variables documents (#30394) (#30404)

Backport #30394 by @lunny

Fix #30393

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Zettat123 <zettat123@gmail.com>
7 months agoNo global variables (#30402)
Jason Song [Thu, 11 Apr 2024 03:25:05 +0000 (11:25 +0800)]
No global variables (#30402)

Fix #30361, regression of #29782 which is a backport, not the original
#29468.

#29468 did a small refactor which introduced a new function
`GetVariablesOfRun`. However, it's designed for v1.22 which supports
global variables.

After backporting it to v1.21, it will still try to get global
variables, which causes it to retrieve all variables.

7 months agoAdd changelog for 1.21.11 (#30314)
Lunny Xiao [Thu, 11 Apr 2024 02:52:02 +0000 (10:52 +0800)]
Add changelog for 1.21.11 (#30314)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoPerformance optimization for git push (#30104) (#30354)
Lunny Xiao [Wed, 10 Apr 2024 06:12:19 +0000 (14:12 +0800)]
Performance optimization for git push (#30104) (#30354)

Agit returned result should be from `ProcReceive` hook but not
`PostReceive` hook. Then for all non-agit pull requests, it will not
check the pull requests for every pushing `refs/pull/%d/head`.

Backport #30104

7 months agoFix create commit status (#30225) (#30340)
Lunny Xiao [Mon, 8 Apr 2024 23:30:55 +0000 (07:30 +0800)]
Fix create commit status (#30225) (#30340)

Partially backport #30223

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.

7 months agoFix possible renderer security problem(#30136) (#30315)
Lunny Xiao [Mon, 8 Apr 2024 22:24:35 +0000 (06:24 +0800)]
Fix possible renderer security problem(#30136) (#30315)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoClose file in the Upload func (#30262) (#30269)
Giteabot [Wed, 3 Apr 2024 15:20:18 +0000 (23:20 +0800)]
Close file in the Upload func (#30262) (#30269)

Co-authored-by: guangwu <guoguangwu@magic-shield.com>
7 months agoAdd -u git to docs when using docker exec with root installation (#29314) (#30264)
Giteabot [Wed, 3 Apr 2024 13:44:11 +0000 (21:44 +0800)]
Add -u git to docs when using docker exec with root installation (#29314) (#30264)

Backport #29314 by @scribblemaniac

This fixes a minor issue in the documentation for SSH Container
Passthrough for non-rootless installs. The non-rootless Dockerfile and
docker-compose do not set `USER`/`user` instructions so `docker exec`
will run as root by default. While running as root, gitea commands will
refuse to execute, breaking these approaches. For containers built with
the rootless instructions, `docker exec` will run as git by default so
this is not necessary in that case.

This issue was already discussed in #19065, but it does not appear this
part of the issue was ever added to the documentation.

Co-authored-by: scribblemaniac <scribblemaniac@users.noreply.github.com>
7 months agoFixes #27605: inline math blocks can't be preceeded/followed by alphanumerical charac...
Giteabot [Wed, 3 Apr 2024 06:06:39 +0000 (14:06 +0800)]
Fixes #27605: inline math blocks can't be preceeded/followed by alphanumerical characters (#30175) (#30250)

Backport #30175 by @jmlt2002

- Inline math blocks couldn't be preceeded or succeeded by
alphanumerical characters due to changes introduced in PR #21171.
Removed the condition that caused this (precedingCharacter condition)
and added a new exit condition of the for-loop that checks if a specific
'$' was escaped using '\' so that the math expression can be rendered as
intended.
- Additionally this PR fixes another bug where math blocks of the type
'$xyz$abc$' where the dollar sign was not escaped by the user, generated
an error (shown in the screenshots below)
- Altered the tests to accomodate for the changes

Former behaviour (from try.gitea.io):

![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235)

Fixed behaviour (from my local build):

![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d)

(Edit) Source code for the README.md file:
```
$x$ -$x$ $x$-

a$xa$ $xa$a 1$xb$ $xb$1

$a a$b b$

a$b $a a$b b$

$a a\$b b$
```

Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt>
Co-authored-by: João Tiago <114936010+jmlt2002@users.noreply.github.com>
7 months agoAdd -u git to docs when using docker exec with root installation (#29314) (#30258)
Giteabot [Wed, 3 Apr 2024 05:44:13 +0000 (13:44 +0800)]
Add -u git to docs when using docker exec with root installation (#29314) (#30258)

Backport #29314 by @scribblemaniac

This fixes a minor issue in the documentation for SSH Container
Passthrough for non-rootless installs. The non-rootless Dockerfile and
docker-compose do not set `USER`/`user` instructions so `docker exec`
will run as root by default. While running as root, gitea commands will
refuse to execute, breaking these approaches. For containers built with
the rootless instructions, `docker exec` will run as git by default so
this is not necessary in that case.

This issue was already discussed in #19065, but it does not appear this
part of the issue was ever added to the documentation.

Co-authored-by: scribblemaniac <scribblemaniac@users.noreply.github.com>
7 months agoFix missing 0 prefix of GPG key id (#30245) (#30247)
Giteabot [Tue, 2 Apr 2024 16:13:07 +0000 (00:13 +0800)]
Fix missing 0 prefix of GPG key id (#30245) (#30247)

Backport #30245 by @KN4CK3R

Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
7 months agoInclude encoding in signature payload (#30174) (#30181)
Giteabot [Mon, 1 Apr 2024 01:47:11 +0000 (09:47 +0800)]
Include encoding in signature payload (#30174) (#30181)

Backport #30174 by @KN4CK3R

Fixes #30119

Include the encoding in the signature payload.

before

![grafik](https://github.com/go-gitea/gitea/assets/1666336/01ab94a3-8af5-4d6f-be73-a10b65a15421)

after

![grafik](https://github.com/go-gitea/gitea/assets/1666336/3a37d438-c70d-4d69-b178-d170e74aa683)

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
7 months agoMove from `max( id )` to `max( index )` for latest commit statuses (#30076) (#30155)
YR Chen [Thu, 28 Mar 2024 16:29:38 +0000 (00:29 +0800)]
Move from `max( id )` to `max( index )` for latest commit statuses (#30076) (#30155)

Backport https://github.com/go-gitea/gitea/pull/30076.

This PR replaces the use of `max( id )`, and instead using ``max(
`index` )`` for determining the latest commit status. Building business
logic over an `auto_increment` primary key like `id` is risky and
there’re already plenty of discussions on the Internet.

There‘s no guarantee for `auto_increment` values to be monotonic,
especially upon failures or with a cluster. In the specific case, we met
the problem of commit statuses being outdated when using TiDB as the
database. As [being
documented](https://docs.pingcap.com/tidb/stable/auto-increment),
`auto_increment` values assigned to an `insert` statement will only be
monotonic on a per server (node) basis.

Closes #30074.

7 months agoLoad attachments for code comments (#30124) (#30126)
yp05327 [Wed, 27 Mar 2024 08:06:23 +0000 (17:06 +0900)]
Load attachments for code comments (#30124) (#30126)

backport #30124

7 months agoFix gitea doctor will remove repo-avatar files when execute command storage-archives...
yp05327 [Wed, 27 Mar 2024 02:09:17 +0000 (11:09 +0900)]
Fix gitea doctor will remove repo-avatar files when execute command storage-archives (#30094) (#30120)

backport #30094

7 months agoFix possible data race on tests (#30093) (#30108)
Lunny Xiao [Tue, 26 Mar 2024 15:49:48 +0000 (23:49 +0800)]
Fix possible data race on tests (#30093) (#30108)

backport #30093

7 months agoFix duplicate migrated milestones (#30102) (#30105)
yp05327 [Tue, 26 Mar 2024 12:58:56 +0000 (21:58 +0900)]
Fix duplicate migrated milestones (#30102) (#30105)

backport #30102

7 months agoFix panic for fixBrokenRepoUnits16961 (#30068) (#30100)
yp05327 [Tue, 26 Mar 2024 10:20:03 +0000 (19:20 +0900)]
Fix panic for fixBrokenRepoUnits16961 (#30068) (#30100)

backport #30068

7 months agoUpdate katex to 0.16.10 (#30089)
silverwind [Tue, 26 Mar 2024 01:42:37 +0000 (02:42 +0100)]
Update katex to 0.16.10 (#30089)

https://github.com/KaTeX/KaTeX/releases/tag/v0.16.10

---------

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoFix incorrect SVGs (#30087)
silverwind [Tue, 26 Mar 2024 00:10:24 +0000 (01:10 +0100)]
Fix incorrect SVGs (#30087)

Just the SVG fixes from https://github.com/go-gitea/gitea/pull/30086 for
v1.21 branch.

7 months agoRelease of 1.21.10 (#30073) v1.21.10
Lunny Xiao [Mon, 25 Mar 2024 23:46:08 +0000 (07:46 +0800)]
Release of 1.21.10 (#30073)

The main reason for this release is to fix a bug #29997

7 months agoFix Add/Remove WIP on pull request title failure (#29999) (#30066)
Lunny Xiao [Mon, 25 Mar 2024 09:26:05 +0000 (17:26 +0800)]
Fix Add/Remove WIP on pull request title failure (#29999) (#30066)

Fix #29997
Backport #29999

7 months agoFix misuse of `TxContext` (#30061) (#30062)
Giteabot [Mon, 25 Mar 2024 07:22:09 +0000 (15:22 +0800)]
Fix misuse of `TxContext` (#30061) (#30062)

Backport #30061 by @wolfogre

Help #29999, or its tests cannot pass.

Also, add some comments to clarify the usage of `TxContext`.

I don't check all usages of `TxContext` because there are too many
(almost 140+). It's a better idea to replace them with `WithTx` instead
of checking them one by one. However, that may be another refactoring
PR.

Co-authored-by: Jason Song <i@wolfogre.com>
7 months agoRespect DEFAULT_ORG_MEMBER_VISIBLE setting when adding creator to org (#30013) (...
Giteabot [Sun, 24 Mar 2024 05:38:31 +0000 (13:38 +0800)]
Respect DEFAULT_ORG_MEMBER_VISIBLE setting when adding creator to org (#30013) (#30035)

Backport #30013 by @DrMaxNix

This PR adds `setting.Service.DefaultOrgMemberVisible` value to dataset
of user when the initial org creator is being added to the created org.

Fixes #30012.

Co-authored-by: DrMaxNix <mail@drmaxnix.de>
7 months agoEscape paths for find file correctly (#30026) (#30031)
wxiaoguang [Sat, 23 Mar 2024 16:21:57 +0000 (00:21 +0800)]
Escape paths for find file correctly (#30026) (#30031)

Backport #30026

7 months agoRemove duplicate option in admin screen and now-unused translation keys (#28492)...
wxiaoguang [Sat, 23 Mar 2024 14:56:19 +0000 (22:56 +0800)]
Remove duplicate option in admin screen and now-unused translation keys (#28492) (#30024)

Backport #28492
Fix #30019

Co-authored-by: The Magician <142242365+TheMagician23@users.noreply.github.com>
8 months agoSmall refactors in anchors.js (#29947) (#30003)
Giteabot [Fri, 22 Mar 2024 14:02:05 +0000 (22:02 +0800)]
Small refactors in anchors.js (#29947) (#30003)

Backport #29947 by @silverwind

Some minor refactors, remove unnecessary `:is` selector and move the
`:target` check out of the function. Might as well backport for the rare
browser that does not support `:is`.

Co-authored-by: silverwind <me@silverwind.io>
8 months agoFix manual merge form and 404 page templates (#30000)
wxiaoguang [Fri, 22 Mar 2024 11:42:41 +0000 (19:42 +0800)]
Fix manual merge form and 404 page templates (#30000)

Partially backport #29985, fix some template errors.

* fix the manual-merge form
* fix the 404 page

8 months agoAdd changelog for 1.21.9 (#29971) v1.21.9
Lunny Xiao [Fri, 22 Mar 2024 04:32:44 +0000 (12:32 +0800)]
Add changelog for 1.21.9 (#29971)

Co-authored-by: Jason Song <i@wolfogre.com>
8 months agoFix bugs in rerunning jobs (#29955) (#29983)
Giteabot [Fri, 22 Mar 2024 03:57:10 +0000 (11:57 +0800)]
Fix bugs in rerunning jobs (#29955) (#29983)

Backport #29955 by @Zettat123

Fix #28761
Fix #27884
Fix #28093

## Changes

### Rerun all jobs
When rerun all jobs, status of the jobs with `needs` will be set to
`blocked` instead of `waiting`. Therefore, these jobs will not run until
the required jobs are completed.

### Rerun a single job
When a single job is rerun, its dependents should also be rerun, just
like GitHub does
(https://github.com/go-gitea/gitea/issues/28761#issuecomment-2008620820).
In this case, only the specified job will be set to `waiting`, its
dependents will be set to `blocked` to wait the job.

### Show warning if every job has `needs`
If every job in a workflow has `needs`, all jobs will be blocked and no
job can be run. So I add a warning message.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b"
width="480px" />

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoPerformance improvements for pull request list page (#29900) (#29972)
Lunny Xiao [Fri, 22 Mar 2024 01:58:04 +0000 (09:58 +0800)]
Performance improvements for pull request list page (#29900) (#29972)

This PR will avoid load pullrequest.Issue twice in pull request list
page. It will reduce x times database queries for those WIP pull
requests.

Partially fix #29585
Backport #29900

8 months agoFix the bug that user may logout if GetUserByID return unknow error (#29964)
Lunny Xiao [Thu, 21 Mar 2024 14:30:55 +0000 (22:30 +0800)]
Fix the bug that user may logout if GetUserByID return unknow error (#29964)

backport #29962

This PR fixed a bug when the user switching pages too fast, he will
logout automatically.

The reason is that when the error is context cancelled, the previous
code think user hasn't login then the session will be deleted. Now it
will return the errors but not think it's not login.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
8 months agoSolving the issue of UI disruption when the review is deleted without refreshing...
HEREYUA [Thu, 21 Mar 2024 14:03:01 +0000 (22:03 +0800)]
Solving the issue of UI disruption when the review is deleted without refreshing (#29951) (#29968)

backport #29951

8 months agoFix and rewrite markup anchor processing (#29931) (#29946)
Giteabot [Wed, 20 Mar 2024 23:09:08 +0000 (07:09 +0800)]
Fix and rewrite markup anchor processing (#29931) (#29946)

Backport #29931 by @lunny

Fix #29877

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
8 months agoFix loadOneBranch panic (#29938) (#29939)
wxiaoguang [Wed, 20 Mar 2024 14:31:32 +0000 (22:31 +0800)]
Fix loadOneBranch panic (#29938) (#29939)

Backport #29938

Try to fix #29936

Far from ideal, but still better than panic.

8 months agoAdd cache for dashbaord commit status (#29932)
Lunny Xiao [Wed, 20 Mar 2024 10:34:40 +0000 (18:34 +0800)]
Add cache for dashbaord commit status (#29932)

backport #29444

8 months agoShow Actions post step when it's running (#29926) (#29928)
Giteabot [Wed, 20 Mar 2024 06:25:11 +0000 (14:25 +0800)]
Show Actions post step when it's running (#29926) (#29928)

Backport #29926 by @wolfogre

The post step was always waiting, even if all steps were done. Then,
once the task was done, the post step became success immediately.

Before:

<img width="915" alt="xnip_240320_120228"
src="https://github.com/go-gitea/gitea/assets/9418365/00347430-f998-4c43-917a-bf6dd6d0e333">

After:

<img width="905" alt="xnip_240320_120443"
src="https://github.com/go-gitea/gitea/assets/9418365/a419b111-17c2-4029-a022-c761cc419091">

Co-authored-by: Jason Song <i@wolfogre.com>
8 months agoNotify reviewers added via CODEOWNERS (#29842) (#29902)
Lunny Xiao [Wed, 20 Mar 2024 06:02:24 +0000 (14:02 +0800)]
Notify reviewers added via CODEOWNERS (#29842) (#29902)

backport #29842

Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
8 months agoFix the wrong default value of ENABLE_OPENID_SIGNIN on docs (#29925) (#29927)
Giteabot [Wed, 20 Mar 2024 05:08:24 +0000 (13:08 +0800)]
Fix the wrong default value of ENABLE_OPENID_SIGNIN on docs (#29925) (#29927)

Backport #29925 by @lunny

Fix #29923

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoFix invalid link of the commit status when ref is tag (#29752) (#29908)
yp05327 [Wed, 20 Mar 2024 04:36:32 +0000 (13:36 +0900)]
Fix invalid link of the commit status when ref is tag (#29752) (#29908)

Backport #29752

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoOnly do counting when count_only=true for repo dashboard (#29884) (#29905)
Lunny Xiao [Wed, 20 Mar 2024 03:02:35 +0000 (11:02 +0800)]
Only do counting when count_only=true for repo dashboard (#29884) (#29905)

Ref: #29878
Backport #29884

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
8 months agoFix PR creation via api between branches of same repo with head field namespaced...
Giteabot [Wed, 20 Mar 2024 01:38:30 +0000 (09:38 +0800)]
Fix PR creation via api between branches of same repo with head field namespaced (#26986) (#29857)

Backport #26986 by @norohind

Fix #20175

Current implementation of API does not allow creating pull requests
between branches of the same
repo when you specify *namespace* (owner of the repo) in `head` field in
http request body.

---------

Co-authored-by: norohind <60548839+norohind@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoFix template error when comment review doesn't exist (#29888) (#29889)
wxiaoguang [Tue, 19 Mar 2024 07:00:01 +0000 (15:00 +0800)]
Fix template error when comment review doesn't exist (#29888) (#29889)

Backport #29888

8 months agoFix bug on template (#29887)
Lunny Xiao [Mon, 18 Mar 2024 15:24:07 +0000 (23:24 +0800)]
Fix bug on template (#29887)

Caused by #29807
Fix #29886

8 months agoEditor error message misleading due to re-used key. (#29859) (#29876)
Giteabot [Mon, 18 Mar 2024 06:45:43 +0000 (14:45 +0800)]
Editor error message misleading due to re-used key. (#29859) (#29876)

Backport #29859 by @buckybytes

The error message:

`editor.file_changed_while_editing = The file contents have changed
since you started editing. <a target="_blank" rel="noopener noreferrer"
href="%s">Click here</a> to see them or <strong>Commit Changes
again</strong> to overwrite them.`

Is re-used in inappropriate contexts. The link in the key goes to a 404
when the key is used in a situation where the file contents have not
changed.

Added two new keys to differentiate commit id mismatch and push out of
date conditions.

Co-authored-by: buckybytes <158571971+buckybytes@users.noreply.github.com>
8 months agoFix user id column case (#29863) (#29867)
Giteabot [Sun, 17 Mar 2024 13:51:15 +0000 (21:51 +0800)]
Fix user id column case (#29863) (#29867)

Backport #29863 by @lng2020

Sometimes the column name is case-sensitive and it may cause 500.

Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com>
8 months agoFix codeowner detected diff base branch to mergebase (#29783) (#29807)
Lunny Xiao [Sun, 17 Mar 2024 01:40:06 +0000 (09:40 +0800)]
Fix codeowner detected diff base branch to mergebase (#29783) (#29807)

Fix #29763
Backport #29783

This PR fixes 2 problems with CodeOwner in the pull request.
- Don't use the pull request base branch but merge-base as a diff base
to detect the code owner.
- CodeOwner detection in fork repositories will be disabled because
almost all the fork repositories will not change CODEOWNERS files but it
should not be used on fork repositories' pull requests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
8 months agofix double border and border-radius on empty action steps (#29845) (#29850)
Giteabot [Sat, 16 Mar 2024 17:16:45 +0000 (01:16 +0800)]
fix double border and border-radius on empty action steps (#29845) (#29850)

Backport #29845 by @silverwind

Before, double border-bottom and incorrect border-radius:

<img width="914" alt="Screenshot 2024-03-16 at 14 46 31"
src="https://github.com/go-gitea/gitea/assets/115237/6ea63c42-754c-420c-a0f5-c889a8507d9f">

After, both fixed:

<img width="917" alt="Screenshot 2024-03-16 at 14 45 59"
src="https://github.com/go-gitea/gitea/assets/115237/9d3f2dba-6b22-441d-8e99-5809d5f1f1c0">

Co-authored-by: silverwind <me@silverwind.io>
8 months agoMake meilisearch do exact search for issues (#29740 & #29671) (#29846)
6543 [Sat, 16 Mar 2024 16:01:40 +0000 (17:01 +0100)]
Make meilisearch do exact search for issues (#29740 & #29671) (#29846)

Backport https://github.com/go-gitea/gitea/pull/29740 (based on #29671
...)

8 months agoFix `for` attribute not pointing to the ID of the color picker (#29813) (#29815)
Giteabot [Fri, 15 Mar 2024 13:33:46 +0000 (21:33 +0800)]
Fix `for` attribute not pointing to the ID of the color picker (#29813) (#29815)

Backport #29813 by @yardenshoham

It didn't include the word picker.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 months agoUse `Temporal.PlainDate` for absolute dates (#29804) (#29808)
silverwind [Fri, 15 Mar 2024 10:20:42 +0000 (11:20 +0100)]
Use `Temporal.PlainDate` for absolute dates (#29804) (#29808)

Backport https://github.com/go-gitea/gitea/pull/29804.

Use the upcoming
[Temporal.PlainDate](https://tc39.es/proposal-temporal/docs/plaindate.html)
via polyfill. If there is any remaining bugs in `<absolute-date>` this
will iron them out. I opted for the lightweight polyfill because both
seem to achieve our goal of localizeable absolute dates.

- With
[`@js-temporal/polyfill`](https://www.npmjs.com/package/@js-temporal/polyfill)
chunk size goes from 81.4 KiB to 274 KiB
- With
[`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill)
chunk size goes from 81.4 KiB to 142 KiB

Also see [this
table](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#comparison-with-js-temporalpolyfill)
for more comparisons of these polyfills. Soon there will be
[treeshakable
API](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#tree-shakable-api)
as well which will further reduce size.

8 months agoUpdate Chroma to v2.13.0 (#29732) (#29805)
Lunny Xiao [Fri, 15 Mar 2024 08:45:10 +0000 (16:45 +0800)]
Update Chroma to v2.13.0 (#29732) (#29805)

Backport #29732

This adds new lexers and includes some fixes. See
https://github.com/alecthomas/chroma/releases/tag/v2.13.0 for the full
changelog.

Co-authored-by: JakobDev <jakobdev@gmx.de>
8 months agoFix Safari spinner rendering (#29801) (#29802)
Giteabot [Thu, 14 Mar 2024 22:08:59 +0000 (06:08 +0800)]
Fix Safari spinner rendering (#29801) (#29802)

Backport #29801 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/29041
Fixes: https://github.com/go-gitea/gitea/pull/29713
Any of the `width: *-content` properties seem to workaround this Webkit
bug, this one seemed most suitable.

Before:
<img width="184" alt="Screenshot 2024-03-14 at 22 29 58"
src="https://github.com/go-gitea/gitea/assets/115237/6effc5f0-bc64-4752-be74-9c43b3974407">

After:
<img width="177" alt="Screenshot 2024-03-14 at 22 30 30"
src="https://github.com/go-gitea/gitea/assets/115237/5de244d7-6b46-428e-957c-4b10f53e2441">

Co-authored-by: silverwind <me@silverwind.io>
8 months agoSupport GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788) (#29791)
Giteabot [Thu, 14 Mar 2024 10:02:37 +0000 (18:02 +0800)]
Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788) (#29791)

Backport #29788 by @wolfogre

I was trying to run unit tests for Gitea on act runner, by using `make
test`.

It failed with log:

```
2024/03/14 03:09:26 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run as root. Sorry. If you need to use privileged TCP ports please instead use setcap and the `cap_net_bind_service` permission
```

So it will be convenient to skip by setting environment, since it's OK
to use root user in job containers.

It's not a bug, but I want to backport it to v1.21 since it doesn't
break anything.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
8 months agoFix missing translation on milestons (#29785) (#29789)
Giteabot [Thu, 14 Mar 2024 08:21:04 +0000 (16:21 +0800)]
Fix missing translation on milestons (#29785) (#29789)

Backport #29785 by @lunny

Caused by #26569
Fix #29778

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoFix user router possbile panic (#29751) (#29786)
Lunny Xiao [Thu, 14 Mar 2024 04:44:14 +0000 (12:44 +0800)]
Fix user router possbile panic (#29751) (#29786)

regression from #28023
backport #29751

8 months agoMake runs-on support variable expression (#29468) (#29782)
sillyguodong [Thu, 14 Mar 2024 02:19:01 +0000 (10:19 +0800)]
Make runs-on support variable expression (#29468) (#29782)

backport #29468

Close issue: https://gitea.com/gitea/act_runner/issues/445
Follow: https://gitea.com/gitea/act/pulls/91

Move `getSecretsOfTask` and `getVariablesOfTask` under models because of
circular dependency issues.