Commit Graph
100 Commits
Author SHA1 Message Date
wxiaoguang 7fa47de7e9 Remove "noscript" tag from html head (#33846) 2025-03-11 00:52:08 +08:00
wxiaoguang 657239b480 Fix material icon & diff highlight (#33844) 2025-03-10 22:34:48 +08:00
wxiaoguang c102492e5a Fix LFS URL (#33840)
Fix #33839
2025-03-10 17:36:02 +08:00
wxiaoguang 34e5df6d30 Add material icons for file list (#33837) 2025-03-10 15:57:17 +08:00
wxiaoguang 7290bfaccb Only keep popular licenses (#33832)
Fix #33467
2025-03-10 06:40:37 +08:00
wxiaoguang 6f13331754 Improve theme display (#30671)
Document: https://gitea.com/gitea/docs/pulls/180

![image](https://github.com/go-gitea/gitea/assets/2114189/68e38573-b911-45d9-b7aa-40d96d836ecb)
2025-03-08 21:38:11 +00:00
wxiaoguang 4ed71eb754 Improve log format (#33814) 2025-03-08 21:47:11 +08:00
wxiaoguang 6422f05a4e Decouple diff stats query from actual diffing (#33810)
The diff stats are no longer part of the diff generation.
Use `GetDiffShortStat` instead to get the total number of changed files,
added lines, and deleted lines.
As such, `gitdiff.GetDiff` can be simplified:
It should not do more than expected.

And do not run "git diff --shortstat" for pull list. Fix #31492
2025-03-08 17:36:08 +08:00
wxiaoguang b8c2afdc5f Do not show passkey on http sites (#33820)
Fix #33615
2025-03-07 19:37:27 +00:00
wxiaoguang ef18655215 Try to fix ACME (3rd) (#33807)
Fix #33802, fix #32191
2025-03-07 01:00:10 +00:00
wxiaoguang 75e85c25c1 Refactor repo-issue.ts (#33784)
And remove jQuery
2025-03-04 17:58:17 +00:00
wxiaoguang ca0ce003ab Refactor repo-settings.ts (#33785)
and remove jQuery
2025-03-05 01:19:03 +08:00
wxiaoguang 163bbca0eb Refactor admin/common.ts (#33788)
Only remove jQuery
2025-03-04 23:42:07 +08:00
wxiaoguang 216243eee2 Refactor error system (#33771)
It should not expose `util.SilentWrap` or construct it manually.
2025-03-03 05:36:10 +00:00
wxiaoguang 02657e85a4 Refactor mail code (#33768)
`mail.go` contains various different functions, it's time to split it.
2025-03-03 03:31:47 +00:00
wxiaoguang 27bf63ad20 Refactor global init code and add more comments (#33755)
Follow up #33748

Now there are 3 "global" functions:

* registerGlobalSelectorFunc: for all elements matching the selector, eg: `.ui.dropdown`
* registerGlobalInitFunc: for `data-global-init="initInputAutoFocusEnd"`
* registerGlobalEventFunc: for `data-global-click="onCommentReactionButtonClick"`


And introduce `initGlobalInput` to replace old `initAutoFocusEnd` and
`attachDirAuto`, use `data-global-init` to replace fragile
`.js-autofocus-end` selector.

Another benefit is that by the new approach, no matter how many times
`registerGlobalInitFunc` is called, we only need to do one
"querySelectorAll" in the last step, it could slightly improve the
performance.
2025-03-03 10:57:28 +08:00
wxiaoguang 698ae7aa5b Fix dynamic content loading init problem (#33748)
1. Rewrite `dirauto.ts` to `observer.ts`. 
* We have been using MutationObserver for long time, it's proven that it
is quite performant.
    * Now we extend its ability to handle more "init" works.
2. Use `observeAddedElement` to init all non-custom "dropdown".
3. Use `data-global-click` to handle click events from dynamically
loaded elements.
* By this new approach, the old fragile selector-based
(`.comment-reaction-button`) mechanism is removed.
4. By the way, remove unused `.diff-box` selector, it was abused and
never really used.

A lot of FIXMEs in "repo-diff.ts" are completely fixed, newly loaded
contents could work as expected.
2025-03-01 02:02:10 +00:00
wxiaoguang 4e56d5f39f Refactor repo-diff.ts (#33746)
Remove jQuery
2025-02-28 16:37:16 +08:00
wxiaoguang 01156f9cc4 Show info about maintainers are allowed to edit a PR (#33738)
A simple and clear approach. The existing test
TestPullCompare_EnableAllowEditsFromMaintainer should be good enough.

Fix #21280



![image](https://github.com/user-attachments/assets/b685950b-4095-45ad-b913-425f840f2876)
2025-02-27 16:47:00 +00:00
wxiaoguang 8db8a3b0d1 Improve admin user view page (#33735)
1. show more user types
2. show prohibited state
2025-02-27 17:47:37 +08:00
wxiaoguang 555d64d024 Always show the "rerun" button for action jobs (#33692)
And improve the mock code.
2025-02-24 08:40:46 +00:00
wxiaoguang 56a0a9c750 Fix git empty check and HEAD request (#33690) 2025-02-24 02:11:29 +00:00
wxiaoguang 8ae46d9684 Fix some user name usages (#33689)
1. GetUserOrgsList should "order by" lower_name
2. GetIssuePostersWithSearch should search in-case-sensitive-ly
3. LoginName should not be used as username

By the way, remove unnecessary "onGiteaRun"
2025-02-23 12:33:43 +00:00
wxiaoguang f991807f7e Try to fix ACME path when renew (#33668)
Try to fix #32191
2025-02-23 13:12:08 +08:00
wxiaoguang ead716d204 Improve Open-with URL encoding (#33666)
Fix #33665
2025-02-21 17:46:05 +00:00
wxiaoguangandsilverwind 4adb7cad8b Improve swagger generation (#33664)
Remove most "sed" tricks

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-02-21 00:04:30 -08:00
wxiaoguang 3ee5ee2029 Upgrade golangci-lint to v1.64.5 (#33654)
Use `usetesting` instead of deprecated `tenv`.
1. Follow up #33648
2. Make lint pass and add some comments
2025-02-21 00:05:40 +08:00
wxiaoguang cd225d7034 Fix mCaptcha bug (#33659)
Fix #33658
2025-02-20 22:53:38 +08:00
wxiaoguang e6759f356d Update Go dependencies (skip blevesearch, meilisearch) (#33655) 2025-02-20 22:10:54 +08:00
c2e23d3301 Fix PR web route permission check (#33636)
See the FIXME comment in code. Otherwise, if a repo's issue unit is
disabled, then the PRs can't be edited anymore.

By the way, make the permission log output look slightly better.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: metiftikci <metiftikci@hotmail.com>
2025-02-19 00:55:19 +00:00
wxiaoguang 15e020eec8 Refactor error system (#33626) 2025-02-17 12:41:03 -08:00
wxiaoguang f35850f48e Refactor error system (#33610) 2025-02-16 22:13:17 -08:00
wxiaoguang b426e383fe Fix PR's target branch dropdown (#33589)
Fix #33586

It only moves `PrepareBranchList` and `retrieveAssigneesData` to before
the `CanModifyIssueOrPull` check, and adds more comments
2025-02-14 05:21:31 +00:00
wxiaoguang e741448a14 Fix various problems (artifact order, api empty slice, assignee check, fuzzy prompt, mirror proxy, adopt git) (#33569)
* Make artifact list output a stable order
* Fix #33506
* Fix #33521
* Fix #33288
* Fix #33196
* Fix #33561
2025-02-13 03:26:27 +08:00
wxiaoguang f58f5bb3d8 Avoid duplicate SetContextValue call (#33564)
And fix FIXME and TODO
2025-02-12 14:25:46 +08:00
wxiaoguang 245ac321c3 Fix context usage (#33554)
Some old code use direct type-casting to get context, it causes
problems.

This PR fixes all legacy problems and use correct `ctx.Value` to get
low-level contexts.

Fix #33518
2025-02-11 16:46:03 +08:00
30993e9508 Feature: Support workflow event dispatch via API (#33545)
Fix: https://github.com/go-gitea/gitea/issues/31765 (Re-open #32059)

---------

Co-authored-by: Bence Santha <git@santha.eu>
Co-authored-by: Bence Sántha <7604637+bencurio@users.noreply.github.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
2025-02-11 03:05:42 +08:00
wxiaoguang 704b65e012 Revert "Feature: Support workflow event dispatch via API (#32059)" (#33541)
This reverts commit 523751dc82.
2025-02-10 17:44:42 +08:00
wxiaoguang 06088ec672 Remove "class-name" from svg icon (#33540)
Only use "class" attribute
2025-02-09 22:39:54 +02:00
wxiaoguang fa0c8ae50f Refactor gitdiff test (#33507) 2025-02-05 16:09:58 +00:00
wxiaoguang 09a3b07f10 Refactor web route handler (#33488) 2025-02-05 02:14:03 +08:00
wxiaoguang 5dddcc1773 chore: fix some trivial problems and TODOs (#33473)
1. Fix incorrect `MentionCount` (actually it seems to be deadcode,
affects nothing)
2. Remove fallback sha1 support for time limit token
3. Use route middleware `reqRepoActionsWriter` for `ArtifactsDeleteView`
4. Use clearer message "Failed to authenticate user" instead of "Verify"
when auth fails
5. `tests/integration/benchmarks_test.go` is not quite right, actually
it is never used, so delete it.
6. Remove or update TODO comments
2025-02-02 18:16:56 +00:00
wxiaoguang 869f8fdbe4 Skip deletion error for action artifacts (#33476) 2025-02-02 09:48:19 -05:00
wxiaoguang 1ab5938e82 Hide/disable unusable UI elements when a repository is archived (#33459)
And by the way, remove some jQuery code
2025-01-31 20:47:31 +08:00
wxiaoguang 0e8738b4b6 Fix SSH LFS memory usage (#33455)
Fix #33448
2025-01-31 19:05:48 +08:00
wxiaoguang 4f3cc26b4e Revert empty lfs ref name (#33454)
Fix #33453
2025-01-31 18:03:11 +08:00
wxiaoguang 5a7b42dac7 Support choose email when creating a commit via web UI (more) (#33445)
Follow #33432
2025-01-31 02:36:18 +00:00
wxiaoguang b57d9f41d4 Fix issue sidebar dropdown keyboard support (#33447)
Just a quick fix, fix #33444
2025-01-30 22:54:50 +00:00
wxiaoguanganddelvh f24d73ab5f Fix "redirect link" handling (#33440)
`a%2fb` should not redirect to `a/b`

---------

Co-authored-by: delvh <dev.lh@web.de>
2025-01-31 04:12:14 +08:00
wxiaoguang 256b94e9e9 Support choose email when creating a commit via web UI (#33432)
Initial PR for #24469
2025-01-30 01:24:57 +00:00
wxiaoguang 4ffc54f59a Refactor user & avatar (#33433)
1. better GetPossibleUserByID logic
2. fix some function name & comment typos
3. do not re-generate avatar if one exists
2025-01-30 07:33:50 +08:00
wxiaoguang 8c4f0f02ef Refactor user package (#33423)
and avoid global variables
2025-01-29 01:14:35 +02:00
wxiaoguang 182e3896bf Fix flex width (#33414)
Fix #33409
2025-01-27 17:09:20 +00:00
wxiaoguang 517a367abe Use ProtonMail/go-crypto to replace keybase/go-crypto (#33402)
Fix #33400

The keybase/go-crypto is no longer maintained and it generates malformed
signatures, ProtonMail/go-crypto is the actively maintained fork.
2025-01-27 09:14:08 +08:00
wxiaoguang e663c4a7f0 Fix issue suggestion bug (#33389)
Fix #33388
2025-01-26 13:13:32 +00:00
wxiaoguang 2c1ff8701a Refactor context flash msg and global variables (#33375)
1. add `GetSiteCookieFlashMessage` to help to parse flash message
2. clarify `handleRepoHomeFeed` logic
3. remove unnecessary global variables, use `sync.OnceValue` instead
4. add some tests for `IsUsableUsername` and `IsUsableRepoName`
2025-01-25 14:36:47 +00:00
wxiaoguang 6a516a0d14 Do not show unnecessary commit sign lock icon (#33387)
Fix #33385
2025-01-25 19:32:35 +08:00
wxiaoguang 7da8a01d39 Fix js error when edit issue (#33384) 2025-01-25 09:37:25 +08:00
wxiaoguang 06ff9b6256 Do not access GitRepo when a repo is being created (#33380) 2025-01-24 18:27:36 +00:00
wxiaoguang 6fe4d1c038 Remove duplicate "ResponseWriter.Status" method (#33346) 2025-01-22 06:37:52 +00:00
wxiaoguangandsilverwind 7069369e03 Support performance trace (#32973)
1. Add a OpenTelemetry-like shim-layer to collect traces
2. Add a simple builtin trace collector and exporter, end users could
download the diagnosis report to get the traces.

This PR's design is quite lightweight, no hard-dependency, and it is
easy to improve or remove. We can try it on gitea.com first to see
whether it works well, and fine tune the details.

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-01-21 18:57:07 +00:00
wxiaoguang 2cb3946496 Make issue suggestion work for all editors (#33340)
And do not handle special keys when the text-expander popup exists
2025-01-21 19:33:45 +08:00
wxiaoguang 46d1e91aed Fix issue count (#33338)
Fix #33336
2025-01-21 18:53:44 +08:00
wxiaoguang 6cc1067884 Fix incorrect ref commit ID usage (#33331)
After the RefName refactoring, the `ctx.Repo.CommitID` is only set when
there is a `RepoRefByType` middleware.

Many handlers do not use that middleware and they only use "default
branch"
2025-01-20 07:43:49 +00:00
wxiaoguang 39de2955fd Improve sync fork behavior (#33319)
Fix #33271

Suppose there is a `branch-a` in fork repo:

1. if `branch-a` exists in base repo: try to sync `base:branch-a` to `fork:branch-a`
2. if `branch-a` doesn't exist in base repo: try to sync `base:main` to `fork:branch-a`
2025-01-20 15:17:47 +08:00
wxiaoguang 6073e2f1bb Refactor response writer & access logger (#33323)
And add comments & tests
2025-01-20 06:25:17 +00:00
wxiaoguang 3b839f8dc0 Trivial fixes (#33304)
1. the error check was added for go-git, it was caused by the empty `.keep` file in the test fixtures.
2. use `PostFormValue` instead of `PostForm.Get` (`Get` needs to parse the form ahead)
3. fix incorrect container text (it should show "Images" in the header but not "OS/Arch")
4. align maven xml
5. fix closed PR color&icon
2025-01-17 08:55:02 +00:00
wxiaoguang cfc6e21f06 Fix incorrect ref usages (#33301)
Fix #33297

By the way, improve some locales
2025-01-16 13:52:21 +00:00
wxiaoguang b15d01b0ce Prepare for support performance trace (#33286)
For #32973
2025-01-15 20:05:18 +00:00
wxiaoguang 6659a381ea Fix closed dependency title (#33285)
Fix #33283
2025-01-15 23:38:03 +08:00
wxiaoguang f6dbf0e7b3 Fix incorrect TagName/BranchName usages (#33279)
Add add a new test
2025-01-15 17:34:55 +08:00
wxiaoguang fcd096231a Simplify context ref name (#33267) 2025-01-15 11:15:47 +08:00
wxiaoguang 4d399e717d Fix some broken route handlers (#33268)
Some mistakes introduced by recent refactoring PRs (some sidebar
dropdowns doesn't work)
2025-01-14 19:03:02 +00:00
wxiaoguang 1299fdb084 Add a confirm dialog for "sync fork" (#33270)
Try to quickly fix #33264
2025-01-14 18:30:43 +00:00
wxiaoguang 5eff19a77a Fix sidebar milestone link (#33269)
Fix  #33266
2025-01-14 13:01:53 -05:00
wxiaoguang a98a836e76 Support public code/issue access for private repositories (#33127)
Close #8649, close #639 (will add "anonymous access" in following PRs)
2025-01-14 01:53:34 +00:00
wxiaoguang 348b7074c8 Fix incorrect ref "blob" (#33240)
1. "blob" is not a "ref", it shouldn't (and not unable to) be handled by
`RepoRefByType`
2. the `/blob/{sha}` handle should use the path param "sha" directly
2025-01-13 16:27:11 +08:00
wxiaoguang 2ea929a952 Refactor RefName (#33234)
And fix some FIXMEs
2025-01-13 14:01:53 +08:00
wxiaoguang 81352542fd Refactor context RefName and RepoAssignment (#33226)
The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of
ambiguity.

This PR does some refactoring and use `RefFullName` to replace the
legacy `RefName`, and simplify RepoAssignment
2025-01-13 01:07:05 +00:00
wxiaoguang c0751ef116 Fix upload file form (#33230)
Fix #33228
2025-01-13 03:39:15 +08:00
wxiaoguang 9024b79933 Remove unused CSS styles and move some styles to proper files (#33217) 2025-01-12 05:16:22 +00:00
wxiaoguang a068462ac0 Refactor context repository (#33202) 2025-01-12 03:39:46 +00:00
wxiaoguang 65aae0912a Fix raw file API ref handling (#33172)
Fix #33164 and add more tests
2025-01-10 01:31:49 +00:00
wxiaoguang 5b31077b68 Fix ACME panic (#33178)
Fix #33177, Manually tested:

````
1.7364311850484018e+09	info	maintenance	started background certificate maintenance	{"cache": "0x1400ca64180"}
1.736431185054049e+09	info	obtain	acquiring lock	{"identifier": "example.com"}
1.736431185058073e+09	info	obtain	lock acquired	{"identifier": "example.com"}
1.736431185058133e+09	info	obtain	obtaining certificate	{"identifier": "example.com"}
````
2025-01-09 23:53:50 +00:00
wxiaoguang a5043af8ea Fix assignee list overlapping in Issue sidebar (#33176)
Fix  #33170

![image](https://github.com/user-attachments/assets/714cebdc-ee76-43e3-9ece-a189f8ecb17a)

![image](https://github.com/user-attachments/assets/cbb58425-42b4-41ee-ba3c-7efbd24607dc)
2025-01-10 01:58:37 +08:00
wxiaoguang 9c00e065a1 Fix form width (#33151)
Fix #33150
2025-01-08 23:57:18 +08:00
wxiaoguang 386c1ed908 Refactor HTMLFormat, update chroma render, fix js error (#33136)
A small refactor to improve HTMLFormat, to help to prevent low-level
mistakes.

And fix #33141, fix #33139
2025-01-08 03:44:32 +00:00
wxiaoguang 34dfc25b83 Make git clone URL could use current signed-in user (#33091)
close #33086

* Add a special value for "SSH_USER" setting: `(DOER_USERNAME)`
* Improve parseRepositoryURL and add tests (now it doesn't have hard
dependency on some setting values)

Many changes are just adding "ctx" and "doer" argument to functions.

By the way, improve app.example.ini, remove all `%(key)s` syntax, it
only makes messy and no user really cares about it.

Document: https://gitea.com/gitea/docs/pulls/138
2025-01-07 13:17:44 +08:00
wxiaoguang 80e4f4c4eb Refactor package (routes and error handling, npm peer dependency) (#33111) 2025-01-06 22:45:20 +08:00
wxiaoguang ef736b7e27 Refactor legacy JS (#33115) 2025-01-06 17:38:42 +08:00
wxiaoguang 40765b5d45 Fix repo empty guide (#33114) 2025-01-06 12:07:52 +08:00
wxiaoguang cf60734a4d Fix dropdown menu header and mobile view (#33108)
![image](https://github.com/user-attachments/assets/3f831c8c-ef87-4282-880a-c2738f3e1d17)

----

![image](https://github.com/user-attachments/assets/c4c0519b-cfa6-42b4-bd28-205ee514eb34)

----

![image](https://github.com/user-attachments/assets/8624a605-9f2b-4905-9cbc-0af073972874)
2025-01-05 21:20:22 +00:00
wxiaoguang df9d1fe8c5 Trivial fixes (#33103)
1. remove `gock` dependency, it is not needed
2. fix a regression from org private profile readme
2025-01-04 22:25:50 +00:00
wxiaoguang 3d544a3ad3 Fix empty git repo handling logic (#33101)
Fix #33092
2025-01-04 18:47:24 +08:00
wxiaoguang 2b064b8637 Refactor legacy line-number and scroll code (#33094)
1. remove jquery
2. rewrite the "line number selection", fix various edge cases
3. fix the scroll
2025-01-04 10:56:07 +08:00
wxiaoguang 68972a9947 Clean up legacy form CSS styles (#33081) 2025-01-03 04:01:19 +00:00
wxiaoguang e709cc76da Make Gitea always use its internal config, ignore /etc/gitconfig (#33076)
In history, Gitea could use the system config `/etc/gitconfig` because
some users said that "they might put certNonceSeed in it"

Actually, we shouldn't not use it, because it also causes conflicts
(there are already some fixes like #28848)

To make the system clear, I think it's worth to introduce the breaking
change: add `GIT_CONFIG_NOSYSTEM=1` to all git commands.


## ⚠️ BREAKING ⚠️

 For most users, nothing need to do.

If you have made changes to `/etc/gitconfig` to affect Gitea's behavior,
you need to move these config options to Gitea's internal git config
file, it is usually in Gitea's `{AppDataPath}/home/.git` directory.
2025-01-02 20:26:48 +00:00
wxiaoguang 9ac536a904 Fix "stop time tracking button" on navbar (#33084)
Fix #33083

By the way (something I was working on):

1. relax color/background-color for more markup elements
2. fix a command line sentence error
2025-01-03 04:01:05 +08:00
wxiaoguang 45973a100b Fix bleve fuzziness search (#33078)
Close #31565
2025-01-03 00:32:02 +08:00
wxiaoguang 9882917bce Try to fix ACME directory problem (#33072) 2025-01-02 04:38:27 +00:00