Compare commits

...

67 commits

Author SHA1 Message Date
Beowulf
702896a512
Merge remote-tracking branch 'origin/forgejo' into davrot-upload_with_path_structure
Some checks failed
Integration tests for the release process / release-simulation (push) Has been cancelled
2025-07-11 16:03:49 +02:00
Earl Warren
0b74ecebe0 i18n: update of translations from Codeberg Translate (#8410)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8410
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2025-07-11 08:33:18 +02:00
Codeberg Translate
dc6626453a
i18n: update of translations from Codeberg Translate
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Atul_Eterno <atul_eterno@noreply.codeberg.org>
Co-authored-by: Benedikt Straub <benedikt-straub@web.de>
Co-authored-by: Codeberg Translate <translate@codeberg.org>
Co-authored-by: Dirk <dirk@noreply.codeberg.org>
Co-authored-by: Edgarsons <edgarsons@noreply.codeberg.org>
Co-authored-by: Fjuro <git@alius.cz>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Juno Takano <jutty@noreply.codeberg.org>
Co-authored-by: Laxystem <the@laxla.quest>
Co-authored-by: Miguel P.L <miguel_pl@noreply.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: SomeTr <sometr@noreply.codeberg.org>
Co-authored-by: aivot-on <aivot-on@noreply.codeberg.org>
Co-authored-by: earl-warren <earl-warren@noreply.codeberg.org>
Co-authored-by: kne <kne@noreply.codeberg.org>
Co-authored-by: oster5 <oster5@noreply.codeberg.org>
Co-authored-by: readevalprintloop <readevalprintloop@noreply.codeberg.org>
Co-authored-by: tacaly <frederick@tacaly.com>
Co-authored-by: volkan <volkan@noreply.codeberg.org>
Co-authored-by: xtex <xtexchooser@duck.com>
Co-authored-by: yurtpage <yurtpage@noreply.codeberg.org>
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/ar/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/be/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/bn/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/ca/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/cs/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/da/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/de/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/es/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/fi/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/hu/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/id/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/ja/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/ko/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/lv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/nds/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/nl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/pt_BR/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/ru/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/sr_SP/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/tr/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/uk/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/vi/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/zh_Hans/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/zh_Hant_HK/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ar/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/bg/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ca/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/cs/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/da/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/de/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/el/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/eo/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/es/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/et/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fa/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fi/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fil/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fr/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ga/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/gl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/he/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/hu/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/id/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/is/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/it/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ja/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ko/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/lt/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ml/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/nds/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/pl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ro/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/ru/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/si/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/sk/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/sl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/sv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/tr/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/uk/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/zh_Hans/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/zh_Hant/
Translation: Forgejo/forgejo
Translation: Forgejo/forgejo-next
2025-07-11 05:58:02 +00:00
Renovate Bot
74f7250259 Update module golang.org/x/net to v0.42.0 (forgejo) (#8484)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [golang.org/x/net](https://pkg.go.dev/golang.org/x/net) | [`v0.41.0` -> `v0.42.0`](https://cs.opensource.google/go/x/net/+/refs/tags/v0.41.0...refs/tags/v0.42.0) | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fnet/v0.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fnet/v0.41.0/v0.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4yMy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMjMuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8484
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-11 07:53:56 +02:00
Earl Warren
316073a925 fix: replace {workflowname} with {workflowfilename} in dispatch API (#8481)
The current {workflowname} in the API endpoint

/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches

is misleading because it does not refer to the name of the workflow but to the filename in which the workflow is defined. Change to

/repos/{owner}/{repo}/actions/workflows/{workflowfilename}/dispatches

---

There is no need for testing because it is a documentation change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8481
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-07-11 05:07:33 +02:00
Renovate Bot
a8d8a4c106 Update module golang.org/x/crypto to v0.40.0 (forgejo) (#8483)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8483
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-11 02:51:56 +02:00
Renovate Bot
51b42e3a84 Update dependency sharp to v0.34.3 (forgejo) (#8482)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8482
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-11 02:49:55 +02:00
Gusted
049899b56b feat: AGit push options starting with {base64} are decoded (#8479)
- When specifying push options, tooling like [git-repo-go](https://github.com/alibaba/git-repo-go) encodes pushoption values if they contain newlines or non-ASCII characters as they cannot be easily specified via the CLI otherwise.
- Recognize such base64 encoded values in the pushoptions (those that have the `{base64}` prefix), if the base64 decoding fails we return the original value.
- Resolves forgejo/forgejo#8161

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/8479): <!--number 8479 --><!--line 0 --><!--description QUdpdCBwdXNoIG9wdGlvbnMgc3RhcnRpbmcgd2l0aCBge2Jhc2U2NH1gIGFyZSBkZWNvZGVk-->AGit push options starting with `{base64}` are decoded<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8479
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-10 17:51:19 +02:00
Renovate Bot
2c01097315 Update module golang.org/x/sys to v0.34.0 (forgejo) (#8470)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8470
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-10 17:12:27 +02:00
Maxim Slipenko
b332d1c2e4 several fixes of ALT Package registry (#8475)
closes #7946

- The `rpmsRepoPattern` regex has been fixed to handle releases with dots correctly. For example, the version `0.9.0-alt1.git.17.g2ba905d` is valid, just like `0.1.0-1.n1` mentioned in the issue (https://codeberg.org/forgejo/forgejo/issues/7946#issue-1628991)

- getEntries now returns entry names. In the integration tests, there were lines like:
```go
assert.Equal(t, []string{"", ""}, result.ProvideNames)
```
and it’s unclear how such test logic could have ever worked correctly (fixes problems with deps https://codeberg.org/forgejo/forgejo/issues/7946#issuecomment-5109795)

- ALT is an acronym for ALT Linux Team, so `Alt` was replaced with `ALT`. Strictly speaking, it should probably be `ALT Linux`, but since we use `Arch` instead of `Arch Linux`, this seems fine. Also, Distrowatch shows `Arch`/`ALT` in its dropdown, so it’s consistent.

- The strings `"Alt Linux Team"` and `"Sisyphus"` in the `Origin` and `Suite` fields have been replaced with `setting.AppName` and `"Unknown"`. `Unknown` is a valid value and is set by default, so this won’t cause any issues.

- The documentation link has been fixed: (404 docs.gitea.com/usage/packages/alt/ -> 200 forgejo.org/docs/latest/user/packages/alt/)

---

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8475
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Maxim Slipenko <maks1ms@altlinux.org>
Co-committed-by: Maxim Slipenko <maks1ms@altlinux.org>
2025-07-10 17:12:07 +02:00
Renovate Bot
7c06db89e3 Update module golang.org/x/sync to v0.16.0 (forgejo) (#8469)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8469
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-10 14:14:30 +02:00
Gusted
7cd313951a fix: use parent context for new transactions (#8464)
- Older code (154 places to be exact) that want to do transactions uses `TxContext`. If the context is not already in a transaction then it uses `DefaultContext` for the new transaction.
- Not reusing the context it was given leads to two problems: for tracing (forgejo/forgejo#6470) any SQL code that is executed inside this transaction is not shown in the trace. If the context is cancelled then the transaction is not cancelled and will always complete (given there's no SQL error).
- When this function was introduced it didn't take a parent context, hence the usage of `DefaultContext`. When `parentCtx` was introduced it was only used to avoid nested transactions and use the parent's transaction. I do not see any reasons why the parent context cannot be reused, it is reused in the newer transaction function `WithTx` without any known problems.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8464
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-10 14:07:18 +02:00
Renovate Bot
3f1ed6dde4 Update dependency webpack to v5.100.0 (forgejo) (#8467)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [webpack](https://github.com/webpack/webpack) | [`5.99.9` -> `5.100.0`](https://renovatebot.com/diffs/npm/webpack/5.99.9/5.100.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/webpack/5.100.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/webpack/5.99.9/5.100.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>webpack/webpack (webpack)</summary>

### [`v5.100.0`](https://github.com/webpack/webpack/releases/tag/v5.100.0)

[Compare Source](https://github.com/webpack/webpack/compare/v5.99.9...v5.100.0)

##### Fixes

- Fixed the case where an ES modules entry chunk depends on the runtime chunk hash
- Handle function exports in webpack module wrapper
- Ensure dependent chunks are imported before startup & fix duplicate export of 'default'
- Generate lose closing brace when exports are unprovided
- CleanPlugin doesn't unlink same file twice
- Fixed unexpected error codes from fs.unlink on Windows
- Typescript types

##### Features

- HMR support for ES modules output
- ES module output mode now fully supports `splitChunks` when external variables and runtimeChunk are not set.
- Added support `using` keyword
- Implemented tc39 [Defer Module Evaluation](https://github.com/tc39/proposal-defer-import-eval) (experiment)
- Support dynamic template literals expressions for `new URL(...)`
- Enable ES modules worker chunk loading for Node.js targets
- Improved support for destructing in DefinePlugin
- Added [VirtualUrlPlugin](https://github.com/webpack/webpack/tree/main/examples/virtual-modules) to support `virtual:` scheme

##### Performance Improvements

- Remove useless startup entrypoint runtime for ES modules output
- Cache `new URL(...)` evaluate expression

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4yMy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMjMuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8467
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-10 10:58:57 +02:00
forgejo-release-manager
86a13589fa chore(release-notes): Forgejo v11.0.3 (#8472)
https://codeberg.org/forgejo/forgejo/milestone/20958
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8472
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-release-manager <contact-forgejo-release-manager@forgejo.org>
Co-committed-by: forgejo-release-manager <contact-forgejo-release-manager@forgejo.org>
2025-07-10 10:50:24 +02:00
forgejo-release-manager
ddc9240a14 chore(release-notes): Forgejo v7.0.16 (#8473)
https://codeberg.org/forgejo/forgejo/milestone/17405
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8473
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-release-manager <contact-forgejo-release-manager@forgejo.org>
Co-committed-by: forgejo-release-manager <contact-forgejo-release-manager@forgejo.org>
2025-07-10 10:50:11 +02:00
Gusted
3c7e3ec9e2 chore: disable mismatched root URL e2e test for safari (#8460)
- I cannot give a good rationale why Mobile Safari and webkit is failing this test quite consistently and also succeed quite often. We add a script to ensure that we get a mismatched URL - but these two browsers either ignore this script sometime or delays the execution until after the root URL check is done.
- Because it is very hard to run webkit and mobile safari without running a heavily containerized environment (without a graphical interface) it is near impossible to debug this issue properly; save ourselves a headache and disable it instead. I find it more likely to be a problem with my playwright test than it to be a problem with the mismatched root URL code.
- Ref forgejo/forgejo#8359

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8460
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-10 01:56:29 +02:00
Gusted
ba42ebf1ae chore: do not navigate to same URL in E2E test (#8461)
- In `test.beforeEach` the browser is navigated to `/user2/repo1/pulls/5` and the test environment is prepared by making sure the pull request is not WIP. At the start of `simple toggle` the browser is navigated to the same URL (and the browser is already on this URL) which the Mobile Chrome browser does not handle gracefully and reliably errors with `net::ERR_ABORTED`.
- Because we are already at that URL, do not try to navigate to it again.
- I cannot offer a rationale why the Mobile Chrome browser does give a error when this happens in subsequent tests of 'Pull: Toggle WIP'.
- Ref forgejo/forgejo#8359

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8461
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-10 00:47:39 +02:00
Gusted
8ac572682b feat(ui): add links to assigners in issue comments (#8264)
When a user is assigning an issue or PR to another user, an entry is posted in the issue comment list. This PR adds a link to the one assigning the issue. Additionally, tests for preventing XSS vulnerabilities in label rendering were added.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8264
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-07-09 23:23:33 +02:00
fruzitent
13b560c191 feat: add _URI entries for mail config (#8116)
For the mailer and incoming_mailer config, allow passwords to be read from a file.
Add `_URI` config values and use the existing `loadSecret` function to do this.

Resolves https://codeberg.org/forgejo/forgejo/issues/8113

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8116
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: fruzitent <fruzit@gmail.com>
Co-committed-by: fruzitent <fruzit@gmail.com>
2025-07-09 23:15:26 +02:00
Nis Wechselberg
24d6972f6b fix: ASCII equal fold for authorization header (#8391)
For the "Authorization:" header only lowercase "token" was accepted. This change allows uppercase "Token" as well.

Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8391
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Nis Wechselberg <enbewe@enbewe.de>
Co-committed-by: Nis Wechselberg <enbewe@enbewe.de>
2025-07-09 23:01:03 +02:00
Gnarwhal
f324ee73c5 fix: file action button spacing when wrapped (#8415)
The download, edit, and trash icon buttons had an extraneous `<span>` that was inconsistent with the copy and RSS button which caused spacing issues when wrapping.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8415
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gnarwhal <git.aspect893@passmail.net>
Co-committed-by: Gnarwhal <git.aspect893@passmail.net>
2025-07-09 22:58:49 +02:00
joneshf
48035bbd4e chore: add tests for admin auth subcommands (#8433)
This PR is adds almost all tests in `cmd/admin_auth_oauth_test.go` with a bit of refactoring beforehand to make the tests easier to write. These should be legitimate refactors where the implementation changes but the public API/behavior does not change. All of the changes in this PR are done to align with how tests are written in `cmd/admin_auth_ldap_test.go`. Since `cmd/admin_auth_ldap.go` is a sibling file to `cmd/admin_auth_oauth.go`, it seems like their test files should also be aligned.

There are some tests added that show the current behavior as not ideal. E.g. not being able to update certain fields, or being able to set fields that are ultimately ignored. These are added so that the behavior is at least shown a bit more visibly. There should likely be a follow-up to fix some of these issues. But that will almost certainly be a breaking change that I'd rather avoid in this PR.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8433
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: joneshf <jones3.hardy@gmail.com>
Co-committed-by: joneshf <jones3.hardy@gmail.com>
2025-07-09 20:55:10 +02:00
Earl Warren
32e8610b20 fix(email): actions notification template confuses branch with PR (#8448)
When a mail notification is sent because of a failed pull request run,
the body will show:

Branch: #661 (f57df45)

where #661 is the number of the pull request and not the branch. This
is because run.PrettyRef() is used and has a misleading special case
returning a PR number instead of a ref.

Remove the textual description as it can easily be discovered from the
run web page linked in the mail.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8448
Reviewed-by: Christopher Besch <mail@chris-besch.com>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-07-09 09:43:33 +02:00
Gusted
11934670ec fix: correctly mark reviews as stale for AGit PRs (#8450)
The argument order for `ValidatePullRequest` is to first give the new commitID and then the old commit ID.

This results in reviews not being marked as stale when they are not stale and reviews as not stale when they are stale. The test will fail if the fix is not present.

Add testing for the following three scenarios:

1. A review is made, the PR is updated and as a consequence the PR's diff is changed. The review is now marked as stale.
2. A review is made but in the meantime the PR is updated and the review is submitted on a older commit ID. If the diff changed the review is marked as stale.
3. A review that was made against a older commit ID is no longer marked as stale if the PR is force-pushed to that older commit ID.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8450
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-09 07:38:00 +02:00
Renovate Bot
0636b3087f Update dependency go to v1.24.5 (forgejo) (#8449)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go](https://go.dev/) ([source](https://github.com/golang/go)) | toolchain | patch | `1.24.4` -> `1.24.5` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4yMy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMjMuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8449
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-09 07:32:03 +02:00
Renovate Bot
34b77270e8 Update dependency mermaid to v11.8.1 (forgejo) (#8440)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8440
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-09 00:14:17 +02:00
0ko
f8d6a61157 fix(ui): make releases filtering responsive (#8399)
* Improve consistency with other list pages (issues, PRs)
* Improve mobile usability
* Refresh the look a bit

---

Bug fix:

Currently on mobile filters get squashed and are not very usable:
https://codeberg.org/attachments/5d6ad65e-6ae5-4819-a3dc-75fb4fe77960

This commit:
https://codeberg.org/attachments/6eb0843e-49fd-4687-ab38-9ba60a6cc6c8

---

Consistency fix:

Use same element order and spacing as in issue list:
https://codeberg.org/attachments/9cdb042d-cdce-4243-a610-a1eabe3f4fc3

On desktop this means full width search bar:
https://codeberg.org/attachments/bdd50c3d-76f3-4ad0-884e-5717f9c86154

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8399
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-07-08 16:58:49 +02:00
Renovate Bot
eb8ed7e5e9 Update module code.forgejo.org/forgejo/act to v1.29.0 (forgejo) (#8442)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [code.forgejo.org/forgejo/act](https://code.forgejo.org/forgejo/act) | `v1.28.0` -> `v1.29.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/code.forgejo.org%2fforgejo%2fact/v1.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/code.forgejo.org%2fforgejo%2fact/v1.28.0/v1.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>forgejo/act (code.forgejo.org/forgejo/act)</summary>

### [`v1.29.0`](https://code.forgejo.org/forgejo/act/compare/v1.28.0...v1.29.0)

[Compare Source](https://code.forgejo.org/forgejo/act/compare/v1.28.0...v1.29.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4yMy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMjMuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8442
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-08 07:59:34 +02:00
oliverpool
cee2aae4ca fix: corrupted wiki unit default permission (#8234 follow-up) (#8258)
Closes #8119, follow-up of #8234

#8234 "only" fixed the case when a new wiki setting was applied.

However it lacked 2 aspects:
- fixing the already corrupted unit permission in the database (required a migration)
- fixing the API route

Both aspects should now be covered.

Additionally, I commented out the unused `UnitAccessMode` and indicated that they are only used for the wiki-unit (hopefully saving some time to future code-readers).

### Testing

- go to a commit before #8234 (e.g. 285f66b782)
- create 3 repositories
  - save the wiki settings of the second, without any change
  - set the wiki of the third to be globally writable
- verify the `default_permissions` column in the database, of the unit `5`: 0, 2, 3
- stop Forgejo, switch to this PR and start Forgejo
- verify that the logs writes `Migration[35]: Fix wiki unit default permission`
- verify the `default_permissions` column in the database, of the unit `5`: 0, 0, 3

Before:

![2025-06-23-150055.png](/attachments/1eb92507-b8b4-422c-921c-4296a91172e7)

After:

![2025-06-23-150853.png](/attachments/c7b53397-54fe-487d-89da-e10b26538cde)

- [x] I did not document these changes and I do not expect someone else to do it.
- [x] I do not want this change to show in the release notes.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8258
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
2025-07-07 18:04:00 +02:00
Michael Jerger
c69e8cde7a chore(ci): temporarily disable flaky ActivityPub related tests (#8395)
As discussed in forgejo/forgejo#8274

A workaround till analysis of test timeouts helped us to fix the root cause.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8395
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
2025-07-07 14:29:57 +02:00
Renovate Bot
63236ed693 Lock file maintenance (forgejo) (#8436)
This PR contains the following updates:

| Update | Change |
|---|---|
| lockFileMaintenance | All locks refreshed |

🔧 This Pull Request updates lock files to use the latest dependency versions.

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMTcuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8436
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-07 07:39:56 +02:00
Renovate Bot
1d310e6df5 Update renovate to v41.23.1 (forgejo) (#8434)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-07 06:50:50 +02:00
Gusted
da1c0f7f18 fix: enable multi-line math equations in wiki (#8424)
- When math equation support was added into Gitea it allowed for math equations to be typed over multiple lines via `\[ ... \]` and `$$ ... $$`. Specifically the former delimiters caused problems with legitimate markdown input to be seen as a math equation and therefore was disabled in e1a82a15d3.
- Enable this multi-line parsing for wiki as it's less likely to cause issues in the context of the wiki.
- It is hard to fix this issue in a proper way without investing a good amount of time in Goldmark as explained in https://codeberg.org/forgejo/forgejo/issues/6902#issuecomment-2845317
- Added unit test.
- Resolves forgejo/forgejo#6902

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8424
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-06 22:00:09 +02:00
Antonin Delpeuch
f5cbb9604d fix(ui): visually distinguish the branch name in action description (#8418)
## Checklist

### Tests

I don't think this deserves a test.

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

### What does it fix

In the dashboard, when someone deletes a branch, the message
that is displayed doesn't distinguish the branch name from the rest
of the message visually. Because that's user-provided content, I find
it odd, as it blends in with the system-generated message.

For consistency with other messages (such as the one obtained when
renaming a repository), I propose to show the branch name in monospaced
font via the `<code></code>` markup.

I didn't update the other languages by fear of interfering with Weblate but
I would be happy to update the other languages accordingly if you wish so.

I didn't add any tests because I don't think it's necessary for such a small change.

#### Before
![image](/attachments/f158626e-fa58-4559-81b7-dd99045e1a33)
#### After
![image](/attachments/f12fe539-5c9a-4d13-a912-414591b8726d)
#### Renaming a repository (unchanged, just for reference)
![image](/attachments/a2366afb-6e24-4ad7-a41d-1c0ac6f04725)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8418
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Co-committed-by: Antonin Delpeuch <antonin@delpeuch.eu>
2025-07-06 14:26:20 +02:00
Gusted
ff5ef8fe8b fix: check PR reference on base repository (#8431)
- Regression of forgejo/forgejo#8425 (I was fooled by the github flow being `headGitRepo`).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8431
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-06 14:23:47 +02:00
Renovate Bot
466e7bfcb8 Update module github.com/go-webauthn/webauthn to v0.13.1 (forgejo) (#8427)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/go-webauthn/webauthn](https://github.com/go-webauthn/webauthn) | `v0.13.0` -> `v0.13.1` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-webauthn%2fwebauthn/v0.13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-webauthn%2fwebauthn/v0.13.0/v0.13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>go-webauthn/webauthn (github.com/go-webauthn/webauthn)</summary>

### [`v0.13.1`](https://github.com/go-webauthn/webauthn/releases/tag/v0.13.1)

[Compare Source](https://github.com/go-webauthn/webauthn/compare/v0.13.0...v0.13.1)

##### Bug Fixes

- **protocol:** conditional create uv check ([#&#8203;434](https://github.com/go-webauthn/webauthn/issues/434)) ([2e13a60](2e13a60aec)), closes [#&#8203;361](https://github.com/go-webauthn/webauthn/issues/361)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMTcuMiIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8427
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-06 07:25:09 +02:00
Gusted
288c56f5d3 feat: if OAuth2 is disabled return 'Not found' for openid configuration (#8426)
- If a Forgejo has disabled being a OAuth2 provider via `[oauth2].ENABLED = false` then return 'Not found' when clients requests `.well-known/openid-configuration` to reflect that OAuth2 is not supported.
- This allows clients to query if Forgejo has OAuth2 enabled.
- Resolves forgejo/forgejo#6978

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8426
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-06 07:19:23 +02:00
Gusted
74981d9e97 chore: Refactor Is{Reference,Branch}Exist (#8425)
- Instead of invoking a new git command to check if a reference exists, use the already opened git repository that uses a batch check to check if the reference exists.
- Instead of invoking a new git command to check if a branch exists, use the already opened git repository that uses a batch check to check if the branch exists.
- Do not depend on `IsReferenceExist` as its no longer used by any other function.
- Specify `--quiet` to not waste Git's time on printing something we do not use.
- Run it via `Run` so no buffers are created for stdout and stderr.
- Add a test that verifies `IsBranchExist` works and does not work for other types of references.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8425
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-06 07:16:43 +02:00
Renovate Bot
212e8ac348 Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.2.1 (forgejo) (#8422)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8422
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-05 18:33:45 +02:00
Renovate Bot
6e239a7f65 Update dependency @vitest/eslint-plugin to v1.3.4 (forgejo) (#8420)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-05 16:38:18 +02:00
Gusted
5f514a6e4d chore: refactor LineBlame (#8419)
- Refactor arguments of the function to make more sense.
  - `path` can be inferred from `repo` receiver.
  - `line` can be `uint64`.
- The two calls to this function check for specific errors, do this error checking in the function.
- The ID of a object format is not 40 in the case of SHA256, get the object format and use the correct length.
- Add test coverage for `LineBlame`, notably it checks for the errors that can legitimately happen.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8419
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-05 16:31:53 +02:00
Renovate Bot
d8c5083c6f Update linters (forgejo) (#8421)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8421
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-05 16:16:10 +02:00
joneshf
d4873965c8 feat: add --attribute-ssh-pubic-key to forgejo admin auth add-oauth and update-oauth CLI (#8383)
As explained in https://codeberg.org/forgejo/forgejo/issues/8072, the CLI was missing a way to set the `AttributeSSHPublicKey` field that was added in https://codeberg.org/forgejo/forgejo/pulls/6232. We add a flag to do that, and thread it through where necessary.

The checklist mentions adding tests, but the code in `cmd/admin_auth_oauth.go` seems to not have a `cmd/admin_auth_oauth_test.go`, and I'm not sure if there's something else that's testing this behavior. I can try to add tests if there's already a good spot to slot them in. If not, it seems like adding a `cmd/cmd/admin_auth_oauth_test.go` that worked similar to the current `cmd/admin_auth_ldap_test.go` might be a bit big of a change.

As far as documentation, I might be wrong about this, but it seems like the CLI docs are only updated once there's a new release. I can't do that yet, so I don't think that either of the checkboxes apply to this PR.

## Manual testing

There are two CLI commands that can be validated: `forgejo admin auth add-oauth` and `forgejo admin auth update-oauth`.
1. `forgejo admin auth add-oauth` requires an actual auto-discovery URL that responds appropriately.

    - If there is not already an OIDC provider set up that has an auto-discovery URL, the sample OIDC provider at https://openidconnect.net/ can be used with it's auto-discovery URL of https://samples.auth0.com/.well-known/openid-configuration.

1. Run the following command to create a new OAuth2 authentication source:
    ```Console
    forgejo admin auth add-oauth --attribute-ssh-public-key=ssh_public_key_field --auto-discover-url=https://samples.auth0.com/.well-known/openid-configuration --name='Delete this later' --provider=openidConnect
    ```

    - This should create a new OAuth2 authentication source named "Delete this later" with the "Public SSH key attribute" field set to `ssh_public_key_field`.
        <details>
        <summary>Screenshot of newly created OAuth2 authentication source</summary>

        ![forgejo-admin-auth-add-oauth](/attachments/166f3f82-adc8-4ef9-9128-fb8a923fdc0d)
        </details>

1. `forgejo admin auth update-oauth` requires the id of the newly created OAuth2 authentication source.

    - This id can be found on either the "Authentication sources" page (`/admin/auths`) or as the URL of the newly created OAuth2 authentication source (`/admins/auths/{id}`).

1. Run the following command to update the OAuth2 authentication source:
    ```Console
    forgejo admin auth update-oauth --attribute-ssh-public-key=ssh_public_key_field_new_name --id=<id-of-new-oauth2-authentication-source>
    ```

    - This should change the "Public SSH key attribute" to `ssh_public_key_field_new_name`.

        <details>
        <summary>Screenshot of updated OAuth2 authentication source</summary>

        ![forgejo-admin-auth-update-oauth](/attachments/9674dba0-6ed1-4fb8-8eb8-d7f33cbf8c3a)
        </details>

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/8383): <!--number 8383 --><!--line 0 --><!--description YWRkIGAtLWF0dHJpYnV0ZS1zc2gtcHViaWMta2V5YCB0byBmb3JnZWpvIGFkbWluIGF1dGggYWRkLW9hdXRoIGFuZCB1cGRhdGUtb2F1dGggQ0xJ-->add `--attribute-ssh-pubic-key` to forgejo admin auth add-oauth and update-oauth CLI<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8383
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: joneshf <jones3.hardy@gmail.com>
Co-committed-by: joneshf <jones3.hardy@gmail.com>
2025-07-05 13:53:00 +02:00
Renovate Bot
a789dd76d5 Update dependency mermaid to v11.8.0 (forgejo) (#8405)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8405
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-04 23:09:26 +02:00
zokki
72620db8df feat: add a EXCLUSION to the logger (#8212)
This feature is intended to help reduce noisy logs generated by routine Kubernetes probes and Prometheus scraping. While logs are essential, these specific requests (e.g., to /metrics and /api/healthz) generally don't provide useful information and tend to clutter the output.

The goal is to introduce functionality that effectively acts as the inverse of the existing EXPRESSION mode—allowing logging to be excluded based on a condition, rather than included.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8212
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: zokki <zokki.softwareschmiede@gmail.com>
Co-committed-by: zokki <zokki.softwareschmiede@gmail.com>
2025-07-04 00:08:23 +02:00
Renovate Bot
b669564f39 Update module github.com/alecthomas/chroma/v2 to v2.19.0 (forgejo) (#8393)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8393
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-04 00:06:28 +02:00
Earl Warren
aca7e8a9af fix: cancelled or skipped runs are not failures for notifications (#8366)
From the point of view of a notification, the only status which must be considered a fail is `StatusFailure`. All others are either success `StatusSuccess` or undetermined `StatusCancelled` and `StatusSkipped`.

Those are the only four status in which a run can be when it reaches the `ActionRunNowDone` function because it is filtered on `IsDone` which is only true for those.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.

### Documentation

- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8366
Reviewed-by: Antonin Delpeuch <wetneb@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-07-03 22:53:55 +02:00
Gusted
b580c830e0 chore: improve reliability of webauthn e2e test (#8400)
- This test is the source of many transient errors https://codeberg.org/forgejo/forgejo/issues/8359#issuecomment-5655557 and is semi-reproducible locally. Any debugging code that is added will result in the error no longer being reproducible, making it hard to say why this is failing.
- It no longer seems necessary to add this `waitForURL` call as Playwright now seems to gracefully handle the case where we want to go to a specific page while playwright might still be navigating to another URL that was initiated by clicking on a button - thus removing the source of the transient error altogether.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8400
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-03 20:10:58 +02:00
Danko Aleksejevs
4935e6e1a3 fix: skip empty tokens in SearchOptions.Tokens() (#8261)
Query string tokenizer could return a list containing empty tokens when the query string was `\` or `"` (probably in other scenarios as well).

This seems undesirable and is what triggered #8260, but I'm posting this separately from that fix in case I'm wrong. Feel free to reject if so.

The actual change in behavior is that now searching for `\` or `"` behaves the same as if the query were empty (the bleve/elastic code checks that the tokenizer actually returned, anything rather than just query being non-empty).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8261
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org>
Co-authored-by: Danko Aleksejevs <danko@very.lv>
Co-committed-by: Danko Aleksejevs <danko@very.lv>
2025-07-03 11:29:04 +02:00
Earl Warren
bc2e4942fc i18n: update of translations from Codeberg Translate (#8295)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8295
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2025-07-03 06:23:05 +02:00
Codeberg Translate
8cc2086402
i18n: update of translations from Codeberg Translate
Co-authored-by: Benedikt Straub <benedikt-straub@web.de>
Co-authored-by: Codeberg Translate <translate@codeberg.org>
Co-authored-by: Dirk <dirk@noreply.codeberg.org>
Co-authored-by: Edgarsons <edgarsons@noreply.codeberg.org>
Co-authored-by: Fjuro <git@alius.cz>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Juno Takano <jutty@noreply.codeberg.org>
Co-authored-by: Outbreak2096 <outbreak2096@noreply.codeberg.org>
Co-authored-by: SomeTr <sometr@noreply.codeberg.org>
Co-authored-by: Vyxie <kitakita@disroot.org>
Co-authored-by: Xinayder <xinayder@noreply.codeberg.org>
Co-authored-by: artnay <artnay@noreply.codeberg.org>
Co-authored-by: earl-warren <earl-warren@noreply.codeberg.org>
Co-authored-by: jedik <jedik@noreply.codeberg.org>
Co-authored-by: justbispo <justbispo@noreply.codeberg.org>
Co-authored-by: kwoot <kwoot@noreply.codeberg.org>
Co-authored-by: leandro-costa <leandro-costa@noreply.codeberg.org>
Co-authored-by: xtex <xtexchooser@duck.com>
Co-authored-by: yeager <yeager@noreply.codeberg.org>
Co-authored-by: zub <zub@noreply.codeberg.org>
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/cs/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/de/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/fil/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/lv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/nb_NO/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/nds/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/nl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/pt_BR/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/pt_PT/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/sv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/uk/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo-next/zh_Hans/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/cs/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fi/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/fr/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/lv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/nb_NO/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/nds/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/nl/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/pt_BR/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/pt_PT/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/sv/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/uk/
Translate-URL: https://translate.codeberg.org/projects/forgejo/forgejo/zh_Hans/
Translation: Forgejo/forgejo
Translation: Forgejo/forgejo-next
2025-07-03 03:51:11 +00:00
Earl Warren
c0eeb75322 fix: disable Forgejo Actions email notifications on recovery (#8374)
- Make the migration to add an index a noop - do not remove it as it would break v12.next & v13.next
- Keep the logic that relies on finding the last run, only always fail to find which is the same as assuming each run is one of a kind

Refs forgejo/forgejo#8373

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8374
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-07-02 19:23:07 +02:00
Renovate Bot
bcde3aea4f Update module github.com/go-chi/cors to v1.2.2 (forgejo) (#8380)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8380
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-02 16:40:48 +02:00
Renovate Bot
abb95c8c92 Update dependency globals to v16.3.0 (forgejo) (#8381)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8381
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-02 16:34:56 +02:00
Gusted
0ecd9d9682 fix: user activation with uppercase email address (#8367)
- Right before the call to user email activation, the user is updated [^1]. This causes the email to be lowered, which in turn makes the call to activate the user activation fail (on database where collation is case sensitive, which is the recommend collation by Forgejo).
- The code in `BeforeUpdate` is quite confusing, the comment has become slightly out of date and was reworded to reflect reality and its purpose. The code is also slightly reworked to only lower the email for the `AvatarEmail` field to avoid causing side-effect.
- Added unit test.
- Resolves forgejo/forgejo#8354

[^1]: 4927d4ee3d/routers/web/auth/auth.go (L785)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8367
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-02 13:04:22 +02:00
Bojidar Marinov
1ed750a33a feat: detect Interlisp sources as text (#8377)
This PR detects Interlisp files (files that include "(DEFINE-FILE-INFO" somewhere near the start, and do not have an .LCOM extension) as text files and displays them as such in the web UI.
To check for extensions, I had to extend the `typesniffer.DetectContentType` function to accept an extra filename parameter—which could be useful for future filetype detection features. It is possible that a few of the places I modified pass a full file path instead of just passing a file name.

Implements #8184

## Checklist

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes... - NA
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/8377): <!--number 8377 --><!--line 0 --><!--description ZGV0ZWN0IEludGVybGlzcCBzb3VyY2VzIGFzIHRleHQ=-->detect Interlisp sources as text<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8377
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
Co-committed-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2025-07-02 07:38:46 +02:00
Michael Jerger
6f501b1fdf Improved signature handling & instance actor (#8275)
This PR is part of https://codeberg.org/forgejo/forgejo/pulls/4767

It improves the signature handling:
1. move logic to a service (might be used from other services as well)
2. make a clear difference between ` ReqHTTPUserSignature` and `ReqHTTPUserOrInstanceSignature`
3. improve test ability (activitypub/client & distant_federation_server_mock

Adjust instance actor
1. name &
2. webfinger

## Strategy for next PRs is

Integration tests are in the driving seat.

I will step by step add integration tests form original PR and add code required by the integration test changes.

## Meta

Proposal howto process large PRs can be discussed here: https://codeberg.org/forgejo-contrib/federation/pulls/37

Current state with rendered diagrams can be found here: https://codeberg.org/meissa/federation/src/branch/merge-large-pr/doc/merge-large-pr.md

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8275
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
2025-07-01 19:49:00 +02:00
Renovate Bot
7a8ff20bf3 Update github.com/google/pprof digest to 6e76a2b (forgejo) (#8368)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8368
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-01 07:17:12 +02:00
Renovate Bot
8f28942233 Update ghcr.io/devcontainers/features/git-lfs Docker tag to v1.2.5 (forgejo) (#8369)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-01 06:31:22 +02:00
Renovate Bot
2b5123a90f Update dependency @playwright/test to v1.53.2 (forgejo) (#8372)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-01 06:09:20 +02:00
Renovate Bot
0730e5481f Update vitest monorepo to v3.2.4 (forgejo) (#8371)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-07-01 06:08:49 +02:00
Robert Wolff
2f0a993a33 fix(ui): repo settings units overview anchor (#8322)
This fixes (or features?) a small nit that I found disturbing when clicking through repository settings.

# Test
- open repo settings
- click in navigation bar on "Units" and then on "Overview"
- the page opens now at top (not jumping down as before that change)
- click on "Issues", etc. -> the page still jumps to the related sections

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8322
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
2025-07-01 01:07:19 +02:00
Gusted
0ecb25fdcb chore: do not require empty fixtures to clean tables (#8353)
- A mistake that is often made is to not put a empty fixture for tables that gets populated in a test and should be cleaned up between runs. The CI does not detect such issues as these never arise on the first run of the test suite and are only noticed when developers run a test for a second time, unless you are aware of this behavior (which very few do as this is not documented and pure folk knowledge) can end up in chasing a bug that does not exist for hours. forgejo/forgejo#7041, forgejo/forgejo#7419, meissa/forgejo#21, forgejo/forgejo#5771
- Because we now own the fixture loader (forgejo/forgejo#7715), its rather simple to ensure that all tables that did not receive fixtures should be cleaned between runs and removes the need to place empty fixture files.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8353
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-06-30 23:04:16 +02:00
0ko
6e58d285c7 merge commit: fix(ui): Add pasted images to dropzone (#7749)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7749
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-06-30 14:30:25 +02:00
Beowulf
6e66380408
fix(ui): Add pasted images to dropzone
This adds pasted images to the dropzone to provide the same experience
as when using the dropzone. This gives the possibility to preview and
delete the image. Additionally it provides a copy button to copy the
markdown code for inserting the image.

Removed the old implementation in `repo-legacy.js` and generalized
everything in `common-global.js` as common implementation.

Replaced old jquery code with plain JS.

Fixes #4588
2025-06-30 12:42:22 +02:00
Robert Wolff
76b3f4cd6a test: prevent XSS for label rendering 2025-06-27 13:27:06 +02:00
Robert Wolff
1b9ac27578 feat(ui): add issue comment assignment doer links 2025-06-27 13:17:34 +02:00
551 changed files with 5386 additions and 2823 deletions

View file

@ -27,15 +27,13 @@ forgejo.org/models/db
TruncateBeans
InTransaction
DumpTables
GetTableNames
forgejo.org/models/dbfs
file.renameTo
Create
Rename
forgejo.org/models/forgefed
GetFederationHost
forgejo.org/models/forgejo/semver
GetVersion
SetVersionString
@ -67,7 +65,6 @@ forgejo.org/models/user
DeleteUserSetting
GetFederatedUser
GetFederatedUserByUserID
UpdateFederatedUser
GetFollowersForUser
AddFollower
RemoveFollower
@ -248,6 +245,9 @@ forgejo.org/routers/web/org
forgejo.org/services/context
GetPrivateContext
forgejo.org/services/federation
Init
forgejo.org/services/repository
IsErrForkAlreadyExist

View file

@ -6,7 +6,7 @@
"ghcr.io/devcontainers/features/node:1": {
"version": "22"
},
"ghcr.io/devcontainers/features/git-lfs:1.2.4": {},
"ghcr.io/devcontainers/features/git-lfs:1.2.5": {},
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
},
"customizations": {

View file

@ -28,7 +28,7 @@ jobs:
runs-on: docker
container:
image: data.forgejo.org/renovate/renovate:41.17.2
image: data.forgejo.org/renovate/renovate:41.23.2
steps:
- name: Load renovate repo cache

View file

@ -79,6 +79,10 @@ linters:
- name: unreachable-code
- name: var-declaration
- name: var-naming
arguments:
- []
- []
- - skip-package-name-checks: true
- name: redefines-builtin-id
disabled: true
staticcheck:

View file

@ -39,7 +39,7 @@ XGO_VERSION := go-1.21.x
AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.3.0 # renovate: datasource=go
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.2.1 # renovate: datasource=go
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11 # renovate: datasource=go
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 # renovate: datasource=go
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
@ -47,7 +47,7 @@ GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 # renovate: datasour
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go
DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.34.0 # renovate: datasource=go
GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.5.2 # renovate: datasource=go
RENOVATE_NPM_PACKAGE ?= renovate@41.17.2 # renovate: datasource=docker packageName=data.forgejo.org/renovate/renovate
RENOVATE_NPM_PACKAGE ?= renovate@41.23.2 # renovate: datasource=docker packageName=data.forgejo.org/renovate/renovate
# https://github.com/disposable-email-domains/disposable-email-domains/commits/main/
DISPOSABLE_EMAILS_SHA ?= 0c27e671231d27cf66370034d7f6818037416989 # renovate: ...

View file

@ -17,6 +17,15 @@ import (
"github.com/urfave/cli/v3"
)
type (
authService struct {
initDB func(ctx context.Context) error
createAuthSource func(context.Context, *auth_model.Source) error
updateAuthSource func(context.Context, *auth_model.Source) error
getAuthSourceByID func(ctx context.Context, id int64) (*auth_model.Source, error)
}
)
func microcmdAuthDelete() *cli.Command {
return &cli.Command{
Name: "delete",
@ -60,6 +69,16 @@ func microcmdAuthList() *cli.Command {
}
}
// newAuthService creates a service with default functions.
func newAuthService() *authService {
return &authService{
initDB: initDB,
createAuthSource: auth_model.CreateSource,
updateAuthSource: auth_model.UpdateSource,
getAuthSourceByID: auth_model.GetSourceByID,
}
}
func runListAuth(ctx context.Context, c *cli.Command) error {
ctx, cancel := installSignals(ctx)
defer cancel()

View file

@ -14,15 +14,6 @@ import (
"github.com/urfave/cli/v3"
)
type (
authService struct {
initDB func(ctx context.Context) error
createAuthSource func(context.Context, *auth.Source) error
updateAuthSource func(context.Context, *auth.Source) error
getAuthSourceByID func(ctx context.Context, id int64) (*auth.Source, error)
}
)
func commonLdapCLIFlags() []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
@ -184,16 +175,6 @@ func microcmdAuthUpdateLdapSimpleAuth() *cli.Command {
}
}
// newAuthService creates a service with default functions.
func newAuthService() *authService {
return &authService{
initDB: initDB,
createAuthSource: auth.CreateSource,
updateAuthSource: auth.UpdateSource,
getAuthSourceByID: auth.GetSourceByID,
}
}
// parseAuthSource assigns values on authSource according to command line flags.
func parseAuthSource(c *cli.Command, authSource *auth.Source) {
if c.IsSet("name") {

View file

@ -86,6 +86,11 @@ func oauthCLIFlags() []cli.Flag {
Value: nil,
Usage: "Scopes to request when to authenticate against this OAuth2 source",
},
&cli.StringFlag{
Name: "attribute-ssh-public-key",
Value: "",
Usage: "Claim name providing SSH public keys for this source",
},
&cli.StringFlag{
Name: "required-claim-name",
Value: "",
@ -127,7 +132,7 @@ func microcmdAuthAddOauth() *cli.Command {
return &cli.Command{
Name: "add-oauth",
Usage: "Add new Oauth authentication source",
Action: runAddOauth,
Action: newAuthService().addOauth,
Flags: oauthCLIFlags(),
}
}
@ -136,7 +141,7 @@ func microcmdAuthUpdateOauth() *cli.Command {
return &cli.Command{
Name: "update-oauth",
Usage: "Update existing Oauth authentication source",
Action: runUpdateOauth,
Action: newAuthService().updateOauth,
Flags: append(oauthCLIFlags()[:1], append([]cli.Flag{idFlag()}, oauthCLIFlags()[1:]...)...),
}
}
@ -163,6 +168,7 @@ func parseOAuth2Config(_ context.Context, c *cli.Command) *oauth2.Source {
IconURL: c.String("icon-url"),
SkipLocalTwoFA: c.Bool("skip-local-2fa"),
Scopes: c.StringSlice("scopes"),
AttributeSSHPublicKey: c.String("attribute-ssh-public-key"),
RequiredClaimName: c.String("required-claim-name"),
RequiredClaimValue: c.String("required-claim-value"),
GroupClaimName: c.String("group-claim-name"),
@ -173,11 +179,11 @@ func parseOAuth2Config(_ context.Context, c *cli.Command) *oauth2.Source {
}
}
func runAddOauth(ctx context.Context, c *cli.Command) error {
func (a *authService) addOauth(ctx context.Context, c *cli.Command) error {
ctx, cancel := installSignals(ctx)
defer cancel()
if err := initDB(ctx); err != nil {
if err := a.initDB(ctx); err != nil {
return err
}
@ -189,7 +195,7 @@ func runAddOauth(ctx context.Context, c *cli.Command) error {
}
}
return auth_model.CreateSource(ctx, &auth_model.Source{
return a.createAuthSource(ctx, &auth_model.Source{
Type: auth_model.OAuth2,
Name: c.String("name"),
IsActive: true,
@ -197,7 +203,7 @@ func runAddOauth(ctx context.Context, c *cli.Command) error {
})
}
func runUpdateOauth(ctx context.Context, c *cli.Command) error {
func (a *authService) updateOauth(ctx context.Context, c *cli.Command) error {
if !c.IsSet("id") {
return errors.New("--id flag is missing")
}
@ -205,11 +211,11 @@ func runUpdateOauth(ctx context.Context, c *cli.Command) error {
ctx, cancel := installSignals(ctx)
defer cancel()
if err := initDB(ctx); err != nil {
if err := a.initDB(ctx); err != nil {
return err
}
source, err := auth_model.GetSourceByID(ctx, c.Int64("id"))
source, err := a.getAuthSourceByID(ctx, c.Int64("id"))
if err != nil {
return err
}
@ -244,6 +250,10 @@ func runUpdateOauth(ctx context.Context, c *cli.Command) error {
oAuth2Config.Scopes = c.StringSlice("scopes")
}
if c.IsSet("attribute-ssh-public-key") {
oAuth2Config.AttributeSSHPublicKey = c.String("attribute-ssh-public-key")
}
if c.IsSet("required-claim-name") {
oAuth2Config.RequiredClaimName = c.String("required-claim-name")
}
@ -300,5 +310,5 @@ func runUpdateOauth(ctx context.Context, c *cli.Command) error {
oAuth2Config.CustomURLMapping = customURLMapping
source.Cfg = oAuth2Config
return auth_model.UpdateSource(ctx, source)
return a.updateAuthSource(ctx, source)
}

View file

@ -0,0 +1,704 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package cmd
import (
"context"
"testing"
"forgejo.org/models/auth"
"forgejo.org/modules/test"
"forgejo.org/services/auth/source/oauth2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v3"
)
func TestAddOauth(t *testing.T) {
// Mock cli functions to do not exit on error
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
// Test cases
cases := []struct {
args []string
source *auth.Source
errMsg string
}{
// case 0
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source full",
"--provider", "openidConnect",
"--key", "client id",
"--secret", "client secret",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
"--use-custom-urls", "",
"--custom-tenant-id", "tenant id",
"--custom-auth-url", "https://example.com/auth",
"--custom-token-url", "https://example.com/token",
"--custom-profile-url", "https://example.com/profile",
"--custom-email-url", "https://example.com/email",
"--icon-url", "https://example.com/icon.svg",
"--skip-local-2fa",
"--scopes", "address",
"--scopes", "email",
"--scopes", "phone",
"--scopes", "profile",
"--attribute-ssh-public-key", "ssh_public_key",
"--required-claim-name", "can_access",
"--required-claim-value", "yes",
"--group-claim-name", "groups",
"--admin-group", "admin",
"--restricted-group", "restricted",
"--group-team-map", `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
"--group-team-map-removal",
},
source: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source full",
IsActive: true,
Cfg: &oauth2.Source{
Provider: "openidConnect",
ClientID: "client id",
ClientSecret: "client secret",
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
CustomURLMapping: &oauth2.CustomURLMapping{
AuthURL: "https://example.com/auth",
TokenURL: "https://example.com/token",
ProfileURL: "https://example.com/profile",
EmailURL: "https://example.com/email",
Tenant: "tenant id",
},
IconURL: "https://example.com/icon.svg",
Scopes: []string{"address", "email", "phone", "profile"},
AttributeSSHPublicKey: "ssh_public_key",
RequiredClaimName: "can_access",
RequiredClaimValue: "yes",
GroupClaimName: "groups",
AdminGroup: "admin",
GroupTeamMap: `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
GroupTeamMapRemoval: true,
RestrictedGroup: "restricted",
SkipLocalTwoFA: true,
},
},
},
// case 1
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source min",
"--provider", "openidConnect",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
},
source: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source min",
IsActive: true,
Cfg: &oauth2.Source{
Provider: "openidConnect",
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
Scopes: []string{},
},
},
},
// case 2
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source `--use-custom-urls` required for `--custom-*` flags",
"--custom-tenant-id", "tenant id",
"--custom-auth-url", "https://example.com/auth",
"--custom-token-url", "https://example.com/token",
"--custom-profile-url", "https://example.com/profile",
"--custom-email-url", "https://example.com/email",
},
source: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--use-custom-urls` required for `--custom-*` flags",
IsActive: true,
Cfg: &oauth2.Source{
Scopes: []string{},
},
},
},
// case 3
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source `--scopes` aggregates multiple uses",
"--provider", "openidConnect",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
"--scopes", "address",
"--scopes", "email",
"--scopes", "phone",
"--scopes", "profile",
},
source: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--scopes` aggregates multiple uses",
IsActive: true,
Cfg: &oauth2.Source{
Provider: "openidConnect",
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
Scopes: []string{"address", "email", "phone", "profile"},
},
},
},
// case 4
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source `--scopes` supports commas as separators",
"--provider", "openidConnect",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
"--scopes", "address,email,phone,profile",
},
source: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--scopes` supports commas as separators",
IsActive: true,
Cfg: &oauth2.Source{
Provider: "openidConnect",
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
Scopes: []string{"address", "email", "phone", "profile"},
},
},
},
// case 5
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source",
"--provider", "openidConnect",
},
errMsg: "invalid Auto Discovery URL: (this must be a valid URL starting with http:// or https://)",
},
// case 6
{
args: []string{
"oauth-test",
"--name", "oauth2 (via openidConnect) source",
"--provider", "openidConnect",
"--auto-discover-url", "example.com",
},
errMsg: "invalid Auto Discovery URL: example.com (this must be a valid URL starting with http:// or https://)",
},
}
for n, c := range cases {
// Mock functions.
var createdAuthSource *auth.Source
service := &authService{
initDB: func(context.Context) error {
return nil
},
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
createdAuthSource = authSource
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "should not call updateAuthSource", "case: %d", n)
return nil
},
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
assert.FailNow(t, "should not call getAuthSourceByID", "case: %d", n)
return nil, nil
},
}
// Create a copy of command to test
app := cli.Command{}
app.Flags = microcmdAuthAddOauth().Flags
app.Action = service.addOauth
// Run it
err := app.Run(t.Context(), c.args)
if c.errMsg != "" {
assert.EqualError(t, err, c.errMsg, "case %d: error should match", n)
} else {
require.NoError(t, err, "case %d: should have no errors", n)
assert.Equal(t, c.source, createdAuthSource, "case %d: wrong authSource", n)
}
}
}
func TestUpdateOauth(t *testing.T) {
// Mock cli functions to do not exit on error
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
// Test cases
cases := []struct {
args []string
id int64
existingAuthSource *auth.Source
authSource *auth.Source
errMsg string
}{
// case 0
{
args: []string{
"oauth-test",
"--id", "23",
"--name", "oauth2 (via openidConnect) source full",
"--provider", "openidConnect",
"--key", "client id",
"--secret", "client secret",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
"--use-custom-urls", "",
"--custom-tenant-id", "tenant id",
"--custom-auth-url", "https://example.com/auth",
"--custom-token-url", "https://example.com/token",
"--custom-profile-url", "https://example.com/profile",
"--custom-email-url", "https://example.com/email",
"--icon-url", "https://example.com/icon.svg",
"--skip-local-2fa",
"--scopes", "address",
"--scopes", "email",
"--scopes", "phone",
"--scopes", "profile",
"--attribute-ssh-public-key", "ssh_public_key",
"--required-claim-name", "can_access",
"--required-claim-value", "yes",
"--group-claim-name", "groups",
"--admin-group", "admin",
"--restricted-group", "restricted",
"--group-team-map", `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
"--group-team-map-removal",
},
id: 23,
existingAuthSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{},
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source full",
Cfg: &oauth2.Source{
Provider: "openidConnect",
ClientID: "client id",
ClientSecret: "client secret",
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
CustomURLMapping: &oauth2.CustomURLMapping{
AuthURL: "https://example.com/auth",
TokenURL: "https://example.com/token",
ProfileURL: "https://example.com/profile",
EmailURL: "https://example.com/email",
Tenant: "tenant id",
},
IconURL: "https://example.com/icon.svg",
Scopes: []string{"address", "email", "phone", "profile"},
AttributeSSHPublicKey: "ssh_public_key",
RequiredClaimName: "can_access",
RequiredClaimValue: "yes",
GroupClaimName: "groups",
AdminGroup: "admin",
GroupTeamMap: `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
GroupTeamMapRemoval: true,
RestrictedGroup: "restricted",
// `--skip-local-2fa` is currently ignored.
// SkipLocalTwoFA: true,
},
},
},
// case 1
{
args: []string{
"oauth-test",
"--id", "1",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 2
{
args: []string{
"oauth-test",
"--id", "1",
"--name", "oauth2 (via openidConnect) source full",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source full",
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 3
{
args: []string{
"oauth-test",
"--id", "1",
"--provider", "openidConnect",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
Provider: "openidConnect",
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 4
{
args: []string{
"oauth-test",
"--id", "1",
"--key", "client id",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
ClientID: "client id",
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 5
{
args: []string{
"oauth-test",
"--id", "1",
"--secret", "client secret",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
ClientSecret: "client secret",
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 6
{
args: []string{
"oauth-test",
"--id", "1",
"--auto-discover-url", "https://example.com/.well-known/openid-configuration",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
OpenIDConnectAutoDiscoveryURL: "https://example.com/.well-known/openid-configuration",
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 7
{
args: []string{
"oauth-test",
"--id", "1",
"--use-custom-urls", "",
"--custom-tenant-id", "tenant id",
"--custom-auth-url", "https://example.com/auth",
"--custom-token-url", "https://example.com/token",
"--custom-profile-url", "https://example.com/profile",
"--custom-email-url", "https://example.com/email",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{
AuthURL: "https://example.com/auth",
TokenURL: "https://example.com/token",
ProfileURL: "https://example.com/profile",
EmailURL: "https://example.com/email",
Tenant: "tenant id",
},
},
},
},
// case 8
{
args: []string{
"oauth-test",
"--id", "1",
"--name", "oauth2 (via openidConnect) source `--use-custom-urls` required for `--custom-*` flags",
"--custom-tenant-id", "tenant id",
"--custom-auth-url", "https://example.com/auth",
"--custom-token-url", "https://example.com/token",
"--custom-profile-url", "https://example.com/profile",
"--custom-email-url", "https://example.com/email",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--use-custom-urls` required for `--custom-*` flags",
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
},
},
},
// case 9
{
args: []string{
"oauth-test",
"--id", "1",
"--icon-url", "https://example.com/icon.svg",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
IconURL: "https://example.com/icon.svg",
},
},
},
// case 10
{
args: []string{
"oauth-test",
"--id", "1",
"--name", "oauth2 (via openidConnect) source `--skip-local-2fa` is currently ignored",
"--skip-local-2fa",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--skip-local-2fa` is currently ignored",
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
// `--skip-local-2fa` is currently ignored.
// SkipLocalTwoFA: true,
},
},
},
// case 11
{
args: []string{
"oauth-test",
"--id", "1",
"--name", "oauth2 (via openidConnect) source `--scopes` aggregates multiple uses",
"--scopes", "address",
"--scopes", "email",
"--scopes", "phone",
"--scopes", "profile",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--scopes` aggregates multiple uses",
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
Scopes: []string{"address", "email", "phone", "profile"},
},
},
},
// case 12
{
args: []string{
"oauth-test",
"--id", "1",
"--name", "oauth2 (via openidConnect) source `--scopes` supports commas as separators",
"--scopes", "address,email,phone,profile",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Name: "oauth2 (via openidConnect) source `--scopes` supports commas as separators",
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
Scopes: []string{"address", "email", "phone", "profile"},
},
},
},
// case 13
{
args: []string{
"oauth-test",
"--id", "1",
"--attribute-ssh-public-key", "ssh_public_key",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
AttributeSSHPublicKey: "ssh_public_key",
},
},
},
// case 14
{
args: []string{
"oauth-test",
"--id", "1",
"--required-claim-name", "can_access",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
RequiredClaimName: "can_access",
},
},
},
// case 15
{
args: []string{
"oauth-test",
"--id", "1",
"--required-claim-value", "yes",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
RequiredClaimValue: "yes",
},
},
},
// case 16
{
args: []string{
"oauth-test",
"--id", "1",
"--group-claim-name", "groups",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
GroupClaimName: "groups",
},
},
},
// case 17
{
args: []string{
"oauth-test",
"--id", "1",
"--admin-group", "admin",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
AdminGroup: "admin",
},
},
},
// case 18
{
args: []string{
"oauth-test",
"--id", "1",
"--restricted-group", "restricted",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
RestrictedGroup: "restricted",
},
},
},
// case 19
{
args: []string{
"oauth-test",
"--id", "1",
"--group-team-map", `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
GroupTeamMap: `{"org_a_team_1": {"organization-a": ["Team 1"]}, "org_a_all_teams": {"organization-a": ["Team 1", "Team 2", "Team 3"]}}`,
},
},
},
// case 20
{
args: []string{
"oauth-test",
"--id", "1",
"--group-team-map-removal",
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
GroupTeamMapRemoval: true,
},
},
},
// case 21
{
args: []string{
"oauth-test",
"--id", "23",
"--group-team-map-removal=false",
},
id: 23,
existingAuthSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
GroupTeamMapRemoval: true,
},
},
authSource: &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{
CustomURLMapping: &oauth2.CustomURLMapping{},
GroupTeamMapRemoval: false,
},
},
},
// case 22
{
args: []string{
"oauth-test",
},
errMsg: "--id flag is missing",
},
}
for n, c := range cases {
// Mock functions.
var updatedAuthSource *auth.Source
service := &authService{
initDB: func(context.Context) error {
return nil
},
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "should not call createAuthSource", "case: %d", n)
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
updatedAuthSource = authSource
return nil
},
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
if c.id != 0 {
assert.Equal(t, c.id, id, "case %d: wrong id", n)
}
if c.existingAuthSource != nil {
return c.existingAuthSource, nil
}
return &auth.Source{
Type: auth.OAuth2,
Cfg: &oauth2.Source{},
}, nil
},
}
// Create a copy of command to test
app := cli.Command{}
app.Flags = microcmdAuthUpdateOauth().Flags
app.Action = service.updateOauth
// Run it
err := app.Run(t.Context(), c.args)
if c.errMsg != "" {
assert.EqualError(t, err, c.errMsg, "case %d: error should match", n)
} else {
require.NoError(t, err, "case %d: should have no errors", n)
assert.Equal(t, c.authSource, updatedAuthSource, "case %d: wrong authSource", n)
}
}
}

View file

@ -44,6 +44,11 @@ func defaultLoggingFlags() []cli.Flag {
Aliases: []string{"e"},
Usage: "Matching expression for the logger",
},
&cli.StringFlag{
Name: "exclusion",
Aliases: []string{"x"},
Usage: "Exclusion for the logger",
},
&cli.StringFlag{
Name: "prefix",
Aliases: []string{"p"},
@ -286,6 +291,9 @@ func commonAddLogger(ctx context.Context, c *cli.Command, mode string, vals map[
if len(c.String("expression")) > 0 {
vals["expression"] = c.String("expression")
}
if len(c.String("exclusion")) > 0 {
vals["exclusion"] = c.String("exclusion")
}
if len(c.String("prefix")) > 0 {
vals["prefix"] = c.String("prefix")
}

View file

@ -631,6 +631,7 @@ LEVEL = Info
;LEVEL=
;FLAGS = stdflags or journald
;EXPRESSION =
;EXCLUSION =
;PREFIX =
;COLORIZE = false
;;
@ -1767,6 +1768,9 @@ LEVEL = Info
;; Use PASSWD = `your password` for quoting if you use special characters in the password.
;PASSWD =
;;
;; Alternative location to specify mailer password. You cannot specify both this and PASSWD, and must pick one
;PASSWD_URI = file:/etc/forgejo/mailer_passwd
;;
;; Send mails only in plain text, without HTML alternative
;SEND_AS_PLAIN_TEXT = false
;;
@ -1819,6 +1823,9 @@ LEVEL = Info
;; Password of the receiving account
;PASSWORD =
;;
;; Alternative location to specify password of the receiving account. You cannot specify both this and PASSWORD, and must pick one
;PASSWORD_URI = file:/etc/forgejo/email_incoming_password
;;
;; Whether the IMAP server uses TLS.
;USE_TLS = false
;;

24
go.mod
View file

@ -2,7 +2,7 @@ module forgejo.org
go 1.24
toolchain go1.24.4
toolchain go1.24.5
require (
code.forgejo.org/f3/gof3/v3 v3.11.0
@ -24,7 +24,7 @@ require (
github.com/ProtonMail/go-crypto v1.3.0
github.com/PuerkitoBio/goquery v1.10.3
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.2
github.com/alecthomas/chroma/v2 v2.18.0
github.com/alecthomas/chroma/v2 v2.19.0
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
github.com/blevesearch/bleve/v2 v2.5.2
github.com/buildkite/terminal-to-html/v3 v3.16.8
@ -42,21 +42,21 @@ require (
github.com/go-ap/activitypub v0.0.0-20231114162308-e219254dc5c9
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73
github.com/go-chi/chi/v5 v5.2.2
github.com/go-chi/cors v1.2.1
github.com/go-chi/cors v1.2.2
github.com/go-co-op/gocron v1.37.0
github.com/go-enry/go-enry/v2 v2.9.2
github.com/go-git/go-git/v5 v5.13.2
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-openapi/spec v0.21.0
github.com/go-sql-driver/mysql v1.9.3
github.com/go-webauthn/webauthn v0.13.0
github.com/go-webauthn/webauthn v0.13.1
github.com/gobwas/glob v0.2.3
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/google/go-github/v64 v64.0.0
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5
github.com/google/uuid v1.6.0
github.com/gorilla/feeds v1.2.0
github.com/gorilla/sessions v1.4.0
@ -99,13 +99,13 @@ require (
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
gitlab.com/gitlab-org/api/client-go v0.130.1
go.uber.org/mock v0.5.2
golang.org/x/crypto v0.39.0
golang.org/x/crypto v0.40.0
golang.org/x/image v0.27.0
golang.org/x/net v0.41.0
golang.org/x/net v0.42.0
golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.15.0
golang.org/x/sys v0.33.0
golang.org/x/text v0.26.0
golang.org/x/sync v0.16.0
golang.org/x/sys v0.34.0
golang.org/x/text v0.27.0
google.golang.org/protobuf v1.36.4
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/ini.v1 v1.67.0
@ -170,7 +170,7 @@ require (
github.com/go-openapi/jsonpointer v0.21.1 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.1 // indirect
github.com/go-webauthn/x v0.1.21 // indirect
github.com/go-webauthn/x v0.1.22 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@ -244,7 +244,7 @@ require (
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
replace github.com/nektos/act => code.forgejo.org/forgejo/act v1.28.0
replace github.com/nektos/act => code.forgejo.org/forgejo/act v1.29.0
replace github.com/mholt/archiver/v3 => code.forgejo.org/forgejo/archiver/v3 v3.5.1

48
go.sum
View file

@ -4,8 +4,8 @@ code.forgejo.org/f3/gof3/v3 v3.11.0 h1:f/xToKwqTgxG6PYxvewywjDQyCcyHEEJ6sZqUitFs
code.forgejo.org/f3/gof3/v3 v3.11.0/go.mod h1:4FaRUNSQGBiD1M0DuB0yNv+Z2wMtlOeckgygHSSq4KQ=
code.forgejo.org/forgejo-contrib/go-libravatar v0.0.0-20191008002943-06d1c002b251 h1:HTZl3CBk3ABNYtFI6TPLvJgGKFIhKT5CBk0sbOtkDKU=
code.forgejo.org/forgejo-contrib/go-libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:PphB88CPbx601QrWPMZATeorACeVmQlyv3u+uUMbSaM=
code.forgejo.org/forgejo/act v1.28.0 h1:96njNC7C1YNyjWq5OWvLZMF/nw0PMthzIA8Nwbnn7jo=
code.forgejo.org/forgejo/act v1.28.0/go.mod h1:dFuiwAmD5vyrzecysHB2kL/GM3wRpoVPl+WdbCTC8Bs=
code.forgejo.org/forgejo/act v1.29.0 h1:CPiI0LRPU0f6gUdQj1ZVax0ySc8CfegY4hiRsymdZU0=
code.forgejo.org/forgejo/act v1.29.0/go.mod h1:RPqtuaI2FkC1SVOaYCRODo5jIfoMTBVgEOOP3Sdiuh4=
code.forgejo.org/forgejo/archiver/v3 v3.5.1 h1:UmmbA7D5550uf71SQjarmrn6yKwOGxtEjb3jaYYtmSE=
code.forgejo.org/forgejo/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
code.forgejo.org/forgejo/go-rpmutils v1.0.0 h1:RZGGeKt70p/WaIEL97pyT6uiiEIoN8/aLmS5Z6WmX0M=
@ -62,8 +62,8 @@ github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.2/go.mod h1:JitQWJ8JuV4Y
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs=
github.com/alecthomas/chroma/v2 v2.18.0 h1:6h53Q4hW83SuF+jcsp7CVhLsMozzvQvO8HBbKQW+gn4=
github.com/alecthomas/chroma/v2 v2.18.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
github.com/alecthomas/chroma/v2 v2.19.0 h1:Im+SLRgT8maArxv81mULDWN8oKxkzboH07CHesxElq4=
github.com/alecthomas/chroma/v2 v2.19.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
@ -215,8 +215,8 @@ github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618=
github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE=
github.com/go-chi/cors v1.2.2/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0=
github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY=
github.com/go-enry/go-enry/v2 v2.9.2 h1:giOQAtCgBX08kosrX818DCQJTCNtKwoPBGu0qb6nKTY=
@ -250,10 +250,10 @@ github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI6
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/go-webauthn/webauthn v0.13.0 h1:cJIL1/1l+22UekVhipziAaSgESJxokYkowUqAIsWs0Y=
github.com/go-webauthn/webauthn v0.13.0/go.mod h1:Oy9o2o79dbLKRPZWWgRIOdtBGAhKnDIaBp2PFkICRHs=
github.com/go-webauthn/x v0.1.21 h1:nFbckQxudvHEJn2uy1VEi713MeSpApoAv9eRqsb9AdQ=
github.com/go-webauthn/x v0.1.21/go.mod h1:sEYohtg1zL4An1TXIUIQ5csdmoO+WO0R4R2pGKaHYKA=
github.com/go-webauthn/webauthn v0.13.1 h1:Q3/GLXsckVJUPE+BGR6ex26yRIiZ/X2ITaMeSkOftuc=
github.com/go-webauthn/webauthn v0.13.1/go.mod h1:HeaBromTjgMg1sHZOzyjEiqcrk4Og7mxafDTWDepaXI=
github.com/go-webauthn/x v0.1.22 h1:rHilV/rYXawarI0uA3uZ5nhLb30Ex8RgbVAsOSt/57o=
github.com/go-webauthn/x v0.1.22/go.mod h1:+iV9BF4OsvLYzETdc0lmQO2webTos10oH6QydSoWxDM=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
@ -307,8 +307,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 h1:xhMrHhTJ6zxu3gA4enFM9MLn9AY7613teCdFnlUVbSQ=
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@ -585,8 +585,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w=
@ -614,8 +614,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -627,8 +627,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -654,8 +654,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@ -665,8 +665,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -677,8 +677,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View file

@ -284,16 +284,10 @@ func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error) {
return &run, nil
}
// GetRunBefore returns the last run that completed a given timestamp (not inclusive).
func GetRunBefore(ctx context.Context, repoID int64, timestamp timeutil.TimeStamp) (*ActionRun, error) {
var run ActionRun
has, err := db.GetEngine(ctx).Where("repo_id=? AND stopped IS NOT NULL AND stopped<?", repoID, timestamp).OrderBy("stopped DESC").Limit(1).Get(&run)
if err != nil {
return nil, err
} else if !has {
return nil, fmt.Errorf("run before: %w", util.ErrNotExist)
}
return &run, nil
func GetRunBefore(ctx context.Context, _ *ActionRun) (*ActionRun, error) {
// TODO return the most recent run related to the run given in argument
// see https://codeberg.org/forgejo/user-research/issues/63 for context
return nil, nil
}
func GetLatestRunForBranchAndWorkflow(ctx context.Context, repoID int64, branch, workflowFile, event string) (*ActionRun, error) {

View file

@ -5,92 +5,7 @@ package actions
import (
"testing"
"time"
"forgejo.org/models/db"
"forgejo.org/models/unittest"
"forgejo.org/modules/timeutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetRunBefore(t *testing.T) {
require.NoError(t, unittest.PrepareTestDatabase())
// this repo is part of the test database requiring loading "repository.yml" in main_test.go
var repoID int64 = 1
workflowID := "test_workflow"
// third completed run
time1, err := time.Parse(time.RFC3339, "2024-07-31T15:47:55+08:00")
require.NoError(t, err)
timeutil.MockSet(time1)
run1 := ActionRun{
ID: 1,
Index: 1,
RepoID: repoID,
Stopped: timeutil.TimeStampNow(),
WorkflowID: workflowID,
}
// fourth completed run
time2, err := time.Parse(time.RFC3339, "2024-08-31T15:47:55+08:00")
require.NoError(t, err)
timeutil.MockSet(time2)
run2 := ActionRun{
ID: 2,
Index: 2,
RepoID: repoID,
Stopped: timeutil.TimeStampNow(),
WorkflowID: workflowID,
}
// second completed run
time3, err := time.Parse(time.RFC3339, "2024-07-31T15:47:54+08:00")
require.NoError(t, err)
timeutil.MockSet(time3)
run3 := ActionRun{
ID: 3,
Index: 3,
RepoID: repoID,
Stopped: timeutil.TimeStampNow(),
WorkflowID: workflowID,
}
// first completed run
time4, err := time.Parse(time.RFC3339, "2024-06-30T15:47:54+08:00")
require.NoError(t, err)
timeutil.MockSet(time4)
run4 := ActionRun{
ID: 4,
Index: 4,
RepoID: repoID,
Stopped: timeutil.TimeStampNow(),
WorkflowID: workflowID,
}
require.NoError(t, db.Insert(db.DefaultContext, &run1))
runBefore, err := GetRunBefore(db.DefaultContext, repoID, run1.Stopped)
// there is no run before run1
require.Error(t, err)
require.Nil(t, runBefore)
// now there is only run3 before run1
require.NoError(t, db.Insert(db.DefaultContext, &run3))
runBefore, err = GetRunBefore(db.DefaultContext, repoID, run1.Stopped)
require.NoError(t, err)
assert.Equal(t, run3.ID, runBefore.ID)
// there still is only run3 before run1
require.NoError(t, db.Insert(db.DefaultContext, &run2))
runBefore, err = GetRunBefore(db.DefaultContext, repoID, run1.Stopped)
require.NoError(t, err)
assert.Equal(t, run3.ID, runBefore.ID)
// run4 is further away from run1
require.NoError(t, db.Insert(db.DefaultContext, &run4))
runBefore, err = GetRunBefore(db.DefaultContext, repoID, run1.Stopped)
require.NoError(t, err)
assert.Equal(t, run3.ID, runBefore.ID)
}

View file

@ -15,8 +15,6 @@ func TestMain(m *testing.M) {
"gpg_key.yml",
"public_key.yml",
"TestParseCommitWithSSHSignature/public_key.yml",
"deploy_key.yml",
"gpg_key_import.yml",
"user.yml",
"email_address.yml",
},

View file

@ -141,7 +141,7 @@ func TxContext(parentCtx context.Context) (*Context, Committer, error) {
return nil, nil, err
}
return newContext(DefaultContext, sess, true), sess, nil
return newContext(parentCtx, sess, true), sess, nil
}
// WithTx represents executing database operations on a transaction, if the transaction exist,

View file

@ -84,4 +84,16 @@ func TestTxContext(t *testing.T) {
return nil
}))
}
t.Run("Reuses parent context", func(t *testing.T) {
type unique struct{}
ctx := context.WithValue(db.DefaultContext, unique{}, "yes!")
assert.False(t, db.InTransaction(ctx))
require.NoError(t, db.WithTx(ctx, func(ctx context.Context) error {
assert.Equal(t, "yes!", ctx.Value(unique{}))
return nil
}))
})
}

View file

@ -15,6 +15,7 @@ import (
"strings"
"time"
"forgejo.org/modules/container"
"forgejo.org/modules/log"
"forgejo.org/modules/setting"
@ -438,3 +439,12 @@ func GetMasterEngine(x Engine) (*xorm.Engine, error) {
return engine, nil
}
// GetTableNames returns the table name of all registered models.
func GetTableNames() container.Set[string] {
names := make(container.Set[string])
for _, table := range tables {
names.Add(x.TableName(table))
}
return names
}

View file

@ -0,0 +1,40 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package db
import (
"slices"
"testing"
"forgejo.org/modules/test"
"github.com/stretchr/testify/assert"
)
func TestGetTableNames(t *testing.T) {
t.Run("Simple", func(t *testing.T) {
defer test.MockVariableValue(&tables, []any{new(GPGKey)})()
assert.Equal(t, []string{"gpg_key"}, GetTableNames().Values())
})
t.Run("Multiple tables", func(t *testing.T) {
defer test.MockVariableValue(&tables, []any{new(GPGKey), new(User), new(BlockedUser)})()
tableNames := GetTableNames().Values()
slices.Sort(tableNames)
assert.Equal(t, []string{"forgejo_blocked_user", "gpg_key", "user"}, tableNames)
})
}
type GPGKey struct{}
type User struct{}
type BlockedUser struct{}
func (*BlockedUser) TableName() string {
return "forgejo_blocked_user"
}

View file

@ -0,0 +1,7 @@
-
id: 1001
uid: 1001
email: AnotherTestUserWithUpperCaseEmail@otto.splvs.net
lower_email: anothertestuserwithuppercaseemail@otto.splvs.net
is_activated: false
is_primary: true

View file

@ -0,0 +1,12 @@
-
id: 1001
lower_name: user1001
name: user1001
full_name: User That loves Upper Cases
email: AnotherTestUserWithUpperCaseEmail@otto.splvs.net
passwd: ZogKvWdyEx:password
passwd_hash_algo: dummy
avatar: ''
avatar_email: anothertestuserwithuppercaseemail@otto.splvs.net
login_name: user1
created_unix: 1672578000

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -3,6 +3,7 @@
repo_id: 1
org_id: 0
name: label1
description: 'First label'
color: '#abcdef'
exclusive: false
num_issues: 2
@ -107,3 +108,26 @@
num_issues: 0
num_closed_issues: 0
archived_unix: 0
-
id: 11
repo_id: 3
org_id: 0
name: " <script>malicious</script> /'?&"
description: "Malicious label ' <script>malicious</script>"
color: '#000000'
exclusive: true
num_issues: 0
num_closed_issues: 0
archived_unix: 0
-
id: 12
repo_id: 3
org_id: 0
name: 'archived label<>'
color: '#000000'
exclusive: false
num_issues: 0
num_closed_issues: 0
archived_unix: 2991092130

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1 +0,0 @@
[] # empty

View file

@ -1,7 +1,7 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"context"
@ -108,7 +108,9 @@ var migrations = []*Migration{
// v33 -> v34
NewMigration("Add `notify-email` column to `action_run` table", AddNotifyEmailToActionRun),
// v34 -> v35
NewMigration("Add index to `stopped` column in `action_run` table", AddIndexToActionRunStopped),
NewMigration("Noop because of https://codeberg.org/forgejo/forgejo/issues/8373", NoopAddIndexToActionRunStopped),
// v35 -> v36
NewMigration("Fix wiki unit default permission", FixWikiUnitDefaultPermission),
}
// GetCurrentDBVersion returns the current Forgejo database version.

View file

@ -1,7 +1,7 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"forgejo.org/models/migrations/base"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"time"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_v1_20 //nolint:revive
package forgejo_v1_20
import (
"forgejo.org/modules/timeutil"

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
package forgejo_v1_20 //nolint:revive
package forgejo_v1_20
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_v1_20 //nolint:revive
package forgejo_v1_20
import (
"forgejo.org/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"forgejo.org/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors c/o Codeberg e.V.. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors c/o Codeberg e.V.. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"strings"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
package v1_22
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"context"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"forgejo.org/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"database/sql"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"time"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"encoding/xml"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"bytes"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"testing"

View file

@ -1,7 +1,7 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import "xorm.io/xorm"

View file

@ -1,19 +1,13 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations //nolint:revive
package forgejo_migrations
import (
"forgejo.org/modules/timeutil"
"xorm.io/xorm"
)
func AddIndexToActionRunStopped(x *xorm.Engine) error {
type ActionRun struct {
ID int64
Stopped timeutil.TimeStamp `xorm:"index"`
}
return x.Sync(&ActionRun{})
// see https://codeberg.org/forgejo/forgejo/issues/8373
func NoopAddIndexToActionRunStopped(x *xorm.Engine) error {
return nil
}

View file

@ -0,0 +1,55 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations
import (
"xorm.io/xorm"
)
func FixWikiUnitDefaultPermission(x *xorm.Engine) error {
// Type is Unit's Type
type Type int
// Enumerate all the unit types
const (
TypeInvalid Type = iota // 0 invalid
TypeCode // 1 code
TypeIssues // 2 issues
TypePullRequests // 3 PRs
TypeReleases // 4 Releases
TypeWiki // 5 Wiki
TypeExternalWiki // 6 ExternalWiki
TypeExternalTracker // 7 ExternalTracker
TypeProjects // 8 Projects
TypePackages // 9 Packages
TypeActions // 10 Actions
)
// RepoUnitAccessMode specifies the users access mode to a repo unit
type UnitAccessMode int
const (
// UnitAccessModeUnset - no unit mode set
UnitAccessModeUnset UnitAccessMode = iota // 0
// UnitAccessModeNone no access
UnitAccessModeNone // 1
// UnitAccessModeRead read access
UnitAccessModeRead // 2
// UnitAccessModeWrite write access
UnitAccessModeWrite // 3
)
_ = UnitAccessModeNone
_ = UnitAccessModeWrite
type RepoUnit struct {
DefaultPermissions UnitAccessMode `xorm:"NOT NULL DEFAULT 0"`
}
_, err := x.Where("type = ?", TypeWiki).
Where("default_permissions = ?", UnitAccessModeRead).
Cols("default_permissions").
Update(RepoUnit{
DefaultPermissions: UnitAccessModeUnset,
})
return err
}

View file

@ -95,7 +95,8 @@ func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, fu
t.Logf("initializing fixtures from: %s", fixturesDir)
if err := unittest.InitFixtures(
unittest.FixturesOptions{
Dir: fixturesDir,
Dir: fixturesDir,
SkipCleanRegistedModels: true,
}, x); err != nil {
t.Errorf("error whilst initializing fixtures from %s: %v", fixturesDir, err)
return x, deferFn

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"net/url"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"crypto/sha1"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"xorm.io/builder"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"path/filepath"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_10 //nolint
package v1_10
import (
"forgejo.org/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_11 //nolint
package v1_11
import (
"forgejo.org/models/migrations/base"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_11 //nolint
package v1_11
import (
"xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_11 //nolint
package v1_11
import (
"forgejo.org/models/migrations/base"

Some files were not shown because too many files have changed in this diff Show more