aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Use maintained gziphandler (#30592) (#30637)Lunny Xiao2024-04-231-7/+13
| | | | | | | Replace #27894 Backport #30592 Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Avoid importing `modules/web/middleware` in `modules/session` (#30584) (#30589)Giteabot2024-04-192-10/+18
| | | | | | | | | | | | | | | Backport #30584 by @wolfogre Related to #30375. It doesn't make sense to import `modules/web/middleware` and `modules/setting` in `modules/web/session` since the last one is more low-level. And it looks like a workaround to call `DeleteLegacySiteCookie` in `RegenerateSession`, so maybe we could reverse the importing by registering hook functions. Co-authored-by: Jason Song <i@wolfogre.com>
* fix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30469)Giteabot2024-04-142-5/+34
| | | | | | | | | | | Backport #30375 by @jtran Cookies may exist on "/subpath" and "/subpath/" for some legacy reasons (eg: changed CookiePath behavior in code). The legacy cookie should be removed correctly. Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Avoid losing token when updating mirror settings (#30429) (#30464)Giteabot2024-04-141-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #30429 by @wolfogre Fix #30416. Before (it shows as "Unset" while there's a token): <img width="980" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a"> After: <img width="977" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5"> The username shows as "oauth2" because of https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99 I have checked that all usage of `MirrorRemoteAddress` has been updated. <img width="1806" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d"> However, it needs to be checked again when backporting. Co-authored-by: Jason Song <i@wolfogre.com>
* Fix label rendering (#30456) (#30460)Giteabot2024-04-132-12/+35
| | | | | | | | | | Backport #30456 by wxiaoguang 1. Check whether the label is for an issue or a pull request. 2. Don't use space to layout 3. Make sure the test strings have trailing spaces explicitly, to avoid some IDE removing the trailing spaces automatically. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Limit the max line length when parsing git grep output (#30418) (#30427)Giteabot2024-04-122-4/+26
| | | | | Backport #30418 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix and rewrite contrast color calculation, fix project-related bugs (#30326)silverwind2024-04-094-60/+45
| | | | | | | Backport https://github.com/go-gitea/gitea/pull/30237 to 1.22. Also includes https://github.com/go-gitea/gitea/pull/30183. Both were clean cherry-picks. Co-authored-by: Giteabot <teabot@gitea.io>
* Performance optimization for git push (#30104) (#30348)Giteabot2024-04-091-10/+15
| | | | | | | | | Backport #30104 by @lunny 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`. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix oauth2 builtin application logic (#30304) (#30327)Giteabot2024-04-082-0/+22
| | | | | | | | | | Backport #30304 by wxiaoguang Fix #29074 (allow to disable all builtin apps) and don't make the doctor command remove the builtin apps. By the way, rename refobject and joincond to camel case. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Some NuGet package enhancements (#30280) (#30324)Giteabot2024-04-072-27/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #30280 by @KN4CK3R Fixes #30265 1. Read second type of dependencies 2. Render `Description` and `ReleaseNotes` old: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/abac057c-11cd-4d25-b196-01ff899d948e) new: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/35302273-740c-481a-a031-1f80d2d7d336) The NuGet spec does not specify what kind of text can be stored in the description but we can best guess markdown. The official NuGet registry just [converts the newlines to html lines](https://www.nuget.org/packages/rb.Firefox#readme-body-tab). 3. Extract and render the readme. This is the new and better place to store larger text than in the description. The content is markdown. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/f442264e-3735-4b55-92c4-3b89a8ebafb0) Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Benjamin Heemann <benjamin.heemann@raith.de>
* Clean up log messages (#30313) (#30318)Giteabot2024-04-071-1/+1
| | | | | | | | Backport #30313 by wxiaoguang `log.Xxx("%v")` is not ideal, this PR adds necessary context messages. Remove some unnecessary logs. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor startup deprecation messages (#30305) (#30312)Giteabot2024-04-078-15/+17
| | | | | | | | | | | Backport #30305 by wxiaoguang 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 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix code block style for code preview (#30298) (#30306)Giteabot2024-04-061-1/+1
| | | | | | | | | Backport #30298 by wxiaoguang Fix #30292 To avoid unnecessary style overriding, use "div" instead of "code" Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Close file in the Upload func (#30262) (#30270)Giteabot2024-04-031-2/+2
| | | Co-authored-by: guangwu <guoguangwu@magic-shield.com>
* Fixes #27605: inline math blocks can't be preceeded/followed by ↵Giteabot2024-04-032-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alphanumerical characters (#30175) (#30251) Backport #30175 by @jmlt2002 - Inline math blocks couldn't be preceeded or succeeded by alphanumerical characters due to changes introduced in PR #21171. Removed the condition that caused this (precedingCharacter condition) and added a new exit condition of the for-loop that checks if a specific '$' was escaped using '\' so that the math expression can be rendered as intended. - Additionally this PR fixes another bug where math blocks of the type '$xyz$abc$' where the dollar sign was not escaped by the user, generated an error (shown in the screenshots below) - Altered the tests to accomodate for the changes Former behaviour (from try.gitea.io): ![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235) Fixed behaviour (from my local build): ![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d) (Edit) Source code for the README.md file: ``` $x$ -$x$ $x$- a$xa$ $xa$a 1$xb$ $xb$1 $a a$b b$ a$b $a a$b b$ $a a\$b b$ ``` Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt> Co-authored-by: João Tiago <114936010+jmlt2002@users.noreply.github.com>
* Refactor "dump" sub-command (#30240) (#30260)Giteabot2024-04-035-1/+306
| | | | | | | | | | | | Backport #30240 by wxiaoguang Major changes: * Move some functions like "addReader" / "isSubDir" / "addRecursiveExclude" to a separate package, and add tests * Clarify the filename&dump type logic and add tests * Clarify the logger behavior and remove FIXME comments Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Render embedded code preview by permlink in markdown (#30234) (#30249)Giteabot2024-04-039-15/+174
| | | | | | | | Backport #30234 by wxiaoguang The permlink in markdown will be rendered as a code preview block, like GitHub Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Fix markdown color code detection (#30208) (#30211)Giteabot2024-03-312-3/+26
| | | | | | | | | Backport #30208 by wxiaoguang When reviewing PRs, some color names might be mentioned, the `transformCodeSpan` (which calls `css.ColorHandler`) considered it as a valid color, but actually it shouldn't be rendered as a color codespan. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Do not allow different storage configurations to point to the same directory ↵Giteabot2024-03-317-15/+13
| | | | | | | | | (#30169) (#30204) Backport #30169 by wxiaoguang Replace #29171 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Include encoding in signature payload (#30174) (#30182)Giteabot2024-03-303-0/+75
| | | | | | | | | | | | | | | | | Backport #30174 by @KN4CK3R Fixes #30119 Include the encoding in the signature payload. before ![grafik](https://github.com/go-gitea/gitea/assets/1666336/01ab94a3-8af5-4d6f-be73-a10b65a15421) after ![grafik](https://github.com/go-gitea/gitea/assets/1666336/3a37d438-c70d-4d69-b178-d170e74aa683) Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Render code tags in commit messages (#30146)silverwind2024-03-281-2/+2
| | | | | | | | | | | | | | | | | | Extend https://github.com/go-gitea/gitea/pull/21432 to commit messages. Color is changed because the markup code block bg does not offer enough contrast on varying backgrounds. <img width="568" alt="Screenshot 2024-03-27 at 19 52 55" src="https://github.com/go-gitea/gitea/assets/115237/ddc9307e-f32f-4e97-8b88-91f88ced2a36"> <img width="573" alt="Screenshot 2024-03-27 at 19 53 33" src="https://github.com/go-gitea/gitea/assets/115237/14b30fd2-bf28-46b8-9e82-eb60a28f6bf2"> <img width="422" alt="Screenshot 2024-03-27 at 19 53 01" src="https://github.com/go-gitea/gitea/assets/115237/a12136b5-c02b-460c-9830-f830542987ae"> <img width="397" alt="Screenshot 2024-03-27 at 19 53 27" src="https://github.com/go-gitea/gitea/assets/115237/c9f05d81-c73e-468e-98e9-e5929bc0da3e"> <img width="333" alt="Screenshot 2024-03-27 at 19 53 07" src="https://github.com/go-gitea/gitea/assets/115237/06b5a9f9-f95d-46b6-8c57-df0b02555652"> <img width="279" alt="Screenshot 2024-03-27 at 19 53 21" src="https://github.com/go-gitea/gitea/assets/115237/b06a0afc-ddd8-48ae-b557-a6dc47802e68">
* Remember login for a month by default (#30150)delvh2024-03-281-1/+1
| | | | | | | | | | | | | | | Previously, the default was a week. As most instances don't set the setting, this leads to a bad user experience by default. ## :warning: Breaking If your instance requires a high level of security, you may want to set `[security].LOGIN_REMEMBER_DAYS` so that logins are not valid as long. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Refactor markdown render (#30139)wxiaoguang2024-03-288-257/+364
| | | | Only split the file into small ones (and rename AttentionTypes to attentionTypes)
* Fix bug for markdown rendering of blockquote (#30130)Lunny Xiao2024-03-271-4/+10
| | | | | | | Caused by #29984 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix git grep search limit, add test (#30071)wxiaoguang2024-03-252-1/+17
| | | Fix #30069
* Use db.ListOptions directly instead of Paginator interface to make it easier ↵Lunny Xiao2024-03-246-16/+39
| | | | | | | | | | | | | to use and fix performance of /pulls and /issues (#29990) This PR uses `db.ListOptions` instead of `Paginor` to make the code simpler. And it also fixed the performance problem when viewing /pulls or /issues. Before the counting in fact will also do the search. --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: silverwind <me@silverwind.io>
* Support repo code search without setting up an indexer (#29998)wxiaoguang2024-03-245-24/+177
| | | | | | | | | | | | | | | | | By using git's ability, end users (especially small instance users) do not need to enable the indexer, they could also benefit from the code searching feature. Fix #29996 ![image](https://github.com/go-gitea/gitea/assets/2114189/11b7e458-88a4-480d-b4d7-72ee59406dd1) ![image](https://github.com/go-gitea/gitea/assets/2114189/0fe777d5-c95c-4288-a818-0427680805b6) --------- Co-authored-by: silverwind <me@silverwind.io>
* Determine fuzziness of bleve indexer by keyword length (#29706)65432024-03-233-28/+22
| | | also bleve did match on fuzzy search and the other way around. this also fix that bug.
* Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995)Lunny Xiao2024-03-222-35/+17
|
* Refactor markdown attention render (#29984)wxiaoguang2024-03-225-65/+145
| | | Follow #29833 and add tests
* Fix some pending problems (#29985)wxiaoguang2024-03-224-10/+8
| | | | | | | | | | | | | | | | | These changes are quite independent and trivial, so I don't want to open too many PRs. * https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091 * the `f.Close` should be called properly * the error message could be more meaningful (https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935) * https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716 * the new translation strings don't take arguments * https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807 * stale for long time * #28140 * a form was forgotten to be changed to work with backend code
* Refactor external URL detection (#29973)wxiaoguang2024-03-222-3/+10
| | | | Follow #29960, `IsExternalURL` is not needed anymore. Add some tests for `RedirectToCurrentSite`
* Refactor StringsToInt64s (#29967)wxiaoguang2024-03-212-8/+12
| | | And close #27176
* Performance improvements for pull request list page (#29900)Lunny Xiao2024-03-211-1/+10
| | | | | | | | | | | This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor URL detection (#29960)wxiaoguang2024-03-212-29/+82
| | | "Redirect" functions should only redirect if the target is for current Gitea site.
* Fix loadOneBranch panic (#29938)wxiaoguang2024-03-201-1/+1
| | | | | | Try to fix #29936 Far from ideal, but still better than panic.
* Show Actions post step when it's running (#29926)Jason Song2024-03-202-2/+46
| | | | | | | | | | | | | | The post step was always waiting, even if all steps were done. Then, once the task was done, the post step became success immediately. Before: <img width="915" alt="xnip_240320_120228" src="https://github.com/go-gitea/gitea/assets/9418365/00347430-f998-4c43-917a-bf6dd6d0e333"> After: <img width="905" alt="xnip_240320_120443" src="https://github.com/go-gitea/gitea/assets/9418365/a419b111-17c2-4029-a022-c761cc419091">
* Fix missing error check of bufio.Scanner (#29882)coldWater2024-03-193-0/+14
| | | maybe more
* Remove unused error in graceful manager (#29871)Nanguan Lin2024-03-182-12/+4
| | | As title.
* Meilisearch double quote on "match" query (#29740)65432024-03-162-70/+37
| | | | | make `nonFuzzyWorkaround` unessesary cc @Kerollmops
* Refactor markdown attention render (#29833)wxiaoguang2024-03-163-32/+12
| | | | | | | * Remove some deadcode * Use 2-word name for CSS class names * Remove "gt-*" rules for sanitizer The UI doesn't change much.
* Refactor code_indexer to use an SearchOptions struct for PerformSearch (#29724)65432024-03-166-35/+53
| | | | | | | | similar to how it's already done for the issue_indexer --- *Sponsored by Kithara Software GmbH*
* Remove the `time-since` class (#29826)Yarden Shoham2024-03-152-2/+4
| | | | | | | | It serves no purpose. --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor graceful manager, fix misused WaitGroup (#29738)coldWater2024-03-154-51/+55
| | | Follow #29629
* Add `<overflow-menu>`, rename webcomponents (#29400)silverwind2024-03-152-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Add `<overflow-menu>` web component 2. Rename `<gitea-origin-url>` to `<origin-url>` and make filenames match. <img width="439" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/2fbe4ca4-110b-4ad2-8e17-c1e116ccbd74"> <img width="444" alt="Screenshot 2024-03-02 at 21 36 52" src="https://github.com/go-gitea/gitea/assets/115237/aa8f786e-dc8c-4030-b12d-7cfb74bdfd6e"> <img width="537" alt="Screenshot 2024-03-03 at 03 05 06" src="https://github.com/go-gitea/gitea/assets/115237/fddd50aa-adf1-4b4b-bd7f-caf30c7b2245"> ![image](https://github.com/go-gitea/gitea/assets/115237/0f43770c-834c-4a05-8e3d-d30eb8653786) ![image](https://github.com/go-gitea/gitea/assets/115237/4b4c6bd7-843f-4f49-808f-6b3aed5e9f9a) TODO: - [x] Check if removal of `requestAnimationFrame` is possible to avoid flash of content. Likely needs a `MutationObserver`. - [x] Hide tippy when button is removed from DOM. - [x] ~~Implement right-aligned items (https://github.com/go-gitea/gitea/pull/28976)~~. Not going to do it. - [x] Clean up CSS so base element has no background and add background via tailwind instead. - [x] Use it for org and user page. --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788)Jason Song2024-03-141-0/+3
| | | | | | | | | | | | It is convenient to skip by setting environment, since it's OK to use root user in job containers. It's not a bug, but I want to backport it to v1.21 since it doesn't break anything. --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix lint-swagger warning (#29787)sillyguodong2024-03-141-7/+0
| | | | | | | | | | | Caused by: #23106 Fix: https://github.com/go-gitea/gitea/actions/runs/8274650046/job/22640335697 1. Delete `UserBadgeList` in `options.go`, because it wasn't used. (The struct defined in `options.go` is the struct used to parse the request body) 2. Move `BadgeList` struct under `routers/api/v1/swagger` folder which response should be defined in.
* Refactor markup/csv: don't read all to memory (#29760)coldWater2024-03-142-12/+55
|
* Add test for webhook (#29755)wxiaoguang2024-03-141-0/+9
| | | Follow #29690
* Improve QueryEscape helper function (#29768)wxiaoguang2024-03-131-1/+5
| | | | Make it return "template.URL" to follow Golang template's context auto-escaping.