]> source.dussan.org Git - gitea.git/log
gitea.git
7 weeks agoBump relative-time-element to v4.4.3 (#31910)
Yarden Shoham [Fri, 23 Aug 2024 17:22:36 +0000 (20:22 +0300)]
Bump relative-time-element to v4.4.3 (#31910)

All date-times work as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
7 weeks ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 22 Aug 2024 00:27:44 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

7 weeks agoUse correct function name (#31887)
Lunny Xiao [Wed, 21 Aug 2024 21:05:48 +0000 (05:05 +0800)]
Use correct function name (#31887)

8 weeks agoMove lock icon position and add additional tooltips to branch list page (#31839)
william-allspice [Wed, 21 Aug 2024 05:40:18 +0000 (00:40 -0500)]
Move lock icon position and add additional tooltips to branch list page (#31839)

This Pull Request adds missing tool tips for the protected, copy, and rss icons on the branch list page. It also moved protected icon position after the branch name.

8 weeks agoDon't return 500 if mirror url contains special chars (#31859)
Lunny Xiao [Wed, 21 Aug 2024 01:54:55 +0000 (09:54 +0800)]
Don't return 500 if mirror url contains special chars (#31859)

Fix #31640

8 weeks ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 21 Aug 2024 00:27:45 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

8 weeks agoRefactor the usage of batch catfile (#31754)
Lunny Xiao [Tue, 20 Aug 2024 17:04:57 +0000 (01:04 +0800)]
Refactor the usage of batch catfile (#31754)

When opening a repository, it will call `ensureValidRepository` and also
`CatFileBatch`. But sometimes these will not be used until repository
closed. So it's a waste of CPU to invoke 3 times git command for every
open repository.

This PR removed all of these from `OpenRepository` but only kept
checking whether the folder exists. When a batch is necessary, the
necessary functions will be invoked.

8 weeks agoFix agit automerge (#31207)
Lunny Xiao [Tue, 20 Aug 2024 06:17:21 +0000 (14:17 +0800)]
Fix agit automerge (#31207)

8 weeks agoadd CfTurnstileSitekey context data to all captcha templates (#31874)
Rowan Bohde [Mon, 19 Aug 2024 17:58:53 +0000 (12:58 -0500)]
add CfTurnstileSitekey context data to all captcha templates (#31874)

In the OpenID flows, the "CfTurnstileSitekey" wasn't populated, which
caused those flows to fail if using Turnstile as the Captcha
implementation.

This adds the missing context variables, allowing Turnstile to be used
in the OpenID flows.

8 weeks agoAdd tag name in the commits list (#31082)
Lunny Xiao [Mon, 19 Aug 2024 17:04:06 +0000 (01:04 +0800)]
Add tag name in the commits list (#31082)

Fix #10036

This PR adds some labels for tags of this commit after the commit
message on the commits table. The tag template is share as commit
graph's.

Desktop:
<img width="1302" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/ba94e1e6-2a3d-44f3-85a3-575fb5667c97">

Mobile:
<img width="370" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/e3eb1f44-3686-4012-aa9d-52cd88b22c0e">

8 weeks agoFix actions notify bug (#31866)
Lunny Xiao [Mon, 19 Aug 2024 16:25:41 +0000 (00:25 +0800)]
Fix actions notify bug (#31866)

Try to fix
https://github.com/go-gitea/gitea/issues/31757#issuecomment-2295131062

8 weeks agoActions support workflow dispatch event (#28163)
胖梁 [Mon, 19 Aug 2024 02:38:40 +0000 (10:38 +0800)]
Actions support workflow dispatch event (#28163)

fix #23668

My plan:
* In the `actions.list` method, if workflow is selected and IsAdmin,
check whether the on event contains `workflow_dispatch`. If so, display
a `Run workflow` button to allow the user to manually trigger the run.
* Providing a form that allows users to select target brach or tag, and
these parameters can be configured in yaml
* Simple form validation, `required` input cannot be empty
* Add a route `/actions/run`, and an `actions.Run` method to handle
* Add `WorkflowDispatchPayload` struct to pass the Webhook event payload
to the runner when triggered, this payload carries the `inputs` values
and other fields, doc: [workflow_dispatch
payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_dispatch)

Other PRs
* the `Workflow.WorkflowDispatchConfig()` method still return non-nil
when workflow_dispatch is not defined. I submitted a PR
https://gitea.com/gitea/act/pulls/85 to fix it. Still waiting for them
to process.

Behavior should be same with github, but may cause confusion. Here's a
quick reminder.
*
[Doc](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch)
Said: This event will `only` trigger a workflow run if the workflow file
is `on the default branch`.
* If the workflow yaml file only exists in a non-default branch, it
cannot be triggered. (It will not even show up in the workflow list)
* If the same workflow yaml file exists in each branch at the same time,
the version of the default branch is used. Even if `Use workflow from`
selects another branch

![image](https://github.com/go-gitea/gitea/assets/3114995/4bf596f3-426b-48e8-9b8f-0f6d18defd79)
```yaml
name: Docker Image CI

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'
        type: choice
        options:
        - info
        - warning
        - debug
      tags:
        description: 'Test scenario tags'
        required: false
        type: boolean
      boolean_default_true:
        description: 'Test scenario tags'
        required: true
        type: boolean
        default: true
      boolean_default_false:
        description: 'Test scenario tags'
        required: false
        type: boolean
        default: false
      environment:
        description: 'Environment to run tests against'
        type: environment
        required: true
        default: 'environment values'
      number_required_1:
        description: 'number '
        type: number
        required: true
        default: '100'
      number_required_2:
        description: 'number'
        type: number
        required: true
        default: '100'
      number_required_3:
        description: 'number'
        type: number
        required: true
        default: '100'
      number_1:
        description: 'number'
        type: number
        required: false
      number_2:
        description: 'number'
        type: number
        required: false
      number_3:
        description: 'number'
        type: number
        required: false

env:
  inputs_logLevel:              ${{ inputs.logLevel }}
  inputs_tags:                  ${{ inputs.tags }}
  inputs_boolean_default_true:  ${{ inputs.boolean_default_true }}
  inputs_boolean_default_false: ${{ inputs.boolean_default_false }}
  inputs_environment:           ${{ inputs.environment }}
  inputs_number_1:              ${{ inputs.number_1  }}
  inputs_number_2:              ${{ inputs.number_2  }}
  inputs_number_3:              ${{ inputs.number_3  }}
  inputs_number_required_1:     ${{ inputs.number_required_1  }}
  inputs_number_required_2:     ${{ inputs.number_required_2  }}
  inputs_number_required_3:     ${{ inputs.number_required_3  }}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: ls -la
      - run: env | grep inputs
      - run: echo ${{ inputs.logLevel }}
      - run: echo ${{ inputs.boolean_default_false }}
```

![image](https://github.com/go-gitea/gitea/assets/3114995/a58a842d-a0ff-4618-bc6d-83a9596d07c8)

![image](https://github.com/go-gitea/gitea/assets/3114995/44a7cca5-7bd4-42a9-8723-91751a501c88)

---------

Co-authored-by: TKaxv_7S <954067342@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 weeks ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 19 Aug 2024 00:28:51 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

8 weeks ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 18 Aug 2024 00:30:09 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

8 weeks agoFix overflowing content in action run log (#31842)
Adrian Hirt [Sat, 17 Aug 2024 03:34:27 +0000 (05:34 +0200)]
Fix overflowing content in action run log (#31842)

When a long line with characters such as dots is returned by a step in
an action (e.g. by the output of the Ruby on Rails test runner), it
overflows the log container, causing the page to scroll sideways.

This PR adds the CSS `overflow-wrap: anywhere;` to the
`.job-step-section .job-step-logs .job-log-line .log-msg` selector,
which causes such lines to wrap as well

8 weeks agoUpgrade `htmx` to `2.0.2` (#31847)
Yarden Shoham [Fri, 16 Aug 2024 17:48:54 +0000 (20:48 +0300)]
Upgrade `htmx` to `2.0.2` (#31847)

Tested `Follow`, `Star`, `Watch`, and the admin dashboard page. All
functionality remains unchanged.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 weeks agofix the component of access token list not mounted (#31824)
sillyguodong [Fri, 16 Aug 2024 17:37:36 +0000 (01:37 +0800)]
fix the component of access token list not mounted (#31824)

try to fix #31771

8 weeks agoAvoid returning without written ctx when posting PR (#31843)
Jason Song [Fri, 16 Aug 2024 17:04:54 +0000 (01:04 +0800)]
Avoid returning without written ctx when posting PR (#31843)

Fix #31625.

If `pull_service.NewPullRequest` return an error which misses each `if`
check, `CompareAndPullRequestPost` will return immediately, since it
doesn't write the HTTP response, a 200 response with empty body will be
sent to clients.

```go
if err := pull_service.NewPullRequest(ctx, repo, pullIssue, labelIDs, attachments, pullRequest, assigneeIDs); err != nil {
if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
} else if git.IsErrPushRejected(err) {
// ...
ctx.JSONError(flashError)
} else if errors.Is(err, user_model.ErrBlockedUser) {
// ...
ctx.JSONError(flashError)
} else if errors.Is(err, issues_model.ErrMustCollaborator) {
// ...
ctx.JSONError(flashError)
}
return
}
```

Not sure what kind of error can cause it to happen, so this PR just
expose it. And we can fix it when users report that creating PRs failed
with error responses.

It's all my guess since I cannot reproduce the problem, but even if it's
not related, the code here needs to be improved.

2 months agoFix raw wiki links (#31825)
Zettat123 [Fri, 16 Aug 2024 12:40:51 +0000 (20:40 +0800)]
Fix raw wiki links (#31825)

Fix #31395

This regression is introduced by #30273. To find out how GitHub handles
this case, I did [some
tests](https://github.com/go-gitea/gitea/issues/31395#issuecomment-2278929115).

I use redirect in this PR instead of checking if the corresponding `.md`
file exists when rendering the link because GitHub also uses redirect.
With this PR, there is no need to resolve the raw wiki link when
rendering a wiki page. If a wiki link points to a raw file, access will
be redirected to the raw link.

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 16 Aug 2024 00:27:28 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoAdd missing repository type filter parameters to pager (#31832)
yp05327 [Thu, 15 Aug 2024 16:34:24 +0000 (01:34 +0900)]
Add missing repository type filter parameters to pager  (#31832)

Fix #31807

ps: the newly added params's value will be changed.
When the first time you selected the filter, the values of params will
be `0` or `1`
But in pager it will be `true` or `false`.
So do we have `boolToInt` function?

2 months agoFix panic of ssh public key page after deletion of auth source (#31829)
Lunny Xiao [Thu, 15 Aug 2024 15:59:01 +0000 (23:59 +0800)]
Fix panic of ssh public key page after deletion of auth source (#31829)

Fix #31730

This PR rewrote the function `PublicKeysAreExternallyManaged` with a
simple test. The new function removed the loop to make it more readable.

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 15 Aug 2024 00:27:03 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agorender plain text file if the LFS object doesn't exist (#31812)
Rowan Bohde [Wed, 14 Aug 2024 21:50:09 +0000 (16:50 -0500)]
render plain text file if the LFS object doesn't exist (#31812)

We had an issue where a repo was using LFS to store a file, but the user
did not push the file. When trying to view the file, Gitea returned a
500 HTTP status code referencing `ErrLFSObjectNotExist`. It appears the
intent was the render this file as plain text, but the conditional was
flipped. I've also added a test to verify that the file is rendered as
plain text.

2 months agoAdd spacing to global error message (#31826)
Sebastian Luino [Wed, 14 Aug 2024 01:58:26 +0000 (21:58 -0400)]
Add spacing to global error message (#31826)

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

Include Typescript files in Tailwind config so they can be
pre-processed.

![Screenshot from 2024-08-13
08-44-33](https://github.com/user-attachments/assets/196d7801-e299-4000-8b39-cd9f89917f17)

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Aug 2024 00:28:12 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoFixes for unreachable project issues when transfer repository from organization ...
Edip Emre Bodur [Tue, 13 Aug 2024 02:53:43 +0000 (05:53 +0300)]
Fixes for unreachable project issues when transfer repository from organization (#31770)

When transferring repositories that have issues linked to a project
board to another organization, the issues remain associated with the
original project board. This causes the columns in the project board to
become bugged, making it difficult to move other issues in or out of the
affected columns. As a solution, I removed the issue relations since the
other organization does not have this project table.

Fix for #31538

Co-authored-by: Jason Song <i@wolfogre.com>
2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 13 Aug 2024 00:28:59 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoScroll images in project issues separately from the remaining issue (#31683)
Simon Priet [Mon, 12 Aug 2024 23:36:28 +0000 (01:36 +0200)]
Scroll images in project issues separately from the remaining issue (#31683)

As discussed in #31667 & #26561, when a card on a Project contains
images, they can overflow the card on its containing column. This aims
to fix this issue via snapping scrollbars.

---
Issue #31667 is open to discussion as there should be room for
improvement.

2 months agoSupport issue template assignees (#31083)
Zettat123 [Mon, 12 Aug 2024 08:00:40 +0000 (16:00 +0800)]
Support issue template assignees (#31083)

Resolve #13955

2 months agoAdd `:focus-visible` style to buttons (#31799)
silverwind [Mon, 12 Aug 2024 00:40:18 +0000 (02:40 +0200)]
Add `:focus-visible` style to buttons (#31799)

Buttons now show a focus style via
[`:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible)
when the browser deems the focus to be important, like for example when
the button is focused via keyboard navigation.

<img width="492" alt="Screenshot 2024-08-07 at 22 12 51"
src="https://github.com/user-attachments/assets/060568b1-1599-4c56-bafb-b36ebb1bec35">
<img width="479" alt="image"
src="https://github.com/user-attachments/assets/885f4e10-f496-47f0-8ae5-45827ded09f8">

2 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 12 Aug 2024 00:29:12 +0000 (00:29 +0000)]
[skip ci] Updated licenses and gitignores

2 months agoShow lock owner instead of repo owner on LFS setting page (#31788)
Jason Song [Sun, 11 Aug 2024 14:48:20 +0000 (22:48 +0800)]
Show lock owner instead of repo owner on LFS setting page (#31788)

Fix #31784.

Before:

<img width="1648" alt="image"
src="https://github.com/user-attachments/assets/03f32545-4a85-42ed-bafc-2b193a5d8023">

After:

<img width="1653" alt="image"
src="https://github.com/user-attachments/assets/e5bcaf93-49cb-421f-aac1-5122bc488b02">

2 months agoMove repository visibility to danger zone in the settings area (#31126)
Fábio Barkoski [Sun, 11 Aug 2024 04:50:54 +0000 (01:50 -0300)]
Move repository visibility to danger zone in the settings area (#31126)

Moved repository visibility to the danger zone in the settings area. To
change the visibility, it is necessary to go to the danger zone, click
on the private/public button, and accept the change in the modal.

Resolves:  #23826

---
## Screenshots

<details>
<summary>Before</summary>
Private repo:

![Private
repo](https://github.com/go-gitea/gitea/assets/65479069/4313492a-4854-48bc-9f47-974e3539d791)

Public repo:

![Public
repo](https://github.com/go-gitea/gitea/assets/65479069/1c45f6e4-ee93-4799-9331-e9d4a7e0f16a)

</details>
<details>
<summary>After</summary>
Make private:

![Screenshot from 2024-05-28
21-35-38](https://github.com/go-gitea/gitea/assets/65479069/4887e28a-0514-4990-aa69-bf3ddc7e6c7d)

Make private modal

![Screenshot from 2024-06-13
23-55-55](https://github.com/go-gitea/gitea/assets/65479069/9f5a7604-069b-41a2-973b-ee2d58e85953)

![Screenshot from 2024-06-13
23-53-09](https://github.com/go-gitea/gitea/assets/65479069/06c22726-eab2-4bce-8df7-62849dcce974)

Make public:

![Screenshot from 2024-05-28
21-34-27](https://github.com/go-gitea/gitea/assets/65479069/6d388f99-0356-48a0-9d85-320cdba55179)

Make public modal

![Screenshot from 2024-06-13
23-53-37](https://github.com/go-gitea/gitea/assets/65479069/8944972e-f2d4-4aea-ba96-b892febb5ced)

</details>

---------

Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 11 Aug 2024 00:31:26 +0000 (00:31 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoAdd types to various low-level functions (#31781)
silverwind [Sat, 10 Aug 2024 09:46:48 +0000 (11:46 +0200)]
Add types to various low-level functions (#31781)

Adds types to various low-level modules. All changes are type-only, no
runtime changes. `tsc` now reports 38 less errors.

One problem was that `@types/sortablejs` does not accept promise return
in its functions which triggered the linter, so I disabled the rules on
those line.

2 months agoAdd warning message in merge instructions when `AutodetectManualMerge` was not enable...
a1012112796 [Sat, 10 Aug 2024 01:09:34 +0000 (09:09 +0800)]
Add warning message in merge instructions when `AutodetectManualMerge` was not enabled (#31805)

not enabled

quick-f-i-x https://github.com/go-gitea/gitea/issues/31433 ? , maybe
need more disscusion about better solutions.

example view:

![image](https://github.com/user-attachments/assets/2af7e1e8-42b9-4473-89c7-12d4a9205d3f)

adtion notes about how to enable `AutodetectManualMerge`

![image](https://github.com/user-attachments/assets/28f84317-367a-40d8-b50d-a19ef7c664d4)

Signed-off-by: a1012112796 <1012112796@qq.com>
2 months agoShow latest run when visit /run/latest (#31808)
FuXiaoHei [Sat, 10 Aug 2024 00:40:41 +0000 (08:40 +0800)]
Show latest run when visit /run/latest (#31808)

Proposal from
https://github.com/go-gitea/gitea/issues/27911#issuecomment-2271982172

When visit latest run path, such as
`/{user}/{repo}/actions/runs/latest`. It renders latest run instead of
index=0 currently.

2 months agoFix typo for `LOG_COMPRESSION` in ini (#31809)
Jason Song [Fri, 9 Aug 2024 22:07:35 +0000 (06:07 +0800)]
Fix typo for `LOG_COMPRESSION` in ini (#31809)

Follow #31761

---------

Co-authored-by: silverwind <me@silverwind.io>
2 months agoAdd label `docs-update-needed` for PRs that modify `app.example.ini` (#31810)
Jason Song [Fri, 9 Aug 2024 16:20:59 +0000 (00:20 +0800)]
Add label `docs-update-needed` for PRs that modify `app.example.ini` (#31810)

To help #31536.

Or it's easy to forget to update https://gitea.com/gitea/docs when
modifying `app.example.ini`.

2 months agoFix `IsObjectExist` with gogit (#31790)
Jason Song [Fri, 9 Aug 2024 02:40:45 +0000 (10:40 +0800)]
Fix `IsObjectExist` with gogit (#31790)

Fix #31271.

When gogit is enabled, `IsObjectExist` calls
`repo.gogitRepo.ResolveRevision`, which is not correct. It's for
checking references not objects, it could work with commit hash since
it's both a valid reference and a commit object, but it doesn't work
with blob objects.

So it causes #31271 because it reports that all blob objects do not
exist.

2 months agoSupport compression for Actions logs (#31761)
Jason Song [Fri, 9 Aug 2024 02:10:30 +0000 (10:10 +0800)]
Support compression for Actions logs (#31761)

Support compression for Actions logs to save storage space and
bandwidth. Inspired by
https://github.com/go-gitea/gitea/issues/24256#issuecomment-1521153015

The biggest challenge is that the compression format should support
[seekable](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md).
So when users are viewing a part of the log lines, Gitea doesn't need to
download the whole compressed file and decompress it.

That means gzip cannot help here. And I did research, there aren't too
many choices, like bgzip and xz, but I think zstd is the most popular
one. It has an implementation in Golang with
[zstd](https://github.com/klauspost/compress/tree/master/zstd) and
[zstd-seekable-format-go](https://github.com/SaveTheRbtz/zstd-seekable-format-go),
and what is better is that it has good compatibility: a seekable format
zstd file can be read by a regular zstd reader.

This PR introduces a new package `zstd` to combine and wrap the two
packages, to provide a unified and easy-to-use API.

And a new setting `LOG_COMPRESSION` is added to the config, although I
don't see any reason why not to use compression, I think's it's a good
idea to keep the default with `none` to be consistent with old versions.

`LOG_COMPRESSION` takes effect for only new log files, it adds `.zst` as
an extension to the file name, so Gitea can determine if it needs
decompression according to the file name when reading. Old files will
keep the format since it's not worth converting them, as they will be
cleared after #31735.

<img width="541" alt="image"
src="https://github.com/user-attachments/assets/e9598764-a4e0-4b68-8c2b-f769265183c9">

2 months agoAdd issue comment when moving issues from one column to another of the project (...
Lunny Xiao [Fri, 9 Aug 2024 01:29:02 +0000 (09:29 +0800)]
Add issue comment when moving issues from one column to another of the project (#29311)

Fix #27278
Replace #27816

This PR adds a meta-comment for an issue when dragging an issue from one
column to another of a project.

<img width="600" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 9 Aug 2024 00:27:50 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoFix RPM resource leak (#31794)
KN4CK3R [Thu, 8 Aug 2024 09:43:04 +0000 (11:43 +0200)]
Fix RPM resource leak (#31794)

Fixes a resource leak introduced by #27069.

- add defer
- move sign code out of `repository.go`

2 months agoAdd `TAGS` to `TEST_TAGS` and fix bugs found with gogit (#31791)
Jason Song [Wed, 7 Aug 2024 15:29:08 +0000 (23:29 +0800)]
Add `TAGS` to `TEST_TAGS` and fix bugs found with gogit (#31791)

Found at
https://github.com/go-gitea/gitea/pull/31790#issuecomment-2272898915

`unit-tests-gogit` never work since the workflow set `TAGS` with
`gogit`, but the Makefile use `TEST_TAGS`.

This PR adds the values of `TAGS` to `TEST_TAGS`, ensuring that setting
`TAGS` is always acceptable and avoiding confusion about which one
should be set.

2 months agoFix protected branch files detection on pre_receive hook (#31778)
Lunny Xiao [Tue, 6 Aug 2024 13:32:49 +0000 (21:32 +0800)]
Fix protected branch files detection on pre_receive hook (#31778)

Fix #31738

When pushing a new branch, the old commit is zero. Most git commands
cannot recognize the zero commit id. To get the changed files in the
push, we need to get the first diverge commit of this branch. In most
situations, we could check commits one by one until one commit is
contained by another branch. Then we will think that commit is the
diverge point.

And in a pre-receive hook, this will be more difficult because all
commits haven't been merged and they actually stored in a temporary
place by git. So we need to bring some envs to let git know the commit
exist.

2 months agoAdd signature support for the RPM module (#27069)
Exploding Dragon [Tue, 6 Aug 2024 13:03:33 +0000 (21:03 +0800)]
Add signature support for the RPM module (#27069)

close  #27031

If the rpm package does not contain a matching gpg signature, the
installation will fail. See (#27031) , now auto-signing rpm uploads.

This option is turned off by default for compatibility.

2 months agoFix null requested_reviewer from API (#31773)
Edip Emre Bodur [Mon, 5 Aug 2024 10:59:53 +0000 (13:59 +0300)]
Fix null requested_reviewer from API (#31773)

If the assign the pull request review to a team, it did not show the
members of the team in the "requested_reviewers" field, so the field was
null. As a solution, I added the team members to the array.

fix #31764

2 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 5 Aug 2024 00:28:44 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

2 months agoRename head branch of pull requests when renaming a branch (#31759)
Lunny Xiao [Sun, 4 Aug 2024 03:21:42 +0000 (11:21 +0800)]
Rename head branch of pull requests when renaming a branch (#31759)

Fix #31716

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 4 Aug 2024 00:30:13 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoFix wiki revision pagination (#31760)
Lunny Xiao [Sat, 3 Aug 2024 18:35:55 +0000 (02:35 +0800)]
Fix wiki revision pagination (#31760)

Fix #31755

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 3 Aug 2024 00:27:17 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoUpdate JS dependencies (#31766)
silverwind [Fri, 2 Aug 2024 21:28:12 +0000 (23:28 +0200)]
Update JS dependencies (#31766)

2 months agoUpgrade bleve to 2.4.2 (#31762)
Lunny Xiao [Fri, 2 Aug 2024 19:32:31 +0000 (03:32 +0800)]
Upgrade bleve to 2.4.2 (#31762)

2 months agoRemove unused code from models/repos/release.go (#31756)
Kemal Zebari [Fri, 2 Aug 2024 14:23:49 +0000 (07:23 -0700)]
Remove unused code from models/repos/release.go (#31756)

These blocks aren't used anywhere else when doing a grep search.

2 months agoClear up old Actions logs (#31735)
Jason Song [Fri, 2 Aug 2024 00:42:08 +0000 (08:42 +0800)]
Clear up old Actions logs (#31735)

Part of #24256.

Clear up old action logs to free up storage space.

Users will see a message indicating that the log has been cleared if
they view old tasks.

<img width="1361" alt="image"
src="https://github.com/user-attachments/assets/9f0f3a3a-bc5a-402f-90ca-49282d196c22">

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

---------

Co-authored-by: silverwind <me@silverwind.io>
2 months agoFix createElementFromAttrs bug (#31751)
wxiaoguang [Thu, 1 Aug 2024 19:06:03 +0000 (03:06 +0800)]
Fix createElementFromAttrs bug (#31751)

The "false" value was not handled correctly, it would cause bugs in the
future (fortunately, this behavior is not used in code yet).

2 months agobump vue-bar-graph (#31705)
techknowlogick [Thu, 1 Aug 2024 17:42:51 +0000 (13:42 -0400)]
bump vue-bar-graph (#31705)

2 months agoUse UTC as default timezone when schedule Actions cron tasks (#31742)
Jason Song [Thu, 1 Aug 2024 10:02:46 +0000 (18:02 +0800)]
Use UTC as default timezone when schedule Actions cron tasks (#31742)

Fix #31657.

According to the
[doc](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onschedule)
of GitHub Actions, The timezone for cron should be UTC, not the local
timezone. And Gitea Actions doesn't have any reasons to change this, so
I think it's a bug.

However, Gitea Actions has extended the syntax, as it supports
descriptors like `@weekly` and `@every 5m`, and supports specifying the
timezone like `TZ=UTC 0 10 * * *`. So we can make it use UTC only when
the timezone is not specified, to be compatible with GitHub Actions, and
also respect the user's specified.

It does break the feature because the times to run tasks would be
changed, and it may confuse users. So I don't think we should backport
this.

## ⚠️ BREAKING ⚠️

If the server's local time zone is not UTC, a scheduled task would run
at a different time after upgrading Gitea to this version.

2 months agoAdd permission description for API to add repo collaborator (#31744)
Jason Song [Thu, 1 Aug 2024 09:33:40 +0000 (17:33 +0800)]
Add permission description for API to add repo collaborator (#31744)

Fix #31552.

2 months agoClarify Actions resources ownership (#31724)
Jason Song [Thu, 1 Aug 2024 09:04:04 +0000 (17:04 +0800)]
Clarify Actions resources ownership (#31724)

Fix #31707.

Also related to #31715.

Some Actions resources could has different types of ownership. It could
be:

- global: all repos and orgs/users can use it.
- org/user level: only the org/user can use it.
- repo level: only the repo can use it.

There are two ways to distinguish org/user level from repo level:
1. `{owner_id: 1, repo_id: 2}` for repo level, and `{owner_id: 1,
repo_id: 0}` for org level.
2. `{owner_id: 0, repo_id: 2}` for repo level, and `{owner_id: 1,
repo_id: 0}` for org level.

The first way seems more reasonable, but it may not be true. The point
is that although a resource, like a runner, belongs to a repo (it can be
used by the repo), the runner doesn't belong to the repo's org (other
repos in the same org cannot use the runner). So, the second method
makes more sense.

And the first way is not user-friendly to query, we must set the repo id
to zero to avoid wrong results.

So, #31715 should be right. And the most simple way to fix #31707 is
just:

```diff
- shared.GetRegistrationToken(ctx, ctx.Repo.Repository.OwnerID, ctx.Repo.Repository.ID)
+ shared.GetRegistrationToken(ctx, 0, ctx.Repo.Repository.ID)
```

However, it is quite intuitive to set both owner id and repo id since
the repo belongs to the owner. So I prefer to be compatible with it. If
we get both owner id and repo id not zero when creating or finding, it's
very clear that the caller want one with repo level, but set owner id
accidentally. So it's OK to accept it but fix the owner id to zero.

2 months agoExclude protected branches from recently pushed (#31748)
Jason Song [Thu, 1 Aug 2024 07:21:28 +0000 (15:21 +0800)]
Exclude protected branches from recently pushed (#31748)

Resolve #31566.

Updates to protected branches often come from PR merges, and they are
unlikely to be used to create new PRs.

<img width="1346" alt="image"
src="https://github.com/user-attachments/assets/9ed72bd6-0303-435d-856c-184784104c6a">
<img width="1347" alt="image"
src="https://github.com/user-attachments/assets/c1a1df4b-1c16-4116-aea3-d452242119e0">
<img width="1336" alt="image"
src="https://github.com/user-attachments/assets/706034ad-d3c3-4853-a6b8-cbaf87c70ba0">

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 1 Aug 2024 00:31:07 +0000 (00:31 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoDistinguish LFS object errors to ignore missing objects during migration (#31702)
Jason Song [Wed, 31 Jul 2024 10:29:48 +0000 (18:29 +0800)]
Distinguish LFS object errors to ignore missing objects during migration (#31702)

Fix #31137.

Replace #31623 #31697.

When migrating LFS objects, if there's any object that failed (like some
objects are losted, which is not really critical), Gitea will stop
migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the [LFS api
doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses).

> LFS object error codes should match HTTP status codes where possible:
>
> - 404 - The object does not exist on the server.
> - 409 - The specified hash algorithm disagrees with the server's
acceptable options.
> - 410 - The object was removed by the owner.
> - 422 - Validation error.

If the error is `404`, it's safe to ignore it and continue migration.
Otherwise, stop the migration and mark it as failed to ensure data
integrity of LFS objects.

And maybe we should also ignore others errors (maybe `410`? I'm not sure
what's the difference between "does not exist" and "removed by the
owner".), we can add it later when some users report that they have
failed to migrate LFS because of an error which should be ignored.

2 months agoImprove names of cron jobs for Actions (#31736)
Jason Song [Wed, 31 Jul 2024 03:03:30 +0000 (11:03 +0800)]
Improve names of cron jobs for Actions (#31736)

Before:

<img width="1641" alt="image"
src="https://github.com/user-attachments/assets/60fa3f3e-cf19-4903-b080-616aef28057b">

After:

<img width="1674" alt="image"
src="https://github.com/user-attachments/assets/b04fd01e-838d-45c3-9655-cb39a2f7d1f2">

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 31 Jul 2024 00:23:19 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoFix the display of project type for deleted projects (#31732)
yp05327 [Tue, 30 Jul 2024 04:37:43 +0000 (13:37 +0900)]
Fix the display of project type for deleted projects (#31732)

Fix: #31727
After:

![image](https://github.com/user-attachments/assets/1dfb4b31-3bd6-47f7-b126-650f33f453e2)

2 months agoFix Null Pointer error for CommitStatusesHideActionsURL (#31731)
yp05327 [Tue, 30 Jul 2024 02:56:25 +0000 (11:56 +0900)]
Fix Null Pointer error for CommitStatusesHideActionsURL (#31731)

Fix https://github.com/go-gitea/gitea/pull/30156#discussion_r1695247028

Forgot fixing it in #31719

2 months agoMove `registerActionsCleanup` to `initActionsTasks` (#31721)
Jason Song [Tue, 30 Jul 2024 02:27:28 +0000 (10:27 +0800)]
Move `registerActionsCleanup` to `initActionsTasks` (#31721)

There's already `initActionsTasks`; it will avoid additional check for
if Actions enabled to move `registerActionsCleanup` into it.

And we don't really need `OlderThanConfig`.

2 months agoSet owner id to zero when GetRegistrationToken for repo (#31725)
Jason Song [Mon, 29 Jul 2024 18:46:45 +0000 (02:46 +0800)]
Set owner id to zero when GetRegistrationToken for repo (#31725)

Fix #31707.

It's split from #31724.

Although #31724 could also fix #31707, it has change a lot so it's not a
good idea to backport it.

2 months agofix(api): owner ID should be zero when created repo secret (#31715)
Bo-Yi Wu [Mon, 29 Jul 2024 17:15:02 +0000 (01:15 +0800)]
fix(api): owner ID should be zero when created repo secret (#31715)

- Change condition to include `RepoID` equal to 0 for organization
secrets

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2 months agoFix API endpoint for registration-token (#31722)
Jason Song [Mon, 29 Jul 2024 16:45:24 +0000 (00:45 +0800)]
Fix API endpoint for registration-token (#31722)

Partially fix #31707. Related to #30656

2 months agoFix loadRepository error when access user dashboard (#31719)
yp05327 [Mon, 29 Jul 2024 06:51:02 +0000 (15:51 +0900)]
Fix loadRepository error when access user dashboard (#31719)

2 months agoAdd permission check when creating PR (#31033)
yp05327 [Mon, 29 Jul 2024 02:21:22 +0000 (11:21 +0900)]
Add permission check when creating PR (#31033)

user should be a collaborator of the base repo to create a PR

2 months agoMake GetRepositoryByName more safer (#31712)
Lunny Xiao [Mon, 29 Jul 2024 01:32:54 +0000 (09:32 +0800)]
Make GetRepositoryByName more safer (#31712)

Fix #31708

2 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 29 Jul 2024 00:28:39 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

2 months agoRun `go-install` in `deps-tools` in parallel (#31711)
silverwind [Sun, 28 Jul 2024 17:27:24 +0000 (19:27 +0200)]
Run `go-install` in `deps-tools` in parallel (#31711)

`go install` is far too conservative in regards to parallel HTTP
requests, so we can run the commands in parallel to achieve a speedup.

2 months agoHide the "Details" link of commit status when the user cannot access actions (#30156)
Zettat123 [Sun, 28 Jul 2024 15:11:40 +0000 (23:11 +0800)]
Hide the "Details" link of commit status when the user cannot access actions (#30156)

Fix #26685

If a commit status comes from Gitea Actions and the user cannot access
the repo's actions unit (the user does not have the permission or the
actions unit is disabled), a 404 page will occur after clicking the
"Details" link. We should hide the "Details" link in this case.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/68361714-b784-4bb5-baab-efde4221f466"
width="400px" />

2 months agoEnable `no-jquery/no-parse-html-literal` and fix violation (#31684)
silverwind [Sat, 27 Jul 2024 14:44:41 +0000 (16:44 +0200)]
Enable `no-jquery/no-parse-html-literal` and fix violation (#31684)

Tested it, path segment creation works just like before.

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 27 Jul 2024 00:27:00 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoOIDC: case-insensitive comparison for auth scheme `Basic` (#31706)
Shivaram Lingamneni [Fri, 26 Jul 2024 19:51:45 +0000 (21:51 +0200)]
OIDC: case-insensitive comparison for auth scheme `Basic` (#31706)

@kylef pointed out on https://github.com/go-gitea/gitea/pull/31632 that
[RFC7617](https://www.rfc-editor.org/rfc/rfc7617.html#section-2)
mandates case-insensitive comparison of the scheme field `Basic`. #31632
copied a case-sensitive comparison from
https://github.com/go-gitea/gitea/pull/6293. This PR fixes both
comparisons.

The issue only affects OIDC, since the implementation for normal Gitea
endpoints is already correct:

https://github.com/go-gitea/gitea/blob/930ca92d7ce80e8b0bdaf92e495026baf2a1d419/services/auth/basic.go#L55-L58

2 months agoSupport `pull_request_target` event for commit status (#31703)
Zettat123 [Fri, 26 Jul 2024 10:00:07 +0000 (18:00 +0800)]
Support `pull_request_target` event for commit status (#31703)

Fix [act_runner #573](https://gitea.com/gitea/act_runner/issues/573)

Before:

![image](https://github.com/user-attachments/assets/3944bf7f-7a60-4801-bcb3-5e158a180fda)

After:

![image](https://github.com/user-attachments/assets/cadac944-40bd-4537-a9d9-e702b8bc1ece)

2 months agoAdd types to fetch,toast,bootstrap,svg (#31627)
silverwind [Thu, 25 Jul 2024 23:31:24 +0000 (01:31 +0200)]
Add types to fetch,toast,bootstrap,svg (#31627)

Reduce `tsc` error count by 53. None of the changes has any runtime
effect.

2 months agoRun `detectWebAuthnSupport` only if necessary (#31691)
Jason Song [Thu, 25 Jul 2024 23:26:41 +0000 (07:26 +0800)]
Run `detectWebAuthnSupport` only if necessary (#31691)

Follow #31676, which is not correct, see
https://github.com/go-gitea/gitea/pull/31676#issuecomment-2246658217

Fix #31675, regression of #31504.

2 months agoadd `username` to OIDC introspection response (#31688)
Shivaram Lingamneni [Thu, 25 Jul 2024 12:36:05 +0000 (14:36 +0200)]
add `username` to OIDC introspection response (#31688)

This field is specified as optional here:
https://datatracker.ietf.org/doc/html/rfc7662#section-2.2

It's used by some OIDC integrations, e.g.
https://emersion.fr/blog/2022/irc-and-oauth2/

Co-authored-by: Giteabot <teabot@gitea.io>
2 months agoAdd return type to GetRawFileOrLFS and GetRawFile (#31680)
Adam Majer [Thu, 25 Jul 2024 12:06:19 +0000 (14:06 +0200)]
Add return type to GetRawFileOrLFS and GetRawFile (#31680)

Document return type for the endpoints that fetch specific files from a
repository. This allows the swagger generated code to read the returned
data.

Co-authored-by: Giteabot <teabot@gitea.io>
2 months agoSupport delete user email in admin panel (#31690)
yp05327 [Thu, 25 Jul 2024 10:11:04 +0000 (19:11 +0900)]
Support delete user email in admin panel (#31690)

![QQ_1721784609320](https://github.com/user-attachments/assets/23f08bf3-93f4-44d7-963d-10380ef8c1f1)

![QQ_1721784616403](https://github.com/user-attachments/assets/667cbd1e-5e21-4489-8d18-2a7be85190db)

![QQ_1721784626722](https://github.com/user-attachments/assets/495beb94-dfa2-481c-aa60-d5115cad1ae1)

---------

Co-authored-by: Jason Song <i@wolfogre.com>
2 months agoUse GetDisplayName() instead of DisplayName() to generate rss feeds (#31687)
Stanislas Dolcini [Thu, 25 Jul 2024 09:33:02 +0000 (11:33 +0200)]
Use GetDisplayName() instead of DisplayName() to generate rss feeds (#31687)

Fixes #31491 The RSS feed converted ignored the setting used in the
application.

2 months agoFix "Filter by commit" Dropdown (#31695)
wxiaoguang [Thu, 25 Jul 2024 01:48:51 +0000 (09:48 +0800)]
Fix "Filter by commit" Dropdown (#31695)

Regression of #31281
Fix #31673

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 25 Jul 2024 00:27:15 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months agouse nolyfill to remove some polyfills (#31468)
techknowlogick [Wed, 24 Jul 2024 00:42:21 +0000 (20:42 -0400)]
use nolyfill to remove some polyfills (#31468)

We don't need to have polyfills down to Node v4. Some of our deps have
polyfills, and don't utilize the built-in implementation if available.
While this does decrease our package graph, I haven't been able to
notice any decrease/increase in page load times, although that could
likely be just because it's already pretty fast.

Nolyfill is https://github.com/SukkaW/nolyfill

updates to files generated with:

```shell
npx nolyfill install
npm update
```

Before this is/isn't merged, I'd be appreciative/thankful for other's
insights.

Edit: This isn't due to a specific individual. I am generally supportive
of them and their dedication to backward compatibility. This PR is due
to not needing those imports for our minimum requirements. Please don't
take this PR as commentary on anyone's character.

---------

Co-authored-by: silverwind <me@silverwind.io>
2 months agoProperly filter issue list given no assignees filter (#31522)
Kemal Zebari [Tue, 23 Jul 2024 18:36:32 +0000 (11:36 -0700)]
Properly filter issue list given no assignees filter (#31522)

Quick fix #31520. This issue is related to #31337.

2 months agoRun `detectWebAuthnSupport` only on sign-in page (#31676)
Jason Song [Tue, 23 Jul 2024 17:52:40 +0000 (01:52 +0800)]
Run `detectWebAuthnSupport` only on sign-in page (#31676)

Fix #31675, regression of #31504.

2 months agofix OIDC introspection authentication (#31632)
Shivaram Lingamneni [Tue, 23 Jul 2024 12:43:03 +0000 (14:43 +0200)]
fix OIDC introspection authentication (#31632)

See discussion on #31561 for some background.

The introspect endpoint was using the OIDC token itself for
authentication. This fixes it to use basic authentication with the
client ID and secret instead:

* Applications with a valid client ID and secret should be able to
  successfully introspect an invalid token, receiving a 200 response
  with JSON data that indicates the token is invalid
* Requests with an invalid client ID and secret should not be able
  to introspect, even if the token itself is valid

Unlike #31561 (which just future-proofed the current behavior against
future changes to `DISABLE_QUERY_AUTH_TOKEN`), this is a potential
compatibility break (some introspection requests without valid client
IDs that would previously succeed will now fail). Affected deployments
must begin sending a valid HTTP basic authentication header with their
introspection requests, with the username set to a valid client ID and
the password set to the corresponding client secret.

2 months agoEnable direnv (#31672)
techknowlogick [Tue, 23 Jul 2024 12:07:41 +0000 (08:07 -0400)]
Enable direnv (#31672)

This lets developers who have direnv enabled to load our nix flake
automatically when entering it

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 23 Jul 2024 00:27:23 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 21 Jul 2024 00:30:14 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

2 months agofix redis dep (#31662)
techknowlogick [Fri, 19 Jul 2024 20:10:31 +0000 (16:10 -0400)]
fix redis dep (#31662)

fix https://github.com/go-gitea/gitea/issues/31658