aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Use db.WithTx/WithTx2 instead of TxContext when possible (#35130)Lunny Xiao6 days15-459/+326
|
* Fix session gob (#35128)wxiaoguang9 days2-9/+8
| | | Fix #35126
* Don't use full-file highlight when there is a git diff textconv (#35114)wxiaoguang10 days1-2/+5
| | | Fix #35106
* Fix submodule parsing when the gitmodules is missing (#35109)wxiaoguang10 days1-1/+3
| | | | | | Follow up #35096, fix #35095, fix #35115 and add more tests The old code used some fragile behaviors which depend on the "nil" receiver. This PR should be a complete fix for more edge cases.
* Fix error logs and improve some comments/messages (#35105)wxiaoguang11 days2-1/+2
|
* Support Basic Authentication for archive downloads (#35087)pvgoran12 days1-2/+2
| | | Resolves #35083
* Rename pull request GetGitRefName to GetGitHeadRefName (#35093)Lunny Xiao12 days17-50/+50
|
* Redirect to a presigned URL of HEAD for HEAD requests (#35088)Risu12 days2-16/+20
| | | | | | | Resolves https://github.com/go-gitea/gitea/issues/35086. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Send email on Workflow Run Success/Failure (#34982)NorthRealm13 days5-34/+240
| | | | | | | | | | | | | | | Closes #23725 ![1](https://github.com/user-attachments/assets/9bfa76ea-8c45-4155-a5d4-dc2f0667faa8) ![2](https://github.com/user-attachments/assets/49be7402-e5d5-486e-a1c2-8d3222540b13) /claim #23725 --------- Signed-off-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: ChristopherHX <christopher.homberger@web.de>
* Improve submodule relative path handling (#35056)wxiaoguang2025-07-145-21/+23
| | | | | | | Fix #35054 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Fix user's sign email check (#35045)wxiaoguang2025-07-122-28/+52
| | | Fix #21692
* Fix incorrect comment diff hunk parsing, fix github asset ID nil panic (#35046)Lunny Xiao2025-07-112-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | * Fix missing the first char when parsing diff hunk header * Fix #35040 * Fix #35049 ---- Introduced in https://github.com/go-gitea/gitea/pull/12047/files#diff-de48c2f70e24ff5603180acf8b5ce9d0356ede8a45bfbf2a485707282ace6d6aR268 Before: <img width="487" height="167" alt="image" src="https://github.com/user-attachments/assets/17524c76-a296-4b4b-a4f9-c5150c41bae5" /> After: <img width="749" height="144" alt="image" src="https://github.com/user-attachments/assets/bcb12c76-c1ae-40f1-81b7-183d15f891db" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix git commit committer parsing and add some tests (#35007)Lunny Xiao2025-07-103-40/+29
| | | | | | | | * Fix #34991 * Fix #34882 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor OpenIDConnect to support SSH/FullName sync (#34978)wxiaoguang2025-07-107-94/+78
| | | | | * Fix #26585 * Fix #28327 * Fix #34932
* Support base64-encoded agit push options (#35037)wxiaoguang2025-07-102-2/+32
|
* Fix ListWorkflowRuns OpenAPI response model. (#35026)Scion2025-07-101-1/+1
| | | | | | | | | Change the OpenAPI response of `ListWorkflowRuns` to `WorkflowRunsList` like it is supposed to be. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor mail template and support preview (#34990)wxiaoguang2025-07-098-39/+42
|
* Start automerge check again after the conflict check and the schedule (#34989)wxiaoguang2025-07-085-49/+127
| | | | | Fix #34988 Co-authored-by: posativ
* Enable gocritic `equalFold` and fix issues (#34952)silverwind2025-07-065-5/+5
| | | | | | | Continuation of https://github.com/go-gitea/gitea/pull/34678. --------- Signed-off-by: silverwind <me@silverwind.io>
* Refactor webhook and fix feishu/lark secret (#34961)wxiaoguang2025-07-061-2/+1
|
* Improve OAuth2 provider (correct Issuer, respect ENABLED) (#34966)wxiaoguang2025-07-062-8/+17
| | | | | | | | 1. Make "Issuer" strictly follow the spec (see comment) 2. Make "/.well-known/openid-configuration" respond 404 if the OAuth2 provider is not enabled. Then by the way, remove the JSEscape template helper because it is not needed any more.
* Mark old reviews as stale on agit pr updates (#34933)Dan Čermák2025-07-051-0/+27
| | | Fixes: https://github.com/go-gitea/gitea/issues/34134
* Fix git graph page (#34948)wxiaoguang2025-07-041-2/+6
| | | fix #34946
* Fix http auth header parsing (#34936)wxiaoguang2025-07-033-24/+15
| | | Using `strings.EqualFold` is wrong in many cases.
* Don't send trigger for a pending review's comment create/update/delete (#34928)Lunny Xiao2025-07-031-0/+23
| | | | | | | | Fix #18846 Fix #34924 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support getting last commit message using contents-ext API (#34904)RickyMa2025-07-033-98/+40
| | | | | | | | Fix #34870 Fix #34929 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Follow file symlinks in the UI to their target (#28835)delvh2025-07-011-1/+1
| | | | | | | | | | Symlinks are followed when you click on a link next to an entry, either until a file has been found or until we know that the link is dead. When the link cannot be accessed, we fall back to the current behavior of showing the document containing the target. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor container package (#34877)wxiaoguang2025-06-291-1/+1
| | | Use standard db.WithTx and introduce db.WithTx2
* enforce explanation for necessary nolints and fix bugs (#34883)TheFox0x72025-06-277-64/+16
| | | | | | | Follows up https://github.com/go-gitea/gitea/pull/34851 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* enforce nolint scope (#34851)TheFox0x72025-06-2710-14/+23
| | | | | | | | | | | | | | | enable nolintlint scope requirement add comments to new directives so it's more obvious why they are in place --- I can also toggle the mandatory comments on if that's something of interest. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Add issue delete notifier (#34592)badhezi2025-06-251-0/+37
| | | | | | Fixes https://github.com/go-gitea/gitea/issues/34591 A reference regarding the deletion of issue webhooks on GitHub: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=deleted#issues
* Refactor "change file" API (#34855)wxiaoguang2025-06-252-2/+1
| | | | | | | | | Follow up the "editor" refactor, use the same approach to simplify code, and fix some docs & comments --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Refactor repo contents API and add "contents-ext" API (#34822)wxiaoguang2025-06-254-200/+151
| | | See the updated swagger document for details.
* fix(issue): Replace stopwatch toggle with explicit start/stop actions (#34818)Junsik Kong2025-06-251-2/+2
| | | | | | | | | | | | | | | | This PR fixes a state de-synchronization bug with the issue stopwatch, it resolves the issue by replacing the ambiguous `/toggle` endpoint with two explicit endpoints: `/start` and `/stop`. - The "Start timer" button now exclusively calls the `/start` endpoint. - The "Stop timer" button now exclusively calls the `/stop` endpoint. This ensures the user's intent is clearly communicated to the server, eliminating the state inconsistency and fixing the bug. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix SSH LFS timeout (#34838)wxiaoguang2025-06-241-6/+3
| | | Fix #34834
* Ignore force pushes for changed files in a PR review (#34837)delvh2025-06-241-1/+2
| | | | | | | Fixes #34832 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix log fmt (#34810)Lunny Xiao2025-06-241-1/+1
|
* Fix team permissions (#34827)wxiaoguang2025-06-243-4/+4
| | | | * Fix #34793 * Fix #33456
* Fix required contexts and commit status matching bug (#34815)Zettat1232025-06-222-2/+14
| | | | | | | | | | | | Fix #34504 Since one required context can match more than one commit statuses, we should not directly compare the lengths of `requiredCommitStatuses` and `requiredContexts` --------- Signed-off-by: Zettat123 <zettat123@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Edit file workflow for creating a fork and proposing changes (#34240)Brecht Van Lommel2025-06-222-45/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When viewing a file that the user can't edit because they can't write to the branch, the new, upload, patch, edit and delete functionality is no longer disabled. If no user fork of the repository exists, there is now a page to create one. It will automatically create a fork with a single branch matching the one being viewed, and a unique repository name will be automatically picked. When a fork exists, but it's archived, a mirror or the user can't write code to it, there will instead be a message explaining the situation. If the usable fork exists, a message will appear at the top of the edit page explaining that the changes will be applied to a branch in the fork. The base repository branch will be pushed to a new branch to the fork, and then the edits will be applied on top. The suggestion to fork happens when accessing /_edit/, so that for example online documentation can have an "edit this page" link to the base repository that does the right thing. Also includes changes to properly report errors when trying to commit to a new branch that is protected, and when trying to commit to an existing branch when choosing the new branch option. Resolves #9017, #20882 --------- Co-authored-by: Brecht Van Lommel <brecht@blender.org> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor packages (#34777)wxiaoguang2025-06-221-1/+1
|
* Refactor wiki (#34805)wxiaoguang2025-06-221-1/+1
| | | Remove unclear code
* Rework delete org and rename org UI (#34762)Lunny Xiao2025-06-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # What's the problem of the original implementation Renaming organization will mix with organization's information change make the operation difficult to keep consistent. This PR created a danger zone like what's repository setting. It also moved organization's `rename` and `delete` operations to this zone. The original updating repository will not change the name any more. This is also a step to extract the `updaterepository` function completely. Before: ![image](https://github.com/user-attachments/assets/d097dfdf-07be-4d79-8fcf-e78822515575) ![image](https://github.com/user-attachments/assets/42ee832c-cb44-41ec-9fe3-92a1c94747d2) After: ![image](https://github.com/user-attachments/assets/f7700ed7-f104-4302-a924-09e118f24be3) ![image](https://github.com/user-attachments/assets/4c49952a-578e-4d14-bd01-4a68c9e02412) ![image](https://github.com/user-attachments/assets/814829d3-00fe-4e87-ae05-625c129170d2) ![image](https://github.com/user-attachments/assets/b067b263-c909-4b48-b23c-73481c32d350) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor editor (#34780)wxiaoguang2025-06-219-380/+223
| | | A complete rewrite
* Improve img lazy loading (#34804)wxiaoguang2025-06-211-1/+1
| | | Related #32051 and #13526
* Fix Feishu webhook signature verification (#34788)Snowball_2332025-06-203-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # Fix Feishu Webhook Signature Verification This PR implements proper signature verification for Feishu (Lark) webhooks according to the [official documentation](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot). ## Changes - Implemented the `GenSign` function based on Feishu's official Go sample code - Modified the webhook request creation to include timestamp and signature in the payload when a secret is configured - Fixed the signature generation algorithm to properly use HMAC-SHA256 with the correct string format ## Implementation Details The signature verification works as follows: 1. When a webhook secret is provided, a timestamp is generated 2. The signature string is created using `timestamp + "\n" + secret` 3. The HMAC-SHA256 algorithm is applied to an empty string using the signature string as the key 4. The result is Base64 encoded to produce the final signature 5. Both timestamp and signature are added to the payload According to Feishu's documentation, the timestamp must be within 1 hour (3600 seconds) of the current time to be considered valid. ## Security Note Feishu emphasizes the importance of keeping webhook URLs secure. Do not disclose them on GitHub, blogs, or any public sites to prevent unauthorized use. ## References - [Feishu Custom Bot Documentation](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot) --------- Co-authored-by: hiifong <i@hiif.ong> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add workflow_run api + webhook (#33964)ChristopherHX2025-06-2025-170/+511
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run - `/actions/runs` for global + user + org (Gitea only) - `/actions/jobs` for global + user + org + repository (Gitea only) - workflow_run webhook + action trigger - limitations - workflow id is assigned to a string, this may result into problems in strongly typed clients Fixes - workflow_job webhook url to no longer contain the `runs/<run>` part to align with api - workflow instance does now use it's name inside the file instead of filename if set Refactoring - Moved a lot of logic from workflows/workflow_job into a shared module used by both webhook and api TODO - [x] Verify Keda Compatibility - [x] Edit Webhook API bug is resolved Closes https://github.com/go-gitea/gitea/issues/23670 Closes https://github.com/go-gitea/gitea/issues/23796 Closes https://github.com/go-gitea/gitea/issues/24898 Replaces https://github.com/go-gitea/gitea/pull/28047 and is much more complete --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add ff_only parameter to POST /repos/{owner}/{repo}/merge-upstream (#34770)Dan Čermák2025-06-191-1/+6
| | | | | | | | | The merge-upstream route was so far performing any kind of merge, even those that would create merge commits and thus make your branch diverge from upstream, requiring manual intervention via the git cli to undo the damage. With the new optional parameter ff_only, we can instruct gitea to error out, if a non-fast-forward merge would be performed.
* Upgrade `gopls` to v0.19.0, add `make fix` (#34772)silverwind2025-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upgrade to [v0.19.0](https://github.com/golang/tools/releases/tag/gopls%2Fv0.19.0) and fix issues. Runs with new `warning` serverity setting. This likely does less checks than before. Additionally, add `make fix` which runs modernize. This is also verified on CI. For the record, here are the issues discoverd when running with `info` severity, in case we want to fix these: ``` tests/integration/repo_test.go:95:5-14: could use tagged switch on i tests/integration/api_packages_generic_test.go:149:4-64: could use tagged switch on setting.Packages.Storage.Type services/webhook/msteams_test.go:33:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:59:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:85:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:111:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:138:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:161:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:187:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:213:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:239:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:266:4-33: could use tagged switch on fact.Name services/webhook/msteams_test.go:407:4-33: could use tagged switch on fact.Name tests/integration/api_packages_conan_test.go:350:6-33: could use tagged switch on pf.Name models/issues/tracked_time_test.go:98:3-18: could use tagged switch on user.ID tests/integration/api_token_test.go:505:5-43: could use tagged switch on minRequiredLevel services/gitdiff/gitdiff.go:220:33-46: method "getLineLegacy" is unused ``` --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor packages (func name & UI) (#34773)wxiaoguang2025-06-181-11/+11
| | | | | | 1. Use `OpenXxx` instead of `GetXxx` because the returned readers should be correctly closed, and clarify the behaviors of the functions: they increase the download counter 2. Use `packages-content` styles instead of `issue-content`