summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Fix org team endpoint (#27721) (#27727)Giteabot2023-10-221-4/+4
| | | | | | | Backport #27721 by @lng2020 Fix #27711 Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
* Fix 404 when deleting Docker package with an internal version (#27615) (#27630)Giteabot2023-10-151-1/+1
| | | | | | | | Backport #27615 by @lng2020 close #27601 The Docker registry has an internal version, which leads to 404 Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
* Don't show Link to TOTP if not set up (#27585) (#27588)Giteabot2023-10-111-0/+8
| | | | | | | | | | | Backport #27585 by @JakobDev Fixes https://codeberg.org/forgejo/forgejo/issues/1592 When login in with WebAuth, the page has a link to use TOTP instead. This link is always displayed, no matter if the User has set up TOTP or not, which do of cause not work for those who have not. Co-authored-by: JakobDev <jakobdev@gmx.de>
* Replace ajax with fetch, improve image diff (#27267) (#27583)Giteabot2023-10-111-10/+17
| | | | | | | | | | | Backport #27267 by @silverwind 1. Dropzone attachment removal, pretty simple replacement 2. Image diff: The previous code fetched every image twice, once via `img[src]` and once via `$.ajax`. Now it's only fetched once and a second time only when necessary. The image diff code was partially rewritten. Co-authored-by: silverwind <me@silverwind.io>
* api: GetPullRequestCommits: return file list (#27483) (#27539)Giteabot2023-10-092-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #27483 by @msantos Fixes https://github.com/go-gitea/gitea/issues/27481 --- Patch tested: ```json [ { "url": "http://100.115.92.198:9292/api/v1/repos/msantos/test/git/commits/7664dcb44167e0f9efd994e4ca6a9164694adc27", "sha": "7664dcb44167e0f9efd994e4ca6a9164694adc27", "created": "2023-10-06T09:57:08-04:00", "html_url": "http://100.115.92.198:9292/msantos/test/commit/7664dcb44167e0f9efd994e4ca6a9164694adc27", ... "files": [ { "filename": "README.md", "status": "modified" } ], "stats": { "total": 2, "additions": 2, "deletions": 0 } } ] ``` Co-authored-by: Michael Santos <michael.santos@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix panic in storageHandler (#27446) (#27479)v1.21.0-rc1Giteabot2023-10-061-51/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #27446 by @sryze storageHandler() is written as a middleware but is used as an endpoint handler, and thus `next` is actually `nil`, which causes a null pointer dereference when a request URL does not match the pattern (where it calls `next.ServerHTTP()`). Example CURL command to trigger the panic: ``` curl -I "http://yourhost/gitea//avatars/a" ``` Fixes #27409 --- Note: the diff looks big but it's actually a small change - all I did was to remove the outer closure (and one level of indentation) ~and removed the HTTP method and pattern checks as they seem redundant because go-chi already does those checks~. You might want to check "Hide whitespace" when reviewing it. Alternative solution (a bit simpler): append `, misc.DummyOK` to the route declarations that utilize `storageHandler()` - this makes it return an empty response when the URL is invalid. I've tested this one and it works too. Or maybe it would be better to return a 400 error in that case (?) Co-authored-by: Sergey Zolotarev <sryze@outlook.com>
* Don't let API add 2 exclusive labels from same scope (#27433) (#27460)Giteabot2023-10-061-1/+1
| | | | | | | Backport #27433 by @JakobDev Fixes #27380 Co-authored-by: JakobDev <jakobdev@gmx.de>
* Refactor system setting (#27000) (#27452)Giteabot2023-10-055-81/+31
| | | | | | | | | | | | | | | | Backport #27000 by @wxiaoguang This PR reduces the complexity of the system setting system. It only needs one line to introduce a new option, and the option can be used anywhere out-of-box. It is still high-performant (and more performant) because the config values are cached in the config system. ![image](https://github.com/go-gitea/gitea/assets/2114189/f8cdd743-1145-41ab-9f8f-3996aa97d440) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* When comparing with an non-exist repository, return 404 but 500 (#27437) ↵Giteabot2023-10-041-1/+3
| | | | | | | (#27442) Backport #27437 by @lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Hide archived labels when filtering by labels on the issue list (#27115) ↵Giteabot2023-10-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#27381) Backport #27115 by @puni9869 Followup https://github.com/go-gitea/gitea/pull/26820 ## Archived labels UI for issue filter and issue filter actions for issues/pull request pages. Changed: * Enhanced the Issue filter and Issue filter actions UI page to seamlessly incorporate a list of archived labels. * Pagination functionality is same as before. If archived label checkbox is checked then we are adding a query string`archived=true` in the url to save the state of page. * Issue filter actions menu is separated into different template. * Adding the archived flag in issue url labels. * Pull Request page is also work the same. Outsourced: * Defer the implementation of specialized handling for archived labels to upcoming pull requests. This step will be undertaken subsequent to the successful merge of this pull request. Screenshots ### Issue page <img width="1360" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/d7efb2ef-5b2b-449d-83f0-d430a32ec432"> ### Issue page with label filter on archived label checkbox when not checked --> No archived label is there in list <img width="1249" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/ceea68ef-91f2-4693-910f-2e25e236bfc9"> ### Issue page with label filter on archived label checkbox when checked --> Show archived label in the list. <img width="710" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/2414d26b-2079-4c3c-bd9e-f2f5411bcabf"> ### Issue page with label filter on issue action menu on archived label checkbox when checked --> Show archived label in the list. <img width="409" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/259cac87-3e21-4778-99a2-a6a0b8c81178"> ### Applied the archived=true in Issue labels when archived checkbox is checked. <img width="984" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/657ce3db-c0ae-402e-b12d-3b580d3c2ed0"> --- Part of https://github.com/go-gitea/gitea/issues/25237 Signed-off-by: puni9869 <punitinani1@hotmail.com> Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com> Co-authored-by: delvh <dev.lh@web.de>
* Allow get release download files and lfs files with oauth2 token format ↵Giteabot2023-10-011-5/+3
| | | | | | | | | | (#26430) (#27379) Backport #26430 by @lunny Fix #26165 Fix #25257 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Introduce fixes and more rigorous tests for 'Show on a map' feature (#26803) ↵Giteabot2023-09-302-1/+1
| | | | | | | | | | | | (#27365) Backport #26803 by @n0toose This change introduces some fixes for my original PR (https://github.com/go-gitea/gitea/pull/26214) and introduces some additional tests so that such a regression does not happen again in the future. Co-authored-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
* Fix repo count in org action settings (#27245) (#27353)Giteabot2023-09-293-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport #27245 by @yp05327 Only in org action settings, repo count is missing Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/4a74c090-c55f-4f06-810a-c390337efa9d) ![image](https://github.com/go-gitea/gitea/assets/18380374/e234f7e7-178c-4186-bbc0-0f291192b011) ![image](https://github.com/go-gitea/gitea/assets/18380374/c1db70cd-973b-40d5-ba17-1f354aed9149) In other setting page: ![image](https://github.com/go-gitea/gitea/assets/18380374/43bfec6b-a1a4-48a9-8280-ab6f967b7ec4) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/9a697bd8-ce9f-40e2-8749-b46726d68d84) ![image](https://github.com/go-gitea/gitea/assets/18380374/3b6d1e59-64dd-4655-953b-064718e6aa7a) ![image](https://github.com/go-gitea/gitea/assets/18380374/5604c063-556c-4252-8778-4e5a5e23b7e1) Co-authored-by: yp05327 <576951401@qq.com>
* More `db.DefaultContext` refactor (#27265) (#27347)Giteabot2023-09-2918-128/+128
| | | | | | | | | | | Backport #27265 by @JakobDev Part of #27065 This PR touches functions used in templates. As templates are not static typed, errors are harder to find, but I hope I catch it all. I think some tests from other persons do not hurt. Co-authored-by: JakobDev <jakobdev@gmx.de>
* Improve tree not found page (#26570) (#27346)Giteabot2023-09-294-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport #26570 by @yp05327 Before: ![before](https://github.com/go-gitea/gitea/assets/18380374/383822d5-7d77-4ec3-b49b-4ab1e8b167ce) After: ![after](https://github.com/go-gitea/gitea/assets/18380374/32afa0a3-fa05-4087-b96e-7d067f0ed756) In Github: https://github.com/yp05327/test/blob/main/test.drawio Updated: UI changed ![image](https://github.com/go-gitea/gitea/assets/18380374/41ed07ff-b815-4b4e-9779-5ab36b5f3980) ![image](https://github.com/go-gitea/gitea/assets/18380374/5d7b28d6-a2fc-4d4c-8d6d-d93f9c9a270b) Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve issue history dialog and make poster can delete their own history ↵Giteabot2023-09-281-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#27323) (#27327) Backport #27323 by @wxiaoguang Fix #27313 (see the comment) And some UI improvements: ### Before ![image](https://github.com/go-gitea/gitea/assets/2114189/420a314d-8f34-4e30-a557-f41cf4f0d2f2) ![image](https://github.com/go-gitea/gitea/assets/2114189/60ca0be4-b55e-4e65-be73-fd53e0d4fc36) ### After ![image](https://github.com/go-gitea/gitea/assets/2114189/d354f815-5a0c-4e63-8d59-d03ed344dbea) ![image](https://github.com/go-gitea/gitea/assets/2114189/6ef437a4-aa6f-4917-a260-00625ee71e79) ![image](https://github.com/go-gitea/gitea/assets/2114189/9d88a36c-616b-4dc9-8c6b-76adaad8acf6) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Redefine the meaning of column is_active to make Actions Registration Token ↵Giteabot2023-09-283-8/+8
| | | | | | | | | | | | | | | | | | | generation easier (#27143) (#27304) Backport #27143 by @lunny Partially Fix #25041 This PR redefined the meaning of column `is_active` in table `action_runner_token`. Before this PR, `is_active` means whether it has been used by any runner. If it's true, other runner cannot use it to register again. In this PR, `is_active` means whether it's validated to be used to register runner. And if it's true, then it can be used to register runners until it become false. When creating a new `is_active` register token, any previous tokens will be set `is_active` to false. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Another round of `db.DefaultContext` refactor (#27103) (#27262)Giteabot2023-09-2552-77/+104
| | | | | | | | Backport #27103 by @JakobDev Part of #27065 Co-authored-by: JakobDev <jakobdev@gmx.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix EOL handling in web editor (#27141) (#27234)Giteabot2023-09-241-1/+1
| | | | | | | | | | | | | Backport #27141 by @silverwind Fixes https://github.com/go-gitea/gitea/issues/27136. This does the following for Monaco's EOL setting: 1. Use editorconfig setting if present 2. Use the file's dominant line ending as detected by monaco, which uses LF for empty file Co-authored-by: silverwind <me@silverwind.io>
* Fix organization field being null in POST /orgs/{orgid}/teams (#27150) (#27163)Giteabot2023-09-211-1/+1
| | | | | | | | | | | | | | | | | Backport #27150 by @memphis88 Similarly to the fix in https://github.com/go-gitea/gitea/pull/24694, this addresses the team creation not returning the organization information in the response. This fix is connected to the [issue](https://gitea.com/gitea/terraform-provider-gitea/issues/27) discovered in the terraform provider. Moreover, the [documentation](https://docs.gitea.com/api/1.20/#tag/organization/operation/orgCreateTeam) suggests that the response body should include the `organization` field (currently being `null`). Co-authored-by: Dionysios Kakouris <1369451+memphis88@users.noreply.github.com>
* Fix: treat tab "overview" as "repositories" in user profiles without readme ↵hazy2023-09-201-1/+2
| | | | | | | | | | | | | | | | (#27124) Beginning since 2af30f715e64dbb0a3900168e3768ffb36c06392, Gitea has a 500 error when visiting a user profile with `?tab=overview` in the URL when the user doesn't have a `.profile/README.md`, because the backend code assumes that if the tab is overview a profile repository must exist, and checks that the repository is nil aren't done. In this PR I treat `?tab=overview` the same as if no tab is set in the URL, which corrects this behaviour- Now, when visiting `?tab=overview`, if `.profile/README.md` exists on that user's profile it'll show that as it should, otherwise it'll show the repositories tab. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix pagination for followers and following (#27127)Earl Warren2023-09-191-2/+2
| | | | | | | | | | | - Use the correct total amount for pagination. Thereby correctly show the pagination bare when there's more than one page of followers/followings. Refs: https://codeberg.org/forgejo/forgejo/pulls/1477 (cherry picked from commit c1a136318be3bf72511bed108f2d67f2cf34e1b8) Co-authored-by: Gusted <postmaster@gusted.xyz>
* Fix token endpoints ignore specified account (#27080)CaiCandong2023-09-182-4/+20
| | | | | | | | | Fix #26234 close #26323 close #27040 --------- Co-authored-by: silverwind <me@silverwind.io>
* Make SSPI auth mockable (#27036)wxiaoguang2023-09-176-60/+9
| | | | | | Before, the SSPI auth is only complied for Windows, it's difficult to test and it breaks a lot. Now, make the SSPI auth mockable and testable.
* Search branches (#27055)Lunny Xiao2023-09-171-1/+4
| | | | | | | | | Resolve #25233 <img width="1315" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/3ba59b58-471a-4e1b-985c-87edac2268c0"> <img width="1297" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/b6caa12f-323b-4f70-9c44-ef91cb71a26c">
* Support `.git-blame-ignore-revs` file (#26395)KN4CK3R2023-09-161-22/+69
| | | | | | | | | | | | | | | | | Closes #26329 This PR adds the ability to ignore revisions specified in the `.git-blame-ignore-revs` file in the root of the repository. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/9e91be0c-6e9c-431c-bbe9-5f80154251c8) The banner is displayed in this case. I intentionally did not add a UI way to bypass the ignore file (same behaviour as Github) but you can add `?bypass-blame-ignore=true` to the url manually. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add `RemoteAddress` to mirrors (#26952)KN4CK3R2023-09-163-20/+32
| | | | | This PR adds a new field `RemoteAddress` to both mirror types which contains the sanitized remote address for easier (database) access to that information. Will be used in the audit PR if merged.
* Next round of `db.DefaultContext` refactor (#27089)JakobDev2023-09-1640-112/+112
| | | Part of #27065
* Fix NPE when editing OAuth2 applications (#27078)JakobDev2023-09-161-3/+3
| | | | | | | | | Fixes #27072 It looks like there are some cases where `ContextUser` is not set here --------- Co-authored-by: techknowlogick <matti@mdranta.net>
* Allow empty Conan files (#27092)KN4CK3R2023-09-151-7/+2
| | | | | | | Fixes #27090 Looks like the Conan upload process has changed since last year. The empty uploads don't occur anymore.
* More refactoring of `db.DefaultContext` (#27083)JakobDev2023-09-1541-86/+88
| | | Next step of #27065
* Reduce usage of `db.DefaultContext` (#27073)JakobDev2023-09-1440-90/+90
| | | | | | | | | | | | | | Part of #27065 This reduces the usage of `db.DefaultContext`. I think I've got enough files for the first PR. When this is merged, I will continue working on this. Considering how many files this PR affect, I hope it won't take to long to merge, so I don't end up in the merge conflict hell. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix issue templates when blank isses are disabled (#27061)JakobDev2023-09-142-11/+14
| | | | | | | | Fixes #27060 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de>
* Display all user types and org types on admin management UI (#27050)Lunny Xiao2023-09-142-2/+4
| | | | | | | | | | Follow #24026 <img width="1049" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/d3fc5159-b5e7-411a-b6f8-4a111a027e6b"> --------- Co-authored-by: delvh <dev.lh@web.de>
* Show the repo count in code tab on both user profile and org page. (#27048)puni98692023-09-131-0/+5
| | | | | | | | | | | | | | | | | | | | | as title Screenshot before User Profile page <img width="1367" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/24e79689-ba2f-4c85-b591-fe5621746965"> after <img width="1346" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/754a7ee8-c2f0-424d-9ba8-be38a48140aa"> Org page <img width="1354" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/c96178d8-664f-45c5-a162-f4df5690d9d0"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Show OpenID Connect and OAuth on signup page (#20242)Dmitry Sharshakov2023-09-131-0/+18
| | | | | | | | Fix #19809 --------- Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> Co-authored-by: jackHay22 <jack@allspice.io>
* Update status and code index after changing the default branch (#27018)Nanguan Lin2023-09-132-50/+64
| | | | | | | | | | | Fix #26723 Add `ChangeDefaultBranch` to the `notifier` interface and implement it in `indexerNotifier`. So when changing the default branch, `indexerNotifier` sends a message to the `indexer queue` to update the index. --------- Co-authored-by: techknowlogick <matti@mdranta.net>
* Add missing 404 response to Swagger (#27038)JakobDev2023-09-1345-0/+300
| | | | | Most middleware throw a 404 in case something is not found e.g. a Repo that is not existing. But most API endpoints don't include the 404 response in their documentation. This PR changes this.
* resolve issue with sort icons on admin/users and admin/runners (#24360)jladbrook2023-09-121-0/+1
| | | | Fixes #24327 to avoid the sort icon changing the table header over multiple lines and adds missing sort icons on the runners page.
* Extract auth middleware from service (#27028)KN4CK3R2023-09-123-11/+262
| | | | | | Related #27027 Extract the router logic from `services/auth/middleware.go` into `routers/web` <-> `routers/common` <-> `routers/api`.
* Fix context cache bug & enable context cache for dashabord commits' authors ↵Lunny Xiao2023-09-112-4/+11
| | | | | | | | | | | (#26991) Unfortunately, when a system setting hasn't been stored in the database, it cannot be cached. Meanwhile, this PR also uses context cache for push email avatar display which should avoid to read user table via email address again and again. According to my local test, this should reduce dashboard elapsed time from 150ms -> 80ms .
* Move some functions to service layer (#26969)Lunny Xiao2023-09-082-4/+3
|
* Add a new column schedule_id for action_run to track (#26975)Lunny Xiao2023-09-081-1/+7
| | | | | | | | Fix #26971 And the UI now will display it's scheduled but not triggered by a push. <img width="954" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/d211845c-457e-4c3e-af1f-a0d654d3f365">
* move repository deletion to service layer (#26948)Lunny Xiao2023-09-086-14/+17
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve hint when uploading a too large avatar (#26935)Lunny Xiao2023-09-072-2/+2
| | | | | | | | | | Fix #26390 --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: silverwind <me@silverwind.io>
* Replace `util.SliceXxx` with `slices.Xxx` (#26958)CaiCandong2023-09-076-8/+14
|
* Add reverseproxy auth for API back with default disabled (#26703)Lunny Xiao2023-09-071-2/+8
| | | | | | | | | | | | | | | This feature was removed by #22219 to avoid possible CSRF attack. This PR takes reverseproxy auth for API back but with default disabled. To prevent possbile CSRF attack, the responsibility will be the reverseproxy but not Gitea itself. For those want to enable this `ENABLE_REVERSE_PROXY_AUTHENTICATION_API`, they should know what they are doing. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Fix the missing repo count (#26942)Nanguan Lin2023-09-071-0/+12
| | | | | | | | The commit (https://github.com/go-gitea/gitea/commit/958d148043a6ace08776b1fd5ec0a5859144dea0) forgot two pages :stuck_out_tongue_closed_eyes: ![ksnip_20230906-182626](https://github.com/go-gitea/gitea/assets/70063547/6da529e9-3028-46fb-8065-abfd804a078b) BTW, the `leave` button is in a weird position
* Move createrepository from module to service layer (#26927)Lunny Xiao2023-09-066-10/+7
| | | | Repository creation depends on many models, so moving it to service layer is better.
* allow "latest" to be used in release vTag when downloading file (#26748)merlleu2023-09-061-4/+17
| | | | | | | | | | | | | | | | | | Hello, In the discord I saw [someone](https://discord.com/channels/322538954119184384/1069795723178160168/1145061200644800514) complaining that you can't use the "latest" keyword as release tag to download a specific file: In his example: https://www.uberwald.me/gitea/public/fvtt-ecryme/releases/latest/system.json However the latest keyword works for the release page, so I think it's a good thing to implement this on the release attachment download url too. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>