Commit Graph
100 Commits
Author SHA1 Message Date
wxiaoguang a920fcfd91 Fix db engine (#32351)
Fix #32349
2024-10-27 18:48:07 -04:00
wxiaoguang d70af38447 Refactor the DB migration system slightly (#32344)
Introduce "idNumber" for each migration, and clarify the difference
between the migration ID number and database version.
2024-10-27 19:54:35 +08:00
wxiaoguang 0196b3583a Warn users when they try to use a non-root-url to sign in/up (#32272) 2024-10-17 10:28:51 +08:00
wxiaoguang 5242e520c4 Make owner/repo/pulls handlers use "PR reader" permission (#32254)
Fix #32253 (partially)
2024-10-15 06:47:07 +00:00
wxiaoguang afa8dd45af Make git push options accept short name (#32245)
Just like what most CLI parsers do: `--opt` means `opt=true`

Then users could use `-o force-push` as `-o force-push=true`
2024-10-12 05:42:10 +00:00
wxiaoguang 6029d78ab5 Improve the maintainblity of the reserved username list (#32229) 2024-10-10 09:04:42 +00:00
wxiaoguang dd83cfcacc Refactor CSRF token (#32216) 2024-10-10 03:48:21 +00:00
wxiaoguang 3b10fd9b34 Only use Host header from reverse proxy (#32060)
X-Forwarded-Host has many problems: non-standard, not well-defined
(X-Forwarded-Port or not), conflicts with Host header, it already caused
problems like #31907. So do not use X-Forwarded-Host, just use Host
header directly.

Official document also only uses `Host` header and never mentioned
others.
2024-09-20 14:57:55 +00:00
wxiaoguang 1fede04b83 Refactor CSRF protector (#32057)
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")
2024-09-18 15:17:25 +08:00
wxiaoguang e3678356e1 Fix createElementFromAttrs bug (#31751)
The "false" value was not handled correctly, it would cause bugs in the
future (fortunately, this behavior is not used in code yet).
2024-08-01 19:06:03 +00:00
wxiaoguang 169031b7cf Fix "Filter by commit" Dropdown (#31695)
Regression of #31281
Fix #31673
2024-07-25 01:48:51 +00:00
wxiaoguang 72b6bc8caf Refactor webhook (#31587)
A more complete fix for #31588

1. Make "generic" code more readable
2. Clarify HTML or Markdown for the payload content
2024-07-10 11:37:16 +00:00
wxiaoguangandsilverwind c1fe6fbcc3 Make toast support preventDuplicates (#31501)
make preventDuplicates default to true, users get a clear UI feedback
and know that "a new message appears".

Fixes: https://github.com/go-gitea/gitea/issues/26651

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-06-27 13:58:38 +00:00
wxiaoguang 00fc29aee1 Refactor issue label selection (#31497)
Follow #26460
2024-06-26 23:41:59 +00:00
wxiaoguang a88f718c10 Refactor dropzone (#31482)
Refactor the legacy code and remove some jQuery calls.
2024-06-27 01:01:20 +08:00
wxiaoguang f4921b9daa Simplify 404/500 page (#31409) 2024-06-23 17:45:21 +00:00
wxiaoguang bda875b6e6 Switch to "Write" tab when edit comment again (#31445)
Fix #19031
2024-06-22 09:25:04 +00:00
wxiaoguang 1d76e9aabf Add simple JS init performance trace (#31459)
Related to #23461, and help some cases like #31412

For developers, they could use browser's Performance tool to collect
performance data, while this PR is also quite handy to optimize the
`index.js`.

For end users, this PR is simple enough and could figure out the slow
function quickly.


![image](https://github.com/go-gitea/gitea/assets/2114189/a557b08e-6594-474b-81a3-03d5ac2bd68e)
2024-06-22 17:20:20 +08:00
wxiaoguang 1a811c0bd1 Refactor image diff (#31444)
And remove some jQuery functions
2024-06-22 04:52:09 +00:00
wxiaoguang 621e1ff9c9 Improve markdown textarea for indentation and lists (#31406)
Almost works like GitHub

* use Tab/Shift-Tab to indent/unindent the selected lines
* use Enter to insert a new line with the same indentation and prefix
2024-06-21 08:14:40 +00:00
wxiaoguang 06782872c4 Split common-global.js into separate files (#31438)
To improve maintainability
2024-06-21 15:40:33 +08:00
wxiaoguang ed5ded3ff8 Fix the link for .git-blame-ignore-revs bypass (#31432)
A quick fix for #31429
2024-06-20 23:28:34 +00:00
wxiaoguang 43c7a2e7b1 Refactor names (#31405)
This PR only does "renaming":

* `Route` should be `Router` (and chi router is also called "router")
* `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`)
* Use lower case for private functions to avoid exposing or abusing
2024-06-19 06:32:45 +08:00
wxiaoguang 21783a5752 Fix rendered wiki page link (#31398)
Fix #31395
2024-06-18 03:09:20 +00:00
wxiaoguangandsilverwind 37a4b233a0 Refactor repo unit "disabled" check (#31389)
1. There are already global "unit consts", no need to use context data, which is fragile
2. Remove the "String()" method from "unit", it would only cause rendering problems in templates

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-06-18 00:51:13 +00:00
wxiaoguang d32648b204 Refactor route path normalization (#31381)
Refactor route path normalization and decouple it from the chi router.
Fix the TODO, fix the legacy strange path behavior.
2024-06-17 23:28:47 +00:00
wxiaoguang 5a7376c060 Refactor markup code (#31399)
1. use clearer names
2. remove deadcode
3. avoid name shadowing
4. eliminate some lint warnings
2024-06-17 22:56:45 +00:00
wxiaoguang 0f09c22663 Improve rubygems package registry (#31357)
To make it work with Bundler:
https://guides.rubygems.org/rubygems-org-compact-index-api/

It only adds 2 new API endpoints and improves some tests, existing logic
is not changed.
2024-06-17 08:42:46 +00:00
wxiaoguang 25f3ec5b65 Fix natural sort (#31384)
Fix #31374
2024-06-17 06:45:12 +00:00
wxiaoguang f5dfd7d73c Add a simple test for AdoptRepository (#31391)
Follow #31333
2024-06-17 01:18:35 +00:00
wxiaoguang f446e3b4ab Fix JS error when creating new issue (#31383)
Fix #31336
2024-06-16 02:07:21 +00:00
wxiaoguangandtdsds.com 84cbb6c4d2 Fix duplicate sub-path for avatars (#31365)
Fix #31361, and add tests

And this PR introduces an undocumented & debug-purpose-only config
option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps
the development of sub-path related problems.

And also fix #31366

Co-authored-by: @ExplodingDragon
2024-06-15 11:43:57 +08:00
wxiaoguangandsilverwind 47ca61d8ba Improve detecting empty files (#31332)
Co-authored-by: silverwind <me@silverwind.io>
2024-06-13 01:06:46 +00:00
wxiaoguang 4bf848a06b Make template Iif exactly match if (#31322) 2024-06-11 14:52:12 +00:00
wxiaoguang 5342a61124 Delete legacy cookie before setting new cookie (#31306)
Try to fix #31202
2024-06-11 11:31:23 +08:00
wxiaoguang 6106a61eff Remove sub-path from container registry realm (#31293)
Container registry requires that the "/v2" must be in the root, so the
sub-path in AppURL should be removed
2024-06-09 16:29:29 +08:00
wxiaoguang 0188d82e49 Fix some URLs whose sub-path is missing (#31289)
Fix #31285
2024-06-07 15:15:17 +00:00
wxiaoguang e728fd741b Fix Activity Page Contributors dropdown (#31264)
Fix #31261
2024-06-06 10:28:33 +08:00
wxiaoguang bd80225ec3 Make blockquote attention recognize more syntaxes (#31240)
Fix #31214
2024-06-04 15:35:29 +00:00
wxiaoguang fcc061ae44 Fix admin oauth2 custom URL settings (#31246)
Fix #31244
2024-06-04 23:06:21 +08:00
wxiaoguangandLunny Xiao 9000811118 Make pasted "img" tag has the same behavior as markdown image (#31235)
Fix #31230

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-06-04 12:19:41 +00:00
wxiaoguang a4275951ba Split sanitizer functions and fine-tune some tests (#31192) 2024-05-31 13:26:01 +00:00
wxiaoguang d612a24e3e Ignore FindRecentlyPushedNewBranches err (#31164)
Fix #31163
2024-05-30 02:24:22 +00:00
wxiaoguang 34daee6baf Fix markup preview (#31158)
Fix #31157

After:

![image](https://github.com/go-gitea/gitea/assets/2114189/4d918cce-cd0d-4601-9c81-4b32df1b0b38)
2024-05-29 16:28:55 +00:00
wxiaoguang 8fc2ec1872 Update pip related commands for docker (#31106)
Thanks to graelo and silverwind for figuring out the problem.

Fix #31101
2024-05-27 13:53:33 +00:00
wxiaoguang 20c40259f1 Fix missing memcache import (#31105)
Fix #31102
2024-05-27 13:43:32 +00:00
wxiaoguang fb1ad920b7 Refactor sha1 and time-limited code (#31023)
Remove "EncodeSha1", it shouldn't be used as a general purpose hasher
(just like we have removed "EncodeMD5" in #28622)

Rewrite the "time-limited code" related code and write better tests, the
old code doesn't seem quite right.
2024-05-20 15:12:50 +00:00
wxiaoguang de9bcd1d23 Avoid 500 panic error when uploading invalid maven package file (#31014)
PackageDescriptor.Metadata might be nil (and maybe not only for maven).
This is only a quick fix.

The new `if` block is written intentionally to avoid unnecessary
indenting to the existing code.
2024-05-20 06:44:16 +00:00
wxiaoguangandGiteabot f48cc501c4 Fix incorrect "blob excerpt" link when comparing files (#31013)
When comparing files between the base repo and forked repo, the "blob
excerpt" link should point to the forked repo, because the commit
doesn't exist in base repo.

Co-authored-by: Giteabot <teabot@gitea.io>
2024-05-20 05:57:57 +00:00
wxiaoguang b6574099ed Fix project column title overflow (#31011)
By the way:
* Re-format the "color.go" to Golang code style
* Remove unused `overflow-y: scroll;` from `.project-column` because
there is `overflow: visible`
2024-05-20 05:21:01 +00:00
wxiaoguang 47accfebbd Fix data-race during testing (#30999)
Fix #30992
2024-05-20 04:35:38 +00:00
wxiaoguang edbf74c418 Fix "force private" logic (#31012)
When creating a repo, the "FORCE_PRIVATE" config option should be
respected, `readonly` doesn't work for checkbox, so it should use
`disabled` attribute.
2024-05-20 00:56:45 +00:00
wxiaoguangandKN4CK3R 339bc8bc8f Improve reverse proxy documents and clarify the AppURL guessing behavior (#31003)
Fix #31002

1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea
2. Clarify the basic requirements and move the "general configuration" to the top
3. Add a comment for the "container registry"
4. Use 1.21 behavior if the reverse proxy is not correctly configured

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-05-19 14:56:08 +00:00
wxiaoguang 821d2fc2a3 Simplify mirror repository API logic (#30963)
Fix #30921
2024-05-17 16:07:41 +00:00
wxiaoguang 740b6e1389 Fix JS error when editing a merged PR's title (#30990) 2024-05-16 13:04:25 +00:00
wxiaoguang effb405cae Always load or generate oauth2 jwt secret (#30942)
Fix #30923
2024-05-14 14:21:38 +00:00
wxiaoguang f4f4e18b14 Filter out duplicate action(activity) items for a repository (#30957)
Fix #20986
2024-05-14 13:47:03 +00:00
wxiaoguangandsilverwind 080486e47d Fix some UI regressions for commit list (#30920)
Close #30919

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-05-10 12:58:05 +00:00
7424f27cf3 Check if reverse proxy is correctly configured (#30890)
Follow #27011
Follow #30885

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-05-10 20:07:01 +08:00
wxiaoguang ed0fc2729e Add missing menu active item background back (#30897)
Fix #30578
2024-05-08 23:01:25 +00:00
wxiaoguang 3fdb2d4ad8 Fix incorrect issue form (#30881)
Fix #30864
2024-05-08 15:39:13 +00:00
wxiaoguangandKN4CK3R 67c1a07285 Refactor AppURL usage (#30885)
Fix #30883
Fix #29591

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-05-07 08:26:13 +00:00
wxiaoguang 9c08637eae Make "sync branch" also sync object format and add tests (#30878) 2024-05-06 17:02:30 +00:00
wxiaoguang 7c613f100e Make sure git version&feature are always prepared (#30877)
Otherwise there would be more similar issues like #29287
2024-05-06 18:34:16 +02:00
wxiaoguang eda10cc2bb Fix some UI problems (dropdown/container) (#30849)
Follow #30345
Follow #30547

`ellipsis` / `white-space` shouldn't be put on the general dropdown components.
2024-05-06 07:17:22 +00:00
wxiaoguang ce8b11ae13 Fix some UI problems (install/checkbox) (#30854)
Fix the space between the box and label for checkboxes, and fix incorrect usages in "repo-issue.js"
2024-05-06 06:32:05 +00:00
wxiaoguang 982b20d259 Do not show monaco JS errors (#30862)
Fix #30861
2024-05-05 16:34:13 +00:00
wxiaoguang 5c236bd4c0 Fix issue/PR title edit (#30858)
1. "enter" doesn't work (I think it is the last enter support for #14843)
2. if a branch name contains something like `&`, then the branch selector doesn't update
2024-05-05 13:09:41 +00:00
wxiaoguang c7bb3aa034 Fix markdown URL parsing for commit ID (#30812) 2024-05-04 09:48:16 +08:00
wxiaoguang 0f3e717a1a Improve grep search (#30843)
Reduce the context line number to 1, make "git grep" search respect the
include/exclude patter, and fix #30785
2024-05-03 09:13:48 +00:00
wxiaoguang 53b55223d1 Ignore useless error message "broken pipe" (#30801)
Fix #30792
2024-05-03 02:39:36 +00:00
wxiaoguang 677032d36a Fix incorrect message id for releaes email (#30825)
Make generateMessageIDForRelease outputs the same format as
generateMessageIDForIssue (old `createReference`)
2024-05-02 15:24:21 +00:00
wxiaoguangandsilverwind eb8bb82e58 Fix activity heat map padding & locale (#30823)
Fix #30808

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-05-02 13:22:55 +00:00
wxiaoguang 6ff2acc52c Fix issue card layout (#30800)
Fix #30788
2024-05-02 11:19:44 +00:00
wxiaoguang ebe6f4cad7 Fix branch selector UI (#30803)
Fix  #30802
2024-05-02 10:45:23 +00:00
wxiaoguangandsilverwind be112c1fc3 Skip gzip for some well-known compressed file types (#30796)
Co-authored-by: silverwind <me@silverwind.io>
2024-05-02 02:27:25 +00:00
wxiaoguang ce08a9fe2f Fix markdown rendering when mentioning users (#30795) 2024-05-02 01:00:46 +00:00
wxiaoguang 6f7cd94a02 Fix bleve fuzziness (#30799)
Fix #30797
Fix #30317
2024-05-01 15:32:52 +03:00
wxiaoguang a988237eb4 Improve logout from worker (#30775)
A quick fix for #30756
2024-04-30 15:35:42 +00:00
wxiaoguang 5f05e7b41a Fix dashboard commit status null access (#30771)
Fix #30768
2024-04-30 12:39:36 +00:00
wxiaoguang 059b2718a5 Right align the "Settings" menu item in overflow-menu (#30764)
I guess there could be enough people liking to make the Settings menu
item right aligned. As a site admin, I found it's easier to find the
right-aligned Settings menu item.

Tested with various sizes:

![image](https://github.com/go-gitea/gitea/assets/2114189/92836527-2cb2-4531-9296-233c5bd698f4)

![image](https://github.com/go-gitea/gitea/assets/2114189/3a0729fc-5e33-44b5-9fb4-3a4e787405b5)

![image](https://github.com/go-gitea/gitea/assets/2114189/9845ab6b-88e3-4e5a-8d6d-2b8af259d593)
2024-04-30 04:26:13 +00:00
wxiaoguang 61b495e5ab Fix issue label rendering in the issue popup (#30763) 2024-04-30 02:36:32 +00:00
wxiaoguang 4daea7c603 Rename CodeIndexerEnabled to IsRepoIndexerEnabled (#30762)
Fix  #30761

Most places use `IsRepoIndexerEnabled` but not `CodeIndexerEnabled`, so
it should always use `IsRepoIndexerEnabled` for consistency.
2024-04-29 20:15:35 +00:00
wxiaoguang 8de2992ffb Make Ctrl+Enter work for issue/comment edit (#30720)
Fix #30710
2024-04-27 14:32:00 +00:00
wxiaoguang 6d2a307ad8 Rename migration package name for 1.22-rc1 (#30730)
Ref: Propose to restart 1.22 release #30501
2024-04-27 14:02:07 +00:00
wxiaoguang d3cdef88ad Add some tests to clarify the "must-change-password" behavior (#30693)
Follow  #30472:

When a user is created by command line `./gitea admin user create`:

Old behavior before #30472: the first user (admin or non-admin) doesn't
need to change password.

Revert to the old behavior before #30472
2024-04-27 12:23:37 +00:00
wxiaoguang 993736d838 Fix code search input for different views (#30678)
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)
2024-04-26 11:21:04 +00:00
wxiaoguangandGiteabot cd70ab31cd Fix incorrect object id hash function (#30708)
Great thanks to @oliverpool for figuring out the problem and proposing a
fix.

Regression of #28138

Incorrect hash causes the user's LFS files get all deleted when running
`doctor fix all`

(by the way, remove unused/non-standard comments)

Co-authored-by: Giteabot <teabot@gitea.io>
2024-04-26 09:49:48 +00:00
wxiaoguang 1e749b80d7 Add route handler info for debugging purpose (#30705)
Follow #30519
2024-04-26 09:09:49 +00:00
wxiaoguang ed8c63cea3 Deduplicate lfs common code (#30704) 2024-04-26 02:53:30 +00:00
wxiaoguang 6a0750177f Allow to save empty comment (#30706)
Fix #29986
2024-04-26 01:17:43 +00:00
wxiaoguang fd63b96f6a Refactor imagediff and fix regression bug (#30694)
Fix #30683
2024-04-25 21:01:38 +08:00
wxiaoguang bffbbf5470 Improve oauth2 client "preferred username field" logic and the error 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.
2024-04-25 11:22:32 +00:00
wxiaoguang 2ee93ea178 Avoid doubled border for the PR info segment (#30663) 2024-04-23 19:24:10 +00:00
wxiaoguang b79e3db264 Initial support for colorblindness-friendly themes (#30625)
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.
2024-04-24 00:18:41 +08:00
wxiaoguang dd2aaadce3 Fix flash message for flex-container (#30657) 2024-04-23 08:31:51 +00:00
wxiaoguang e6103955cc Fix queue test (#30646)
Fix #30643

The old test code is not stable due to the data-race described in the
TODO added at that time.

Make it stable, and remove a debug-only field from old test code.
2024-04-22 23:55:43 +00:00
wxiaoguang 7cb88e9c18 Use correct hash for "git update-index" (#30626) 2024-04-22 00:13:44 +00:00
wxiaoguang f4a1cf7eab Fix repo home UI when there is no repo description (#30552)
Fix #30502 by a new approach.


![image](https://github.com/go-gitea/gitea/assets/2114189/22f48bca-82d1-45cc-b1b7-ee2344b81a76)
2024-04-21 23:47:31 +00:00
wxiaoguang 1e4867730b Fix dropdown text ellipsis (#30628)
Follow
https://github.com/go-gitea/gitea/pull/30547#discussion_r1573866519

Fix #30624

The Fomantic UI Dropdown wasn't designed to work that way, its "text"
element might contain images. So the "overflow" shouldn't be added to
any general dropdown text.


![image](https://github.com/go-gitea/gitea/assets/2114189/f6ceaabd-bc89-4bf2-baa2-a6f0324c1962)
2024-04-21 23:14:33 +00:00