aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle invalid target when creating releases using API (#31841)Kemal Zebari2024-09-121-0/+3
| | | | | | | A 500 status code was thrown when passing a non-existent target to the create release API. This snapshot handles this error and instead throws a 404 status code. Discovered while working on #31840.
* Support migration from AWS CodeCommit (#31981)Zettat1232024-09-111-0/+4
| | | | | | | | | | | | | | | | | | | | This PR adds support for migrating repos from [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html). The access key ID and secret access key are required to get repository information and pull requests. And [HTTPS Git credentials](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html) are required to clone the repository. <img src="https://github.com/user-attachments/assets/82ecb2d0-8d43-42b0-b5af-f5347a13b9d0" width="680" /> The AWS CodeCommit icon is from [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/). <img src="https://github.com/user-attachments/assets/3c44d21f-d753-40f5-9eae-5d3589e0d50d" width="320" />
* bump to go 1.23 (#31855)techknowlogick2024-09-101-1/+1
|
* Save initial signup information for users to aid in spam prevention (#31852)techknowlogick2024-09-091-1/+1
| | | | | | | | | | | | | | This will allow instance admins to view signup pattern patterns for public instances. It is modelled after discourse, mastodon, and MediaWiki's approaches. Note: This has privacy implications, but as the above-stated open-source projects take this approach, especially MediaWiki, which I have no doubt looked into this thoroughly, it is likely okay for us, too. However, I would be appreciative of any feedback on how this could be improved. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Remove SHA1 for support for ssh rsa signing (#31857)Wim2024-09-071-1/+1
| | | | | | | | | | | | https://github.com/go-fed/httpsig seems to be unmaintained. Switch to github.com/42wim/httpsig which has removed deprecated crypto and default sha256 signing for ssh rsa. No impact for those that use ed25519 ssh certificates. This is a breaking change for: - gitea.com/gitea/tea (go-sdk) - I'll be sending a PR there too - activitypub using deprecated crypto (is this actually used?)
* Return 404 instead of error when commit not exist (#31977)Adam Majer2024-09-061-1/+1
| | | Fix #31976
* Fix nuget/conan/container packages upload bugs (#31967)Lunny Xiao2024-09-055-10/+66
|
* Fix 500 error when `state` params is set when editing issue/PR by API (#31880)yp053272024-09-022-10/+38
| | | A quick fix for #31871
* Fix RPM resource leak (#31794)KN4CK3R2024-08-081-4/+5
| | | | | | | Fixes a resource leak introduced by #27069. - add defer - move sign code out of `repository.go`
* Add signature support for the RPM module (#27069)Exploding Dragon2024-08-061-1/+15
| | | | | | | | 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.
* Set owner id to zero when GetRegistrationToken for repo (#31725)Jason Song2024-07-291-1/+1
| | | | | | | | | 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.
* fix(api): owner ID should be zero when created repo secret (#31715)Bo-Yi Wu2024-07-291-4/+2
| | | | | | | | | - 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>
* Fix API endpoint for registration-token (#31722)Jason Song2024-07-291-1/+1
| | | Partially fix #31707. Related to #30656
* Add permission check when creating PR (#31033)yp053272024-07-291-0/+2
| | | user should be a collaborator of the base repo to create a PR
* Add return type to GetRawFileOrLFS and GetRawFile (#31680)Adam Majer2024-07-251-1/+7
| | | | | | | 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>
* add skip secondary authorization option for public oauth2 clients (#31454)Denys Konovalov2024-07-191-9/+11
|
* Allow force push to protected branches (#28086)Henry Goodman2024-07-051-6/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22722 ### Problem Currently, it is not possible to force push to a branch with branch protection rules in place. There are often times where this is necessary (CI workflows/administrative tasks etc). The current workaround is to rename/remove the branch protection, perform the force push, and then reinstate the protections. ### Solution Provide an additional section in the branch protection rules to allow users to specify which users with push access can also force push to the branch. The default value of the rule will be set to `Disabled`, and the UI is intuitive and very similar to the `Push` section. It is worth noting in this implementation that allowing force push does not override regular push access, and both will need to be enabled for a user to force push. This applies to manual force push to a remote, and also in Gitea UI updating a PR by rebase (which requires force push) This modifies the `BranchProtection` API structs to add: - `enable_force_push bool` - `enable_force_push_whitelist bool` - `force_push_whitelist_usernames string[]` - `force_push_whitelist_teams string[]` - `force_push_whitelist_deploy_keys bool` ### Updated Branch Protection UI: <img width="943" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/7491899c-d816-45d5-be84-8512abd156bf"> ### Pull Request `Update branch by Rebase` option enabled with source branch `test` being a protected branch: ![image](https://github.com/go-gitea/gitea/assets/79623665/e018e6e9-b7b2-4bd3-808e-4947d7da35cc) <img width="1038" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/57ead13e-9006-459f-b83c-7079e6f4c654"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor names (#31405)wxiaoguang2024-06-1986-415/+415
| | | | | | | This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
* Improve rubygems package registry (#31357)wxiaoguang2024-06-172-6/+134
| | | | | | | To make it work with Bundler: https://guides.rubygems.org/rubygems-org-compact-index-api/ It only adds 2 new API endpoints and improves some tests, existing logic is not changed.
* Fix missing images in editor preview due to wrong links (#31299)Brecht Van Lommel2024-06-171-39/+61
| | | | | | | | | | Parse base path and tree path so that media links can be correctly created with /media/. Resolves #31294 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Rename repo_model.SearchOrderByMap to repo_model.OrderByMap (#31359)65432024-06-151-1/+1
| | | https://github.com/go-gitea/gitea/pull/30876#discussion_r1637112394
* Fix duplicate sub-path for avatars (#31365)wxiaoguang2024-06-151-1/+1
| | | | | | | | | | | Fix #31361, and add tests And this PR introduces an undocumented & debug-purpose-only config option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps the development of sub-path related problems. And also fix #31366 Co-authored-by: @ExplodingDragon
* Add tag protection via rest api #17862 (#31295)mzroot2024-06-144-0/+379
| | | | | | | | Add tag protection manage via rest API. --------- Co-authored-by: Alexander Kogay <kogay.a@citilink.ru> Co-authored-by: Giteabot <teabot@gitea.io>
* [Refactor] Unify repo search order by logic (#30876)65432024-06-131-1/+1
| | | | have repo OrderBy definitions defined in one place and use a single type for OrderBy database options
* Reduce memory usage for chunked artifact uploads to MinIO (#31325)Rowan Bohde2024-06-121-2/+2
| | | | | | | | | | | | When using the MinIO storage driver for Actions Artifacts, we found that the chunked artifact required significantly more memory usage to both upload and merge than the local storage driver. This seems to be related to hardcoding a value of `-1` for the size to the MinIO client [which has a warning about memory usage in the respective docs](https://pkg.go.dev/github.com/minio/minio-go/v7#Client.PutObject). Specifying the size in both the upload and merge case reduces memory usage of the MinIO client. Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Enable `unparam` linter (#31277)silverwind2024-06-116-27/+23
| | | | | | | | | | | | Enable [unparam](https://github.com/mvdan/unparam) linter. Often I could not tell the intention why param is unused, so I put `//nolint` for those cases like webhook request creation functions never using `ctx`. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Remove sub-path from container registry realm (#31293)wxiaoguang2024-06-091-3/+3
| | | | Container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed
* Fix NuGet Package API for $filter with Id equality (#31188)Thomas Desveaux2024-06-041-19/+29
| | | | | | | | | | | | | | | | Fixes issue when running `choco info pkgname` where `pkgname` is also a substring of another package Id. Relates to #31168 --- This might fix the issue linked, but I'd like to test it with more choco commands before closing the issue in case I find other problems if that's ok. --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Performance improvements for pull request list API (#30490)Lunny Xiao2024-05-311-16/+32
| | | | | | | | Fix #30483 --------- Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Azure blob storage support (#30995)Lunny Xiao2024-05-304-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This PR implemented object storages(LFS/Packages/Attachments and etc.) for Azure Blob Storage. It depends on azure official golang SDK and can support both the azure blob storage cloud service and azurite mock server. Replace #25458 Fix #22527 - [x] CI Tests - [x] integration test, MSSQL integration tests will now based on azureblob - [x] unit test - [x] CLI Migrate Storage - [x] Documentation for configuration added ------ TODO (other PRs): - [ ] Improve performance of `blob download`. --------- Co-authored-by: yp05327 <576951401@qq.com>
* Add an immutable tarball link to archive download headers for Nix (#31139)Jörg Thalheim2024-05-281-0/+6
| | | | | | | | This allows `nix flake metadata` and nix in general to lock a *branch* tarball link in a manner that causes it to fetch the correct commit even if the branch is updated with a newer version. Co-authored-by: Jade Lovelace <software@lfcode.ca> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add missed return after `ctx.ServerError` (#31130)Lunny Xiao2024-05-281-0/+1
|
* Prevent simultaneous editing of comments and issues (#31053)metiftikci2024-05-275-5/+15
| | | | | | | | | | | fixes #22907 Tested: - [x] issue content edit - [x] issue content change tasklist - [x] pull request content edit - [x] pull request change tasklist ![issue-content-edit](https://github.com/go-gitea/gitea/assets/29250154/a0828889-fb96-4bc4-8600-da92e3205812)
* Fix "force private" logic (#31012)wxiaoguang2024-05-202-3/+3
| | | | | When creating a repo, the "FORCE_PRIVATE" config option should be respected, `readonly` doesn't work for checkbox, so it should use `disabled` attribute.
* Improve reverse proxy documents and clarify the AppURL guessing behavior ↵wxiaoguang2024-05-191-0/+2
| | | | | | | | | | | | (#31003) Fix #31002 1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea 2. Clarify the basic requirements and move the "general configuration" to the top 3. Add a comment for the "container registry" 4. Use 1.21 behavior if the reverse proxy is not correctly configured Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix bug on avatar (#31008)Lunny Xiao2024-05-192-0/+4
| | | Co-authored-by: silverwind <me@silverwind.io>
* Simplify mirror repository API logic (#30963)wxiaoguang2024-05-171-9/+3
| | | Fix #30921
* Protected tag is no internal server error (#30962)KN4CK3R2024-05-143-8/+17
| | | | | | Fixes #30959 Adds an API test for protected tags. Fix existing tag in combination with fixtures.
* Support using label names when changing issue labels (#30943)Zettat1232024-05-131-1/+28
| | | | | | | | | | | | Resolve #30917 Make the APIs for adding labels and replacing labels support both label IDs and label names so the [`actions/labeler`](https://github.com/actions/labeler) action can work in Gitea. <img width="600px" src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3" />
* Remove deprecated stuff for runners (#30930)Jason Song2024-05-102-19/+0
| | | | | | | | It's time (maybe somewhat late) to remove some deprecated stuff for the runner. - `x-runner-version`: runners needn't to report version in every request, they will call `Declare`. - `AgentLabels`: runners will report them as `Labels`.
* Fix misspelling of mergable (#30896)yp053272024-05-081-2/+2
| | | | https://github.com/go-gitea/gitea/pull/25812#issuecomment-2099833692 Follow #30573
* Refactor AppURL usage (#30885)wxiaoguang2024-05-073-10/+13
| | | | | | | | Fix #30883 Fix #29591 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Don't only list code-enabled repositories when using repository API (#30817)Kemal Zebari2024-05-031-3/+1
| | | | | We should be listing all repositories by default. Fixes #28483.
* Fix no edit history after editing issue's title and content (#30814)yp053272024-05-032-40/+33
| | | | | Fix #30807 reuse functions in services
* Ignore useless error message "broken pipe" (#30801)wxiaoguang2024-05-031-3/+1
| | | Fix #30792
* refactor: merge ListActionTasks func to action.go file (#30811)Bo-Yi Wu2024-05-022-80/+66
| | | | | Just merge actions.go file to action.go Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Catch and handle unallowed file type errors in issue attachment API (#30791)Kemal Zebari2024-05-022-2/+17
| | | | | Before, we would just throw 500 if a user passes an attachment that is not an allowed type. This commit catches this error and throws a 422 instead since this should be considered a validation error.
* Add API endpoints for getting action jobs status (#26673)Chester2024-05-013-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sample of response, it is similar to Github actions ref https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository ``` json { "workflow_runs": [ { "id": 3, "name": "Explore-Gitea-Actions", "head_branch": "main", "head_sha": "6d8d29a9f7a01ded8f8aeb64341cb31ee1ab5f19", "run_number": 3, "event": "push", "display_title": "More job", "status": "success", "workflow_id": "demo2.yaml", "url": "/chester/test/actions/runs/3", "created_at": "2023-08-22T13:41:33-04:00", "updated_at": "2023-08-22T13:41:37-04:00", "run_started_at": "2023-08-22T13:41:33-04:00" }, { "id": 2, "name": "Explore-Gitea-Actions", "head_branch": "main", "head_sha": "6d8d29a9f7a01ded8f8aeb64341cb31ee1ab5f19", "run_number": 2, "event": "push", "display_title": "More job", "status": "success", "workflow_id": "demo.yaml", "url": "/chester/test/actions/runs/2", "created_at": "2023-08-22T13:41:30-04:00", "updated_at": "2023-08-22T13:41:33-04:00", "run_started_at": "2023-08-22T13:41:30-04:00" }, { "id": 1, "name": "Explore-Gitea-Actions", "head_branch": "main", "head_sha": "e5369ab054cae79899ba36e45ee82811a6e0acd5", "run_number": 1, "event": "push", "display_title": "Add job", "status": "failure", "workflow_id": "demo.yaml", "url": "/chester/test/actions/runs/1", "created_at": "2023-08-22T13:15:21-04:00", "updated_at": "2023-08-22T13:18:10-04:00", "run_started_at": "2023-08-22T13:15:21-04:00" } ], "total_count": 3 } ``` --------- Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
* Resolve lint for unused parameter and unnecessary type arguments (#30750)Chongyi Zheng2024-04-292-6/+6
| | | | | | | | | | Resolve all cases for `unused parameter` and `unnecessary type arguments` Related: #30729 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Add support for npm bundleDependencies (#30751)Micash2024-04-291-0/+1
|