Commit graph

19960 commits

Author SHA1 Message Date
Gusted 70a7d6a0de
[ENHANCEMENT] Improve caching of contributor stats
- It was noticed [in the Forgejo matrix channel](https://matrix.to/#/!qjPHwFPdxhpLkXMkyP:matrix.org/$vk78UR0eFCwQMDMTZ7-DWjMVB_LIAwHW6SkjhEcGkQQ?via=matrix.org) that the generation of the Forgejo project contributor stats was taking quite a while on codeberg.org. This was continued with the fact that a few moments later it was once again generating them again; it seemed like they weren't being cached while they were.
- The problem was that the cache TTL is hardcoded to ten minutes and not to the configured TTL. This patch changes that by using the configured TLL for the contributor cache, as this is a computationally heavy operation and should be cached for as long as possible for a good user experience. This doesn't impact the accuracy of this feature because the commit ID of the default branch is used as a cache key.
- Also changed in this patch, is that errors aren't cached and are instead being logged, this is more helpful to the administrator. For the user essentially nothing changed on this side, the contributor stats just looks like it's loading indefinitely.
- Realistically, testing this isn't possible, as the cache library Forgejo currently uses doesn't expose the TTL or expiration time of a key. Manually testing this behavior is quite lengthy, as one of the steps would need to be "wait for ten minutes" and describe how you can notice the data was cached or was just generated, and because you could use different types of cache, it will be quite hard to write down how you could check the TTL of a key for a particular cache (I'm not even sure it's even possible for some).
2024-07-06 21:23:46 +02:00
Gusted 3c7a830fda Merge pull request 'Update module google.golang.org/grpc to v1.65.0' (#4314) from renovate/google.golang.org-grpc-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4314
Reviewed-by: thefox <thefox@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-07-04 22:19:07 +00:00
TheFox0x7 79b91930fa chore(license): license path change for protobuf 2024-07-04 22:19:07 +00:00
Renovate Bot 1c49047390 Update module google.golang.org/grpc to v1.65.0 2024-07-04 22:19:07 +00:00
Earl Warren 741191a498 Merge pull request 'build(go-licenses): support go toolchain mismatch' (#4322) from viceice/build-go-licenses into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4322
2024-07-04 14:15:08 +00:00
Earl Warren 3a442b9f09 Merge pull request 'Update module github.com/blevesearch/bleve/v2 to v2.4.1' (#4311) from renovate/github.com-blevesearch-bleve-v2-2.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4311
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-07-04 14:06:19 +00:00
Earl Warren ec883971ef Merge pull request 'Update dependency esbuild-loader to v4.2.0' (#4165) from renovate/esbuild-loader-4.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4165
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-07-04 12:54:54 +00:00
Michael Kriese b31e21d80e
build(go-licenses): support go toolchain mismatch 2024-07-04 14:42:26 +02:00
0ko aa7657c544 ui(blame): remove broken padding (#4318)
This padding causes visual bug, because it only applies to the first line and not to the rest in case the line is broken into multiple.
I don't think it's actually needed here for good look, so I decided to remove it. In case decreased padding looks worse, the padding can be grown back via other element so it wouldn't cause this bug.

Preview: https://codeberg.org/attachments/56fd2ee8-4955-409d-998f-1feba987b9af

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4318
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-07-04 11:46:31 +00:00
Earl Warren 4c4aaea26d Merge pull request 'Update dependency katex to v0.16.11' (#4291) from renovate/katex-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4291
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-04 10:19:32 +00:00
Earl Warren 763f4659cc Merge pull request 'Update dependency eslint-plugin-vue to v9.27.0' (#4312) from renovate/linters into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4312
2024-07-04 07:35:39 +00:00
Codeberg Translate 2a643d2136 [I18N] Translations update from Weblate (#4251)
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: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Panagiotis \"Ivory\" Vasilopoulos <git@n0toose.net>
Co-authored-by: ZDev <ZDev@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: fnetX <otto@codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: Marco Ciampa <ciampix@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: b1nar10 <b1nar10@users.noreply.translate.codeberg.org>
Co-authored-by: Eryk Michalak <gnu.ewm@protonmail.com>
Co-authored-by: revi <revi@omglol.email>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4251
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-07-04 06:41:53 +00:00
Renovate Bot 15d25db3f8 Update dependency eslint-plugin-vue to v9.27.0 2024-07-04 06:07:24 +00:00
Earl Warren 938e6c0fd7 Merge pull request 'test: remove performance sensitive test' (#4315) from earl-warren/forgejo:wip-redis-test into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4315
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-07-04 05:39:07 +00:00
Earl Warren 11596374ba
test: remove performance sensitive test
A test must not fail depending on the performance of the machine it
runs on. It creates false negative and serves no purpose. These are
not benchmark tests for the hardware running them.
2024-07-04 07:03:54 +02:00
Renovate Bot 319c4efbe7 Update module github.com/blevesearch/bleve/v2 to v2.4.1 2024-07-04 00:02:31 +00:00
Earl Warren e19be90a6b Merge pull request 'Update module github.com/minio/minio-go/v7 to v7.0.73' (#4292) from renovate/github.com-minio-minio-go-v7-7.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4292
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-03 19:39:12 +00:00
Earl Warren dc0fa915d4
docs(release-notes): 7.0.5 [skip ci] 2024-07-03 21:02:39 +02:00
Earl Warren 4b485825c9
docs(release-notes): KaTeX add support for \emph 2024-07-03 20:38:22 +02:00
Earl Warren 11433a5378
docs(licenses): add github.com/go-ini/ini 2024-07-03 20:35:07 +02:00
Renovate Bot 4101260d6e Update module github.com/minio/minio-go/v7 to v7.0.73 2024-07-03 18:07:19 +00:00
Earl Warren a6756ed3b8 Merge pull request 'test(js): false negative in sleep test' (#4285) from earl-warren/forgejo:wip-js-utils into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4285
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-07-03 17:12:27 +00:00
Earl Warren d1c5ddc5a6 Merge pull request 'Update dependency @playwright/test to v1.45.1' (#4290) from renovate/playwright-monorepo into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4290
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-03 17:11:53 +00:00
Earl Warren 9e6b6f5a06 Merge pull request 'Update module golang.org/x/tools/gopls to v0.16.1' (#4293) from renovate/golang.org-x-tools-gopls-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4293
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-03 17:11:18 +00:00
Earl Warren 0ab2852114 Merge pull request 'fix(ci): do not block pull request CI when go-versions lags behind' (#4298) from earl-warren/forgejo:wip-go-version-lag-workaround into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4298
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-07-03 17:10:17 +00:00
Renovate Bot 75966ddef6 Update module golang.org/x/tools/gopls to v0.16.1 2024-07-03 16:03:58 +00:00
Renovate Bot e510f2e84d Update dependency @playwright/test to v1.45.1 2024-07-03 16:03:51 +00:00
Earl Warren d1139ac55f Merge pull request 'Update dependency go to v1.22.5' (#4286) from renovate/patch-golang-packages into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4286
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-07-03 14:57:04 +00:00
Earl Warren ee7f568aed
fix(ci): do not block pull request CI when go-versions lags behind
When a new go version is published, it takes about 24h for
https://github.com/actions/go-versions to be updated (see
https://github.com/actions/go-versions/pull/102 for example).

In the meantime the setup-go action that depends on it will install a
version of go that fails golang.org/x/vuln/cmd/govulncheck.

Move the security check to be the last step of the test job instead of
the first. It will still block the PRs from being merged but it will
allow the PR authors to keep working and look at the test results in
the meantime.

Fixes: https://codeberg.org/forgejo/forgejo/issues/4294
2024-07-03 15:57:35 +02:00
Renovate Bot fa1a853db0 Update dependency go to v1.22.5 2024-07-03 08:23:00 +00:00
Renovate Bot f752ab5edd Update dependency katex to v0.16.11 2024-07-03 00:02:23 +00:00
Earl Warren 17139b649b Merge pull request 'fix(hook): ignore unknown push options instead of failing' (#4253) from twenty-panda/forgejo:pr-3706 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4253
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-02 20:17:51 +00:00
Twenty Panda 5561e80b04 fix(hook): ignore unknown push options instead of failing
If a repository has

git config --add push.pushOption submit=".sourcehut/*.yml"

it failed when pushed because of the unknown submit push
option. It will be ignored instead.

Filtering out the push options is done in an earlier stage, when the
hook command runs, before it submits the options map to the private
endpoint.

* move all the push options logic to modules/git/pushoptions
* add 100% test coverage for modules/git/pushoptions

Test coverage for the code paths from which code was moved to the
modules/git/pushoptions package:

* cmd/hook.go:runHookPreReceive
* routers/private/hook_pre_receive.go:validatePushOptions
  tests/integration/git_push_test.go:TestOptionsGitPush runs through
  both. The test verifying the option is rejected was removed and, if
  added again, will fail because the option is now ignored instead of
  being rejected.

* cmd/hook.go:runHookProcReceive
* services/agit/agit.go:ProcReceive
  tests/integration/git_test.go: doCreateAgitFlowPull runs through
  both. It uses variations of AGit related push options.

* cmd/hook.go:runHookPostReceive
* routers/private/hook_post_receive.go:HookPostReceive
  tests/integration/git_test.go:doPushCreate called by TestGit/HTTP/sha1/PushCreate
  runs through both.
  Note that although it provides coverage for this code path it does not use push options.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3651
2024-07-02 21:39:01 +02:00
Earl Warren a0d9d8d576
test(js): false negative in sleep test
It is entirely possible that the difference between the specified
sleep time and the actual sleep time is greater than 15 seconds.

https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#Notes

> Note that in either case, the actual delay may be longer than
> intended; see Reasons for delays longer than specified below.

It is however an error for the delay to be shorter.

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  web_src/js/utils.test.js > sleep
AssertionError: expected false to be truthy
 ❯ testSleep web_src/js/utils.test.js:192:48
    190|   const endTime = Date.now();    // Record the end time
    191|   const actualSleepTime = endTime - startTime;
    192|   expect(Math.abs(actualSleepTime - ms) <= 15).toBeTruthy();
       |                                                ^
    193| }
    194|
 ❯ web_src/js/utils.test.js:184:3
2024-07-02 19:35:35 +02:00
Earl Warren c7bb90bc6b Merge pull request '[gitea] week 2024-27 cherry pick (gitea/main -> forgejo)' (#4266) from earl-warren/wcp/2024-27 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4266
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-07-02 08:29:04 +00:00
Earl Warren 9524361bb4
docs(release-notes): development continues to Forgejo 9.0.0 2024-07-01 18:17:11 +02:00
Renovate Bot 1576ea38f8 Update dependency esbuild-loader to v4.2.0 2024-07-01 14:02:08 +00:00
Earl Warren c521e58190 Merge pull request 'Lock file maintenance' (#4280) from renovate/lock-file-maintenance into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4280
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-01 13:35:05 +00:00
Earl Warren f9ad844fd6 Merge pull request 'ci(release): upgrade v*.next.forgejo.org when the release is ready' (#4281) from earl-warren/forgejo:wip-demo-upgrade into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4281
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-07-01 13:25:22 +00:00
Earl Warren abf72a42e7
ci(release): upgrade v*.next.forgejo.org when the release is ready
The https://v$major.next.forgejo.org instances are polling for new
releases with a cron job every hour. This is not only a waste of
resources because there is nothing most of the time, it also imposes a
delay of maximum one hour when there is a new release.

When the release is published, notify the corresponding instance that
an upgrade is ready. In the request will 404 but leave a trace in the
logs which can trigger an upgrade script if wakeup-on-logs is
configured accordingly.

  GET https://v$major.next.forgejo.org/.well-known/wakeup-on-logs/forgejo-v$major

* v8 - a daemon watching on the web server logs was installed for
  https://v8.next.forgejo.org and will perform the upgrade.
* v7 - nothing will happen for https://v7.next.forgejo.org because
  it still relies on the hourly cron job.
* v1.21 - nothing will happen because https://v1.next.forgejo.org does
  not exist.

See also:

* https://forgejo.org/docs/next/developer/infrastructure
* https://code.forgejo.org/infrastructure/wakeup-on-logs
2024-07-01 12:52:59 +02:00
Earl Warren c5362d5f9e Merge pull request 'Update renovate to v37.421.2' (#4278) from renovate/renovate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4278
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-07-01 05:15:47 +00:00
Renovate Bot 15f9dde1c9 Lock file maintenance 2024-07-01 00:03:45 +00:00
Renovate Bot db8fb0021f Update renovate to v37.421.2 2024-07-01 00:01:26 +00:00
Danko Aleksejevs 36b6444f34 Remove tab key handling in markdown editor, add toolbar buttons instead, re #4072 #4142 (#4263)
We haven't decided much (to my knowledge), and I've been using the main branch in production (as one does) and found out even I myself rely on Tab sometimes working to move focus and have been caught off guard by it indenting lines instead.

So this removes Tab handling and instead adds two new buttons to the toolbar. The indentation logic is unchanged (other than now focusing the textarea during button handling, to ensure execCommand works, and thus undo history is preserved).

I'm not sure which terminology to use in tooltips. Could also add keyboard shortcuts for the whole toolbar eventually, but as is this is hopefully an better solution to the problems I previously created than un-merging the whole thing :)

<img width="414" alt="Screenshot with two new buttons" src="/attachments/b7af3aa4-a195-48d1-be0a-1559f25dce8e">

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4263
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Danko Aleksejevs <danko@very.lv>
Co-committed-by: Danko Aleksejevs <danko@very.lv>
2024-06-30 13:03:32 +00:00
Earl Warren 7b80ac476f Merge pull request 'Fixes git references wrongly transmitted to the action run' (#4272) from Mai-Lapyst/forgejo:fix-workflow_dispatch-gitrefs into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4272
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-30 08:26:12 +00:00
Mai-Lapyst 9b225b56a9
Fixes git references wrongly transmitted to the action run 2024-06-30 06:17:40 +02:00
mritunjayr 9634d954d4 test: add test coverage for web_src/js/utils/time.test.js (#4252)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4252
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: mritunjayr <mritunjaykumar694@gmail.com>
Co-committed-by: mritunjayr <mritunjaykumar694@gmail.com>
2024-06-29 09:08:29 +00:00
Shiny Nematoda 8546b01249 [FEAT] branch/tag dropdown for git-grep (#4262)
#3654 introduced support for searching non-default branches and tags.

However, the results page lacked any indicator (aside from the url) on which branch/tag the searcg was performed. A branch dropdown was introduced to the code search page when git-grep is used both as an indicator and as a intrusive way to switch between branches/tags.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4262
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
2024-06-29 06:57:34 +00:00
Earl Warren a2426e2f90
docs(release-notes): week 2024-27 cherry pick 2024-06-29 08:03:51 +02:00
Royce Remer 45181ee945
Support legacy _links LFS batch responses (#31513)
Support legacy _links LFS batch response.

Fixes #31512.

This is backwards-compatible change to the LFS client so that, upon
mirroring from an upstream which has a batch api, it can download
objects whether the responses contain the `_links` field or its
successor the `actions` field. When Gitea must fallback to the legacy
`_links` field a logline is emitted at INFO level which looks like this:
```
...s/lfs/http_client.go:188:performOperation() [I] <LFSPointer ee95d0a27ccdfc7c12516d4f80dcf144a5eaf10d0461d282a7206390635cdbee:160> is using a deprecated batch schema response!
```

I've only run `test-backend` with this code, but added a new test to
cover this case. Additionally I have a fork with this change deployed
which I've confirmed syncs LFS from Gitea<-Artifactory (which has legacy
`_links`) as well as from Gitea<-Gitea (which has the modern `actions`).

Signed-off-by: Royce Remer <royceremer@gmail.com>
(cherry picked from commit df805d6ed0458dbec258d115238fde794ed4d0ce)
2024-06-29 07:56:18 +02:00