summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Prevent allow/reject reviews on merged/closed PRs (#30686)Kemal Zebari2024-04-272-2/+13
| | | Resolves #30675.
* Update misspell to 0.5.1 and add `misspellings.csv` (#30573)silverwind2024-04-279-11/+11
| | | | | | Misspell 0.5.0 supports passing a csv file to extend the list of misspellings, so I added some common ones from the codebase. There is at least one typo in a API response so we need to decided whether to revert that and then likely remove the dict entry.
* feat(api): enhance Actions Secrets Management API for repository (#30656)Bo-Yi Wu2024-04-266-284/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | - Add endpoint to list repository action secrets in API routes - Implement `ListActionsSecrets` function to retrieve action secrets from the database - Update Swagger documentation to include the new `/repos/{owner}/{repo}/actions/secrets` endpoint - Add `actions` package import and define new routes for actions, secrets, variables, and runners in `api.go`. - Refactor action-related API functions into `Action` struct methods in `org/action.go` and `repo/action.go`. - Remove `actionAPI` struct and related functions, replacing them with `NewAction()` calls. - Rename `variables.go` to `action.go` in `org` directory. - Delete `runners.go` and `secrets.go` in both `org` and `repo` directories, consolidating their content into `action.go`. - Update copyright year and add new imports in `org/action.go`. - Implement `API` interface in `services/actions/interface.go` for action-related methods. - Remove individual action-related functions and replace them with methods on the `Action` struct in `repo/action.go`. --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Signed-off-by: appleboy <appleboy.tw@gmail.com>
* Fix code search input for different views (#30678)wxiaoguang2024-04-263-4/+0
| | | | | | Now only show the "code search" on the repo home page, because it only does global search. So do not show it when viewing file or directory to avoid misleading users (it doesn't search in a directory)
* Add route handler info for debugging purpose (#30705)wxiaoguang2024-04-262-1/+7
| | | Follow #30519
* Improve job commit description (#30579)yp053272024-04-261-12/+14
| | | | | | | | | | | | | | | | | | | | | Fix https://github.com/go-gitea/gitea/issues/30567 When job is a schedule: ![image](https://github.com/go-gitea/gitea/assets/18380374/b07e9d43-e8b7-4ee2-87b3-a7050c3a8ca5) When it is a normal one: ![image](https://github.com/go-gitea/gitea/assets/18380374/0d58dab9-74bb-421b-8952-0578cdf21a52) also add a 'space' behind `:` ![image](https://github.com/go-gitea/gitea/assets/18380374/4cebece0-bfe6-4ad9-b806-e5c49bb9be43) ![image](https://github.com/go-gitea/gitea/assets/18380374/02da7681-474b-4c0f-9dad-b6558f6cb484) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Allow to save empty comment (#30706)wxiaoguang2024-04-261-19/+22
| | | Fix #29986
* Improve oauth2 client "preferred username field" logic and the error ↵wxiaoguang2024-04-254-28/+81
| | | | | | | | | | | | | handling (#30622) Follow #30454 And fix #24957 When using "preferred_username", if no such field, `extractUserNameFromOAuth2` (old `getUserName`) shouldn't return an error. All other USERNAME options do not return such error. And fine tune some logic and error messages, make code more stable and more friendly to end users.
* Fix a panic bug when head repository deleting (#30674)Lunny Xiao2024-04-241-13/+13
| | | | When visiting a pull request files which head repository has been deleted, it will panic because headrepo is nil.
* Initial support for colorblindness-friendly themes (#30625)wxiaoguang2024-04-242-2/+11
| | | | | | | Initial support for #25680 This PR only adds some simple styles from GitHub, it is big enough and it focuses on adding the necessary framework-level supports. More styles could be fine-tuned later.
* Fix compare api swagger (#30648)Lunny Xiao2024-04-231-1/+1
| | | The swagger format on #30349 is not right. This PR will fix it.
* Enable more `revive` linter rules (#30608)silverwind2024-04-2224-42/+23
| | | | | | | | | | | Noteable additions: - `redefines-builtin-id` forbid variable names that shadow go builtins - `empty-lines` remove unnecessary empty lines that `gofumpt` does not remove for some reason - `superfluous-else` eliminate more superfluous `else` branches Rules are also sorted alphabetically and I cleaned up various parts of `.golangci.yml`.
* fix(api): refactor branch and tag existence checks (#30618)Bo-Yi Wu2024-04-221-5/+4
| | | | | | | | | | | | - Update branch existence check to also include tag existence check - Adjust error message for branch/tag existence check ref: https://github.com/go-gitea/gitea/pull/30349 --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Use maintained gziphandler (#30592)Lunny Xiao2024-04-211-4/+6
| | | | | | | | Replace #27894 --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Clarify permission "HasAccess" behavior (#30585)wxiaoguang2024-04-203-5/+5
| | | | | | | | | | | | | | | Follow #30495 "HasAccess" behavior wasn't clear, to make it clear: * Use a new name `HasAnyUnitAccess`, it will be easier to review related code and permission problems. * Separate everyone access mode to a separate field, then all calls to HasAccess are reverted to old behavior before #30495. * Add new tests. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Fix HEAD method for robots.txt (#30603)wxiaoguang2024-04-191-1/+1
| | | Fix #30601
* Fix project description rendering for org (#30587)wxiaoguang2024-04-191-2/+2
| | | | | | | | Fix #30263 ![image](https://github.com/go-gitea/gitea/assets/2114189/41cabe6c-f94a-4874-a26f-d01bb89bb28c) Co-authored-by: Giteabot <teabot@gitea.io>
* Some following up changes for routes (#30550)wxiaoguang2024-04-181-5/+3
| | | | 1. Switch back to the old order for `reqRepoAdmin, context.RepoRef()` 2. Add a routing function info for global NotFound
* Expose fuzzy search for issues/pulls (#29701)65432024-04-181-2/+10
| | | | | | | | close #29685 --------- Signed-off-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io>
* Allow everyone to read or write a wiki by a repo unit setting (#30495)wxiaoguang2024-04-174-14/+9
| | | | | Replace #6312 Help #5833 Wiki solution for #639
* Support nuspec manifest download for nuget packages (#28921)Michael Kriese2024-04-171-2/+30
| | | | | | | | | | | | | | | | Support downloading nuget nuspec manifest[^1]. This is useful for renovate because it uses this api to find the corresponding repository - Store nuspec along with nupkg on upload - allow downloading nuspec - add doctor command to add missing nuspec files [^1]: https://learn.microsoft.com/en-us/nuget/api/package-base-address-resource#download-package-manifest-nuspec --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix branch_protection api shows users/teams who has no readAccess (#30291)Edward Zhang2024-04-171-4/+4
| | | | | | | | | | | | Add some logic in `convert.ToBranchProtection` to return only the names associated with readAccess instead of returning all names. This will ensure consistency in behavior between the frontend and backend. Fixes: #27694 --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wenzhuo.zhang <wenzhuo.zhang@geely.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor web routes (#30519)wxiaoguang2024-04-172-264/+276
| | | | | | | Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()` --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Allow `preferred_username` as username source for OIDC (#30454)SimonErm2024-04-161-0/+7
| | | | | | This PR adds the preferred_username claim as a possible username source for the oauth2_client. Closes #21518
* Fix empty field `login_name` in API response JSON when creating user (#30511)yp053272024-04-161-3/+3
| | | | | Fix #30508 ps: if `sourceID` is not set, `LoginName` will be ignored
* feat(api): implement branch/commit comparison API (#30349)Bo-Yi Wu2024-04-165-14/+132
| | | | | | | | | | | | | | | | | | | | | | | | | - Add new `Compare` struct to represent comparison between two commits - Introduce new API endpoint `/compare/*` to get commit comparison information - Create new file `repo_compare.go` with the `Compare` struct definition - Add new file `compare.go` in `routers/api/v1/repo` to handle comparison logic - Add new file `compare.go` in `routers/common` to define `CompareInfo` struct - Refactor `ParseCompareInfo` function to use `common.CompareInfo` struct - Update Swagger documentation to include the new API endpoint for commit comparison - Remove duplicate `CompareInfo` struct from `routers/web/repo/compare.go` - Adjust base path in Swagger template to be relative (`/api/v1`) GitHub API https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Rewrite and restyle reaction selector and enable no-sizzle eslint rule (#30453)silverwind2024-04-141-2/+0
| | | | | | | | | | | Enable `no-sizzle` lint rule, there was only one use in `initCompReactionSelector` and: - Remove all jQuery except the necessary fomantic dropdown init - Remove the recursion, instead bind event listeners to common parent container nodes --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Fix network error when open/close organization/individual projects and ↵yp053272024-04-132-11/+6
| | | | | | | | | | | redirect to project page (#30387) Follow #27734 ![image](https://github.com/go-gitea/gitea/assets/18380374/02ed6b9a-cbb6-4f49-a54a-ca76a0d052a9) Updated: Redirect to project page instead of project list page.
* Refactor cache and disable go-chi cache (#30417)wxiaoguang2024-04-131-4/+2
| | | use built-in cache package to wrap external go-chi cache package
* Fix rename branch 500 when the target branch is deleted but exist in ↵Lunny Xiao2024-04-121-1/+7
| | | | | database (#30430) Fix #30428
* Check the token's owner and repository when registering a runner (#30406)Zettat1232024-04-111-0/+14
| | | Fix #30378
* Use raw Wiki links for non-renderable Wiki files (#30273)Rafael2024-04-101-6/+7
| | | | | | | | | | | | | | | | | | | In Wiki pages, short-links created to local Wiki files were always expanded as regular Wiki Links. In particular, if a link wanted to point to a file that Gitea doesn't know how to render (e.g, a .zip file), a user following the link would be silently redirected to the Wiki's home page. This change makes short-links* in Wiki pages be expanded to raw wiki links, so these local wiki files may be accessed without manually accessing their URL. * only short-links ending in a file extension that isn't renderable are affected. Closes #27121. Signed-off-by: Rafael Girão <rafael.s.girao@tecnico.ulisboa.pt> Co-authored-by: silverwind <me@silverwind.io>
* Performance optimization for git push (#30104)Lunny Xiao2024-04-091-41/+44
| | | | | Agit returned result should be from `ProcReceive` hook but not `PostReceive` hook. Then for all non-agit pull requests, it will not check the pull requests for every pushing `refs/pull/%d/head`.
* Fix missed doer (#30231)Lunny Xiao2024-04-086-21/+21
| | | | | Fix #29879 Co-authored-by: Giteabot <teabot@gitea.io>
* Avoid showing `Failed to change the default wiki branch` if repo has no wiki ↵yp053272024-04-081-0/+6
| | | | when saving repo settings (#30329)
* Clean up log messages (#30313)wxiaoguang2024-04-077-17/+10
| | | | | | `log.Xxx("%v")` is not ideal, this PR adds necessary context messages. Remove some unnecessary logs. Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor startup deprecation messages (#30305)wxiaoguang2024-04-072-10/+10
| | | | | | | It doesn't change logic, it only does: 1. Rename the variable and function names 2. Use more consistent format when mentioning config section&key 3. Improve some messages
* Render embedded code preview by permlink in markdown (#30234)wxiaoguang2024-04-022-2/+2
| | | | | The permlink in markdown will be rendered as a code preview block, like GitHub Co-authored-by: silverwind <me@silverwind.io>
* Remove scheduled action tasks if the repo is archived (#30224)Zettat1232024-04-012-0/+22
| | | Fix #30220
* Refactor file view & render (#30227)wxiaoguang2024-04-013-15/+24
| | | The old code is inconsistent and fragile, and the UI isn't right.
* Do not allow different storage configurations to point to the same directory ↵wxiaoguang2024-03-311-0/+8
| | | | | (#30169) Replace #29171
* Add setting to disable user features when user login type is not plain (#29615)Jack Hay2024-03-294-12/+14
| | | | | | | | | ## Changes - Adds setting `EXTERNAL_USER_DISABLE_FEATURES` to disable any supported user features when login type is not plain - In general, this is necessary for SSO implementations to avoid inconsistencies between the external account management and the linked account - Adds helper functions to encourage correct use
* Refactor topic Find functions and add more tests for pagination (#30127)Lunny Xiao2024-03-293-5/+6
| | | This also fixed #22238
* Add API for `Variables` (#29520)sillyguodong2024-03-288-62/+893
| | | | | | | close #27801 --------- Co-authored-by: silverwind <me@silverwind.io>
* Prevent re-review and dismiss review actions on closed and merged PRs (#30065)Kemal Zebari2024-03-283-6/+19
| | | | | | | | | | | | | | | | | | | Resolves #29965. --- Manually tested this by: - Following the [installation](https://docs.gitea.com/next/installation/install-with-docker#basics) guide (but built a local Docker image instead) - Creating 2 users, one who is the `Owner` of a newly-created repository and the other a `Collaborator` - Had the `Collaborator` create a PR that the `Owner` reviews - `Collaborator` resolves conversation and `Owner` merges PR And with this change we see that we can no longer see re-request review button for the `Owner`: <img width="1351" alt="Screenshot 2024-03-25 at 12 39 18 AM" src="https://github.com/go-gitea/gitea/assets/60799661/bcd9c579-3cf7-474f-a51e-b436fe1a39a4">
* Add default board to new projects, remove uncategorized pseudo-board (#29874)Denys Konovalov2024-03-273-132/+30
| | | | | | | | | | | | | | | | | | On creation of an empty project (no template) a default board will be created instead of falling back to the uneditable pseudo-board. Every project now has to have exactly one default boards. As a consequence, you cannot unset a board as default, instead you have to set another board as default. Existing projects will be modified using a cron job, additionally this check will run every midnight by default. Deleting the default board is not allowed, you have to set another board as default to do it. Fixes #29873 Fixes #14679 along the way Fixes #29853 Co-authored-by: delvh <dev.lh@web.de>
* Relax generic package filename restrictions (#30135)wxiaoguang2024-03-272-5/+89
| | | | | | | | Now, the chars `=:;()[]{}~!@#$%^ &` are possible as well Fixes #30134 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Refactor render (#30136)wxiaoguang2024-03-271-8/+7
|
* Put an edit file button on pull request files to allow a quick operation ↵Lunny Xiao2024-03-273-2/+40
| | | | | | | | | | | | | | | | | | | | (#29697) Resolve #23848 This PR put an edit file button on pull request files to allow a quick edit for a file. After the edit finished, it will return back to the viewed file position on pull request files tab. It also use a branch view file link instead of commit link when it's a non-commit pull request files view. <img width="1532" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/3637ca4c-89d5-4621-847b-79702a44f617"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Remove repetitive words (#30091)crazeteam2024-03-262-2/+2
| | | | | remove repetitive words Signed-off-by: crazeteam <lilujing@outlook.com>