aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
Commit message (Collapse)AuthorAgeFilesLines
...
* Move commits signature and verify functions to service layers (#33605)Lunny Xiao2025-02-164-7/+10
| | | | No logic change, just move functions.
* enable literal string for code search (#33590)Darren Hoo2025-02-162-59/+6
| | | | | | | | Close: #33588 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Artifacts download api for artifact actions v4 (#33510)ChristopherHX2025-02-161-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * download endpoint has to use 302 redirect * fake blob download used if direct download not possible * downloading v3 artifacts not possible New repo apis based on GitHub Rest V3 - GET /runs/{run}/artifacts (Cannot use run index of url due to not being unique) - GET /artifacts - GET + DELETE /artifacts/{artifact_id} - GET /artifacts/{artifact_id}/zip - (GET /artifacts/{artifact_id}/zip/raw this is a workaround for a http 302 assertion in actions/toolkit) - api docs removed this is protected by a signed url like the internal artifacts api and no longer usable with any token or swagger - returns http 401 if the signature is invalid - or change the artifact id - or expired after 1 hour Closes #33353 Closes #32124 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve commits list performance to reduce unnecessary database queries (#33528)Lunny Xiao2025-02-145-10/+45
| | | | | | When listing commits, Gitea attempts to retrieve the actual user based on the commit email. Querying users one by one from the database is inefficient. This PR optimizes the process by batch querying users by email, reducing the number of database queries.
* Performance optimization for pull request files loading comments attachments ↵Lunny Xiao2025-02-141-6/+6
| | | | (#33585)
* Fix PR's target branch dropdown (#33589)wxiaoguang2025-02-141-8/+16
| | | | | | Fix #33586 It only moves `PrepareBranchList` and `retrieveAssigneesData` to before the `CanModifyIssueOrPull` check, and adds more comments
* Fix various problems (artifact order, api empty slice, assignee check, fuzzy ↵wxiaoguang2025-02-131-4/+7
| | | | | | | | | | prompt, mirror proxy, adopt git) (#33569) * Make artifact list output a stable order * Fix #33506 * Fix #33521 * Fix #33288 * Fix #33196 * Fix #33561
* Fix context usage (#33554)wxiaoguang2025-02-111-1/+1
| | | | | | | | | Some old code use direct type-casting to get context, it causes problems. This PR fixes all legacy problems and use correct `ctx.Value` to get low-level contexts. Fix #33518
* Enhance routers for the Actions runner operations (#33549)Jason Song2025-02-113-207/+227
| | | | | | | | | - Find the runner before deleting - Move the main logic from `routers/web/repo/setting/runners.go` to `routers/web/shared/actions/runners.go`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enhance routers for the Actions variable operations (#33547)Jason Song2025-02-113-156/+175
| | | | | | | | | | - Find the variable before updating or deleting - Move the main logic from `routers/web/repo/setting/variables.go` to `routers/web/shared/actions/variables.go`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Feature: Support workflow event dispatch via API (#33545)wxiaoguang2025-02-111-130/+11
| | | | | | | | | Fix: https://github.com/go-gitea/gitea/issues/31765 (Re-open #32059) --------- Co-authored-by: Bence Santha <git@santha.eu> Co-authored-by: Bence Sántha <7604637+bencurio@users.noreply.github.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
* Rework suggestion backend (#33538)Lunny Xiao2025-02-101-49/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #33522 The suggestion backend logic now is - If the keyword is empty, returned the latest 5 issues/prs with index desc order - If the keyword is digital, find all issues/prs which `index` has a prefix with that, with index asc order - If the keyword is non-digital or if the queried records less than 5, searching issues/prs title with a `like`, with index desc order ## Empty keyword <img width="310" alt="image" src="https://github.com/user-attachments/assets/1912c634-0d98-4eeb-8542-d54240901f77" /> ## Digital <img width="479" alt="image" src="https://github.com/user-attachments/assets/0356a936-7110-4a24-b21e-7400201bf9b8" /> ## Digital and title contains the digital <img width="363" alt="image" src="https://github.com/user-attachments/assets/6e12f908-28fe-48de-8ccc-09cbeab024d4" /> ## non-Digital <img width="435" alt="image" src="https://github.com/user-attachments/assets/2722bb53-baa2-4d67-a224-522a65f73856" /> <img width="477" alt="image" src="https://github.com/user-attachments/assets/06708dd9-80d1-4a88-b32b-d29072dd1ba6" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Revert "Feature: Support workflow event dispatch via API (#32059)" (#33541)wxiaoguang2025-02-101-24/+136
| | | This reverts commit 523751dc82bbb9d3f8d413f232e23ab0476eb4d4.
* Feature: Support workflow event dispatch via API (#32059)Bence Sántha2025-02-101-136/+24
| | | | | | | | | ref: https://github.com/go-gitea/gitea/issues/31765 --------- Signed-off-by: Bence Santha <git@santha.eu> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
* Add a option "--user-type bot" to admin user create, improve role display ↵mscherer2025-02-071-44/+37
| | | | | | | | | | | (#27885) Partially solve #13044 Fix #33295 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Move gitgraph from modules to services layer (#33527)Lunny Xiao2025-02-071-1/+1
| | | Just move, no code change.
* Refactor web route handler (#33488)wxiaoguang2025-02-057-107/+117
|
* Reject star-related requests if stars are disabled (#33208)Henrique Corrêa2025-02-041-2/+11
| | | | | | | | | | | | | This PR fixes #33205. If stars are disabled: * The `.../repo/stars` page returns a 403 Forbidden error * Star-related API endpoints return a 403 Forbidden error saying `Stars are disabled.` * Same for action endpoints --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix commit status events (#33320)Lunny Xiao2025-02-041-0/+1
| | | | | | | | | | Fix #32873 Fix #33201 ~Fix #33244~ ~Fix #33302~ depends on ~#33396~ A part of this PR should be backported to v1.23 manually.
* chore: fix some trivial problems and TODOs (#33473)wxiaoguang2025-02-022-7/+2
| | | | | | | | | | | 1. Fix incorrect `MentionCount` (actually it seems to be deadcode, affects nothing) 2. Remove fallback sha1 support for time limit token 3. Use route middleware `reqRepoActionsWriter` for `ArtifactsDeleteView` 4. Use clearer message "Failed to authenticate user" instead of "Verify" when auth fails 5. `tests/integration/benchmarks_test.go` is not quite right, actually it is never used, so delete it. 6. Remove or update TODO comments
* Worktime tracking for the organization level (#19808)K Kovacs2025-02-032-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dear Gitea team, first of all, thanks for the great work you're doing with this project. I'm planning to introduce Gitea at a client site, and noticed that while there is time recording, there are no project-manager-friendly reports to actually make use of that data, as were also mentioned by others in #4870 #8684 and #13531. Since I had a little time last weekend, I had put together something that I hope to be a useful contribution to this great project (while of course useful for me too). This PR adds a new "Worktime" tab to the Organisation level. There is a date range selector (by default set to the current month), and there are three possible views: - by repository, - by milestone, and - by team member. Happy to receive any feedback! There are several possible future improvements of course (predefined date ranges, charts, a member time sheet, matrix of repos/members, etc) but I hope that even in this relatively simple state this would be useful to lots of people. <img width="1161" alt="Screen Shot 2022-05-25 at 22 12 58" src="https://user-images.githubusercontent.com/118010/170366976-af00c7af-c4f3-4117-86d7-00356d6797a5.png"> Keep up the good work! Kristof --------- Co-authored-by: user <user@kk-git1> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* actions view: move loading of task attributes etc... into own func (#31494)65432025-02-021-67/+81
| | | | just a smal refactor to make the function length smaler ... and code more reusable in the future
* Support choose email when creating a commit via web UI (more) (#33445)wxiaoguang2025-01-315-31/+86
| | | Follow #33432
* Fix "redirect link" handling (#33440)wxiaoguang2025-01-313-14/+19
| | | | | | | `a%2fb` should not redirect to `a/b` --------- Co-authored-by: delvh <dev.lh@web.de>
* Refactor repository transfer (#33211)Lunny Xiao2025-01-302-50/+37
| | | | | | | | | | | | | - Both have `RejectTransfer` and `CancelTransfer` because the permission checks are not the same. `CancelTransfer` can be done by the doer or those who have admin permission to access this repository. `RejectTransfer` can be done by the receiver user if it's an individual or those who can create repositories if it's an organization. - Some tests are wrong, this PR corrects them. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support choose email when creating a commit via web UI (#33432)wxiaoguang2025-01-301-22/+46
| | | Initial PR for #24469
* Link to tree views of submodules if possible (#33424)Rowan Bohde2025-01-302-0/+13
| | | | | | | | | | | | | | This is a follow-up to https://github.com/go-gitea/gitea/pull/33097. When linking a submodule at a commit in either the repo view, or a diff when adding a new submodule, link to the tree view of that submodules intead of the individual commit. This shows the user the full tree, instead of the diff of the commit. This makes the assumption that the tree for a given SHA is at `<repo_url>/tree/<sha>`. This URL format is supported by both Github & Gitlab, but not Gitea. To fix this, add a redirect from `<username>/<repo>/tree/<ref>` to `<username>/<repo>/src/<ref>`, so that Gitea can support this URL structure.
* Refactor user & avatar (#33433)wxiaoguang2025-01-303-19/+10
| | | | | 1. better GetPossibleUserByID logic 2. fix some function name & comment typos 3. do not re-generate avatar if one exists
* Refactor user package (#33423)wxiaoguang2025-01-291-2/+1
| | | and avoid global variables
* Add pubdate for repository rss and add some tests (#33411)Lunny Xiao2025-01-272-0/+2
| | | Fix #33291
* Use ProtonMail/go-crypto to replace keybase/go-crypto (#33402)wxiaoguang2025-01-271-2/+2
| | | | | | Fix #33400 The keybase/go-crypto is no longer maintained and it generates malformed signatures, ProtonMail/go-crypto is the actively maintained fork.
* Refactor context flash msg and global variables (#33375)wxiaoguang2025-01-254-20/+20
| | | | | | 1. add `GetSiteCookieFlashMessage` to help to parse flash message 2. clarify `handleRepoHomeFeed` logic 3. remove unnecessary global variables, use `sync.OnceValue` instead 4. add some tests for `IsUsableUsername` and `IsUsableRepoName`
* Refactor webhook events (#33337)Lunny Xiao2025-01-231-21/+21
| | | | | | | Extract from #33320 This PR uses a map instead of a struct to store webhook event information. It removes many duplicated functions and makes the logic clearer.
* Support disable passkey auth (#33348)yp053272025-01-223-0/+14
| | | | | | | Fix #33314 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove duplicate "ResponseWriter.Status" method (#33346)wxiaoguang2025-01-225-35/+35
|
* Support performance trace (#32973)wxiaoguang2025-01-215-4/+45
| | | | | | | | | | | | | 1. Add a OpenTelemetry-like shim-layer to collect traces 2. Add a simple builtin trace collector and exporter, end users could download the diagnosis report to get the traces. This PR's design is quite lightweight, no hard-dependency, and it is easy to improve or remove. We can try it on gitea.com first to see whether it works well, and fine tune the details. --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix issue count (#33338)wxiaoguang2025-01-211-10/+20
| | | Fix #33336
* Fix incorrect ref commit ID usage (#33331)wxiaoguang2025-01-206-7/+15
| | | | | | | After the RefName refactoring, the `ctx.Repo.CommitID` is only set when there is a `RepoRefByType` middleware. Many handlers do not use that middleware and they only use "default branch"
* Fix Account linking page (#33325)CrimsonEdgeHope2025-01-191-0/+11
| | | | | | | | | | | Fix password form missing whilst linking account even with `ENABLE_PASSWORD_SIGNIN_FORM = true`. Remove redundant empty box in account linking sign up page when `LinkAccountMode` is true. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make tracked time representation display as hours (#33315)Vladimir Sysoev2025-01-191-1/+1
| | | | | | | | | | Estimated time represented in hours it might be convenient to have tracked time represented in the same way to be compared and managed. --------- Co-authored-by: Sysoev, Vladimir <i@vsysoev.ru> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix push message behavior (#33215)Chai-Shi2025-01-171-1/+19
| | | | | | | Fixes #32769 by the logic from pr #33192 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Trivial fixes (#33304)wxiaoguang2025-01-173-3/+3
| | | | | | | 1. the error check was added for go-git, it was caused by the empty `.keep` file in the test fixtures. 2. use `PostFormValue` instead of `PostForm.Get` (`Get` needs to parse the form ahead) 3. fix incorrect container text (it should show "Images" in the header but not "OS/Arch") 4. align maven xml 5. fix closed PR color&icon
* Fix incorrect ref usages (#33301)wxiaoguang2025-01-163-18/+8
| | | | | Fix #33297 By the way, improve some locales
* Only allow admins to rename default/protected branches (#33276)Kemal Zebari2025-01-151-0/+8
| | | | | | | | | | | | | Currently, anyone with write permissions to a repo are able to rename default or protected branches. This change follows [GitHub's](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch) design by only allowing repo/site admins to change these branches. However, it also follows are current design for protected branches and only allows admins to modify branch names == branch protection rule names. Glob-based rules cannot be renamed by anyone (as was already the case, but we now catch `ErrBranchIsProtected` which we previously did not catch, throwing a 500).
* Prepare for support performance trace (#33286)wxiaoguang2025-01-152-3/+3
| | | For #32973
* Fix incorrect TagName/BranchName usages (#33279)wxiaoguang2025-01-153-2/+3
| | | Add add a new test
* Simplify context ref name (#33267)wxiaoguang2025-01-155-15/+5
|
* Fix some broken route handlers (#33268)wxiaoguang2025-01-141-4/+5
| | | | Some mistakes introduced by recent refactoring PRs (some sidebar dropdowns doesn't work)
* Refactor ref type (#33242)Lunny Xiao2025-01-143-56/+50
| | | | | | | | | | | | Major changes: 1. do not sync ".keep" file during tests 2. fix incorrect route handler and empty repo handling (backported as #33253 with tests) 3. do not use `RepoRef`: most of the calls are abuses. 4. Use `git.RefType` instead of a new type definition `RepoRefType` on `context`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support public code/issue access for private repositories (#33127)wxiaoguang2025-01-143-98/+112
| | | Close #8649, close #639 (will add "anonymous access" in following PRs)