Commit Graph
100 Commits
Author SHA1 Message Date
wxiaoguangandGitHub 182e3896bf Fix flex width (#33414)
Fix #33409
2025-01-27 17:09:20 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub e663c4a7f0 Fix issue suggestion bug (#33389)
Fix #33388
2025-01-26 13:13:32 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 6a516a0d14 Do not show unnecessary commit sign lock icon (#33387)
Fix #33385
2025-01-25 19:32:35 +08:00
wxiaoguangandGitHub 7da8a01d39 Fix js error when edit issue (#33384) 2025-01-25 09:37:25 +08:00
wxiaoguangandGitHub 06ff9b6256 Do not access GitRepo when a repo is being created (#33380) 2025-01-24 18:27:36 +00:00
wxiaoguangandGitHub 6fe4d1c038 Remove duplicate "ResponseWriter.Status" method (#33346) 2025-01-22 06:37:52 +00:00
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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 46d1e91aed Fix issue count (#33338)
Fix #33336
2025-01-21 18:53:44 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 6073e2f1bb Refactor response writer & access logger (#33323)
And add comments & tests
2025-01-20 06:25:17 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub cfc6e21f06 Fix incorrect ref usages (#33301)
Fix #33297

By the way, improve some locales
2025-01-16 13:52:21 +00:00
wxiaoguangandGitHub b15d01b0ce Prepare for support performance trace (#33286)
For #32973
2025-01-15 20:05:18 +00:00
wxiaoguangandGitHub 6659a381ea Fix closed dependency title (#33285)
Fix #33283
2025-01-15 23:38:03 +08:00
wxiaoguangandGitHub f6dbf0e7b3 Fix incorrect TagName/BranchName usages (#33279)
Add add a new test
2025-01-15 17:34:55 +08:00
wxiaoguangandGitHub fcd096231a Simplify context ref name (#33267) 2025-01-15 11:15:47 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 1299fdb084 Add a confirm dialog for "sync fork" (#33270)
Try to quickly fix #33264
2025-01-14 18:30:43 +00:00
wxiaoguangandGitHub 5eff19a77a Fix sidebar milestone link (#33269)
Fix  #33266
2025-01-14 13:01:53 -05:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 2ea929a952 Refactor RefName (#33234)
And fix some FIXMEs
2025-01-13 14:01:53 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub c0751ef116 Fix upload file form (#33230)
Fix #33228
2025-01-13 03:39:15 +08:00
wxiaoguangandGitHub 9024b79933 Remove unused CSS styles and move some styles to proper files (#33217) 2025-01-12 05:16:22 +00:00
wxiaoguangandGitHub a068462ac0 Refactor context repository (#33202) 2025-01-12 03:39:46 +00:00
wxiaoguangandGitHub 65aae0912a Fix raw file API ref handling (#33172)
Fix #33164 and add more tests
2025-01-10 01:31:49 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 9c00e065a1 Fix form width (#33151)
Fix #33150
2025-01-08 23:57:18 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 80e4f4c4eb Refactor package (routes and error handling, npm peer dependency) (#33111) 2025-01-06 22:45:20 +08:00
wxiaoguangandGitHub ef736b7e27 Refactor legacy JS (#33115) 2025-01-06 17:38:42 +08:00
wxiaoguangandGitHub 40765b5d45 Fix repo empty guide (#33114) 2025-01-06 12:07:52 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 3d544a3ad3 Fix empty git repo handling logic (#33101)
Fix #33092
2025-01-04 18:47:24 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 68972a9947 Clean up legacy form CSS styles (#33081) 2025-01-03 04:01:19 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 45973a100b Fix bleve fuzziness search (#33078)
Close #31565
2025-01-03 00:32:02 +08:00
wxiaoguangandGitHub 9882917bce Try to fix ACME directory problem (#33072) 2025-01-02 04:38:27 +00:00
wxiaoguangandGitHub 4f386e2c5e Refactor env var related code (#33075)
And add more comments
2025-01-02 11:36:50 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 85c756e279 Refactor pull-request compare&create page (#33071)
The old code is unnecessarily complex.
2025-01-02 01:16:09 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 58c092cfea Fix locale type (#33059)
Follow #32872
2024-12-31 06:37:37 +00:00
wxiaoguangandGitHub e5c576e92b Refactor maven package registry (#33049)
Close #33036
2024-12-31 05:30:52 +00:00
wxiaoguangandGitHub c09656e0e0 Make issue suggestion work for new PR page (#33035)
Fix #33026
2024-12-31 03:50:55 +00:00
wxiaoguangandGitHub dafadf0028 Refactor fixture loading for testing (#33024)
To help binary size and testing performance
2024-12-30 04:06:57 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 1dbf0d7f08 Test webhook email (#33033)
Close #27918
2024-12-30 01:25:49 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub a92f5057ae Fix and/or comment some legacy CSS problems (#33015) 2024-12-28 11:51:38 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub e435b1900a Refactor arch route handlers (#32993) 2024-12-28 03:31:46 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 550abdbc24 Improve "ellipsis string" (#32989) 2024-12-26 14:19:35 +08:00
wxiaoguangandGitHub 9bfa9f450d Refactor "string truncate" (#32984) 2024-12-26 11:56:03 +08:00
wxiaoguangandGitHub 594edad213 Do not render truncated links in markdown (#32980)
Fixes #31780
2024-12-26 00:33:55 +08:00
wxiaoguangandGitHub 973363fec3 Fix maven pom inheritance (#32943)
Fix  #30568
2024-12-25 04:28:37 +00:00
wxiaoguangandGitHub ca31d478ee Refactor arch route handlers (#32972) 2024-12-25 04:03:14 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub bd5d1341d4 Fix commit range paging (#32944) 2024-12-23 07:07:12 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 462ce31530 Fix repo avatar conflict (#32958)
Continue even if the avatar deleting fails
2024-12-23 02:52:25 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub afe314fa77 Use primary as button color (#32949)
* Fix #32871
* Fix #32948
2024-12-22 23:03:39 +08:00
wxiaoguangandGitHub 143946834a Fix locale (#32937)
Fix #32936
2024-12-21 19:24:43 +00:00
wxiaoguangandGitHub 09a0041965 Fix areYouSure confirm (#32941)
See the comment
2024-12-21 12:11:22 -05:00
wxiaoguangandGitHub 4774151e53 Improve navbar: add "admin" tip, add "active" style (#32927)
By the way, remove all "tw-" patches and unused styles.
2024-12-20 16:38:56 +00:00
wxiaoguangandGitHub 1c9b022c4d Refactor db package and remove unnecessary DumpTables (#32930) 2024-12-20 16:11:38 +00:00
wxiaoguangandGitHub 52b319bc00 Refactor pprof labels and process desc (#32909)
* Deprecate "gopid" in log, it is not useful and requires very hacky
approach
* Remove "git.Command.SetDescription" because it is not useful and only
makes the logs too flexible
2024-12-20 12:17:14 +08:00
2d7e6e9482 Fix various trivial problems (#32861)
1. add/improve comments to help future readers could understand the
problem more easily.
2. add an error log to LDAP with username fallback
3. use `or` instead of `Iif` for "repo/branch_dropdown" (`Iif` was a
mistake, but it doesn't really affect the UI)
4. add `tw-font-mono` style to container digest to match dockerhub
5. fix a bug in RepoBranchTagSelector: the form is not updated when
there is no click to an item

---------

Co-authored-by: delvh <dev.lh@web.de>
2024-12-17 01:15:18 +00:00
wxiaoguangandGitHub 22c4599542 Improve Actions status aggregations (#32860)
Make the result the same as GitHub:

* all skipped, then result is skipped
* any cancelled, then result cancelled
2024-12-16 21:49:53 +08:00
wxiaoguangandGitHub d28a4843b8 Fix incomplete Actions status aggregations (#32859)
fix #32857
2024-12-16 11:18:00 +08:00
wxiaoguangandGitHub b01b0b99a5 Refactor some LDAP code (#32849) 2024-12-15 11:59:18 +00:00
wxiaoguangandGitHub d1c1e3cbcc Fine tune ssh related comments and code (#32846)
Add more comments to explain the ssh problem, 
and rename `sshConn` to `sshSession`
2024-12-15 06:07:50 +00:00
wxiaoguangandGitHub cc5ff98e0d Refactor markdown math render (#32831)
Add more tests
2024-12-14 13:43:05 +08:00
wxiaoguangandGitHub a66c16dc1b Allow to fork repository into the same owner (#32819)
This feature is experimental, not fully tested, and may be changed in
the future.

It is only designed for users who really need it: set
`[repository].ALLOW_FORK_INTO_SAME_OWNER=true` in your app.ini

Doc: https://gitea.com/gitea/docs/pulls/122


![image](https://github.com/user-attachments/assets/38d08c23-9cfc-49d8-9321-ff81edf65395)
2024-12-14 09:39:05 +08:00
wxiaoguangandGitHub 5bc030efa2 Fix various UI bugs (#32821) 2024-12-13 01:45:32 -05:00
wxiaoguangandGitHub 2910f384d5 Fix misuse of PublicKeyCallback (#32810)
Only upgrading the ssh package is not enough.
2024-12-13 03:57:37 +00:00
00e2b339b6 Fix "unicode escape" JS error (#32806)
<details>


![image](https://github.com/user-attachments/assets/98aef2fb-791e-4b4a-b2ac-e880f8a52040)


![image](https://github.com/user-attachments/assets/532673ae-c4cf-4d84-a5c6-93e6eacd341c)


![image](https://github.com/user-attachments/assets/2a241a3d-b7f6-44ca-89d9-9d68386fbf3e)


![image](https://github.com/user-attachments/assets/1251e43d-41f2-42d1-a23b-3182e3812c3d)

</details>

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-12-12 18:37:44 +00:00
wxiaoguangandGitHub 22bf2ca6ba Make API "compare" accept commit IDs (#32801) 2024-12-12 08:10:09 +00:00
wxiaoguangandGitHub 1e751d81b3 Fix JS error when dropping a file to a editor without dropzone (#32804)
`dropzoneEl` may not exist
2024-12-12 12:37:25 +08:00
wxiaoguangandGitHub 17f0411441 Fix clone panel js error (#32798)
side effect of jquery removal, fix #32797
2024-12-12 02:01:20 +00:00
wxiaoguangandGitHub 4814f43af7 Fix repo home file list (#32788)
1. use grid instead of table, completely drop "ui table" from that list
2. move some "commit sign" related styles into a new file by the way (no
change) because I need to figure out where `#repo-files-table` is used.
3. move legacy "branch/tag selector" related code into repo-legacy.ts,
now there are 13 `import $` files left.
2024-12-11 23:54:42 +08:00
wxiaoguangandGitHub e619384098 Add label/author/assignee filters to the user/org home issue list (#32779)
Replace #26661, fix #25979

Not perfect, but usable and much better than before. Since it is quite
complex, I am not quite sure whether there would be any regression, if
any, I will fix in first time.

I have tested the related pages many times: issue list, milestone issue
list, project view, user issue list, org issue list.
2024-12-11 06:33:24 +00:00
wxiaoguangandGitHub 8f271c6036 Fix wiki ui (#32781)
Fix #32774
2024-12-10 11:41:44 -05:00