aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't remove all mirror repository's releases when mirroring (#28817) (#28939)Giteabot2024-01-312-6/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #28817 by @lunny Fix #22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of #19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Preserve BOM in web editor (#28935) (#28959)Giteabot2024-01-274-122/+58
| | | | | | | | | | | | | | | | | | | | | | | Backport #28935 by @silverwind The `ToUTF8*` functions were stripping BOM, while BOM is actually valid in UTF8, so the stripping must be optional depending on use case. This does: - Add a options struct to all `ToUTF8*` functions, that by default will strip BOM to preserve existing behaviour - Remove `ToUTF8` function, it was dead code - Rename `ToUTF8WithErr` to `ToUTF8` - Preserve BOM in Monaco Editor - Remove a unnecessary newline in the textarea value. Browsers did ignore it, it seems but it's better not to rely on this behaviour. Fixes: https://github.com/go-gitea/gitea/issues/28743 Related: https://github.com/go-gitea/gitea/issues/6716 which seems to have once introduced a mechanism that strips and re-adds the BOM, but from what I can tell, this mechanism was removed at some point after that PR. Co-authored-by: silverwind <me@silverwind.io>
* Strip `/` from relative links (#28932) (#28952)Giteabot2024-01-272-4/+32
| | | | | | | | | | | Backport #28932 by @KN4CK3R Fixes #28915 Restores the old behaviour: https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Update go dependencies and fix go-git (#28893) (#28934)65432024-01-262-2/+11
| | | Backport #28893
* Respect branch info for relative links (#28909) (#28922)Giteabot2024-01-252-2/+4
| | | | | | | Backport #28909 by @KN4CK3R Fix #28904 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix sort bug on repository issues list (#28897) (#28901)Giteabot2024-01-231-2/+2
| | | | | | | Backport #28897 by @lunny Fix #28896 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Prevent anonymous container access if `RequireSignInView` is enabled ↵Giteabot2024-01-221-1/+1
| | | | | | | | | | | (#28877) (#28882) Backport #28877 by @KN4CK3R Fixes #28875 If `RequireSignInView` is enabled, the ghost user has no access rights. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix incorrect PostgreSQL connection string for Unix sockets (#28865) (#28870)Giteabot2024-01-212-2/+10
| | | | | | | Backport #28865 by @sdvcrx Fix #28864 Co-authored-by: sdvcrx <memory.silentvoyage@gmail.com>
* Warn that `DISABLE_QUERY_AUTH_TOKEN` is false only if it's explicitly ↵Giteabot2024-01-211-1/+4
| | | | | | | | | | | | | defined (#28783) (#28868) Backport #28783 by @yardenshoham So we don't warn on default behavior - Fixes https://github.com/go-gitea/gitea/issues/28758 - Follows https://github.com/go-gitea/gitea/pull/28390 Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Fix archive creating LFS hooks and breaking pull requests (#28848) (#28851)Giteabot2024-01-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport #28848 by @brechtvl When LFS hooks are present in gitea-repositories, operations like git push for creating a pull request fail. These repositories are not meant to include LFS files or git push them, that is handled separately. And so they should not have LFS hooks. Installing git-lfs on some systems (like Debian Linux) will automatically set up /etc/gitconfig to create LFS hooks in repositories. For most git commands in Gitea this is not a problem, either because they run on a temporary clone or the git command does not create LFS hooks. But one case where this happens is git archive for creating repository archives. To fix that, add a GIT_CONFIG_NOSYSTEM=1 to disable using the system configuration for that command. According to a comment, GIT_CONFIG_NOSYSTEM is not used for all git commands because the system configuration can be intentionally set up for Gitea to use. Resolves #19810, #21148 Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Remove duplicated checkinit on git module (#28824) (#28831)Giteabot2024-01-171-4/+0
| | | | | | | | Backport #28824 by @lunny `checkInit` has been invoked in `InitSimple`. So it's unnecessary to invoke it twice in `InitFull`. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use refname:strip-2 instead of refname:short when syncing tags (#28797) (#28811)Giteabot2024-01-163-13/+15
| | | | | | | | | | | | | Backport #28797 by @lunny Fix #28694 Generally, `refname:short` should be equal to `refname:lstrip=2` except `core.warnAmbiguousRefs is used to select the strict abbreviation mode.` ref: https://git-scm.com/docs/git-for-each-ref#Documentation/git-for-each-ref.txt-refname Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Rework markup link rendering (#26745) (#28803)KN4CK3R2024-01-1613-244/+750
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #26745 Fixes #26548 This PR refactors the rendering of markup links. The old code uses `strings.Replace` to change some urls while the new code uses more context to decide which link should be generated. The added tests should ensure the same output for the old and new behaviour (besides the bug). We may need to refactor the rendering a bit more to make it clear how the different helper methods render the input string. There are lots of options (resolve links / images / mentions / git hashes / emojis / ...) but you don't really know what helper uses which options. For example, we currently support images in the user description which should not be allowed I think: <details> <summary>Profile</summary> https://try.gitea.io/KN4CK3R ![grafik](https://github.com/go-gitea/gitea/assets/1666336/109ae422-496d-4200-b52e-b3a528f553e5) </details>
* Use correct `has error` check for internal responses (#28796) (#28798)Giteabot2024-01-154-3/+4
| | | | | | | | Backport #28796 by @wxiaoguang `resp != nil` doesn't mean the request really succeeded. Add a comment for requestJSONResp to clarify the behavior. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix nil pointer panic when exec some gitea cli command (#28791) (#28795)Giteabot2024-01-153-0/+9
| | | | | | | | | | | | | Backport #28791 by @yp05327 panic: ![image](https://github.com/go-gitea/gitea/assets/18380374/7fcde2ad-1d42-4b60-b120-3b60a8926e8e) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/49d9f0ca-e590-4a35-8ca2-1317d1b7c939) Co-authored-by: yp05327 <576951401@qq.com>
* 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>