aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve the maintainblity of the reserved username list (#32229)wxiaoguang2024-10-101-5/+3
|
* Refactor CSRF token (#32216)wxiaoguang2024-10-102-5/+3
|
* Fix bug when a token is given public only (#32204)Lunny Xiao2024-10-081-3/+4
|
* Fix javascript error when an anonymous user visiting migration page (#32144)Lunny Xiao2024-10-021-1/+4
| | | | | | | | | | | | This PR fixes javascript errors when an anonymous user visits the migration page. It also makes task view checking more restrictive. The router moved from `/user/task/{id}/status` to `/username/reponame/-/migrate/status` because it's a migrate status. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make oauth2 code clear. Move oauth2 provider code to their own ↵Lunny Xiao2024-10-026-23/+245
| | | | | | packages/files (#32148) Fix #30266 Replace #31533
* Support repo license (#24872)yp053272024-10-0113-0/+357
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-012-2/+8
| | | Fix #31423
* Fix bug when deleting a migrated branch (#32075)Lunny Xiao2024-09-241-6/+7
| | | | After migrating a repository with pull request, the branch is missed and after the pull request merged, the branch cannot be deleted.
* Truncate commit message during Discord webhook push events (#31970)Kemal Zebari2024-09-243-3/+32
| | | Resolves #31668.
* Fix: database not update release when using `git push --tags --force` (#32040)Exploding Dragon2024-09-181-8/+10
| | | | | | | link: https://codeberg.org/forgejo/forgejo/issues/4274 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor CSRF protector (#32057)wxiaoguang2024-09-182-137/+61
| | | | | | Remove unused CSRF options, decouple "new csrf protector" and "prepare" logic, do not redirect to home page if CSRF validation falis (it shouldn't happen in daily usage, if it happens, redirecting to home doesn't help either but just makes the problem more complex for "fetch")
* Add missing comment reply handling (#32050)KN4CK3R2024-09-171-27/+29
| | | | | | | | | Fixes #31937 - Add missing comment reply handling - Use `onGiteaRun` in the test because the fixtures are not present otherwise (did this behaviour change?) Compare without whitespaces.
* Do not escape relative path in RPM primary index (#32038)KN4CK3R2024-09-161-2/+1
| | | | | Fixes #32021 Do not escape the relative path.
* Handle invalid target when creating releases using API (#31841)Kemal Zebari2024-09-121-1/+1
| | | | | | | A 500 status code was thrown when passing a non-existent target to the create release API. This snapshot handles this error and instead throws a 404 status code. Discovered while working on #31840.
* Fix `/repos/{owner}/{repo}/pulls/{index}/files` endpoint not populating ↵charles-plutohealth2024-09-121-12/+11
| | | | | | | | | `previous_filename` (#32017) --- `status == "rename"` should have read `status == "renamed"`. The typo means that file.PreviousFilename would never be populated, which e.g. breaks usage of the Github Action at https://github.com/dorny/paths-filter.
* Support allowed hosts for migrations to work with proxy (#32025)Jason Song2024-09-113-6/+2
|
* Support migration from AWS CodeCommit (#31981)Zettat1232024-09-113-0/+274
| | | | | | | | | | | | | | | | | | | | This PR adds support for migrating repos from [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html). The access key ID and secret access key are required to get repository information and pull requests. And [HTTPS Git credentials](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html) are required to clone the repository. <img src="https://github.com/user-attachments/assets/82ecb2d0-8d43-42b0-b5af-f5347a13b9d0" width="680" /> The AWS CodeCommit icon is from [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/). <img src="https://github.com/user-attachments/assets/3c44d21f-d753-40f5-9eae-5d3589e0d50d" width="320" />
* bump to go 1.23 (#31855)techknowlogick2024-09-102-2/+3
|
* Save initial signup information for users to aid in spam prevention (#31852)techknowlogick2024-09-098-9/+9
| | | | | | | | | | | | | | This will allow instance admins to view signup pattern patterns for public instances. It is modelled after discourse, mastodon, and MediaWiki's approaches. Note: This has privacy implications, but as the above-stated open-source projects take this approach, especially MediaWiki, which I have no doubt looked into this thoroughly, it is likely okay for us, too. However, I would be appreciative of any feedback on how this could be improved. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Remove SHA1 for support for ssh rsa signing (#31857)Wim2024-09-071-2/+2
| | | | | | | | | | | | https://github.com/go-fed/httpsig seems to be unmaintained. Switch to github.com/42wim/httpsig which has removed deprecated crypto and default sha256 signing for ssh rsa. No impact for those that use ed25519 ssh certificates. This is a breaking change for: - gitea.com/gitea/tea (go-sdk) - I'll be sending a PR there too - activitypub using deprecated crypto (is this actually used?)
* Use global lock instead of NewExclusivePool to allow distributed lock ↵Lunny Xiao2024-09-066-36/+81
| | | | | | | | | | between multiple Gitea instances (#31813) Replace #26486 Fix #19620 --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Fix nuget/conan/container packages upload bugs (#31967)Lunny Xiao2024-09-052-10/+47
|
* Fix 500 error when `state` params is set when editing issue/PR by API (#31880)yp053272024-09-021-0/+3
| | | A quick fix for #31871
* Handle "close" actionable references for manual merges (#31879)Zettat1232024-08-261-1/+6
| | | Fix #31743
* Fix agit automerge (#31207)Lunny Xiao2024-08-201-3/+15
|
* Fix actions notify bug (#31866)Lunny Xiao2024-08-192-11/+16
| | | | Try to fix https://github.com/go-gitea/gitea/issues/31757#issuecomment-2295131062
* Fixes for unreachable project issues when transfer repository from ↵Edip Emre Bodur2024-08-131-0/+17
| | | | | | | | | | | | | | organization (#31770) When transferring repositories that have issues linked to a project board to another organization, the issues remain associated with the original project board. This causes the columns in the project board to become bugged, making it difficult to move other issues in or out of the affected columns. As a solution, I removed the issue relations since the other organization does not have this project table. Fix for #31538 Co-authored-by: Jason Song <i@wolfogre.com>
* Move repository visibility to danger zone in the settings area (#31126)Fábio Barkoski2024-08-111-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved repository visibility to the danger zone in the settings area. To change the visibility, it is necessary to go to the danger zone, click on the private/public button, and accept the change in the modal. Resolves: #23826 --- ## Screenshots <details> <summary>Before</summary> Private repo: ![Private repo](https://github.com/go-gitea/gitea/assets/65479069/4313492a-4854-48bc-9f47-974e3539d791) Public repo: ![Public repo](https://github.com/go-gitea/gitea/assets/65479069/1c45f6e4-ee93-4799-9331-e9d4a7e0f16a) </details> <details> <summary>After</summary> Make private: ![Screenshot from 2024-05-28 21-35-38](https://github.com/go-gitea/gitea/assets/65479069/4887e28a-0514-4990-aa69-bf3ddc7e6c7d) Make private modal ![Screenshot from 2024-06-13 23-55-55](https://github.com/go-gitea/gitea/assets/65479069/9f5a7604-069b-41a2-973b-ee2d58e85953) ![Screenshot from 2024-06-13 23-53-09](https://github.com/go-gitea/gitea/assets/65479069/06c22726-eab2-4bce-8df7-62849dcce974) Make public: ![Screenshot from 2024-05-28 21-34-27](https://github.com/go-gitea/gitea/assets/65479069/6d388f99-0356-48a0-9d85-320cdba55179) Make public modal ![Screenshot from 2024-06-13 23-53-37](https://github.com/go-gitea/gitea/assets/65479069/8944972e-f2d4-4aea-ba96-b892febb5ced) </details> --------- Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
* Add issue comment when moving issues from one column to another of the ↵Lunny Xiao2024-08-091-0/+79
| | | | | | | | | | | | | | | | | project (#29311) Fix #27278 Replace #27816 This PR adds a meta-comment for an issue when dragging an issue from one column to another of a project. <img width="600" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: yp05327 <576951401@qq.com>
* Fix RPM resource leak (#31794)KN4CK3R2024-08-082-32/+39
| | | | | | | Fixes a resource leak introduced by #27069. - add defer - move sign code out of `repository.go`
* Fix protected branch files detection on pre_receive hook (#31778)Lunny Xiao2024-08-061-5/+5
| | | | | | | | | | | | | | | Fix #31738 When pushing a new branch, the old commit is zero. Most git commands cannot recognize the zero commit id. To get the changed files in the push, we need to get the first diverge commit of this branch. In most situations, we could check commits one by one until one commit is contained by another branch. Then we will think that commit is the diverge point. And in a pre-receive hook, this will be more difficult because all commits haven't been merged and they actually stored in a temporary place by git. So we need to bring some envs to let git know the commit exist.
* Add signature support for the RPM module (#27069)Exploding Dragon2024-08-061-3/+35
| | | | | | | | close #27031 If the rpm package does not contain a matching gpg signature, the installation will fail. See (#27031) , now auto-signing rpm uploads. This option is turned off by default for compatibility.
* Fix null requested_reviewer from API (#31773)Edip Emre Bodur2024-08-051-0/+15
| | | | | | | | If the assign the pull request review to a team, it did not show the members of the team in the "requested_reviewers" field, so the field was null. As a solution, I added the team members to the array. fix #31764
* Clear up old Actions logs (#31735)Jason Song2024-08-022-10/+59
| | | | | | | | | | | | | | | | | Part of #24256. Clear up old action logs to free up storage space. Users will see a message indicating that the log has been cleared if they view old tasks. <img width="1361" alt="image" src="https://github.com/user-attachments/assets/9f0f3a3a-bc5a-402f-90ca-49282d196c22"> Docs: https://gitea.com/gitea/docs/pulls/40 --------- Co-authored-by: silverwind <me@silverwind.io>
* Distinguish LFS object errors to ignore missing objects during migration ↵Jason Song2024-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#31702) Fix #31137. Replace #31623 #31697. When migrating LFS objects, if there's any object that failed (like some objects are losted, which is not really critical), Gitea will stop migrating LFS immediately but treat the migration as successful. This PR checks the error according to the [LFS api doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses). > LFS object error codes should match HTTP status codes where possible: > > - 404 - The object does not exist on the server. > - 409 - The specified hash algorithm disagrees with the server's acceptable options. > - 410 - The object was removed by the owner. > - 422 - Validation error. If the error is `404`, it's safe to ignore it and continue migration. Otherwise, stop the migration and mark it as failed to ensure data integrity of LFS objects. And maybe we should also ignore others errors (maybe `410`? I'm not sure what's the difference between "does not exist" and "removed by the owner".), we can add it later when some users report that they have failed to migrate LFS because of an error which should be ignored.
* Move `registerActionsCleanup` to `initActionsTasks` (#31721)Jason Song2024-07-303-20/+12
| | | | | | | There's already `initActionsTasks`; it will avoid additional check for if Actions enabled to move `registerActionsCleanup` into it. And we don't really need `OlderThanConfig`.
* Add permission check when creating PR (#31033)yp053272024-07-291-0/+24
| | | user should be a collaborator of the base repo to create a PR
* Support `pull_request_target` event for commit status (#31703)Zettat1232024-07-261-1/+6
| | | | | | | | | | | | Fix [act_runner #573](https://gitea.com/gitea/act_runner/issues/573) Before: ![image](https://github.com/user-attachments/assets/3944bf7f-7a60-4801-bcb3-5e158a180fda) After: ![image](https://github.com/user-attachments/assets/cadac944-40bd-4537-a9d9-e702b8bc1ece)
* add skip secondary authorization option for public oauth2 clients (#31454)Denys Konovalov2024-07-192-10/+12
|
* Fix a branch divergence cache bug (#31659)Zettat1232024-07-192-2/+25
| | | | | | | Fix #31599 A branch divergence is counted based on the default branch. If the default branch is updated, all divergence caches of the repo need to be deleted.
* allow synchronizing user status from OAuth2 login providers (#31572)Rowan Bohde2024-07-166-4/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This leverages the existing `sync_external_users` cron job to synchronize the `IsActive` flag on users who use an OAuth2 provider set to synchronize. This synchronization is done by checking for expired access tokens, and using the stored refresh token to request a new access token. If the response back from the OAuth2 provider is the `invalid_grant` error code, the user is marked as inactive. However, the user is able to reactivate their account by logging in the web browser through their OAuth2 flow. Also changed to support this is that a linked `ExternalLoginUser` is always created upon a login or signup via OAuth2. ### Notes on updating permissions Ideally, we would also refresh permissions from the configured OAuth provider (e.g., admin, restricted and group mappings) to match the implementation of LDAP. However, the OAuth library used for this `goth`, doesn't seem to support issuing a session via refresh tokens. The interface provides a [`RefreshToken` method](https://github.com/markbates/goth/blob/master/provider.go#L20), but the returned `oauth.Token` doesn't implement the `goth.Session` we would need to call `FetchUser`. Due to specific implementations, we would need to build a compatibility function for every provider, since they cast to concrete types (e.g. [Azure](https://github.com/markbates/goth/blob/master/providers/azureadv2/azureadv2.go#L132)) --------- Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Add option to change mail from user display name (#31528)65432024-07-144-3/+67
| | | | | | | | | | Make it posible to let mails show e.g.: `Max Musternam (via gitea.kithara.com) <gitea@kithara.com>` Docs: https://gitea.com/gitea/docs/pulls/23 --- *Sponsored by Kithara Software GmbH*
* Display app name in the registration email title (#31562)Sunny Wan2024-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | I changed the title of the registation email from "Welcome to Gitea" to "Welcome to (appname)". I did this by substituting 'Gitea' in register_notify to %s and formating the registration title in mail.go. I changed this for all the languages I could, but I struggled to changed the translation file for Farsi. I have attached the screenshots of before and after and the related issue below. Related issue: https://github.com/go-gitea/gitea/issues/31108 Before change: ![Screenshot from 2024-07-04 22-32-17](https://github.com/go-gitea/gitea/assets/94445569/4178b51c-1acc-45f4-9750-dff41564a709) After: ![Screenshot from 2024-07-04 22-32-01](https://github.com/go-gitea/gitea/assets/94445569/9cd7a58d-c0f5-4a3c-a66c-805c55411eaa) --------- Signed-off-by: Sunny Wan <Sunnywan2020@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Refactor webhook (#31587)wxiaoguang2024-07-1015-178/+162
| | | | | | A more complete fix for #31588 1. Make "generic" code more readable 2. Clarify HTML or Markdown for the payload content
* Fix: Allow org team names of length 255 in create team form (#31564)Tobias Balle-Petersen2024-07-101-1/+1
| | | | | | | | | | | | | Gitea 1.22.1 was supposed to allow for team names of length 255 (up from 30) after the following PR was merged in: https://github.com/go-gitea/gitea/pull/31410. However, the length of team names was still limited to 30 as described in this issue: https://github.com/go-gitea/gitea/issues/31554. One more change to _gitea_ needs to be made to allow for the longer team names, as there is a 30 character limit here: https://github.com/go-gitea/gitea/blob/2c92c7c5226e29636a1d47a277130f477fa2037b/services/forms/org.go#L65 This PR changes that value to 255.
* Add `YEAR`, `MONTH`, `MONTH_ENGLISH`, `DAY` variables for template repos ↵delvh2024-07-091-0/+6
| | | | | (#31584) Fixes #31583
* Use FullName in Emails to address the recipient if possible (#31527)65432024-07-083-13/+13
| | | | | | | | Before we had just the plain mail address as recipient. But now we provide additional Information for the Mail clients. --- *Sponsored by Kithara Software GmbH*
* Allow force push to protected branches (#28086)Henry Goodman2024-07-053-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22722 ### Problem Currently, it is not possible to force push to a branch with branch protection rules in place. There are often times where this is necessary (CI workflows/administrative tasks etc). The current workaround is to rename/remove the branch protection, perform the force push, and then reinstate the protections. ### Solution Provide an additional section in the branch protection rules to allow users to specify which users with push access can also force push to the branch. The default value of the rule will be set to `Disabled`, and the UI is intuitive and very similar to the `Push` section. It is worth noting in this implementation that allowing force push does not override regular push access, and both will need to be enabled for a user to force push. This applies to manual force push to a remote, and also in Gitea UI updating a PR by rebase (which requires force push) This modifies the `BranchProtection` API structs to add: - `enable_force_push bool` - `enable_force_push_whitelist bool` - `force_push_whitelist_usernames string[]` - `force_push_whitelist_teams string[]` - `force_push_whitelist_deploy_keys bool` ### Updated Branch Protection UI: <img width="943" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/7491899c-d816-45d5-be84-8512abd156bf"> ### Pull Request `Update branch by Rebase` option enabled with source branch `test` being a protected branch: ![image](https://github.com/go-gitea/gitea/assets/79623665/e018e6e9-b7b2-4bd3-808e-4947d7da35cc) <img width="1038" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/57ead13e-9006-459f-b83c-7079e6f4c654"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix slow patch checking with commits that add or remove many files (#31548)Brecht Van Lommel2024-07-041-8/+21
| | | | | | | | | | | | | Running git update-index for every individual file is slow, so add and remove everything with a single git command. When such a big commit lands in the default branch, it could cause PR creation and patch checking for all open PRs to be slow, or time out entirely. For example, a commit that removes 1383 files was measured to take more than 60 seconds and timed out. With this change checking took about a second. This is related to #27967, though this will not help with commits that change many lines in few files.
* [Fix] Account Linking UpdateMigrationsByType (#31428)Sumit2024-06-201-0/+6
| | | Fix https://github.com/go-gitea/gitea/issues/31427