Commit graph

17415 commits

Author SHA1 Message Date
Gusted
cbbcfdd400
[FEAT] Don't log context cancelled SQL errors
- I found this while doing some unrelated testing in Forgejo. It wasn't
my intention to log failed SQL queries if they were cancelled (which can
happen quite frequently for larger instances) as in those cases it's not
interesting to know which SQL query was run. My intentation was only to
log an SQL query if there was an error reported by the database.
- Ref #2140
2024-02-12 23:11:50 +01:00
Earl Warren
c6a89b490d Merge pull request '[gitea] cherry-pick' (#2324) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2324
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-12 13:39:28 +00:00
Earl Warren
98e7753ade Merge pull request '[FEAT]: Allow forking without a repo ID' (#2310) from algernon/forgejo:f/repo/fork-route into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2310
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-12 13:36:49 +00:00
Earl Warren
ba5f9f7bb4 Merge pull request '[RELEASE] Gitea version is for interoperability only' (#2327) from earl-warren/forgejo:wip-version into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2327
Reviewed-by: Otto <otto@codeberg.org>
2024-02-11 21:44:31 +00:00
Alexandre Oliveira
29007c09bd Fix Alpine Registry packages with noarch not being found (#2285)
Fixes #2173
~~Still requires a bit of work to do, I'm not 100% happy with this solution.~~

The idea is to copy the noarch package to the architectures available in the package repository.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2285
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
Co-committed-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
2024-02-11 18:02:56 +00:00
Earl Warren
db3b867b02
[RELEASE] Gitea version is for interoperability only
Forgejo now has its own lifecycle and its version is derived from the
tag. The Gitea tags are no longer found in the Forgejo codebase and
can no longer be used for that purpose.

When a Forgejo release is published, for interoperability with the
existing tools in the ecosystem, it advertises the supported Gitea
version via /api/v1/version. It is set in the Makefile manually and
cannot be automatically set.

https://codeberg.org/forgejo-contrib/delightful-forgejo#packaging

Existing Forgejo packages rely on the Makefile to build and the change
must be done in a way that tries to not break their assumptions. From
the point of view of a Forgejo package build, the following will
happen on the next major release:

- The package version will bump from v1.21.x to v7.0.0
- /api/v1/version will bump from v1.21.x to v1.22.0
- /api/forgejo/v1/version will bump from v6.x to v7.0.0

The Makefile uses the following variables:

GITEA_VERSION is returned by /api/v1/version
FORGEJO_VERSION is returned by /api/forgejo/v1/version
VERSION is used in the name the binary file and the source archive

Before:

GITEA_VERSION is the computed version
FORGEJO_VERSION is set manually
VERSION defaults to GITEA_VERSION

After:

FORGEJO_VERSION is the computed version
GITEA_VERSION is set manually
VERSION defaults to FORGEJO_VERSION

When the version is computed, it comes from:

- The content of the VERSION file if it exists. It is inserted in
  the source archive because it does not contain a git repository
- Otherwise the output of `git describe`
2024-02-11 15:36:58 +01:00
Earl Warren
7b4dba3aa0 [ACTIONS] skip superflous pull request synchronized event (#2314)
Skip a HookEventPullRequestSync event if it has the same CommitSHA as an existing HookEventPullRequest event in the ActionRun table. A HookEventPullRequestSync event must only create an ActionRun if the CommitSHA is different from what it was when the PR was open.

This guards against a race that can happen when the following is done in parallel:

* A commit C is pushed to a repo on branch B
* A pull request with head on branch B

it is then possible that the pull request is created first, successfully. The commit that was just pushed is not known yet but the PR only references the repository and the B branch so it is fine.

A HookEventPullRequest event is sent to the notification queue but not processed immediately.

The commit C is pushed and processed successfully. Since the PR already exists and has a head that matches the branch, the head of the PR is updated with the commit C and a HookEventPullRequestSync event is sent to the notification queue.

The HookEventPullRequest event is processed and since the head of the PR was updated to be commit C, an ActionRun with CommitSHA C is created.

The HookEventPullRequestSync event is then processed and also has a CommitSHA equal to C.

Refs: https://codeberg.org/forgejo/forgejo/issues/2009
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2314
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2024-02-11 13:06:54 +00:00
silverwind
9c4e0c26f9
[gitea] Remove obsolete border-radius on comment content (#29128)
This border-radius is obsolete since we changed the comment rendering a
few months ago and it caused incorrect display on blockquotes.

Before:
<img width="160" alt="Screenshot 2024-02-10 at 18 42 48"
src="https://github.com/go-gitea/gitea/assets/115237/ccbf4660-acf9-4268-aad9-1ad49d317a67">

After:
<img width="135" alt="Screenshot 2024-02-10 at 18 42 40"
src="https://github.com/go-gitea/gitea/assets/115237/6f588e02-3b2a-49ee-b459-81d8068b2f4e">

(cherry picked from commit 9063fa096386362f9ae602fdf8a39ae8c972b8e0)
2024-02-11 13:47:48 +01:00
Yarden Shoham
7c9387a242
[gitea] Make blockquote border size less aggressive (#29124)
It's too thick

I made it match GitHub's size

![image](https://github.com/go-gitea/gitea/assets/20454870/08c05004-acd9-485e-9219-110d93fe1226)

![image](https://github.com/go-gitea/gitea/assets/20454870/e2e32b6c-4ba8-488e-9405-95d33f80adf7)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 5f5b5ba6e3e50ba5385e6cbf5957d4b73805769b)
2024-02-11 13:47:46 +01:00
Gwyneth Morgan
9a1d5c549c
[gitea] Drop "@" from email sender to avoid spam filters (#29109)
Commit 360b3fd17c (Include username in email headers (#28981),
2024-02-03) adds usernames to the From field of notification emails in
the form of `Display Name (@username)`, to prevent spoofing. However,
some email filtering software flags "@" in the display name part of the
From field as potential spoofing, as you could set the display name part
to another email address than the one you are sending from (e.g.
`From: "apparent@email-address" <actual@email-address>`). To avoid
being flagged, instead send emails from `Display Name (username)`.

Closes: #29107

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 5b2fd0fc19a2a77414c8e2989b4794b6617221f5)
2024-02-11 13:47:44 +01:00
GiteaBot
22fd29d3b7
[gitea] [skip ci] Updated translations via Crowdin
(cherry picked from commit c1f7249056d4aa38927aebcbddc6459ee714c801)
2024-02-11 13:47:36 +01:00
Earl Warren
40b9f3996b Merge pull request '[FEAT]: New route to view latest run of specific workflows' (#2304) from algernon/forgejo:f/web/actions/workflow-latest-run-routes into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2304
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-11 07:34:08 +00:00
Earl Warren
91f2f02f09 Merge pull request '[gitea] cherry-pick' (#2320) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2320
2024-02-10 10:37:00 +00:00
silverwind
22c694a9e9
[gitea] add lint-spell-fix to lint-fix (#29111)
Followup to https://github.com/go-gitea/gitea/pull/29106, fix this
oversight.

(cherry picked from commit c7a21cbb0c5f8302495fa24baf218dc3462de2c5)
2024-02-10 10:53:43 +01:00
silverwind
6fcb8e652b
[gitea] Rework spellchecking, add lint-spell (#29106)
- Use maintained fork https://github.com/golangci/misspell
- Rename `mispell-check` to `lint-spell`, add `lint-spell-fix`
- Run `lint-spell` in separate actions step
- Lint more files, fix discovered issues
- Remove inaccurate and outdated info in docs (we do not need GOPATH for
tools anymore)

Maybe later we can add more spellchecking tools, but I have not found
any good ones yet.

(cherry picked from commit 9c39f8515fa88d644736c6773d7a05d070a02e82)

Conflicts:
	.github/workflows/pull-compliance.yml
	Makefile
2024-02-10 10:53:43 +01:00
wxiaoguang
83bb3cf86a
[gitea] Refactor parseSignatureFromCommitLine (#29054)
Replace #28849. Thanks to @yp05327 for the looking into the problem.
Fix #28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.

(cherry picked from commit a24e1da7e9e38fc5f5c84c083d122c0cc3da4b74)
2024-02-10 10:53:43 +01:00
KN4CK3R
045bd097c6
[gitea] Display friendly error message (#29105)
`ctx.Error` only displays the text but `ctx.ServerError` renders the
usual error page.

(cherry picked from commit da2f03750f9672c5aac48209539874f2af2673f1)
2024-02-10 10:53:43 +01:00
silverwind
0d62b52f4f
[gitea] Use defaults browserslist (#29098)
IE usage has dropped enough to not be included in the defaults
browserslist anymore as per https://browsersl.ist/#q=defaults, so we can
use the defaults now.

(cherry picked from commit ce9978bfd4e035ed065b02b28e02905674320b6a)
2024-02-10 10:53:43 +01:00
Lunny Xiao
b9f48332c7
[gitea] Fix push to create with capitalize repo name (#29090)
Fix #29073

(cherry picked from commit 96ad1d6340038c0c841d9cad9a440daee3241aac)
2024-02-10 10:53:43 +01:00
Lunny Xiao
1fdd8341d6
[gitea] Remove unnecessary parameter (#29092)
The parameter extraConfigs has never been used anywhere. This PR just
removed it. It can be taken back once it's needed.

(cherry picked from commit 8c6ffdac378654f9d2171ebdbc46becf1571f7fe)
2024-02-10 10:53:43 +01:00
silverwind
02b03247de
[gitea] Move vitest setup file to root (#29097)
I'm using this convention in other projects and I think it makes sense
for gitea too because the vitest setup file is loaded globally for all
tests, not just ones in web_src, so it makes sense to be in the root.

(cherry picked from commit 98e7e3a5f07b8bc620e26bc1ab6f7a86bccbb7cb)
2024-02-10 10:53:43 +01:00
CEnnis91
4b1b774ccd
[gitea] Fix incorrect link to swift doc and swift package-registry login command (#29096)
Fixes a few mistakes in the Swift package registry documentation.

Syntax for the `package-registry login` command can be found
[here](https://github.com/apple/swift-package-manager/blob/main/Documentation/PackageRegistry/PackageRegistryUsage.md#registry-authentication).
I was not sure the best way to compress all of that information, so I
just focused on making sure the incorrect `package-registry set` command
was fixed.

(cherry picked from commit eb5ddc0a78ecfe007a6e279a3c59711cdfb3f701)
2024-02-10 10:53:43 +01:00
CEnnis91
e87ab053e7
[gitea] Fix swift packages not resolving (#29095)
Fixes #29094

(cherry picked from commit 6be3fda6fc746b1285e6dee72de1118177ba429e)
2024-02-10 10:53:43 +01:00
Wiktor Kwapisiewicz
34450f7d35
[gitea] Fix missing link on outgoing new release notifications (#29079)
Outgoing new release e-mail notifications were missing links to the
actual release. An example from Codeberg.org e-mail:

    <a href=3D"">View it on Codeberg.org</a>.<br/>

This PR adds `"Link"` context property pointing to the release on the
web interface.

The change was tested using `[mailer] PROTOCOL=dummy`.

Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
(cherry picked from commit 37191dcfbdbd007266a4d15a3c85cdf94cec1a7a)
2024-02-10 10:53:43 +01:00
wxiaoguang
51c6103195
[gitea] Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081)
Try to fix #29080

(cherry picked from commit f290c24d286b996ac6b512f49a30aa5aef1a2dbe)
2024-02-10 10:53:43 +01:00
silverwind
73e32eae5b
[gitea] Fix gitea-origin-url with default ports (#29085)
When setting `url.host` on a URL object with no port specified (like is
the case of default port), the resulting URL's port will not change.
Workaround this quirk in the URL standard by explicitely setting port
for the http and https protocols.

Extracted the logic to a function for the purpose of testing. Initially
I wanted to have the function in utils.js, but it turns out esbuild can
not treeshake the unused functions which would result in the
webcomponents chunk having all 2kB utils.js inlined, so it seemed not
worth.

Fixes: https://github.com/go-gitea/gitea/issues/29084
(cherry picked from commit b6bf8041d8e8ee845728687b1f358f1d482afff2)
2024-02-10 10:53:43 +01:00
dark-angel
00370f17a4
[gitea] fix: Elasticsearch: Request Entity Too Large #28117 (#29062)
Fix for gitea putting everything into one request without batching and
sending it to Elasticsearch for indexing as issued in #28117

This issue occured in large repositories while Gitea tries to
index the code using ElasticSearch.

I've applied necessary changes that takes batch length from below config
(app.ini)
```
[queue.code_indexer]
BATCH_LENGTH=<length_int>
```
and batches all requests to Elasticsearch in chunks as configured in the
above config

(cherry picked from commit 5c0fc9087211f01375f208d679a1e6de0685320c)
2024-02-10 10:53:43 +01:00
silverwind
75937b5784
[gitea] Remove lightningcss (#29070)
Remove lightningcss and minify with esbuild again. The size of output
CSS will increase by around 1.4%, but I think it's worth it to allow
building gitea in more cases like the one in the linked issue. We can
reconsider once lightningcss becomes more stable.

Fixes: https://github.com/go-gitea/gitea/issues/29058
(cherry picked from commit 5849d4fde347cd1e47f2243b3239724c73b1261d)
2024-02-10 10:53:43 +01:00
Jason Song
a01777fd21
[gitea] Hide code links on release page if user cannot read code (#29064)
On the release list page, if the user doesn't have the permission to
read code, the code links will lead to 404 pages or api errors:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a74fbc63-6dd6-43c6-853c-28acdbfdcb4e">

After this PR:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a626373d-c2df-40a9-8fed-1b12ff6bc56f">

And this PR also removed some dead code. After #23465, the tag list page
has an independent template, and all `IsTag` in the release list
template are always false.

(cherry picked from commit f9072dbf3c558ba5d4365b551d95936a52e4c94d)
2024-02-10 10:53:42 +01:00
GiteaBot
7c1bb0626b
[gitea] [skip ci] Updated translations via Crowdin
(cherry picked from commit f69914dd0b5607861f36f89c362f4b2cc3f60403)
2024-02-10 10:53:42 +01:00
Earl Warren
a4ca473d33
[CI] cascade end-to-end must not try to merge feature branches
they no longer exist as of the hard fork
2024-02-10 10:53:04 +01:00
Gergely Nagy
5f2d8be38e
[FEAT]: New route to view lates run of specific workflows
This adds a new route at `/actions/workflows/{workflow}/runs/latest`,
which will redirect to the latest run of the given workflow. It can be
further restricted by specifying an optional `?branch={branch}` query
parameter. If no branch is specified, the route defaults to using the
repo's default branch.

This route is meant to go hand in hand with the Badge route that returns
the result of the same workflow as a badge. This route can be used to
link to the run that produced that result.

Fixes #2303.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-10 09:15:58 +01:00
Gergely Nagy
f8da672307
[FEAT]: Allow forking without a repo ID
Forking a repository via the web UI currently requires visiting a
`/repo/fork/{{repoid}}` URL. This makes it cumbersome to create a link
that starts a fork, because the repository ID is only available via the
API. While it *is* possible to create a link, doing so requires extra
steps.

To make it easier to have a "Fork me!"-style links, introduce the
`/{username}/{repo}/fork` route, which will start the forking process
based on the repository in context instead.

The old `/repo/fork/{repoid}` route (with a `GET` request) will remain
there for the sake of backwards compatibility, but will redirect to the
new URL instead. It's `POST` handler is removed.

Tests that used the old route are updated to use the new one, and new
tests are introduced to exercise the redirect.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-10 09:14:14 +01:00
Earl Warren
cf1c57b681 Merge pull request 'Forgejo hard fork' (#2319) from earl-warren/forgejo:wip-forgejo into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2319
2024-02-10 06:33:59 +00:00
Earl Warren
beff445741
Merge remote-tracking branch 'forgejo/forgejo-development' into wip-forgejo 2024-02-09 23:22:12 +01:00
Earl Warren
1c183c8031 Merge pull request '[TESTS] add manual testing instructions as a sub-module' (#2265) from earl-warren/forgejo:wip-manual-testing into forgejo-development
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2265
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-09 22:21:25 +00:00
Earl Warren
7cbf05fafb
Merge remote-tracking branch 'forgejo/forgejo-dependency' into wip-forgejo
Conflicts:
	.forgejo/workflows/testing.yml
	trivial conflict
2024-02-09 19:00:54 +01:00
Earl Warren
36fc9a9f72
Merge remote-tracking branch 'forgejo/forgejo-branding' into wip-forgejo 2024-02-09 18:59:07 +01:00
Earl Warren
16794897bc
Merge remote-tracking branch 'forgejo/forgejo-development' into wip-forgejo 2024-02-09 18:58:05 +01:00
Codeberg Translate
3c31c92efb [I18N] Translations update from Weblate (#2317)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: earl-warren <contact@earl-warren.org>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2317
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-02-09 14:53:38 +00:00
Earl Warren
12e289f6f9 Merge pull request 'CI: merge checks-backend and lint-backend' (#2315) from oliverpool/forgejo:ci_merge_steps into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2315
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-09 14:17:35 +00:00
Codeberg Translate
e71cdd05d8 [I18N] Translations update from Weblate (#2316)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Mormegil <mormegil@centrum.cz>
Co-authored-by: nightm4re <matthiasf.wilke@yahoo.de>
Co-authored-by: fnetX <otto@codeberg.org>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Co-authored-by: kikocorreoso <kachine@protonmail.com>
Co-authored-by: earl-warren <contact@earl-warren.org>
Co-authored-by: bart <bart@bartmathijssen.com>
Co-authored-by: tranzystorekk <tranzystorek.io@protonmail.com>
Co-authored-by: Xinayder <me+codeberg@aoalmeida.com>
Co-authored-by: rmorettibr <rafael.moretti@protonmail.com>
Co-authored-by: Werenter <abelokopytov149@gmail.com>
Co-authored-by: dobrvlskyi <dobrovolskyi@peremozhemo.org>
Co-authored-by: ika <ika@thewizardbay.cc>
Co-authored-by: noureddin <noureddin@protonmail.com>
Co-authored-by: esensar <dev@ensarsarajcic.com>
Co-authored-by: mondstern <mondstern@monocles.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2316
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-02-09 12:43:51 +00:00
oliverpool
ffc94d9463 remove debug print 2024-02-09 11:27:58 +01:00
oliverpool
cab17d7a72 DEBUG: -j 2024-02-09 11:20:15 +01:00
oliverpool
01539730c0 CI: merge checks-backend and lint-backend 2024-02-09 11:08:19 +01:00
Earl Warren
da12d2001c Merge pull request '[I18N] Translations update from Weblate' (#2305) from translate/forgejo:weblate-forgejo-forgejo into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2305
2024-02-09 08:30:00 +00:00
Earl Warren
95188d497d
[CI] pin go 1.21 2024-02-08 12:39:38 +01:00
Earl Warren
a058770914
[TESTS] add manual testing instructions as a sub-module
Refs: https://codeberg.org/forgejo/discussions/issues/100
2024-02-08 11:43:43 +01:00
Earl Warren
f7ca64d028 Merge pull request '[FEAT] support .forgejo dir for issue and PR templates' (#2290) from algernon/forgejo:pr/template-dirs into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2290
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-08 10:42:23 +00:00
mondstern
4d62c5df14
Added translation using Weblate (Slovenian) 2024-02-07 19:04:37 +00:00