aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
Commit message (Collapse)AuthorAgeFilesLines
* Fix: RPM package download routing & missing package version count (#34909)Exploding Dragon9 hours1-0/+2
| | | | | | | | | * Fix RPM package download routing * Fix missing package version count --------- Signed-off-by: Exploding Dragon <explodingfkl@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add a `login`/`login-name`/`username` disambiguation to affected endpoint ↵AlexMaryW20 hours20-51/+51
| | | | | | | | | | | | parameters and response/request models (#34901) Issue: [link](https://github.com/go-gitea/gitea/issues/9637) Changes introduced: I have clarified the problematic terms (`login`, `login_name`, and `username`) in all affected endpoints. The changes were made to relevant: - HTTP endpoint parameters' descriptions - response/request models' fields
* Refactor container package (#34877)wxiaoguang47 hours4-138/+76
| | | Use standard db.WithTx and introduce db.WithTx2
* enforce explanation for necessary nolints and fix bugs (#34883)TheFox0x73 days4-5/+5
| | | | | | | Follows up https://github.com/go-gitea/gitea/pull/34851 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* enforce nolint scope (#34851)TheFox0x74 days1-4/+4
| | | | | | | | | | | | | | | 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>
* Refactor "change file" API (#34855)wxiaoguang5 days3-294/+134
| | | | | | | | | 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>
* Fix archive API (#34853)wxiaoguang6 days1-3/+3
| | | Fix #34852
* Refactor repo contents API and add "contents-ext" API (#34822)wxiaoguang6 days5-12/+88
| | | See the updated swagger document for details.
* fix(issue): Replace stopwatch toggle with explicit start/stop actions (#34818)Junsik Kong6 days1-31/+25
| | | | | | | | | | | | | | | | 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>
* Refactor packages (#34777)wxiaoguang9 days5-202/+74
|
* Refactor editor (#34780)wxiaoguang10 days1-0/+3
| | | A complete rewrite
* Fix container range bug (#34795)wxiaoguang10 days1-1/+3
| | | Fix #34792 and add new tests
* Fix OCI manifest parser (#34797)wxiaoguang10 days2-18/+8
| | | Do not parse the media type we don't know.
* Add workflow_run api + webhook (#33964)ChristopherHX10 days8-10/+766
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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ák11 days1-1/+1
| | | | | | | | | 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.
* Refactor packages (func name & UI) (#34773)wxiaoguang12 days22-28/+28
| | | | | | 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`
* Fix some package registry problems (#34759)wxiaoguang12 days1-33/+9
| | | | 1. Fix #33787 2. Fix container image display
* Support annotated tags when using create release API (#31840)Kemal Zebari13 days1-1/+3
| | | | | | | | | | This adds a new field, "tag_message", that represents the message of the annotated tag. Resolves #31835. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove unused param `doer` (#34545)Philip Peterson13 days1-1/+1
|
* Run `gopls modernize` on codebase (#34751)silverwind13 days4-24/+6
| | | | Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
* Improve nuget/rubygems package registries (#34741)wxiaoguang13 days5-29/+116
| | | | | | | | 1. Add some missing (optional) fields for nuget v2, and sort the fields to make it easier to maintain 2. Add missing "platform" for rubygems: `VERSION-PLATFORM` and `VERSION_PLATFORM` Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor container and UI (#34736)wxiaoguang2025-06-164-72/+110
|
* Fix container range bug (#34725)wxiaoguang2025-06-151-8/+15
| | | Fix #34724
* Improve instance wide ssh commit signing (#34341)ChristopherHX2025-06-112-19/+65
| | | | | | | | | | | | | | | | | * Signed SSH commits can look in the UI like on GitHub, just like gpg keys today in Gitea * SSH format can be added in gitea config * SSH Signing worked before with DEFAULT_TRUST_MODEL=committer `TRUSTED_SSH_KEYS` can be a list of additional ssh public key contents to trust for every user of this instance Closes #34329 Related #31392 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix last admin check when syncing users (#34649)wxiaoguang2025-06-091-1/+1
| | | Fix #34358
* Fix "oras" OCI client compatibility (#34666)wxiaoguang2025-06-091-7/+8
| | | | | | Fix #25846 1. the ImageConfig can be empty, fall back to default 2. the blob size can be empty, it still needs "Content-Length" header
* Ignore "Close" error when uploading container blob (#34620)wxiaoguang2025-06-091-11/+5
|
* Refactor FindOrgOptions to use enum instead of bool, fix membership ↵wxiaoguang2025-06-091-5/+3
| | | | visibility (#34629)
* Fix possible pull request broken when leave the page immediately after ↵Lunny Xiao2025-06-041-1/+2
| | | | | | | | | | clicking the update button (#34509) If user leaves the page, the context will become cancelled, so that the update process maybe terminal in an unexpected status. This PR haven't resolve the problem totally. It uses a background context to not cancel the update process even if the user leaved the pull request view page. Fix #31779
* Do not mutate incoming options to SearchRepositoryByName (#34553)Philip Peterson2025-06-023-4/+4
| | | | | | | | | | | | | | Similar to #34544, this PR changes the `opts` argument in `SearchRepositoryByName()` to be passed by value instead of by pointer, as its mutations do not escape the function scope and are not used elsewhere. This simplifies reasoning about the function and avoids unnecessary pointer usage. This insight emerged during an initial attempt to refactor `RenderUserSearch()`, which currently intermixes multiple concerns. --------- Co-authored-by: Philip Peterson <philip-peterson@users.noreply.github.com>
* Fix some trivial problems (#34579)wxiaoguang2025-06-021-1/+1
|
* Do not mutate incoming options to RenderUserSearch and SearchUsers (#34544)Philip Peterson2025-05-274-4/+4
| | | | | | | | | | | This PR changes the `opts` argument in `SearchUsers()` to be passed by value instead of by pointer, as its mutations do not escape the function scope and are not used elsewhere. This simplifies reasoning about the function and avoids unnecessary pointer usage. This insight emerged during an initial attempt to refactor `RenderUserSearch()`, which currently intermixes multiple concerns. Co-authored-by: Philip Peterson <philip-peterson@users.noreply.github.com>
* Split GetLatestCommitStatus as two functions (#34535)Lunny Xiao2025-05-261-3/+8
| | | | | | | | Extract from #34531. This will reduce unnecessary count operation in databases. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add sort option recentclose for issues and pulls (#34525)Markus Amshove2025-05-261-1/+1
| | | | | | closes #34171 Adds a new sort option `recentclose` for issues and pull requests which will return items in a descending order of when they were closed
* fix: return 201 Created for CreateVariable API responses (#34517)Bo-Yi Wu2025-05-263-17/+15
| | | | | | | | | | | | | | | | | | | - Change CreateVariable API response status from 204 No Content to 201 Created - Update related integration tests to expect 201 Created instead of 204 No Content ## :warning: BREAKING :warning: Change the response status code of the Create Variable API under both Org and Repo levels to `201` instead of 204. API SDK: https://gitea.com/gitea/go-sdk/pulls/713 --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* feat(api): add date range filtering to commit retrieval endpoints (#34497)Bo-Yi Wu2025-05-191-1/+35
| | | | | | | | | | | | | | | - Add support for filtering commits by date range via new "since" and "until" parameters - Update API endpoints and command logic to handle the new parameters for fetching commits within given dates - Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters - Refactor related function signatures and implementations to accept and pass "since" and "until" values --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Fix edithook api can not update package, status and workflow_job events (#34495)ChristopherHX2025-05-181-55/+37
| | | * the origin of this problem is duplicated code
* Fix url validation in webhook add/edit API (#34492)Lunny Xiao2025-05-173-0/+112
|
* Fix get / delete runner to use consistent http 404 and 500 status (#34480)ChristopherHX2025-05-161-18/+27
| | | | * previously deleting an already deleted runner returned http 500 * previously any database error for the get endpoint was http 404 and never 500
* Add endpoint deleting workflow run (#34337)NorthRealm2025-05-132-1/+56
| | | | | | | | | | | Add endpoint deleting workflow run Resolves #26219 /claim #26219 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix bug webhook milestone is not right. (#34419)Lunny Xiao2025-05-112-0/+14
| | | | | | | Fix #34400 --------- Co-authored-by: silverwind <me@silverwind.io>
* When updating comment, if the content is the same, just return and not ↵Lunny Xiao2025-05-111-8/+10
| | | | | update the databse (#34422) Fix #34318
* Fix bug when API get pull changed files for deleted head repository (#34333)Lunny Xiao2025-05-041-1/+3
|
* feat: return time of last usage for public keys and access tokens in the api ↵Tobias Balle-Petersen2025-05-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | (#34323) In the Gitea GUI, the user can see the time that _AccessTokens_ and _PublicKeys_ were last used. This information is not returned by the _/users/{username}/tokens_ and _/user/keys_ endpoints in the API. This PR adds the missing data. The time of last usage for for _tokens_ & _keys_ seem to be stored in the _Updated_ field of the structs internally. For consistency, I have used the name _updated_at_ for the new field returned by the _API_. However, for the _API_ user, I don't think that name reflects the data returned, as I believe it is the time of last usage. I propose that we use the name _last_used_at_ instead. Let's hear reviewers opinion on that. * PublicKey 1. _last_used_at_: string($date-time) * AccessToken 1. _created_at_: string($date-time) (for parity with public keys) 2. _last_used_at_: string($date-time) Fix #34313
* Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187)wxiaoguang2025-04-281-1/+25
| | | | | | | | | | | | | | | | | | | | | Fix #880 Design: 1. A global setting `security.TWO_FACTOR_AUTH`. * To support org-level config, we need to introduce a better "owner setting" system first (in the future) 2. A user without 2FA can login and may explore, but can NOT read or write to any repositories via API/web. 3. Keep things as simple as possible. * This option only aggressively suggest users to enable their 2FA at the moment, it does NOT guarantee that users must have 2FA before all other operations, it should be good enough for real world use cases. * Some details and tests could be improved in the future since this change only adds a check and seems won't affect too much. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* actions artifacts api list/download check status upload confirmed (#34273)ChristopherHX2025-04-282-7/+24
| | | | | | | | | | | * fixes a fixture status to upload confirmed * add another fixture as noise to break tests as soon they are exposed to api * v4 delete test added check that artifact is no longer visible in internal api with status pending delete * removal of http 404 on empty list: actions/upload-artifact@v4 now backoff on http 404 of ListArtifacts endpoint * fixes artifacts with pending delete etc. are able to be found and downloaded if the storage is not freed
* Option to delay conflict checking of old pull requests until page view (#27779)Brecht Van Lommel2025-04-241-2/+10
| | | | | | | | | | | | | | | | | | | | | | `[repository.pull-request] DELAY_CHECK_FOR_INACTIVE_DAYS` is a new setting to delay the mergeable check for pull requests that have been inactive for the specified number of days. This avoids potentially long delays for big repositories with many pull requests. and reduces system load overall when there are many repositories or pull requests. When viewing the PR, checking will start immediately and the PR merge box will automatically reload when complete. Accessing the PR through the API will also start checking immediately. The default value of `7` provides a balance between system load, and keeping behavior similar to what it was before both for users and API access. With `0` all conflict checking will be delayed, while `-1` always checks immediately to restore the previous behavior. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve "not found" error messages for API (#34267)wxiaoguang2025-04-234-6/+5
| | | Make the message clear, for example: #34266
* Add API endpoint to request contents of multiple files simultaniously (#34139)Denys Konovalov2025-04-226-104/+168
| | | | | | | | | | | | | | | | Adds an API POST endpoint under `/repos/{owner}/{repo}/file-contents` which receives a list of paths and returns a list of the contents of these files. This API endpoint will be helpful for applications like headless CMS (reference: https://github.com/sveltia/sveltia-cms/issues/198) which need to retrieve a large number of files by reducing the amount of needed API calls. Close #33495 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add API routes to lock and unlock issues (#34165)YaFou2025-04-213-0/+160
| | | | | | | | | | | | | | | This pull request adds a GitHub-compatible API endpoint to lock and unlock an issue. The following routes exist now: - `PUT /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to lock an issue - `DELETE /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to unlock an issue Fixes #33677 Fixes #20012 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>