]> source.dussan.org Git - gitea.git/log
gitea.git
9 months agoAdd global setting how timestamps should be rendered (#28657)
Yarden Shoham [Tue, 2 Jan 2024 01:25:30 +0000 (03:25 +0200)]
Add global setting how timestamps should be rendered (#28657)

- Resolves https://github.com/go-gitea/gitea/issues/22493
- Related to https://github.com/go-gitea/gitea/issues/4520

Some admins prefer all timestamps to display the full date instead of
relative time. They can do that now by setting

```ini
[ui]
PREFERRED_TIMESTAMP_TENSE = absolute
```

This setting is set to `mixed` by default, allowing dates to render as
"5 hours ago". Here are some screenshots of the UI with this setting set
to `absolute`:

![image](https://github.com/go-gitea/gitea/assets/20454870/f496457f-6afa-44be-a1e7-249ee5fe0706)

![image](https://github.com/go-gitea/gitea/assets/20454870/c03b14f5-063d-4e13-9780-76ab002d76a9)

![image](https://github.com/go-gitea/gitea/assets/20454870/f4b34e28-1546-4374-9199-c43348844edd)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: delvh <dev.lh@web.de>
9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 1 Jan 2024 00:27:55 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

9 months agoUpgrade xorm to new version which supported update join for all supported databases...
Lunny Xiao [Sun, 31 Dec 2023 05:00:35 +0000 (13:00 +0800)]
Upgrade xorm to new version which supported update join for all supported databases (#28590)

Fix https://github.com/go-gitea/gitea/pull/28547#issuecomment-1867740842

Since https://gitea.com/xorm/xorm/pulls/2383 merged, xorm now supports
UPDATE JOIN.
To keep consistent from different databases, xorm use
`engine.Join().Update`, but the actural generated SQL are different
between different databases.

For MySQL, it's `UPDATE talbe1 JOIN table2 ON join_conditions SET xxx
Where xxx`.

For MSSQL, it's `UPDATE table1 SET xxx FROM TABLE1, TABLE2 WHERE
join_conditions`.

For SQLITE per https://www.sqlite.org/lang_update.html, sqlite support
`UPDATE table1 SET xxx FROM table2 WHERE join conditions` from
3.33.0(2020-8-14).

POSTGRES is the same as SQLITE.

9 months agoFix: system webhooks API bug (#28531)
vincent [Sun, 31 Dec 2023 04:31:50 +0000 (12:31 +0800)]
Fix: system webhooks API bug (#28531)

- Fix the bug about admin/hooks API that `GET /admin/hooks` can only
fetch system_hooks, `POST /admin/hooks` can only create default_hooks.

9 months agoFix alpine package files are not rebuilt (#28638)
Nanguan Lin [Sun, 31 Dec 2023 04:08:46 +0000 (12:08 +0800)]
Fix alpine package files are not rebuilt (#28638)

I noticed the `BuildAllRepositoryFiles` function under the Alpine folder
is unused and I thought it was a bug.
But I'm not sure about this. Was it on purpose?

9 months agoFix migration test (#28659)
Lunny Xiao [Sat, 30 Dec 2023 13:54:48 +0000 (21:54 +0800)]
Fix migration test (#28659)

9 months agoAvoid cycle-redirecting user/login page (#28636)
wxiaoguang [Sat, 30 Dec 2023 08:48:34 +0000 (16:48 +0800)]
Avoid cycle-redirecting user/login page (#28636)

Fix #28231, and remove some unused code. The `db.HasEngine` doesn't seem
useful because the db engine is always initialized before web route.

9 months agoFix long package version names overflowing (#28619)
Mihir Joshi [Sat, 30 Dec 2023 07:42:16 +0000 (13:12 +0530)]
Fix long package version names overflowing (#28619)

Fixes #28534

---
Before:

![image](https://github.com/go-gitea/gitea/assets/50193156/b229551c-0a7d-4a99-9553-1f11b994876a)

After:
<img width="304" alt="image"
src="https://github.com/go-gitea/gitea/assets/50193156/53d04ad0-6d5c-47e2-8a7d-30a4d5dd9959">

Should we also apply this for long filenames in Assets?
It looks like this currently:
<img width="285" alt="image"
src="https://github.com/go-gitea/gitea/assets/50193156/e2dcbb2e-30d5-4e35-b304-6274ef60bda7">

---------

Co-authored-by: Mihir <mihir.joshi@senpiper.com>
9 months agoUpdate JS dependencies (#28537)
silverwind [Sat, 30 Dec 2023 05:29:03 +0000 (06:29 +0100)]
Update JS dependencies (#28537)

- Update all JS dependencies excluding mcaptcha (breaking changes) and
stylelint (plugin not compatible with v16)
- Regenerate SVGs
- Update markdownlint rule names
- Fix one issue of heading in markdown discovered during lint
- Update for monaco options renames
- Fix stylelint rule length-zero-no-unit for custom properties
- Tested editor, swagger, sorting, vue, lint

9 months agoImprove document for ARTIFACT_RETENTION_DAYS (#28646)
wxiaoguang [Fri, 29 Dec 2023 06:44:58 +0000 (14:44 +0800)]
Improve document for ARTIFACT_RETENTION_DAYS (#28646)

Follow #28626

9 months agofix empty ref for cron workflow runs (#28640)
Denys Konovalov [Fri, 29 Dec 2023 06:18:57 +0000 (07:18 +0100)]
fix empty ref for cron workflow runs (#28640)

Fix #27678
Please see
https://github.com/go-gitea/gitea/issues/27678#issuecomment-1871445853
for details.

9 months agoImprove 1.22 document for Database Preparation (#28643)
wxiaoguang [Fri, 29 Dec 2023 05:42:22 +0000 (13:42 +0800)]
Improve 1.22 document for Database Preparation (#28643)

Fix #28247

9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 29 Dec 2023 00:20:25 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

9 months agoswitch destination directory for apt signing keys (#28639)
Denys Konovalov [Thu, 28 Dec 2023 21:08:59 +0000 (22:08 +0100)]
switch destination directory for apt signing keys (#28639)

According to [Debian
docs](https://wiki.debian.org/DebianRepository/UseThirdParty):

> The certificate MUST NOT be placed in /etc/apt/trusted.gpg.d or loaded
by apt-key add.
> ...
> If future updates to the certificate will be managed by an apt/dpkg
package as recommended below, then it SHOULD be downloaded into
/usr/share/keyrings using the same filename that will be provided by the
package. If it will be managed locally , it SHOULD be downloaded into
/etc/apt/keyrings instead.
> ...
> A sources.list entry SHOULD have the signed-by option set.

9 months agoExtend description for ARTIFACT_RETENTION_DAYS (#28626)
Gerd Katzenbeisser [Thu, 28 Dec 2023 10:11:44 +0000 (11:11 +0100)]
Extend description for ARTIFACT_RETENTION_DAYS (#28626)

Make it clear that this value is just a default value and that every
artifact can have it's own value.

9 months agoRefactor timeutil package (#28623)
wxiaoguang [Thu, 28 Dec 2023 10:09:57 +0000 (18:09 +0800)]
Refactor timeutil package (#28623)

1. make names more readable
2. remove unused FormatLong/FormatShort
3. use `FormatDate` instead of `Format "2006-01-02"`

9 months agoRefactor some legacy code and remove unused code (#28622)
wxiaoguang [Thu, 28 Dec 2023 09:38:59 +0000 (17:38 +0800)]
Refactor some legacy code and remove unused code (#28622)

1. use slices.Contains, remove Int64sContains
2. use HashEmail, remove base.EncodeMD5
3. remove BasicAuthEncode, IsLetter

9 months agoRemove unnecessary syncbranchToDB with tests (#28624)
Lunny Xiao [Thu, 28 Dec 2023 07:28:57 +0000 (15:28 +0800)]
Remove unnecessary syncbranchToDB with tests (#28624)

#28361 introduced `syncBranchToDB` in `CreateNewBranchFromCommit`. This
PR will revert the change because it's unnecessary. Every push will
already be checked by `syncBranchToDB`.
This PR also created a test to ensure it's right.

9 months agoDo not set `Accept` header twice (#28598)
KN4CK3R [Thu, 28 Dec 2023 03:59:00 +0000 (04:59 +0100)]
Do not set `Accept` header twice (#28598)

Revert #28550

Don't add the `Accept` header twice.

9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 28 Dec 2023 00:24:21 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

9 months agofix wrong link in user and organization profile when using relative url (#28617)
katsu [Wed, 27 Dec 2023 08:32:27 +0000 (16:32 +0800)]
fix wrong link in user and organization profile when using relative url (#28617)

fix #28436.
the doc https://docs.gitea.com/usage/profile-readme maybe also need to
be updated to tell that
the main branch is necessary,which means the following three conditions
should be satisfied:
- repo: **.profile**
- branch: **[default branch]**
- markdown: **README.md**

9 months agoAdd get actions runner registration token for API routes, repo, org, user and global...
Lunny Xiao [Wed, 27 Dec 2023 07:57:54 +0000 (15:57 +0800)]
Add get actions runner registration token for API routes, repo, org, user and global level (#27144)

Replace #23761

---------

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
9 months agoFix session key conflict with database keyword (#28613)
Lunny Xiao [Wed, 27 Dec 2023 07:24:23 +0000 (15:24 +0800)]
Fix session key conflict with database keyword (#28613)

This is a regression from #28220 .
`builder.Cond` will not add `` ` `` automatically but xorm method
`Get/Find` adds `` ` ``.

This PR also adds tests to prevent the method from being implemented
incorrectly. The tests are added in `integrations` to test every
database.

9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 27 Dec 2023 00:23:45 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

9 months agoUse known issue IID to generate new PR index number when migrating from GitLab (...
wxiaoguang [Tue, 26 Dec 2023 17:57:25 +0000 (01:57 +0800)]
Use known issue IID to generate new PR index number when migrating from GitLab (#28616)

Fix #13884

9 months agoUpdate repo-mirror.en-us.md (#28612)
Volodymyr Stelmashchuk [Tue, 26 Dec 2023 16:36:11 +0000 (18:36 +0200)]
Update repo-mirror.en-us.md (#28612)

Add small changes to the doc. The workflow scope require for push code
to github mirror in case the project use the github action compatibility
ui.

9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 26 Dec 2023 00:24:05 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

9 months agoRefactor deletion (#28610)
delvh [Mon, 25 Dec 2023 20:25:29 +0000 (21:25 +0100)]
Refactor deletion (#28610)

Introduce the new generic deletion methods
- `func DeleteByID[T any](ctx context.Context, id int64) (int64, error)`
- `func DeleteByIDs[T any](ctx context.Context, ids ...int64) error`
- `func Delete[T any](ctx context.Context, opts FindOptions) (int64,
error)`

So, we no longer need any specific deletion method and can just use
the generic ones instead.

Replacement of #28450

Closes #28450

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
9 months agoRefactor CORS handler (#28587)
wxiaoguang [Mon, 25 Dec 2023 12:13:18 +0000 (20:13 +0800)]
Refactor CORS handler (#28587)

The CORS code has been unmaintained for long time, and the behavior is
not correct.

This PR tries to improve it. The key point is written as comment in
code. And add more tests.

Fix #28515
Fix #27642
Fix #17098

9 months agoAdded instance-level variables (#28115)
Jean-Baptiste Gomond [Mon, 25 Dec 2023 07:28:59 +0000 (08:28 +0100)]
Added instance-level variables (#28115)

This PR adds instance-level variables, and so closes #27726

![gitea_instance_variables_1](https://github.com/go-gitea/gitea/assets/8344487/ad409cd4-ce36-4c84-a764-34451b0fb63a)

![gitea_instance_variables_2](https://github.com/go-gitea/gitea/assets/8344487/426f0965-dec6-4560-948c-067cdeddd720)

![gitea_instance_variables_3](https://github.com/go-gitea/gitea/assets/8344487/cf1d7776-4938-4825-922e-cbbbf28a5f33)

9 months agoRevert "improve possible performance bottleneck (#28547)" (#28593)
Lunny Xiao [Mon, 25 Dec 2023 06:52:17 +0000 (14:52 +0800)]
Revert "improve possible performance bottleneck (#28547)" (#28593)

This reverts commit b35d3fddfac389a7be401a63b4e1283dd74af681.

This is totally wrong. I think `Update join` hasn't been supported well
by xorm.

I just revert the PR and will try to send another one.

9 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 25 Dec 2023 00:25:23 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

9 months agoFix flex container width (#28603)
wxiaoguang [Sun, 24 Dec 2023 14:39:02 +0000 (22:39 +0800)]
Fix flex container width (#28603)

Fix #28489

9 months agoFix the scroll behavior for emoji/mention list (#28597)
wxiaoguang [Sun, 24 Dec 2023 05:08:41 +0000 (13:08 +0800)]
Fix the scroll behavior for emoji/mention list (#28597)

Fix #28595 by https://github.com/github/combobox-nav/pull/79 (combobox-nav v2.3.1)

9 months agobump to use alpine3.19 (#28594)
techknowlogick [Sat, 23 Dec 2023 21:04:58 +0000 (16:04 -0500)]
bump to use alpine3.19 (#28594)

9 months agoInclude heap pprof in diagnosis report to help debugging memory leaks (#28596)
wxiaoguang [Sat, 23 Dec 2023 19:06:02 +0000 (03:06 +0800)]
Include heap pprof in diagnosis report to help debugging memory leaks (#28596)

9 months agoDisable query token param in integration tests (#28592)
Kyle D [Sat, 23 Dec 2023 03:29:51 +0000 (22:29 -0500)]
Disable query token param in integration tests (#28592)

Follow up to https://github.com/go-gitea/gitea/pull/28484, this PR
enables the setting for integration tests and migrates a few additional
test queries.

9 months agoFix wrong due date rendering in issue list page (#28588)
Yarden Shoham [Fri, 22 Dec 2023 16:53:12 +0000 (18:53 +0200)]
Fix wrong due date rendering in issue list page (#28588)

It included the hours, minutes, and seconds. By removing these, the date
renders correctly.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
9 months agoFix `status_check_contexts` matching bug (#28582)
Zettat123 [Fri, 22 Dec 2023 13:29:50 +0000 (21:29 +0800)]
Fix `status_check_contexts` matching bug (#28582)

Fix #28570
Follow #24633

---
Copied from
https://github.com/go-gitea/gitea/issues/28570#issuecomment-1867327999

The feature introduced in #24633 should be compatible with
`status_check_contexts`. However, if one or more of
`status_check_contexts` is not a legal glob expressions, `glob.Compile`
will fail and the contexts cannot match.

https://github.com/go-gitea/gitea/blob/21229ed2c8ed00f57100adf9ebc5f4a08da9a66e/routers/web/repo/pull.go#L653-L663

9 months agoFix 405 method not allowed CORS / OIDC (#28583)
morphelinho [Fri, 22 Dec 2023 12:23:24 +0000 (13:23 +0100)]
Fix 405 method not allowed CORS / OIDC (#28583)

Follow #28184
Follow #28515

Fix problem with 405 method not allowed for CORS wrt OIDC

9 months agoAdd more ways to try (#28581)
Jason Song [Fri, 22 Dec 2023 06:20:59 +0000 (14:20 +0800)]
Add more ways to try (#28581)

9 months agoConvert to url auth to header auth in tests (#28484)
KN4CK3R [Thu, 21 Dec 2023 23:59:59 +0000 (00:59 +0100)]
Convert to url auth to header auth in tests (#28484)

Related #28390

9 months agoFix 500 error of searching commits (#28576)
wxiaoguang [Thu, 21 Dec 2023 23:09:14 +0000 (07:09 +0800)]
Fix 500 error of searching commits (#28576)

Regression of #28454 . Now the string is escaped HTML, so it doesn't
need `| Safe`.

Fix #28575

9 months agoimprove possible performance bottleneck (#28547)
Lunny Xiao [Thu, 21 Dec 2023 22:25:57 +0000 (06:25 +0800)]
improve possible performance bottleneck (#28547)

Replace #28500

---------

Co-authored-by: Giteabot <teabot@gitea.io>
9 months agoUse information from previous blame parts (#28572)
KN4CK3R [Thu, 21 Dec 2023 21:48:18 +0000 (22:48 +0100)]
Use information from previous blame parts (#28572)

Fixes #28545

`git blame` output can contain blocks without commit information if it
was outputted before (the `0dafa97ea3f6d9662299579e5be1875cd28baaae 48
26 1` line):
```
fec25436488499df7231f63b857f66457c193d5c 24 25 1
author Bastien Montagne
author-mail <bastien@blender.org>
author-time 1660731031
author-tz +0200
committer Bastien Montagne
committer-mail <bastien@blender.org>
committer-time 1660731031
committer-tz +0200
summary LibOverride: Add Make/Reset/Clear entries to IDTemplate contextual menu.
previous 839ece6477203382b7a7483062961540180ff1cd source/blender/editors/interface/interface_ops.c
filename source/blender/editors/interface/interface_ops.c
        #include "BLT_translation.h"
0dafa97ea3f6d9662299579e5be1875cd28baaae 48 26 1

3d57bc4397fca53bc9702a27bbf50102827829b0 27 27 1
author Hans Goudey
author-mail <hans@blender.org>
author-time 1700131315
author-tz +0100
committer Hans Goudey
committer-mail <hooglyboogly@noreply.localhost>
committer-time 1700131315
committer-tz +0100
summary Cleanup: Move several blenkernel headers to C++
previous 451c054d9b7d3148a646caa5a72fb127a5b5c408 source/blender/editors/interface/interface_ops.cc
filename source/blender/editors/interface/interface_ops.cc
        #include "BKE_context.hh"
```
This PR reuses data from the previous blame part to fill these gaps.

9 months agoMake offline mode as default to no connect external avatar service by default (#28548)
Lunny Xiao [Thu, 21 Dec 2023 07:42:16 +0000 (15:42 +0800)]
Make offline mode as default to no connect external avatar service by default (#28548)

To keep user's privacy, make offline mode as true by default.

Users can still change it from installation ui and app.ini

9 months agoFix merging artifact chunks error when minio storage basepath is set (#28555)
FuXiaoHei [Thu, 21 Dec 2023 07:04:50 +0000 (15:04 +0800)]
Fix merging artifact chunks error when minio storage basepath is set (#28555)

Related to  https://github.com/go-gitea/gitea/issues/28279

When merging artifact chunks, it lists chunks from storage. When storage
is minio, chunk's path contains `MINIO_BASE_PATH` that makes merging
break.

<del>So trim the `MINIO_BASE_PATH` when handle chunks.</del>

Update the chunk file's basename to retain necessary information. It
ensures that the directory in the chunk's path remains unaffected.

9 months agofeat: bump `dessant/lock-threads` and `actions/setup-go` to use nodejs20 runtime...
Rui Chen [Thu, 21 Dec 2023 05:31:04 +0000 (00:31 -0500)]
feat: bump `dessant/lock-threads` and `actions/setup-go` to use nodejs20 runtime (#28565)

Update more actions to use nodejs20 runtime and also update the docs for
checkout action usage.

similar to:
- #27836
- #27096

---------

Signed-off-by: Rui Chen <rui@chenrui.dev>
9 months agoUpdate actions document about comparsion as Github Actions (#28560)
Lunny Xiao [Wed, 20 Dec 2023 20:12:25 +0000 (04:12 +0800)]
Update actions document about comparsion as Github Actions (#28560)

9 months agoFix inperformant query on retrifing review from database. (#28552)
6543 [Wed, 20 Dec 2023 15:19:58 +0000 (16:19 +0100)]
Fix inperformant query on retrifing review from database. (#28552)

can we please PLEAS PLEASE only use raw SQL statements if it is relay
needed!!!

source is https://github.com/go-gitea/gitea/pull/28544 (before
refactoring)

9 months agoFix the issue ref rendering for wiki (#28556)
wxiaoguang [Wed, 20 Dec 2023 14:11:59 +0000 (22:11 +0800)]
Fix the issue ref rendering for wiki (#28556)

Fix #28526, regression of
* #26365

(although the author of #26365 has recent activities, but there is no
response for the regression, so I proposed this quick fix and keep the
fix simple to make it easier to backport to 1.21)

9 months agoAdd missing head of lfs client batch (#28550)
Lunny Xiao [Wed, 20 Dec 2023 11:54:34 +0000 (19:54 +0800)]
Add missing head of lfs client batch (#28550)

ref https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#git-lfs-batch-api

9 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 20 Dec 2023 00:20:44 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

9 months agoRemove deadcode under models/issues (#28536)
Nanguan Lin [Tue, 19 Dec 2023 19:12:02 +0000 (03:12 +0800)]
Remove deadcode under models/issues (#28536)

Using the Go Official tool `golang.org/x/tools/cmd/deadcode@latest`
mentioned by [go blog](https://go.dev/blog/deadcode).
Just use `deadcode .` in the project root folder and it gives a list of
unused functions. Though it has some false alarms.
This PR removes dead code detected in `models/issues`.

9 months agoAlways enable caches (#28527)
Lunny Xiao [Tue, 19 Dec 2023 09:29:05 +0000 (17:29 +0800)]
Always enable caches (#28527)

Nowadays, cache will be used on almost everywhere of Gitea and it cannot
be disabled, otherwise some features will become unaviable.

Then I think we can just remove the option for cache enable. That means
cache cannot be disabled.
But of course, we can still use cache configuration to set how should
Gitea use the cache.

9 months agoImprove ObjectFormat interface (#28496)
Lunny Xiao [Tue, 19 Dec 2023 07:20:47 +0000 (15:20 +0800)]
Improve ObjectFormat interface (#28496)

The 4 functions are duplicated, especially as interface methods. I think
we just need to keep `MustID` the only one and remove other 3.

```
MustID(b []byte) ObjectID
MustIDFromString(s string) ObjectID
NewID(b []byte) (ObjectID, error)
NewIDFromString(s string) (ObjectID, error)
```

Introduced the new interfrace method `ComputeHash` which will replace
the interface `HasherInterface`. Now we don't need to keep two
interfaces.

Reintroduced `git.NewIDFromString` and `git.MustIDFromString`. The new
function will detect the hash length to decide which objectformat of it.
If it's 40, then it's SHA1. If it's 64, then it's SHA256. This will be
right if the commitID is a full one. So the parameter should be always a
full commit id.

@AdamMajer Please review.

9 months agoFix duplicate ID when deleting repo (#28520)
David Øvrelid [Tue, 19 Dec 2023 04:40:05 +0000 (05:40 +0100)]
Fix duplicate ID when deleting repo (#28520)

There is an accessibility issue in the interface when attempting to
delete a repository. When I click on "Delete repository," a dialog box
appears, requiring confirmation to proceed with the repository deletion.
However, when I press the "Repo name" label, the wrong input field gains
focus. The focused field is located behind the dialog and is intended
for renaming the repository.

9 months agochore(api): support ignore password if login source type is LDAP for creating user...
Bo-Yi Wu [Tue, 19 Dec 2023 02:32:45 +0000 (10:32 +0800)]
chore(api): support ignore password if login source type is LDAP for creating user API (#28491)

- Modify the `Password` field in `CreateUserOption` struct to remove the
`Required` tag
- Update the `v1_json.tmpl` template to include the `email` field and
remove the `password` field

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
9 months agoUpdate go dependencies (#28518)
wxiaoguang [Tue, 19 Dec 2023 01:18:42 +0000 (09:18 +0800)]
Update go dependencies (#28518)

Update golang.org/x/crypto for CVE-2023-48795 and update other packages.
`go-git` is not updated because it needs time to figure out why some
tests fail.

9 months agoBump google/go-github to v57 (#28514)
Yevhen Pavlov [Mon, 18 Dec 2023 21:42:04 +0000 (23:42 +0200)]
Bump google/go-github to v57 (#28514)

10 months agoOnly check online runner when detecting matching runners in workflows (#28286)
yp05327 [Mon, 18 Dec 2023 16:06:19 +0000 (01:06 +0900)]
Only check online runner when detecting matching runners in workflows (#28286)

Mentioned:
[#28277](https://github.com/go-gitea/gitea/issues/28277#issuecomment-1831325276)

We should only check online runner when detecting matching runners in
workflows,
as if runner is not online, the workflow will not run.

![image](https://github.com/go-gitea/gitea/assets/18380374/11855e9d-7241-4b7a-b8d7-49dbb94ba1c5)

10 months agoAdd orphaned topic consistency check (#28507)
Earl Warren [Mon, 18 Dec 2023 15:32:08 +0000 (16:32 +0100)]
Add orphaned topic consistency check (#28507)

- If a topic has zero repository count, it means that none of the
repositories are using that topic, that would make them 'useless' to
keep. One caveat is that if that topic is going to be used in the
future, it will be added again to the database, but simply with a new
ID.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1964

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoImprove the prompt for "ssh-keygen sign" (#28509)
wxiaoguang [Mon, 18 Dec 2023 14:53:04 +0000 (22:53 +0800)]
Improve the prompt for "ssh-keygen sign" (#28509)

Close #28505, ref:
* https://github.com/go-gitea/gitea/pull/20112#issuecomment-1165423026
* https://github.com/go-gitea/gitea/issues/28505#issuecomment-1860048116

10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 18 Dec 2023 00:25:45 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoAdd option to disable ambiguous unicode characters detection (#28454)
wxiaoguang [Sun, 17 Dec 2023 14:38:54 +0000 (22:38 +0800)]
Add option to disable ambiguous unicode characters detection (#28454)

* Close #24483
* Close #28123
* Close #23682
* Close #23149

(maybe more)

10 months agoAdjust object format interface (#28469)
Lunny Xiao [Sun, 17 Dec 2023 11:56:08 +0000 (19:56 +0800)]
Adjust object format interface (#28469)

- Remove `ObjectFormatID`
- Remove function `ObjectFormatFromID`.
- Use `Sha1ObjectFormat` directly but not a pointer because it's an
empty struct.
- Store `ObjectFormatName` in `repository` struct

10 months agoRemove duplicate option in admin screen and now-unused translation keys (#28492)
The Magician [Sun, 17 Dec 2023 04:33:37 +0000 (04:33 +0000)]
Remove duplicate option in admin screen and now-unused translation keys (#28492)

Resolves https://github.com/go-gitea/gitea/issues/28451.

This change follows the recommendation by wxiaoguang to remove the
"Disable Minimum Key Size Check" from the "Service Configuration"
section of the UI, because this option belongs to the "SSH
Configuration" section of the administration menu and already has a
functioning indicator in that section of the UI.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 17 Dec 2023 00:26:56 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoInitalize stroage for orphaned repository doctor (#28487)
Earl Warren [Sat, 16 Dec 2023 12:17:39 +0000 (13:17 +0100)]
Initalize stroage for orphaned repository doctor (#28487)

- When a repository is orphaned and has objects stored in any of the
storages such as repository avatar or attachments the delete function
would error, because the storage module wasn't initalized.
- Add code to initialize the storage module.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1954

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoUpdate docs for DISABLE_QUERY_AUTH_TOKEN (#28485)
Kyle D [Sat, 16 Dec 2023 02:54:35 +0000 (21:54 -0500)]
Update docs for DISABLE_QUERY_AUTH_TOKEN (#28485)

As described
[here](https://github.com/go-gitea/gitea/pull/28390#issuecomment-1857553331).

10 months agoImprove CLI code and descriptions (#28482)
wxiaoguang [Fri, 15 Dec 2023 15:49:01 +0000 (23:49 +0800)]
Improve CLI code and descriptions (#28482)

* Close #28444
* Actually, it doesn't need to use that trick because it looks like it
is not necessary, no user really needs it
* Remove the hidden (legacy) "doctor" subcommand and update documents
* Fix "actions" usage

![image](https://github.com/go-gitea/gitea/assets/2114189/3c2b34a7-4f92-4a6c-96fd-9505e413d4ec)

10 months agoRemove unnecessary forgot password link in delete user section (#28355)
yp05327 [Fri, 15 Dec 2023 14:13:55 +0000 (23:13 +0900)]
Remove unnecessary forgot password link in delete user section (#28355)

Before:
<img width="458" alt="image"
src="https://github.com/go-gitea/gitea/assets/18380374/92815496-38cc-4bb9-9182-1509a72b07f6">

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/d96ed908-47ad-44cc-a624-4c10fa8c8c86)

10 months agoRefactor SSH clone URL generation code (#28421)
wxiaoguang [Fri, 15 Dec 2023 06:18:12 +0000 (14:18 +0800)]
Refactor SSH clone URL generation code (#28421)

Refactor the code and add tests, keep the old logic.

10 months agoPolyfill SubmitEvent for PaleMoon (#28441)
wxiaoguang [Thu, 14 Dec 2023 23:26:36 +0000 (07:26 +0800)]
Polyfill SubmitEvent for PaleMoon (#28441)

10 months agoFix Chinese translation of config cheat sheet[API] (#28472)
CaiCandong [Thu, 14 Dec 2023 16:00:04 +0000 (00:00 +0800)]
Fix Chinese translation of config cheat sheet[API] (#28472)

10 months agoAdd combined index for issue_user.uid and issue_id (#28080)
sebastian-sauer [Thu, 14 Dec 2023 09:26:59 +0000 (10:26 +0100)]
Add combined index for issue_user.uid and issue_id (#28080)

fixes #27877

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
10 months agoFix documents for "custom/public/assets/" (#28465)
wxiaoguang [Thu, 14 Dec 2023 08:52:16 +0000 (16:52 +0800)]
Fix documents for "custom/public/assets/" (#28465)

Fix #28463

10 months agoOnly use SHA256 feature when git >= 2.42 (#28466)
wxiaoguang [Thu, 14 Dec 2023 08:51:05 +0000 (16:51 +0800)]
Only use SHA256 feature when git >= 2.42 (#28466)

And fix some comments

10 months agoRetry SSH key verification with additional CRLF if it failed (#28392)
nekrondev [Thu, 14 Dec 2023 02:39:32 +0000 (03:39 +0100)]
Retry SSH key verification with additional CRLF if it failed (#28392)

Windows-based shells will add a CRLF when piping the token into
ssh-keygen command resulting in
verification error. This resolves #21527.

---------

Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
10 months agoAbstract hash function usage (#28138)
Adam Majer [Wed, 13 Dec 2023 21:02:00 +0000 (21:02 +0000)]
Abstract hash function usage (#28138)

Refactor Hash interfaces and centralize hash function. This will allow
easier introduction of different hash function later on.

This forms the "no-op" part of the SHA256 enablement patch.

10 months agoAdd endpoint for not implemented Docker auth (#28457)
KN4CK3R [Wed, 13 Dec 2023 20:23:53 +0000 (21:23 +0100)]
Add endpoint for not implemented Docker auth (#28457)

Recently Docker started to use the optional `POST /v2/token` endpoint
which should respond with a `404 Not Found` status code instead of the
current `405 Method Not Allowed`.

> Note: Not all token servers implement oauth2. If the request to the
endpoint returns 404 using the HTTP POST method, refer to Token
Documentation for using the HTTP GET method supported by all token
servers.

10 months agodocs: Update group membership fields to match application. (#28175)
David Hulick [Wed, 13 Dec 2023 07:14:37 +0000 (02:14 -0500)]
docs: Update group membership fields to match application. (#28175)

Several fields in the "Verify group membership in LDAP" docs were
confusingly titled when compared to the actual fields in the
application, this change rectifies that by matching the docs to the
fields already present in gitea.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 13 Dec 2023 00:24:37 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoFix possible nil pointer access (#28428)
KN4CK3R [Tue, 12 Dec 2023 13:51:33 +0000 (14:51 +0100)]
Fix possible nil pointer access (#28428)

There could be a nil pointer exception if the file is not found because
that specific error is suppressed but not handled.

10 months agoDon't show unnecessary citation JS error on UI (#28433)
wxiaoguang [Tue, 12 Dec 2023 11:31:11 +0000 (19:31 +0800)]
Don't show unnecessary citation JS error on UI (#28433)

Fix #28226

10 months agoDo some missing checks (#28423)
Lunny Xiao [Tue, 12 Dec 2023 05:01:17 +0000 (13:01 +0800)]
Do some missing checks (#28423)

10 months agoDeprecate query string auth tokens (#28390)
Jack Hay [Tue, 12 Dec 2023 03:48:53 +0000 (22:48 -0500)]
Deprecate query string auth tokens (#28390)

## Changes
- Add deprecation warning to `Token` and `AccessToken` authentication
methods in swagger.
- Add deprecation warning header to API response. Example:
  ```
  HTTP/1.1 200 OK
  ...
  Warning: token and access_token API authentication is deprecated
  ...
  ```
- Add setting `DISABLE_QUERY_AUTH_TOKEN` to reject query string auth
tokens entirely. Default is `false`

## Next steps
- `DISABLE_QUERY_AUTH_TOKEN` should be true in a subsequent release and
the methods should be removed in swagger
- `DISABLE_QUERY_AUTH_TOKEN` should be removed and the implementation of
the auth methods in question should be removed

## Open questions
- Should there be further changes to the swagger documentation?
Deprecation is not yet supported for security definitions (coming in
[OpenAPI Spec version
3.2.0](https://github.com/OAI/OpenAPI-Specification/issues/2506))
- Should the API router logger sanitize urls that use `token` or
`access_token`? (This is obviously an insufficient solution on its own)

---------

Co-authored-by: delvh <dev.lh@web.de>
10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 12 Dec 2023 00:25:05 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoLet `curl` write the content to file (#28427)
KN4CK3R [Mon, 11 Dec 2023 23:19:30 +0000 (00:19 +0100)]
Let `curl` write the content to file (#28427)

10 months agoImprove doctor cli behavior (#28422)
wxiaoguang [Mon, 11 Dec 2023 15:55:10 +0000 (23:55 +0800)]
Improve doctor cli behavior (#28422)

1. Do not sort the "checks" slice again and again when "Register", it
just wastes CPU when the Gitea instance runs
2. If a check doesn't exist, tell the end user
3. Add some tests

10 months agoSecond part of refactor `db.Find` (#28194)
Lunny Xiao [Mon, 11 Dec 2023 08:56:48 +0000 (16:56 +0800)]
Second part of refactor `db.Find` (#28194)

Continue of #27798 and move more functions to `db.Find` and `db.Count`.

10 months agoFix commit status in repo list (#28412)
yp05327 [Mon, 11 Dec 2023 06:19:57 +0000 (15:19 +0900)]
Fix commit status in repo list (#28412)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/00edf23a-aee1-4177-a12c-bd03ae14e65e)

![image](https://github.com/go-gitea/gitea/assets/18380374/0663e443-682c-4a68-b14e-a0fa0e4c3716)
`TestOrg/testactions` does have commit status, but won't display in
`All`

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/7231db29-9c4e-484f-afa2-87db19be19b8)

Same to #26179.

10 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 11 Dec 2023 00:25:45 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

10 months agoActually recover from a panic in cron task (#28409)
Earl Warren [Sun, 10 Dec 2023 20:15:06 +0000 (21:15 +0100)]
Actually recover from a panic in cron task (#28409)

- Currently there's code to recover gracefully from panics that happen
within the execution of cron tasks. However this recover code wasn't
being run, because `RunWithShutdownContext` also contains code to
recover from any panic and then gracefully shutdown Forgejo. Because
`RunWithShutdownContext` registers that code as last, that would get run
first which in this case is not behavior that we want.
- Move the recover code to inside the function, so that is run first
before `RunWithShutdownContext`'s recover code (which is now a noop).

Fixes: https://codeberg.org/forgejo/forgejo/issues/1910
Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoFix missing check (#28406)
Lunny Xiao [Sun, 10 Dec 2023 19:37:10 +0000 (03:37 +0800)]
Fix missing check (#28406)

10 months agoAlso sync DB branches on push if necessary (#28361)
Lunny Xiao [Sat, 9 Dec 2023 13:30:56 +0000 (21:30 +0800)]
Also sync DB branches on push if necessary (#28361)

Fix #28056

This PR will check whether the repo has zero branch when pushing a
branch. If that, it means this repository hasn't been synced.

The reason caused that is after user upgrade from v1.20 -> v1.21, he
just push branches without visit the repository user interface. Because
all repositories routers will check whether a branches sync is necessary
but push has not such check.

For every repository, it has two states, synced or not synced. If there
is zero branch for a repository, then it will be assumed as non-sync
state. Otherwise, it's synced state. So if we think it's synced, we just
need to update branch/insert new branch. Otherwise do a full sync. So
that, for every push, there will be almost no extra load added. It's
high performance than yours.

For the implementation, we in fact will try to update the branch first,
if updated success with affect records > 0, then all are done. Because
that means the branch has been in the database. If no record is
affected, that means the branch does not exist in database. So there are
two possibilities. One is this is a new branch, then we just need to
insert the record. Another is the branches haven't been synced, then we
need to sync all the branches into database.

10 months agoRemove stale since giteabot has similiar feature (#28401)
Lunny Xiao [Sat, 9 Dec 2023 11:38:46 +0000 (19:38 +0800)]
Remove stale since giteabot has similiar feature (#28401)

Replace #27447

10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 9 Dec 2023 00:24:26 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoImprove text in Security settings (#28393)
Panagiotis "Ivory" Vasilopoulos [Thu, 7 Dec 2023 22:38:55 +0000 (22:38 +0000)]
Improve text in Security settings (#28393)

- en-US: Rename "Scratch Tokens" to "single-use recovery keys".
  Longer, but clearer.
- Improve titles
- TOTP: Improve description
- TOTP: Inform user about Scratch Tokens to encourage TOTP usage
- WebAuthn: Add loss of access warning

10 months agoFix Docker meta action for releases (#28232)
John Olheiser [Thu, 7 Dec 2023 17:42:58 +0000 (11:42 -0600)]
Fix Docker meta action for releases (#28232)

Should fix #28229 and #28230 for next release.

Assuming I'm reading the docs correctly for the docker meta action:

https://github.com/docker/metadata-action#flavor-input
https://github.com/docker/metadata-action#latest-tag

1. We want `latest=false` for the RCs.
2. `latest` should happen already due to `auto` mode, however there's an
extra option for the `suffix` flavor.

This PR is ready, but leaving it as draft to make sure someone
double-checks my sleuth-work.

Signed-off-by: jolheiser <john.olheiser@gmail.com>