Commit Graph
100 Commits
Author SHA1 Message Date
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
wxiaoguang 4f386e2c5e Refactor env var related code (#33075)
And add more comments
2025-01-02 11:36:50 +08:00
wxiaoguang c1167709ed Refactor repo-new.ts (#33070)
1. merge `repo-template.ts` into `repo-new.ts` (they are all for "/repo/create")
2. remove jquery
3. fix an anonying fomantic dropdown bug, see the comment of `onResponseKeepSelectedItem`
2025-01-01 17:21:13 +00:00
wxiaoguang 85c756e279 Refactor pull-request compare&create page (#33071)
The old code is unnecessarily complex.
2025-01-02 01:16:09 +08:00
wxiaoguang 2564c15cb0 Remove some unnecessary template helpers (#33069)
DisableGitHooks and DisableImportLocal are only used when editing a
user, so only set them in `editUserCommon`
2025-01-01 18:02:34 +08:00
wxiaoguang a0853e2278 Fix unittest and repo create bug (#33061)
1. `StatDir` was not right, fix the FIXME
2. Clarify the test cases for `IsUsableRepoName`
3. Fix regression bug in `repo-new.ts`

Fix #33060
2024-12-31 18:45:05 +08:00
wxiaoguang 58c092cfea Fix locale type (#33059)
Follow #32872
2024-12-31 06:37:37 +00:00
wxiaoguang e5c576e92b Refactor maven package registry (#33049)
Close #33036
2024-12-31 05:30:52 +00:00
wxiaoguang c09656e0e0 Make issue suggestion work for new PR page (#33035)
Fix #33026
2024-12-31 03:50:55 +00:00
wxiaoguang dafadf0028 Refactor fixture loading for testing (#33024)
To help binary size and testing performance
2024-12-30 04:06:57 +00:00
wxiaoguang cd1b5488a3 Refactor pagination (#33037)
I am sure the simple approach should work, let's try it in 1.24

Follow #29834 and #29841
2024-12-30 01:57:38 +00:00
wxiaoguang 1dbf0d7f08 Test webhook email (#33033)
Close #27918
2024-12-30 01:25:49 +08:00
wxiaoguang 0ed160ffea Refactor tests (#33021)
1. fix incorrect tests, for example: BeanExists doesn't do assert and
shouldn't be used
2. remove unnecessary test functions
3. introduce DumpQueryResult to help to see the database rows during
test (at least I need it)

```
====== DumpQueryResult: SELECT * FROM action_runner_token ======
- # row[0]
  id: 1
  token: xeiWBL5kuTYxGPynHCqQdoeYmJAeG3IzGXCYTrDX
  owner_id: 0
...
```
2024-12-29 01:05:56 +00:00
wxiaoguang a92f5057ae Fix and/or comment some legacy CSS problems (#33015) 2024-12-28 11:51:38 +00:00
wxiaoguang 3d3ece36d2 Refactor comment history and fix content edit (#33018)
And fix a regression bug for comment content editing.

Now 11 "import jquery" files left
2024-12-28 19:26:16 +08:00
wxiaoguang e435b1900a Refactor arch route handlers (#32993) 2024-12-28 03:31:46 +00:00
wxiaoguang ea198f9ea8 Fix eslint (#33002)
Fix  #32982
Related #32869

* eslint-plugin-github 5.1.x doesn't work well with eslint8
* no-undef is still needed
2024-12-27 19:34:39 +00:00
wxiaoguang 550abdbc24 Improve "ellipsis string" (#32989) 2024-12-26 14:19:35 +08:00
wxiaoguang 9bfa9f450d Refactor "string truncate" (#32984) 2024-12-26 11:56:03 +08:00
wxiaoguang 594edad213 Do not render truncated links in markdown (#32980)
Fixes #31780
2024-12-26 00:33:55 +08:00
wxiaoguang 973363fec3 Fix maven pom inheritance (#32943)
Fix  #30568
2024-12-25 04:28:37 +00:00
wxiaoguang ca31d478ee Refactor arch route handlers (#32972) 2024-12-25 04:03:14 +00:00
wxiaoguang b7260400f8 Refactor tmpl and blob_excerpt (#32967)
1. do not use `{{/* */}}` to remove spaces, use `{{- -}}`
2. fix "blob_excerpt" endpoint, remove the legacy fragile code: have
tested commit diff and wiki diff
2024-12-25 00:51:13 +08:00
wxiaoguang 2a828e2798 Clarify path param naming (#32969)
In history (from some legacy frameworks), both `:name` and `name` are
supported as path path name, `:name` is an alias to `name`.

To make code consistent, now we should only use `name` but not `:name`.

Also added panic check in related functions to make sure the name won't
be abused in case some downstreams still use them.
2024-12-24 13:47:45 +00:00
wxiaoguang 6d5aa9218e Refactor request context (#32956)
Introduce RequestContext: is a short-lived context that is used to store
request-specific data.

RequestContext could be used to clean form tmp files, close context git
repo, and do some tracing in the future.

Then a lot of legacy code could be removed or improved. For example:
most `ctx.Repo.GitRepo.Close()` could be removed because the git repo
could be closed when the request is done.
2024-12-24 11:43:57 +08:00
wxiaoguang 781c6df40f Add sub issue list support (#32940)
Just like GitHub, show issue icon/title when the issue number is in a list
2024-12-24 01:54:19 +00:00
wxiaoguang 7553ae1a57 Use env GITEA_RUNNER_REGISTRATION_TOKEN as global runner token (#32946)
Fix #23703

When Gitea starts, it reads GITEA_RUNNER_REGISTRATION_TOKEN
or GITEA_RUNNER_REGISTRATION_TOKEN_FILE to add registration token.
2024-12-23 09:59:16 +00:00
wxiaoguang bd5d1341d4 Fix commit range paging (#32944) 2024-12-23 07:07:12 +00:00
wxiaoguang 89f31f79fd Fix outdated tmpl code (#32953)
Some PRs were before tmpl ctx refactoring and used outdated code
2024-12-23 11:21:11 +08:00
wxiaoguang 462ce31530 Fix repo avatar conflict (#32958)
Continue even if the avatar deleting fails
2024-12-23 02:52:25 +00:00
wxiaoguang a163c53a60 Refactor template & test related code (#32938)
Move some legacy code from "base" package to proper packages.
2024-12-22 15:33:19 +00:00
wxiaoguang afe314fa77 Use primary as button color (#32949)
* Fix #32871
* Fix #32948
2024-12-22 23:03:39 +08:00
wxiaoguang 143946834a Fix locale (#32937)
Fix #32936
2024-12-21 19:24:43 +00:00