Commit Graph

18155 Commits

Author SHA1 Message Date
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
Zettat123 f1d9f18d96
Return `access_denied` error when an OAuth2 request is denied (#30974)
According to [RFC
6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1),
when the resource owner or authorization server denied an request, an
`access_denied` error should be returned. But currently in this case
Gitea does not return any error.

For example, if the user clicks "Cancel" here, an `access_denied` error
should be returned.

<img width="360px"
src="https://github.com/go-gitea/gitea/assets/15528715/be31c09b-4c0a-4701-b7a4-f54b8fe3a6c5"
/>
2024-05-20 07:17:00 +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
wxiaoguang 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
GiteaBot 82a0c36332 [skip ci] Updated licenses and gitignores 2024-05-20 00:25:39 +00:00
wxiaoguang 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
Lunny Xiao 58a03e9fad
Fix bug on avatar (#31008)
Co-authored-by: silverwind <me@silverwind.io>
2024-05-19 12:58:39 +08:00
silverwind 028992429a
Clean up revive linter config, tweak golangci output (#30980)
The `errorCode` and `warningCode` options were removed at some point,
they are not recognized by golangci-lint any more at least and they do
not match their published json schema. `confidence` and
`ignore-generated-header` are at the default value so does not need to
be configured.

https://golangci-lint.run/usage/linters/#revive
2024-05-18 08:53:28 +00:00
wxiaoguang 821d2fc2a3
Simplify mirror repository API logic (#30963)
Fix #30921
2024-05-17 16:07:41 +00:00
GiteaBot 68d5c18953 [skip ci] Updated translations via Crowdin 2024-05-17 00:25:42 +00:00
silverwind a73e3c6a69
Upgrade `tqdm` dependency (#30996)
Result of `make update-py`

Fixes: https://github.com/go-gitea/gitea/security/dependabot/65
2024-05-16 19:40:57 +00:00
wxiaoguang 740b6e1389
Fix JS error when editing a merged PR's title (#30990) 2024-05-16 13:04:25 +00:00
Frank Villaro-Dixon 2611249511
template: `label` fix correct input id (#30987)
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
2024-05-16 14:36:31 +08:00
silverwind ea8e4baacc
Put web editor into a segment (#30966)
Implement
https://github.com/go-gitea/gitea/pull/30707#issuecomment-2084126206

Diff without whitespace:
https://github.com/go-gitea/gitea/pull/30966/files?diff=unified&w=1

Might as well backport.
2024-05-15 14:54:34 +00:00
Zettat123 fc89363832
Check if the release is converted from the tag when updating the release (#30984)
Call `notify_service.NewRelease` when a release is created
from an existing tag.
2024-05-15 14:25:47 +00:00
dicarne d0d6aad85f
Supports forced use of S3 virtual-hosted style (#30969)
Add a configuration item to enable S3 virtual-hosted style (V2) to solve
the problem caused by some S3 service providers not supporting path
style (V1).
2024-05-15 08:56:17 -05:00
GiteaBot db578431ea [skip ci] Updated translations via Crowdin 2024-05-15 00:25:44 +00:00
Lunny Xiao 5b6f80989f
Remove unnecessary double quotes on language file (#30977)
The double quotes and the prefix/suffix space are unnecessary.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-05-15 01:06:12 +02: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
KN4CK3R b1d8f13bd0
Protected tag is no internal server error (#30962)
Fixes #30959

Adds an API test for protected tags.
Fix existing tag in combination with fixtures.
2024-05-14 06:48:21 +00:00
GiteaBot 9a577c62e4 [skip ci] Updated translations via Crowdin 2024-05-14 00:25:02 +00:00
silverwind ed25676a9a
Restyle release list, fix branch dropdown (#30837)
Fixes https://github.com/go-gitea/gitea/issues/30821 and restyles the
release list.

Desktop:

<img width="1199" alt="Screenshot 2024-05-02 at 20 46 10"
src="https://github.com/go-gitea/gitea/assets/115237/bee92423-d4a9-4b26-8301-3a1e09eef4cd">


Mobile:

<img width="443" alt="Screenshot 2024-05-02 at 20 46 21"
src="https://github.com/go-gitea/gitea/assets/115237/42ecbae5-bdb6-4b16-a0ee-9c64daede68d">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2024-05-13 23:33:51 +02:00
james yang 8218b6484c
fix: change npm scope registry (#30964)
https://docs.npmjs.com/cli/v10/using-npm/scope#associating-a-scope-with-a-registry
2024-05-13 22:05:56 +08:00
Zettat123 b3beaed147
Support using label names when changing issue labels (#30943)
Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>
2024-05-13 04:28:53 +00:00
GiteaBot 2442ead680 [skip ci] Updated licenses and gitignores 2024-05-13 00:26:15 +00:00
silverwind 301eaf60bf
Fix file path width in repo non-homepage view (#30951)
Fixes: https://github.com/go-gitea/gitea/issues/30940

<img width="1310" alt="Screenshot 2024-05-11 at 20 48 41"
src="https://github.com/go-gitea/gitea/assets/115237/f163dfd4-1299-421f-a99e-cd0c793e0e3d">
2024-05-12 04:02:25 +00:00
silverwind 46b7004f05
Enable `declaration-block-no-redundant-longhand-properties` (#30950)
Enable
[`declaration-block-no-redundant-longhand-properties`](https://stylelint.io/user-guide/rules/declaration-block-no-redundant-longhand-properties/)
and autofix issues. The exclusions are because I find these two
shorthands to be harder to read.
2024-05-12 02:33:05 +00:00
GiteaBot f80b403dc9 [skip ci] Updated translations via Crowdin 2024-05-12 00:27:35 +00:00
Lunny Xiao 26ae592234
Move reverproxyauth before session so the header will not be ignored even if user has login (#27821)
When a user logout and then login another user, the reverseproxy auth
should be checked before session otherwise the old user is still login.
2024-05-11 14:55:49 +00:00
silverwind 3c2406a2f3
Use CSS `inset` shorthand (#30939)
Use [inset](https://developer.mozilla.org/en-US/docs/Web/CSS/inset)
shorthand instead of longhands. There may be more cases but these ones I
was able to definitely identify.
2024-05-11 14:28:56 +00:00
Lunny Xiao 40de54ece8
Remove If Exist check on migration for mssql because that syntax required SQL server 2016 (#30894)
Fix #30872

We will assume the database is consistent before executing the
migration. So the indexes should exist. Removing `IF EXIST` then is safe
enough.

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-05-11 22:16:09 +08:00
silverwind 1f3ada47a3
Update JS dependencies, add new eslint rules (#30840) 2024-05-10 18:53:43 +00:00
wxiaoguang 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
silverwind 5556782ebe
Forbid deprecated `break-word` in CSS (#30934)
Forbid
[deprecated](https://drafts.csswg.org/css-text-3/#word-break-property)
`break-word` and fix all occurences.

Regarding `overflow-wrap: break-word` vs `overflow-wrap: anywhere`:

Example of difference: https://jsfiddle.net/silverwind/1va6972r/

[Here](https://stackoverflow.com/questions/77651244) it says:

> The differences between normal, break-word and anywhere are only clear
if you are using width: min-content on the element containing the text,
and you also set a max-width. A pretty rare scenario.

I don't think this difference will make any practical impact as we are
not hitting this rare scenario.
2024-05-10 12:25:49 +00:00
wxiaoguang 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
Jason Song b9396a9b85
Remove deprecated stuff for runners (#30930)
It's time (maybe somewhat late) to remove some deprecated stuff for the
runner.

- `x-runner-version`: runners needn't to report version in every
request, they will call `Declare`.
- `AgentLabels`: runners will report them as `Labels`.
2024-05-10 16:23:47 +08:00
yp05327 e94723f2de
Fix incorrect default branch when adopt a repository (#30912)
Fix #30521

we should sync branches first, then detect default branch, or
`git_model.FindBranchNames` will always return empty list, and the
detection will be wrong.
2024-05-09 08:44:26 +00:00
wxiaoguang ed0fc2729e
Add missing menu active item background back (#30897)
Fix #30578
2024-05-08 23:01:25 +00:00
yp05327 f7d2f695a4
Fix misspelling of mergable (#30896)
https://github.com/go-gitea/gitea/pull/25812#issuecomment-2099833692
Follow #30573
2024-05-08 16:11:43 +00:00
wxiaoguang 3fdb2d4ad8
Fix incorrect issue form (#30881)
Fix #30864
2024-05-08 15:39:13 +00:00
Zettat123 f09e68ec33
Update issue indexer after merging a PR (#30715)
Fix #30684
2024-05-08 14:45:15 +00:00
Lunny Xiao a303c973e0
Fix various problems around projects board view (#30696)
# The problem
The previous implementation will start multiple POST requests from the
frontend when moving a column and another bug is moving the default
column will never be remembered in fact.

# What's changed

- [x] This PR will allow the default column to move to a non-first
position
- [x] And it also uses one request instead of multiple requests when
moving the columns
- [x] Use a star instead of a pin as the icon for setting the default
column action
- [x] Inserted new column will be append to the end
- [x] Fix #30701 the newly added issue will be append to the end of the
default column
- [x] Fix when deleting a column, all issues in it will be displayed
from UI but database records exist.
- [x] Add a limitation for columns in a project to 20. So the sorting
will not be overflow because it's int8.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-05-08 13:44:57 +00:00
Lunny Xiao f5f921c095
Fix wrong transfer hint (#30889)
Fix #30187
2024-05-08 13:17:11 +00:00
silverwind d9b37d085a
Remove obsolete monaco workaround (#30893)
This workaround is not neccessary any more since monaco 0.35.0.

Ref: https://github.com/microsoft/monaco-editor/issues/2962
Ref: https://github.com/microsoft/vscode/pull/173688
2024-05-08 02:42:33 +00:00
GiteaBot f1b0729078 [skip ci] Updated translations via Crowdin 2024-05-08 00:21:06 +00:00
Kemal Zebari 880e0b7c82
Apply to become a maintainer (#30884)
Hello! After contributing for some time I am interested in taking a more
involved role as a maintainer. When time allows it, I plan to perform
code reviews, continue resolving/triaging issues, and engage with the
community to see if I can offer any useful insights. My current
interests are in backend work, but I plan to study the web frontend
architecture to see if I can contribute there as well.

Thanks for this awesome project. I hope I can both learn and contribute
to its continued success!

PR list:
https://github.com/go-gitea/gitea/pulls?q=is%3Apr+is%3Aclosed+author%3Akemzeb
Discord: kemzeb
2024-05-07 14:41:52 +02:00