Commit Graph
100 Commits
Author SHA1 Message Date
wxiaoguangandGitHub e818de179e Refactor legacy code (#35708) (#35713)
Backport #35708
2025-10-21 09:10:10 +08:00
wxiaoguangandGitHub 9162f4403a Fix various bugs (1.24) (#35186)
Backport #35177, #35183
2025-07-31 12:04:47 +08:00
wxiaoguangandGitHub 99596044d7 Don't use full-file highlight when there is a git diff textconv (#35114) (#35119)
Fix #35106
2025-07-18 13:52:41 +00:00
wxiaoguangandGitHub 12bfa9e83d Improve submodule relative path handling (#35056) (#35075)
Backport #35056
2025-07-14 17:26:16 +00:00
e13deb7a16 Fix API response for swagger spec (#35029)
Co-authored-by: Scion <scion@studiowhy.net>
2025-07-10 15:27:34 +08:00
wxiaoguangandGitHub 81ee93e5bc Fix repo settings and protocol log problems (#35012) (#35013)
Backport #35012
2025-07-09 17:20:15 +00:00
wxiaoguangandGitHub 68fcdb6122 Fix project images scroll (#34971) (#34972) 2025-07-07 00:30:43 +08:00
wxiaoguangandGitHub 4aba42519d Fix git graph page (#34948) (#34949) 2025-07-04 15:33:17 +00:00
wxiaoguangandGitHub c3fa2a8729 Fix issue filter (#34914) (#34915)
Backport #34914
2025-07-03 09:45:17 +08:00
wxiaoguangandGitHub 5d5b695527 Skip updating timestamp when sync branch (#34875) 2025-06-26 17:59:06 -07:00
wxiaoguangandGitHub 52a964d1fc Fix container range bug (#34795) (#34796)
Backport #34795
2025-06-20 17:35:36 +00:00
wxiaoguangandGitHub ae2b795693 Fix incorrect cli default values (#34765) (#34766)
Backport #34765
2025-06-18 23:51:37 +08:00
wxiaoguangandGitHub b39f7a37d1 Fix dropdown filter (#34708) (#34711)
Partially backport #34708
2025-06-12 19:31:12 -07:00
b1cc4bf77f Validate hex colors when creating/editing labels (#34623) (#34630)
Backport #34623

---------

Co-authored-by: Kemal Zebari <kemalzebra@gmail.com>
2025-06-07 11:24:28 +03:00
e9481e1da3 Fix line-button issue after file selection in file tree (#34574) (#34576)
Backport #34574

---------

Co-authored-by: Kerwin Bryant <kerwin612@qq.com>
2025-06-01 23:20:21 -07:00
0148d03f21 Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187)
Fix #880

Design:

1. A global setting `security.TWO_FACTOR_AUTH`.
* To support org-level config, we need to introduce a better "owner
setting" system first (in the future)
2. A user without 2FA can login and may explore, but can NOT read or
write to any repositories via API/web.
3. Keep things as simple as possible.
* This option only aggressively suggest users to enable their 2FA at the
moment, it does NOT guarantee that users must have 2FA before all other
operations, it should be good enough for real world use cases.
* Some details and tests could be improved in the future since this
change only adds a check and seems won't affect too much.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-04-28 15:31:59 -07:00
wxiaoguangandGitHub d1ad8e1e80 Update unrs-resolver (#34279) 2025-04-24 14:02:38 +02:00
e625250ffc Fix various trivial frontend problems (#34263)
1. Fix #20606
2. Fix #34246
3. Fix missing spaces, fix misspells, no visual change.
4. Fix missing "not-mobile", fix #34265

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-04-24 09:11:54 +08:00
wxiaoguangandGitHub 58d2a87c6c update go&js dependencies (#34262) 2025-04-23 21:22:40 +00:00
wxiaoguangandGitHub b758241f28 Fix runner list tmpl (#34270)
Fix  #34269

And fix some layout problems.
2025-04-23 15:34:18 +00:00
wxiaoguangandGitHub 8aee07a064 Improve "not found" error messages for API (#34267)
Make the message clear, for example: #34266
2025-04-23 17:42:50 +08:00
wxiaoguangandGitHub 4832cb9e27 Display when a release attachment was uploaded (#34261)
Fix #34260
2025-04-22 23:03:49 +08:00
9705adb27f Make public URL generation configurable (#34250)
Follow up #32564

Co-authored-by: Jannis Pohl <838818+jannispl@users.noreply.github.com>
Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2025-04-22 06:49:37 +08:00
wxiaoguangandGitHub c9aa9068b3 Fix various UI problems (#34243)
Also fix #34242
2025-04-19 08:43:22 +00:00
wxiaoguangandGitHub ba0deab616 Fix some trivial problems (#34237)
1. Using existing "content" variable in `swift.go`
2. Do not report 500 server error in `GetPullDiffStats` middleware,
otherwise a PR missing ref won't be able to view.
3. Fix the abused "label button" when listing commits, there was too
much padding space, see the screenshot below.
2025-04-18 22:56:50 +08:00
wxiaoguangandGitHub d2d381fd4b Improve "lock conversation" UI (#34207)
Fix #34203
2025-04-15 15:01:12 +00:00
wxiaoguangandGitHub 58a3952458 Fix package upload temp path (#34196)
Fix #34195

The temp dir should be created when it is used.
2025-04-14 18:55:02 +08:00
wxiaoguangandGitHub 34349c085c Fix incorrect file links (#34189)
Fix #34188

The name "FileName" is ambiguous: sometimes it is "base name without
path", sometimes it is "full name with path".

The ambiguous name causes various problems.

This PR clarifies the usage: `FileTreePath`: the full name with path.
2025-04-13 12:27:31 -07:00
wxiaoguangandGitHub f8edc29f5d Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (#34152)
Fix #32015
2025-04-09 07:52:01 +00:00
wxiaoguangandGitHub 07c6087878 Fix team permission (#34128)
The `team.access_mode` should be either `none` or `admin/owner`.
For non-admin team, the real permissions are provided by `team_unit`.
2025-04-08 04:15:15 +00:00
wxiaoguangandGitHub bcc38eb35f Make markdown render match GitHub's behavior (#34129)
For #2246
2025-04-06 17:34:59 +00:00
wxiaoguangandGitHub 3fe082a5a3 Remove dead code: RepoRef (#34131)
The RepoRef is a no-op since Refactor ref type (#33242) (Jan 14)
2025-04-06 20:08:10 +03:00
wxiaoguangandGitHub e94f8d56f1 Correctly handle submodule view and avoid throwing 500 error (#34121)
Auto-redirect for in-site links, and show 404 for external links
(to avoid open redirect or phishing)
2025-04-06 09:38:08 +00:00
wxiaoguangandGitHub a62ed19da6 Use overflow-wrap: anywhere to replace word-break: break-all (#34126) 2025-04-06 17:13:02 +08:00
wxiaoguangandGitHub e1c2d05bde Fix markdown render behaviors (#34122)
* Fix #27645
* Add config options `MATH_CODE_BLOCK_DETECTION`, problematic syntaxes
are disabled by default
* Fix #33639
    * Add config options `RENDER_OPTIONS_*`, old behaviors are kept
2025-04-05 11:56:48 +08:00
wxiaoguangandGitHub ee6929d96b Refactor dropdown ellipsis (#34123)
Remove legacy `truncated-item-container` and `truncated-item-name`.
2025-04-05 03:21:11 +00:00
wxiaoguangandGitHub 6cee3bfa96 Refactor markup render to fix various path problems (#34114)
* Fix #33972
    * Use consistent path resolving for links and medias.
* No need to make the markup renders to resolve the paths, instead, the
paths are all correctly resolved in the "post process" step.
* Fix #33274
* Since 1.23, all paths starting with "/" are relative to current render
context (for example: the current repo branch)
* Introduce `/:root/path-relative-to-root`, then the path will be
rendered as relative to "ROOT_URL"
2025-04-04 23:45:23 +08:00
wxiaoguangandGitHub ba921fd903 Fix markdown frontmatter rendering (#34102)
Fix #34101
2025-04-03 05:48:24 +00:00
wxiaoguangandGitHub 285950a222 Support creating relative link to raw path in markdown (#34105)
Fix #34104
2025-04-03 01:05:43 +08:00
wxiaoguangandGitHub 6ed1b26c58 Do not show 500 error when default branch doesn't exist (#34096)
Fix #34090
2025-04-01 21:39:00 -07:00
wxiaoguangandGitHub 86c1a33369 Fix some UI bugs and clean up unused tests (#34088)
1. Make the material icon falls back to basic theme correctly
2. Remove `TestAttributeReader`, the problem has been resolved.
3. Fix `toggleElem` bug and add tests
2025-04-01 07:02:30 +00:00
wxiaoguangandGitHub b59705fa34 Add a config option to block "expensive" pages for anonymous users (#34024)
Fix #33966

```
;; User must sign in to view anything.
;; It could be set to "expensive" to block anonymous users accessing some pages which consume a lot of resources,
;; for example: block anonymous AI crawlers from accessing repo code pages.
;; The "expensive" mode is experimental and subject to change.
;REQUIRE_SIGNIN_VIEW = false
```
2025-03-30 05:26:19 +00:00
wxiaoguangandGitHub cddd19efc8 Add anonymous access support for private/unlisted repositories (#34051)
Follow #33127

Fix #8649, fix #639

This is a complete solution. A repo unit could be set to:

* Anonymous read (non-signed-in user)
* Everyone read (signed-in user)
* Everyone write (wiki-only)
2025-03-29 13:26:41 +08:00
wxiaoguangandGitHub 0d2607a303 Add anonymous access support for private repositories (backend) (#33257)
Follow #33127

This PR add backend logic and test for "anonymous access", it shares the
same logic as "everyone access", so not too much change.

By the way, split `SettingsPost` into small functions to make it easier
to make frontend-related changes in the future.

Next PR will add frontend support for "anonymous access"
2025-03-28 22:42:29 +08:00
894821d522 Fix git client accessing renamed repo (#34034)
Fix #28460

The `reqGitSignIn` is just copied-pasted code (from githtttp.go) and
causes the regression bug.

Co-authored-by: Giteabot <teabot@gitea.io>
2025-03-28 07:28:58 +08:00
wxiaoguangandGitHub 96e7369515 Try to fix check-attr bug (#34029) 2025-03-27 05:07:17 +00:00
wxiaoguangandGitHub c7b85f7070 Fix dropdown module accessing (#34026)
Follow #34014.
2025-03-26 16:01:43 +00:00
wxiaoguangandGitHub d70be9d0fe Polyfill WeakRef (#34025)
Fix #33407
2025-03-26 23:56:25 +08:00
wxiaoguangandGitHub d28a7f9fea Fix dropdown delegating and some UI problems (#34014)
The old logic is incomplete. See the comment for the improved logic.

Fix #34011

And more fixes:

1. use empty "alt" for images, otherwise the width is not right when the
image fails to load
2. remove the "dropdown icon" patch, because it has been clearly done in
"dropdown.js" now
3. remove the "dropdown filtered item" patch, added a clear callback,
and improve the logic
4. fix global init when a node is removed and added back gain (eg: the
"cherry pick" dialog with a dropdown)
2025-03-26 02:51:22 +00:00
wxiaoguangandGitHub 41c946a66f Prepare common tmpl functions in a middleware (#33957)
Fix the TODO in `routers/web/web.go`, and avoid the unnecessary
`GetActiveStopwatch` SQL query in non-related route handlers.
2025-03-25 06:17:58 +00:00
32258e0f22 Update go mod dependencies (#33988)
blevesearch is skipped because it causes errors

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2025-03-25 05:51:52 +00:00
wxiaoguangandGitHub 51d86adb6d Fix some migration and repo name problems (#33986)
1. Ignore empty inputs in `UnmarshalHandleDoubleEncode`
2. Ignore non-existing `stateEvent.User` in gitlab migration
3. Enable `release` and `wiki` units when they are selected in migration
4. Sanitize repo name for migration and new repo
2025-03-24 20:26:58 -07:00
8745129c9c Fix incorrect code search indexer options (#33992)
Fix #33798

Co-authored-by: Giteabot <teabot@gitea.io>
2025-03-24 17:18:21 +01:00
wxiaoguangandGitHub b1e326d09e Auto expand "New PR" form (#33971)
Follow GitHub's behavior: use `?expand=1` to expand the "New PR" form
2025-03-24 14:28:02 +00:00
wxiaoguangandGitHub e1bba9c1a2 Improve oauth2 error handling (#33969)
Show the callback error to end users, it should be safe.
Fix #33967
2025-03-22 10:15:45 +08:00
wxiaoguangandGitHub 279473f467 Fix oauth2 auth and UI (#33961) 2025-03-21 20:50:39 +08:00
wxiaoguangandGitHub 9d7c02f9f7 Try to figure out attribute checker problem (#33901)
For #31600
2025-03-17 11:59:34 -07:00
wxiaoguangandGitHub fdaf1cca65 Defer captcha script loading (#33919)
Fix #33899
2025-03-17 15:21:04 +00:00
wxiaoguangandGitHub 9d89dfe142 Remove unused or abused styles (#33918)
* `top aligned` => `tw-align-top`
* label list: it was broken, this PR fixes it
* reference link: simplified
* settings/repos: not affected
2025-03-17 22:11:24 +08:00
wxiaoguangandGitHub a0e0a30d23 Make SearchMode have default value and add comments (#33863)
* Make `SearchMode` have default value if it is empty
* Add some comments for the "match" queries
* Fix a copy-paste mistake in `buildMatchQuery` (`db.go`)
* Add missing `q.Analyzer = repoIndexerAnalyzer`, it is in old code,
although I do not see real difference ....
2025-03-14 18:06:31 +00:00
wxiaoguangandGitHub 45c4139134 Fix maven panic when no package exists (#33888)
Fix #33886

Restore the old logic from #16510, which was incorrectly removed by
#33678
2025-03-14 10:35:40 -07:00
wxiaoguangandGitHub 0dfa94edc8 Add old svg class name to git entry icon (#33884)
Fix https://github.com/go-gitea/gitea/pull/33837#discussion_r1995521288
2025-03-14 23:11:29 +08:00
wxiaoguangandGitHub cb6b33c9cd Ignore trivial errors when updating push data (#33864)
Fix #23213
2025-03-14 08:36:39 +00:00
b094f9b75d Improve repo commit view (#33877)
Fix #24623

Major changes:

1. Redirect `/owner/repo/blob/*` requests to `/owner/repo/src/commit/*`
(like GitHub)
2. Add a "view file diff" link (see screenshot below)
3. Refactor "AssertHTMLElement" to generic, now we can accurately assert
existence or number.
4. Add more tests

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
2025-03-14 07:45:11 +00:00
wxiaoguangandGitHub d879ec6d92 Fine tune push mirror UI (#33866) 2025-03-14 00:03:21 +00:00
wxiaoguangandGitHub 8a0f7f0975 Fix markdown render (#33870)
Fix #33869, some code block is moved to make it easier to test.

Added a new test
2025-03-13 12:14:35 -07:00
wxiaoguangandGitHub 403775e74e Improve issue & code search (#33860)
Each "indexer" should provide the "search modes" they support by
themselves. And we need to remove the "fuzzy" search for code.
2025-03-13 11:07:48 +08:00
wxiaoguangandGitHub 3996518ed4 Refactor cache-control (#33861)
And fix #21391
2025-03-13 07:04:50 +08:00
wxiaoguangandGitHub 91610a987e Fix various Fomantic UI and htmx problems (#33851)
Also fix #31328, fix #33854
2025-03-11 11:35:05 -07:00
wxiaoguangandGitHub f61f30153b Fix file icon mapping (#33855)
Use the file extension mapping from VSCode's extensions.
Otherwise js/ts/vba/... files won't get correct icons.
2025-03-11 21:06:59 +08:00
wxiaoguangandGitHub 608ccc32e5 Drop fomantic build (#33845)
We would never update or build fomantic again, we have forked it as a
private library long time ago.

So just put the JS and CSS files in "fomantic/build" into git. And use
"import" to use them.

Remove "form.js", rewrite "tab" component.

All source code is from official Fomantic UI build. Will apply patches
in separate PRs.
2025-03-11 12:44:52 +08:00
wxiaoguangandGitHub e47bba046c Fix test code (#33829)
Do not use onGiteaRun if there is no git operation
2025-03-10 21:45:42 +00:00
wxiaoguangandGitHub 7fa47de7e9 Remove "noscript" tag from html head (#33846) 2025-03-11 00:52:08 +08:00
wxiaoguangandGitHub 657239b480 Fix material icon & diff highlight (#33844) 2025-03-10 22:34:48 +08:00
wxiaoguangandGitHub c102492e5a Fix LFS URL (#33840)
Fix #33839
2025-03-10 17:36:02 +08:00
wxiaoguangandGitHub 34e5df6d30 Add material icons for file list (#33837) 2025-03-10 15:57:17 +08:00
wxiaoguangandGitHub 7290bfaccb Only keep popular licenses (#33832)
Fix #33467
2025-03-10 06:40:37 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 4ed71eb754 Improve log format (#33814) 2025-03-08 21:47:11 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub b8c2afdc5f Do not show passkey on http sites (#33820)
Fix #33615
2025-03-07 19:37:27 +00:00
wxiaoguangandGitHub ef18655215 Try to fix ACME (3rd) (#33807)
Fix #33802, fix #32191
2025-03-07 01:00:10 +00:00
wxiaoguangandGitHub 75e85c25c1 Refactor repo-issue.ts (#33784)
And remove jQuery
2025-03-04 17:58:17 +00:00
wxiaoguangandGitHub ca0ce003ab Refactor repo-settings.ts (#33785)
and remove jQuery
2025-03-05 01:19:03 +08:00
wxiaoguangandGitHub 163bbca0eb Refactor admin/common.ts (#33788)
Only remove jQuery
2025-03-04 23:42:07 +08:00
wxiaoguangandGitHub 216243eee2 Refactor error system (#33771)
It should not expose `util.SilentWrap` or construct it manually.
2025-03-03 05:36:10 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 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
wxiaoguangandGitHub 4e56d5f39f Refactor repo-diff.ts (#33746)
Remove jQuery
2025-02-28 16:37:16 +08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub 8db8a3b0d1 Improve admin user view page (#33735)
1. show more user types
2. show prohibited state
2025-02-27 17:47:37 +08:00
wxiaoguangandGitHub 555d64d024 Always show the "rerun" button for action jobs (#33692)
And improve the mock code.
2025-02-24 08:40:46 +00:00
wxiaoguangandGitHub 56a0a9c750 Fix git empty check and HEAD request (#33690) 2025-02-24 02:11:29 +00:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub f991807f7e Try to fix ACME path when renew (#33668)
Try to fix #32191
2025-02-23 13:12:08 +08:00
wxiaoguangandGitHub ead716d204 Improve Open-with URL encoding (#33666)
Fix #33665
2025-02-21 17:46:05 +00:00
4adb7cad8b Improve swagger generation (#33664)
Remove most "sed" tricks

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-02-21 00:04:30 -08:00
wxiaoguangandGitHub 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
wxiaoguangandGitHub cd225d7034 Fix mCaptcha bug (#33659)
Fix #33658
2025-02-20 22:53:38 +08:00