summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix schedule tasks bugs (#28691) (#28780)Lunny Xiao2024-01-144-10/+26
| | | | | | | | | | | | | | Fix #28157 Backport #28691 This PR fix the possible bugs about actions schedule. - Move `UpdateRepositoryUnit` and `SetRepoDefaultBranch` from models to service layer - Remove schedules plan from database and cancel waiting & running schedules tasks in this repository when actions unit has been disabled or global disabled. - Remove schedules plan from database and cancel waiting & running schedules tasks in this repository when default branch changed.
* Show description as tooltip instead of title for labels (#28754) (#28766)Giteabot2024-01-121-2/+2
| | | | | | | | | | | | | | | | | Backport #28754 by @delvh Follow GitHubs behavior of showing the label description as a tooltip instead of the browser native title. ## Before ![grafik](https://github.com/go-gitea/gitea/assets/51889757/70448327-467b-4bee-b799-40a442a5ce16) ## After ![grafik](https://github.com/go-gitea/gitea/assets/51889757/abe7d700-148b-4cef-a487-6b0f8f20b212) Co-authored-by: delvh <dev.lh@web.de>
* Add -F to commit search to treat keywords as strings (#28744) (#28748)Giteabot2024-01-101-0/+3
| | | | | | | | | | | | | | | | | Backport #28744 by @me-heer Fixes #28269 The [default behavior](https://git-scm.com/docs/git-log#Documentation/git-log.txt---basic-regexp) of --grep in git log is to interpret the keyword as a regular expression. This causes the search to fail in the cases where the search keyword contains a `[`, since `[` is a special character used in grep. If we want our keywords to be interpreted as 'strings', we should use [-F flag](https://git-scm.com/docs/git-log#Documentation/git-log.txt---basic-regexp). Co-authored-by: Mihir Joshi <mihir67mj@gmail.com>
* Fix panic when parsing empty pgsql host (#28708) (#28709)Giteabot2024-01-062-1/+5
| | | | | | | | Backport #28708 by wxiaoguang Regression of #27723 Fix #28705 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make template `DateTime` show proper tooltip (#28677) (#28683)wxiaoguang2024-01-032-15/+21
| | | Backport #28677
* Avoid cycle-redirecting user/login page (#28636) (#28658)wxiaoguang2023-12-301-2/+1
| | | | | Backport #28636 Fix #28231, and remove some unused code.
* Refactor CORS handler (#28587) (#28611)wxiaoguang2023-12-253-22/+8
| | | | | | | | | | | | | Backport #28587, the only conflict is the test file. The CORS code has been unmaintained for long time, and the behavior is not correct. This PR tries to improve it. The key point is written as comment in code. And add more tests. Fix #28515 Fix #27642 Fix #17098
* Fix the issue ref rendering for wiki (#28556) (#28559)Giteabot2023-12-201-1/+3
| | | | | | | | Backport #28556 by wxiaoguang Fix #28526, regression of * #26365 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* chore(api): support ignore password if login source type is LDAP for ↵Giteabot2023-12-191-3/+2
| | | | | | | | | | | | | creating user API (#28491) (#28525) Backport #28491 by @appleboy - Modify the `Password` field in `CreateUserOption` struct to remove the `Required` tag - Update the `v1_json.tmpl` template to include the `email` field and remove the `password` field Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Add option to disable ambiguous unicode characters detection (#28454) (#28499)wxiaoguang2023-12-1810-124/+85
| | | | | | | | Backport #28454 (the only conflict is caused by some comments) * Close #24483 * Close #28123 * Close #23682 * Close #23149
* Initalize stroage for orphaned repository doctor (#28487) (#28490)Giteabot2023-12-161-0/+5
| | | | | | | | | | | | | Backport #28487 by @earl-warren - When a repository is orphaned and has objects stored in any of the storages such as repository avatar or attachments the delete function would error, because the storage module wasn't initalized. - Add code to initialize the storage module. Refs: https://codeberg.org/forgejo/forgejo/pulls/1954 Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* Deprecate query string auth tokens (#28390) (#28430)Giteabot2023-12-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #28390 by @jackHay22 ## Changes - Add deprecation warning to `Token` and `AccessToken` authentication methods in swagger. - Add deprecation warning header to API response. Example: ``` HTTP/1.1 200 OK ... Warning: token and access_token API authentication is deprecated ... ``` - Add setting `DISABLE_QUERY_AUTH_TOKEN` to reject query string auth tokens entirely. Default is `false` ## Next steps - `DISABLE_QUERY_AUTH_TOKEN` should be true in a subsequent release and the methods should be removed in swagger - `DISABLE_QUERY_AUTH_TOKEN` should be removed and the implementation of the auth methods in question should be removed ## Open questions - Should there be further changes to the swagger documentation? Deprecation is not yet supported for security definitions (coming in [OpenAPI Spec version 3.2.0](https://github.com/OAI/OpenAPI-Specification/issues/2506)) - Should the API router logger sanitize urls that use `token` or `access_token`? (This is obviously an insufficient solution on its own) Co-authored-by: Jack Hay <jack@allspice.io> Co-authored-by: delvh <dev.lh@web.de>
* Improve doctor cli behavior (#28422) (#28424)Giteabot2023-12-111-6/+10
| | | | | | | | | | Backport #28422 by wxiaoguang 1. Do not sort the "checks" slice again and again when "Register", it just wastes CPU when the Gitea instance runs 2. If a check doesn't exist, tell the end user 3. Add some tests Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make gogit Repository.GetBranchNames consistent (#28348) (#28386)Giteabot2023-12-071-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #28348 by @AdamMajer nogogit GetBranchNames() lists branches sorted in reverse commit date order. On the other hand the gogit implementation doesn't apply any ordering resulting in unpredictable behaviour. In my case, the unit tests requiring particular order fail repo_branch_test.go:24: Error Trace: ./gitea/modules/git/repo_branch_test.go:24 Error: elements differ extra elements in list A: ([]interface {}) (len=1) { (string) (len=6) "master" } extra elements in list B: ([]interface {}) (len=1) { (string) (len=7) "branch1" } listA: ([]string) (len=2) { (string) (len=6) "master", (string) (len=7) "branch2" } listB: ([]string) (len=2) { (string) (len=7) "branch1", (string) (len=7) "branch2" } Test: TestRepository_GetBranches To fix this, we sort branches based on their commit date in gogit implementation. Fixes: #28318 Co-authored-by: Adam Majer <amajer@suse.de>
* Fix incorrect default value of `[attachment].MAX_SIZE` (#28373) (#28376)Giteabot2023-12-061-1/+1
| | | | | | | | | Backport #28373 by @capvor In the documents, the `[attachment] MAX_SIZE` default value should be 4. Reference the source code `modules/setting/attachment.go` line 29. Co-authored-by: capvor <capvor@sina.com>
* Use `filepath` instead of `path` to create SQLite3 database file (#28374) ↵Giteabot2023-12-061-2/+1
| | | | | | | (#28378) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Fix #28300
* Convert git commit summary to valid UTF8. (#28356) (#28358)Giteabot2023-12-051-1/+2
| | | | | | | | | | | Backport #28356 by @darrinsmart The summary string ends up in the database, and (at least) MySQL & PostgreSQL require valid UTF8 strings. Fixes #28178 Co-authored-by: darrinsmart <darrin@djs.to> Co-authored-by: Darrin Smart <darrin@filmlight.ltd.uk>
* Read `previous` info from git blame (#28306) (#28310)Giteabot2023-12-012-24/+41
| | | | | | | | | | Backport #28306 by @KN4CK3R Fixes #28280 Reads the `previous` info from the `git blame` output instead of calculating it afterwards. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Ignore "non-existing" errors when getDirectorySize calculates the size ↵wxiaoguang2023-11-301-11/+12
| | | | | | | | | | | (#28276) (#28285) Backport #28276 The git command may operate the git directory (add/remove) files in any time. So when the code iterates the directory, some files may disappear during the "walk". All "IsNotExist" errors should be ignored.
* Meilisearch: require all query terms to be matched (#28293) (#28296)Giteabot2023-11-291-4/+5
| | | | Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Fix delete-orphaned-repos (#28200) (#28202)pitpalme2023-11-241-2/+2
| | | | | | | | | Backport #28200 gitea doctor failed at checking and fixing 'delete-orphaned-repos', because table name 'user' needs quoting to be correctly recognized by at least PostgreSQL. fixes #28199
* Make CORS work for oauth2 handlers (#28184) (#28185)Giteabot2023-11-231-0/+4
| | | | | | | | | | Backport #28184 Fix #25473 Although there was `m.Post("/login/oauth/access_token", CorsHandler()...`, it never really worked, because it still lacks the "OPTIONS" handler. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add guide page to actions when there's no workflows (#28145) (#28153)Giteabot2023-11-221-0/+1
| | | | | | | | | | | | | Backport #28145 by @yp05327 Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/599d40c1-9b8d-4189-9286-c9c36fb780dd) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/848a73d1-aaec-478f-93a7-adcc7ee18907) Co-authored-by: yp05327 <576951401@qq.com>
* Change default size of attachments and repo files (#28100) (#28106)Giteabot2023-11-172-2/+2
| | | | | | | | Backport #28100 by @lng2020 https://github.com/go-gitea/gitea/pull/27946 forgets to change them in code. Sorry about that. Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
* Fix incorrect pgsql conn builder behavior (#28085) (#28098)Giteabot2023-11-172-9/+11
| | | | | | | Backport #28085 by @wxiaoguang Fix #28083 and fix the tests Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Render email addresses as such if followed by punctuation (#27987) (#27992)Giteabot2023-11-112-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Backport #27987 by @yardenshoham Added the following characters to the regular expression for the email: - , - ; - ? - ! Also added a test case. - Fixes #27616 # Before ![image](https://github.com/go-gitea/gitea/assets/20454870/c57eac26-f281-43ef-a51d-9c9a81b63efa) # After ![image](https://github.com/go-gitea/gitea/assets/20454870/fc7d5c08-4350-4af0-a7f0-d1444d2d75af) Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Unify two factor check (#27915) (#27929)Giteabot2023-11-061-27/+0
| | | | | | | | | | | | Backport #27915 by @KN4CK3R Fixes #27819 We have support for two factor logins with the normal web login and with basic auth. For basic auth the two factor check was implemented at three different places and you need to know that this check is necessary. This PR moves the check into the basic auth itself. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Remove action runners on user deletion (#27902) (#27908)Giteabot2023-11-051-0/+7
| | | | | | | | | | | | | Backport #27902 by @earl-warren - On user deletion, delete action runners that the user has created. - Add a database consistency check to remove action runners that have nonexistent belonging owner. - Resolves https://codeberg.org/forgejo/forgejo/issues/1720 (cherry picked from commit 009ca7223dab054f7f760b7ccae69e745eebfabb) Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* refactor postgres connection string building (#27723) (#27869)Giteabot2023-11-012-29/+44
| | | | | | | | | | | | Backport #27723 by @mpldr This patchset changes the connection string builder to use net.URL and the host/port parser to use the stdlib function for splitting host from port. It also adds a footnote about a potentially required portnumber for postgres UNIX sockets. Fixes: #24552 Co-authored-by: Moritz Poldrack <33086936+mpldr@users.noreply.github.com>
* Clean up template locale usage (#27856) (#27857)wxiaoguang2023-10-311-1/+0
| | | | | | | Backport #27856 The only conflict is `ThemeName` in `500.tmpl`, it has been resolved manually by keeping using old `{{.SignedUser.Theme}}{{else}}{{DefaultTheme}}`
* Fix package webhook (#27839) (#27855)Giteabot2023-10-311-0/+1
| | | | | | | | Backport #27839 by @lunny Fix #23742 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Close all hashed buffers (#27787) (#27790)Giteabot2023-10-251-1/+1
| | | | | | | | Backport #27787 by @KN4CK3R Add missing `.Close()` calls. The current code does not delete the temporary files if the data grows over 32mb. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix label render containing invalid HTML (#27752) (#27762)Giteabot2023-10-241-1/+1
| | | | | | | | | | | | Backport #27752 by @earl-warren - The label HTML contained a quote that wasn't being closed. Refs: https://codeberg.org/forgejo/forgejo/pulls/1651 (cherry picked from commit e2bc2c9a1fff482c49dbeb3a51e4e1c698bf506c) Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* Add doctor dbconsistency fix to delete repos with no owner (#27290) (#27693)65432023-10-221-0/+70
| | | Backport #27290
* Improve feed icons and feed merge text color (#27498) (#27716)Giteabot2023-10-211-10/+14
| | | | | | | | | | | | | | | | | | Backport #27498 by @silverwind 1. Improve various feed icons 2. Fix merge message color <img width="763" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/3f5bcb23-6d90-4c63-85f2-46bd7e1c96d6"> <img width="769" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/466c37b4-e2f4-42bb-922d-b86596cdc6d0"> Fixes: https://github.com/go-gitea/gitea/issues/27495 Continues: https://github.com/go-gitea/gitea/pull/27356 Co-authored-by: silverwind <me@silverwind.io>
* Support allowed hosts for webhook to work with proxy (#27655) (#27675)Giteabot2023-10-181-3/+15
| | | | | | | | | | | | | | | | | | | | | Backport #27655 by @wolfogre When `webhook.PROXY_URL` has been set, the old code will check if the proxy host is in `ALLOWED_HOST_LIST` or reject requests through the proxy. It requires users to add the proxy host to `ALLOWED_HOST_LIST`. However, it actually allows all requests to any port on the host, when the proxy host is probably an internal address. But things may be even worse. `ALLOWED_HOST_LIST` doesn't really work when requests are sent to the allowed proxy, and the proxy could forward them to any hosts. This PR fixes it by: - If the proxy has been set, always allow connectioins to the host and port. - Check `ALLOWED_HOST_LIST` before forwarding. Co-authored-by: Jason Song <i@wolfogre.com>
* Improve retrying index issues (#27554) (#27634)Giteabot2023-10-162-30/+41
| | | | | | | Backport #27554 by @wolfogre Fix #27540 Co-authored-by: Jason Song <i@wolfogre.com>
* Increase queue length (#27555) (#27562)Giteabot2023-10-102-2/+2
| | | | | | | | | | | | | | | Backport #27555 by @wolfogre It should be OK to increase the default queue length since the default type is "level". IMO, the old default length (100) is a little too small. See https://github.com/go-gitea/gitea/issues/27540#issuecomment-1754269491 IIRC, a larger length could lead to more memory usage only when the type is "channel," but it's an obscure case. Otherwise, it's just a limit (for "level" or "redis"). Co-authored-by: Jason Song <i@wolfogre.com>
* Fix `environment-to-ini` inherited key bug (#27543) (#27546)Giteabot2023-10-092-1/+28
| | | | | | | | | | | Backport #27543 by @wxiaoguang Fix #27541 The INI package has a quirk: by default, the keys are inherited. When maintaining the keys, the newly added sub key should not be affected by the parent key. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Restore warning commit status (#27504) (#27529)Giteabot2023-10-091-3/+11
| | | | | | | | | | | | | Backport #27504 by @silverwind Partial revert of https://github.com/go-gitea/gitea/pull/25839. This commit status is used by a number of external integrations, so I think we should not remove it (See https://github.com/go-gitea/gitea/pull/25839#issuecomment-1729002077). This is a rare case where an existing migration needed to be alterted to avoid data loss. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de>
* Refactor system setting (#27000) (#27452)Giteabot2023-10-054-8/+186
| | | | | | | | | | | | | | | | 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>
* Add support for HEAD ref in /src/branch and /src/commit routes (#27384) (#27407)Giteabot2023-10-031-0/+20
| | | | | | | | | | | | | Backport #27384 by @rbhz Add support for HEAD in paths: ``` /src/branch/HEAD/README.md /src/commit/HEAD/README.md ``` Closes #26920 Co-authored-by: Kirill Sorokin <48334247+rbhz@users.noreply.github.com>
* Make Actions tasks/jobs timeouts configurable by the user (#27400) (#27402)Giteabot2023-10-031-0/+8
| | | | | | | | | | | | | | | | | | | | | Backport #27400 by @fantognazza With this PR we added the possibility to configure the Actions timeouts values for killing tasks/jobs. Particularly this enhancement is closely related to the `act_runner` configuration reported below: ``` # The timeout for a job to be finished. # Please note that the Gitea instance also has a timeout (3h by default) for the job. # So the job could be stopped by the Gitea instance if it's timeout is shorter than this. timeout: 3h ``` --- Setting the corresponding key in the INI configuration file, it is possible to let jobs run for more than 3 hours. Signed-off-by: Francesco Antognazza <francesco.antognazza@gmail.com>
* Fix git 2.11 error when checking IsEmpty (#27393) (#27397)Giteabot2023-10-021-1/+2
| | | | | | | | | Backport #27393 by @wxiaoguang Fix #27389 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* More `db.DefaultContext` refactor (#27265) (#27347)Giteabot2023-09-293-7/+7
| | | | | | | | | | | 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>
* fix orphan check for deleted branch (#27310) (#27321)Giteabot2023-09-281-3/+3
| | | | | | | | | | | | | Backport #27310 by @earl-warren - Modify the deleted branch orphan check to check for the new table instead. - Regression from 6e19484f4d3bf372212f2da462110a1a8c10cbf2 - Resolves https://codeberg.org/forgejo/forgejo/issues/1522 (cherry picked from commit c1d888686fe445e4edecb9d835c5b3893b574b75) Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* Another round of `db.DefaultContext` refactor (#27103) (#27262)Giteabot2023-09-256-16/+17
| | | | | | | | Backport #27103 by @JakobDev Part of #27065 Co-authored-by: JakobDev <jakobdev@gmx.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix PushEvent NullPointerException jenkinsci/github-plugin (#27203) (#27251)Giteabot2023-09-251-0/+1
| | | | | | | Backport #27203 by @Nabapadma-sarker Fixes #27202 Co-authored-by: Nabapadma-sarker <nabapadmacse1991@gmail.com>
* Quote table `release` in sql queries (#27205) (#27218)Giteabot2023-09-231-1/+1
| | | | | | | | | | | | | | Backport #27205 by @KN4CK3R Fixes #27174 `release` is a reserved keyword in MySql. I can't reproduce the issue on my setup and we have a test for that code but it seems there can be setups where it fails. https://github.com/go-gitea/gitea/blob/a101dbaa7952e359843c6d8303ca24a0e63c865c/tests/integration/repo_activity_test.go#L45-L46 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix review request number and add more tests (#27104) (#27168)Giteabot2023-09-211-6/+21
| | | | | | | | | | | | | | | | | | | | | Backport #27104 by @lng2020 fix #27019 ## testfixture yml 1. add issue20(a pr issue) in repo 23, org 17 2. add user15 to team 9 3. add four reviews about issue20 ## test case add two tests that are described with code comments the code before pr #26784 failed the first test <img width="479" alt="image" src="https://github.com/go-gitea/gitea/assets/70063547/1d9b5787-11b4-4c4d-931f-6a9869547f35"> current code failed the second test(as mentioned in #27019) <img width="484" alt="image" src="https://github.com/go-gitea/gitea/assets/70063547/05608055-7587-43d1-bae1-92c688270819"> Any advice is appreciated. Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>