aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
Commit message (Collapse)AuthorAgeFilesLines
* Move delete deploy keys into service layer (#32201)Lunny Xiao2024-12-181-1/+1
|
* Move RepoTransfer from models to models/repo sub package (#32506)Lunny Xiao2024-12-183-8/+7
| | | | | | | | | | | | | `RepoTransfer` now is at models, but if we want to move it into `repo` model, it will depend on `Team`. So this PR also makes repo model depend on org model to make it possible. Just refactor, no code change. - [x] Move `DeleteOrganization` from `models/organization` to service layer - [x] Move `AccessibleTeamReposEnv` to `models/repo` - [x] Move `RepoTransfer` from `models` to `models/repo` - [x] Merge `getUserTeamIDs` and `GetUserTeamIDs`, Merge `GetUserTeams` and `getUserTeams`. - [x] Remove `Team`'s `Repos []*repo_model.Repository` to avoid dependency recycle.
* Update golangci-lint to v1.62.2, fix issues (#32845)silverwind2024-12-152-4/+4
| | | Update it and fix new issues related to `redefines-builtin-id`
* Fix missing outputs for jobs with matrix (#32823)Zettat1232024-12-143-16/+86
| | | | | | | Fix #32795 If a job uses a matrix, multiple `ActionRunJobs` may have the same `JobID`. We need to merge the outputs of these jobs to make them available to the jobs that need them.
* Make API "compare" accept commit IDs (#32801)wxiaoguang2024-12-122-83/+79
|
* Implement update branch API (#32433)Kemal Zebari2024-12-123-0/+74
| | | | | | | | | | Resolves #22526. Builds upon #23061. --------- Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add standard-compliant route to serve outdated R packages (#32783)Sebastian T. T.2024-12-111-0/+1
| | | | | | | | | | | | | The R package repository currently does not have support for older versions of packages which should be stored in a separate /Archive router. This PR remedies that by adding a new path router. I am a member of a group that loves using Gitea and this bug has been annoying us for a long time. Hope it can be merged in time for Gitea 1.23.0. Any feedback much appreciated. Fixes #32782
* Use batch database operations instead of one by one to optimze api pulls ↵Lunny Xiao2024-12-111-33/+2
| | | | | | | | | | | | | | | | | | | | (#32680) Resolve #31492 The response time for the Pull Requests API has improved significantly, dropping from over `2000ms` to about `350ms` on my local machine. It's about `6` times faster. A key area for further optimization lies in batch-fetching data for `apiPullRequest.ChangedFiles, apiPullRequest.Additions, and apiPullRequest.Deletions`. Tests `TestAPIViewPulls` does exist and new tests added. - This PR also fixes some bugs in `GetDiff` functions. - This PR also fixes data inconsistent in test data. For a pull request, the head branch's reference should be equal to the reference in `pull/xxx/head`.
* Fix internal server error when updating labels without write permission (#32776)yp053272024-12-101-5/+5
| | | | | | Fix #32775 if permission denined, `prepareForReplaceOrAdd` will return nothing, and this case is not handled.
* Add Arch package registry (#32692)KN4CK3R2024-12-042-0/+350
| | | | | | | | | | | | | | | | | | | | | | | Close #25037 Close #31037 This PR adds a Arch package registry usable with pacman. ![grafik](https://github.com/user-attachments/assets/81cdb0c2-02f9-4733-bee2-e48af6b45224) Rewrite of #25396 and #31037. You can follow [this tutorial](https://wiki.archlinux.org/title/Creating_packages) to build a package for testing. Docs PR: https://gitea.com/gitea/docs/pulls/111 Co-authored-by: [d1nch8g@ion.lc](mailto:d1nch8g@ion.lc) Co-authored-by: @ExplodingDragon --------- Co-authored-by: dancheg97 <dancheg97@fmnx.su> Co-authored-by: dragon <ExplodingFKL@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix delete branch perm checking (#32654)Lunny Xiao2024-12-042-44/+44
|
* Add Swift login endpoint (#32693)KN4CK3R2024-12-032-43/+59
| | | | | Fix #32683 This PR adds the login endpoint and fixes the documentation links.
* Move GetFeeds to service layer (#32526)Lunny Xiao2024-11-294-4/+8
| | | Move GetFeeds from models to service layer, no code change.
* Move team related functions to service layer (#32537)Lunny Xiao2024-11-273-11/+9
| | | | | There are still some functions under `models` after last big refactor about `models`. This change will move all team related functions to service layer with no code change.
* Add priority to protected branch (#32286)65432024-11-273-4/+56
| | | | | | | | | | | | | | | | | | | ## Solves Currently for rules to re-order them you have to alter the creation date. so you basicly have to delete and recreate them in the right order. This is more than just inconvinient ... ## Solution Add a new col for prioritization ## Demo WebUI Video https://github.com/user-attachments/assets/92182a31-9705-4ac5-b6e3-9bb74108cbd1 --- *Sponsored by Kithara Software GmbH*
* Improve oauth2 scope token handling (#32633)wxiaoguang2024-11-261-1/+1
|
* Add github compatible tarball download API endpoints (#32572)Lunny Xiao2024-11-253-3/+67
| | | | Fix #29654 Fix #32481
* Fix markup render regression and fix some tests (#32640)wxiaoguang2024-11-261-17/+31
| | | | | | | Fix #32639, https://github.com/go-gitea/gitea/issues/32608#issuecomment-2497918210 By the way, fix some incorrect SQLs (use single quote but not double quote)
* Refactor markup render system (#32612)wxiaoguang2024-11-241-3/+5
| | | | | | | | | | This PR removes (almost) all path tricks, and introduces "renderhelper" package. Now we can clearly see the rendering behaviors for comment/file/wiki, more details are in "renderhelper" tests. Fix #31411 , fix #18592, fix #25632 and maybe more problems. (ps: fix #32608 by the way)
* Fix get reviewers' bug (#32415)Lunny Xiao2024-11-221-1/+9
| | | | | | | | | | This PR rewrites `GetReviewer` function and move it to service layer. Reviewers should not be watchers, so that this PR removed all watchers from reviewers. When the repository is under an organization, the pull request unit read permission will be checked to resolve the bug of #32394 Fix #32394
* Refactor markup render system (#32589)wxiaoguang2024-11-221-3/+1
| | | | This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
* Remove duplicate empty repo check in delete branch API (#32569)Kemal Zebari2024-11-201-5/+0
| | | | | | Found while working on #32433. This branch will never be executed because we have would have already made the same check a couple lines above.
* Refactor find forks and fix possible bugs that weak permissions check (#32528)Lunny Xiao2024-11-181-3/+12
| | | | | | | | | | | - Move models/GetForks to services/FindForks - Add doer as a parameter of FindForks to check permissions - Slight performance optimization for get forks API with batch loading of repository units - Add tests for forking repository to organizations --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor render system (#32492)wxiaoguang2024-11-142-13/+12
| | | | | | | | | | | | | | | | | | | There were too many patches to the Render system, it's really difficult to make further improvements. This PR clears the legacy problems and fix TODOs. 1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify its usage. 2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify the rendering behaviors. 3. Use "wiki" mode instead of "mode=gfm + wiki=true" 4. Merge `renderByType` and `renderByFile` 5. Add more comments ---- The problem of "mode=document": in many cases it is not set, so many non-comment places use comment's hard line break incorrectly
* Harden runner updateTask and updateLog api (#32462)ChristopherHX2024-11-111-1/+7
| | | Per proposal https://github.com/go-gitea/gitea/issues/32461
* Calculate `PublicOnly` for org membership only once (#32234)65432024-11-111-9/+13
| | | | | | | | | | Refactoring of #32211 this move the PublicOnly() filter calcuation next to the DB querys and let it be decided by the Doer --- *Sponsored by Kithara Software GmbH*
* Add reviewers selection to new pull request (#32403)Calvin K2024-11-092-55/+67
| | | | | | | | | | Users could add reviewers when creating new PRs. --------- Co-authored-by: splitt3r <splitt3r@users.noreply.github.com> Co-authored-by: Sebastian Sauer <sauer.sebastian@gmail.com> Co-authored-by: bb-ben <70356237+bboerben@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support quote selected comments to reply (#32431)wxiaoguang2024-11-071-2/+4
| | | | | | | | | Many existing tests were quite hacky, these could be improved later. <details> ![image](https://github.com/user-attachments/assets/93aebb4f-9de5-4cb8-910b-50c64cbcd25a) </details>
* Move AddCollabrator and CreateRepositoryByExample to service layer (#32419)Lunny Xiao2024-11-072-15/+12
| | | | | | - [x] Move `CreateRepositoryByExample` to service layer - [x] Move `AddCollabrator` to service layer - [x] Add a new parameter for `AddCollabrator` so that changing mode immediately after that will become unnecessary.
* Include file extension checks in attachment API (#32151)Kemal Zebari2024-11-063-9/+30
| | | | | | From testing, I found that issue posters and users with repository write access are able to edit attachment names in a way that circumvents the instance-level file extension restrictions using the edit attachment APIs. This snapshot adds checks for these endpoints.
* Fix milestone deadline and date related problems (#32339)Lunny Xiao2024-11-052-17/+9
| | | | | | | | | Use zero instead of 9999-12-31 for deadline Fix #32291 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor RepoRefByType (#32413)wxiaoguang2024-11-051-4/+4
| | | | | 1. clarify the "filepath" could(should) contain "{ref}" 2. remove unclear RepoRefLegacy and RepoRefAny, use RepoRefUnknown to guess 3. by the way, avoid using AppURL
* Fix git error handling (#32401)wxiaoguang2024-11-021-5/+2
|
* Fix `missing signature key` error when pulling Docker images with ↵Zettat1232024-10-315-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SERVE_DIRECT` enabled (#32365) Fix #28121 I did some tests and found that the `missing signature key` error is caused by an incorrect `Content-Type` header. Gitea correctly sets the `Content-Type` header when serving files. https://github.com/go-gitea/gitea/blob/348d1d0f322ca57c459acd902f54821d687ca804/routers/api/packages/container/container.go#L712-L717 However, when `SERVE_DIRECT` is enabled, the `Content-Type` header may be set to an incorrect value by the storage service. To fix this issue, we can use query parameters to override response header values. https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html <img width="600px" src="https://github.com/user-attachments/assets/f2ff90f0-f1df-46f9-9680-b8120222c555" /> In this PR, I introduced a new parameter to the `URL` method to support additional parameters. ``` URL(path, name string, reqParams url.Values) (*url.URL, error) ``` --- Most S3-like services support specifying the content type when storing objects. However, Gitea always use `application/octet-stream`. Therefore, I believe we also need to improve the `Save` method to support storing objects with the correct content type. https://github.com/go-gitea/gitea/blob/b7fb20e73e63b8edc9b90c52073e248bef428fcc/modules/storage/minio.go#L214-L221
* refactor: remove redundant err declarations (#32381)Oleksandr Redko2024-10-302-2/+0
|
* Make admins adhere to branch protection rules (#32248)Tim2024-10-231-0/+5
| | | | | | | | | | | | This introduces a new flag `BlockAdminMergeOverride` on the branch protection rules that prevents admins/repo owners from bypassing branch protection rules and merging without approvals or failing status checks. Fixes #17131 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Add `DISABLE_ORGANIZATIONS_PAGE` and `DISABLE_CODE_PAGE` settings for ↵Zettat1232024-10-221-2/+10
| | | | | | | | | | | | explore pages and fix an issue related to user search (#32288) These settings can allow users to only display the repositories explore page. Thanks to yp05327 and wxiaoguang ! --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* API: enhance SearchIssues swagger docs (#32208)65432024-10-191-19/+32
| | | | | | | this will result in better api clients generated out of the openapi docs ... for SearchIssues --- *Sponsored by Kithara Software GmbH*
* Use per package global lock for container uploads instead of memory lock ↵Lunny Xiao2024-10-111-8/+18
| | | | | | (#31860) This PR uses a per-package lock instead of a global lock for container uploads. So that different packages can be uploaded simultaneously.
* Move admin routers from /admin to /-/admin (#32189)Lunny Xiao2024-10-102-4/+4
| | | | | | | Resolve #32181 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix bug when a token is given public only (#32204)Lunny Xiao2024-10-086-51/+111
|
* Allow filtering PRs by poster in the ListPullRequests API (#32209)65432024-10-071-9/+33
| | | | | | as title --- *Sponsored by Kithara Software GmbH*
* Add support for searching users by email (#30908)yp053272024-10-041-5/+6
| | | | | | | Fix #30898 we have an option `SearchByEmail`, so enable it, then we can search user by email. Also added a test for it.
* Fix PR creation on forked repositories (#31863)Job2024-10-041-3/+14
| | | Resolves #20475
* Support repo license (#24872)yp053272024-10-014-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close #278 Close #24076 ## Solutions: - Use [google/licenseclassifier](https://github.com/google/licenseclassifier/) Test result between [google/licensecheck](https://github.com/google/licensecheck) and [go-license-detector](https://github.com/go-enry/go-license-detector): https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167 Test result between [google/licensecheck](https://github.com/google/licensecheck) and [google/licenseclassifier](https://github.com/google/licenseclassifier/): https://github.com/go-gitea/gitea/pull/24872#issuecomment-1576092178 - Generate License Convert Name List to avoid import license templates with same contents Gitea automatically get latest license data from[ spdx/license-list-data](https://github.com/spdx/license-list-data). But unfortunately, some license templates have same contents. #20915 [click here to see the list](https://github.com/go-gitea/gitea/pull/24872#issuecomment-1584141684) So we will generate a list of these license templates with same contents and create a new file to save the result when using `make generate-license`. (Need to decide the save path) - Save License info into a new table `repo_license` Can easily support searching repo by license in the future. ## Screen shot Single License: ![image](https://github.com/go-gitea/gitea/assets/18380374/41260bd7-0b4c-4038-8592-508706cffa9f) Multiple Licenses: ![image](https://github.com/go-gitea/gitea/assets/18380374/34ce2f73-7e18-446b-9b96-ecc4fb61bd70) Triggers: - [x] Push commit to default branch - [x] Create repo - [x] Mirror repo - [x] When Default Branch is changed, licenses should be updated Todo: - [x] Save Licenses info in to DB when there's a change to license file in the commit - [x] DB Migration - [x] A nominal test? - [x] Select which library to use(https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167) - [x] API Support - [x] Add repo license table - ~Select license in settings if there are several licenses(Not recommended)~ - License board(later, not in this PR) ![image](https://github.com/go-gitea/gitea/assets/18380374/2c3c3bf8-bcc2-4c6d-8ce0-81d1a9733878) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <m.huber@kithara.com> Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com>
* Fix the logic of finding the latest pull review commit ID (#32139)Zettat1232024-10-011-1/+0
| | | Fix #31423
* Fix bug in getting merged pull request by commit (#32079)Zettat1232024-09-242-3/+5
|
* Fix artifact v4 upload above 8MB (#31664)ChristopherHX2024-09-222-40/+156
| | | | | | | | | | | | Multiple chunks are uploaded with type "block" without using "appendBlock" and eventually out of order for bigger uploads. 8MB seems to be the chunk size This change parses the blockList uploaded after all blocks to get the final artifact size and order them correctly before calculating the sha256 checksum over all blocks Fixes #31354
* Fix wrong last modify time (#32102)Lunny Xiao2024-09-211-1/+3
|
* Fix upload maven pacakge parallelly (#31851)Lunny Xiao2024-09-211-0/+13
| | | | | | | Use globallock for maven package uploads. Thanks @tlusser for the test code. Depends on ~#31813~