Commit graph

19059 commits

Author SHA1 Message Date
Matthias Riße
90b3bd1fb4 Git-annex web uploads (#21)
This implements support for uploading files into the annex using the web
interface.

If a repository is a git-annex-enabled repository all files will be
added to it using git annex add. This means that the repository's
configuration for what to put into the annex (annex.largefiles in
gitattributes) will be respected.

Plain git repositories without git-annex will work as before, directly
uploading to git.

Fixes #5.

Reviewed-on: https://codeberg.org/matrss/forgejo-aneksajo/pulls/21
Co-authored-by: Matthias Riße <m.risse@fz-juelich.de>
Co-committed-by: Matthias Riße <m.risse@fz-juelich.de>
2024-07-18 18:18:06 +00:00
Matthias Riße
97f45ffeed Error if git-annex is enabled but missing (#16)
Copied from https://github.com/neuropoly/gitea/pull/47

This adds a check so that if `setting.Annex.Enabled` is true and git-annex is not in the PATH Forgejo will abort on startup with a reasonable error message.

Fixes #15.

Reviewed-on: https://codeberg.org/matrss/forgejo-aneksajo/pulls/16
Co-authored-by: Matthias Riße <m.risse@fz-juelich.de>
Co-committed-by: Matthias Riße <m.risse@fz-juelich.de>
2024-07-18 16:43:42 +00:00
Matthias Riße
89f8aa0bf5 Add git-annex to docker image 2024-07-04 09:25:33 +02:00
Matthias Riße
12cc57151a Adapt patch to upstream changes
Test with different objectFormats.
2024-07-04 09:25:33 +02:00
Nick
0c6a038c95 git-annex: views for annex files (#22)
This updates the repo index/file view endpoints so annex files match the way
LFS files are rendered, making annexed files accessible via the web instead of
being black boxes only accessible by git clone.

This mostly just duplicates the existing LFS logic. It doesn't try to combine itself
with the existing logic, to make merging with upstream easier. If upstream ever
decides to accept, I would like to try to merge the redundant logic.

The one bit that doesn't directly copy LFS is my choice to hide annex-symlinks.
LFS files are always _pointer files_ and therefore always render with the "file"
icon and no special label, but annex files come in two flavours: symlinks or
pointer files. I've conflated both kinds to try to give a consistent experience.

The tests in here ensure the correct download link (/media, from the last PR)
renders in both the toolbar and, if a binary file (like most annexed files will be),
in the main pane, but it also adds quite a bit of code to make sure text files
that happen to be annexed are dug out and rendered inline like LFS files are.
2024-07-04 09:25:33 +02:00
Matthias Riße
61d0a74605 Adapt patch to upstream changes
Use tests.FileCmp instead of util.FileCmp.
2024-07-04 09:25:33 +02:00
Matthias Riße
abcadaa707 Adapt patch to upstream changes
Test with different objectFormats.
2024-07-04 09:25:33 +02:00
Nick
c270f5bcd9 git-annex: make /media/ download annexed content (#20)
Previously, Gitea's LFS support allowed direct-downloads of LFS content,
via http://$HOSTNAME:$PORT/$USER/$REPO/media/branch/$BRANCH/$FILE
Expand that grace to git-annex too. Now /media should provide the
relevant *content* from the .git/annex/objects/ folder.

This adds tests too. And expands the tests to try symlink-based annexing,
since /media implicitly supports both that and pointer-file-based annexing.
2024-07-04 09:25:33 +02:00
Matthias Riße
4c839954e4 Adapt patch to upstream changes
The git repository must be closed after using it. Without this change
some tests started to fail due to the lingering repository running into
a timeout.
2024-07-04 09:25:33 +02:00
Nick
3c3bf55a36 git-annex: create modules/annex (#21)
This moves the `annexObjectPath()` helper out of the tests and into a
dedicated sub-package as `annex.ContentLocation()`, and expands it with
`.Pointer()` (which validates using `git annex examinekey`),
`.IsAnnexed()` and `.Content()` to make it a more useful module.

The tests retain their own wrapper version of `ContentLocation()`
because I tried to follow close to the API modules/lfs uses, which in
terms of abstract `git.Blob` and `git.TreeEntry` objects, not in terms
of `repoPath string`s which are more convenient for the tests.
2024-07-04 09:25:33 +02:00
Matthias Riße
037a038708 Adapt patch to upstream changes
The "context_service" import was changed to use the default name of just
"context". The patch set had to be adapted for that.
2024-07-04 09:25:33 +02:00
Matthias Riße
6c7f013070 Adapt patch to upstream changes
Usage of `path` was replaced by `path/filepath` in upstream forgejo, and
it made sense to use that as well where `path` was previously used. The
`setHeaderCacheForever` function and the `sendFile` method had their
signature changed.
2024-07-04 09:25:32 +02:00
Matthias Riße
a67fa24986 Fix exit code check for git command
The err.IsExitCode method was changed to a function IsErrorExitCode
taking err as its first argument in
1e7a6483b8.
2024-07-04 09:25:32 +02:00
Matthias Riße
935cd0ddc9 Replace m.GetOptions with m.Methods
This applies the same changes that were done in
265cd70bdb to the git-annex specific
routes as well.
2024-07-04 09:25:32 +02:00
Nick
7800919f7d git-annex: support downloading over HTTP (#6)
This makes HTTP symmetric with SSH clone URLs.

This gives us the fancy feature of _anonymous_ downloads,
so people can access datasets without having to set up an
account or manage ssh keys.

Previously, to access "open access" data shared this way,
users would need to:

  1. Create an account on gitea.example.com
  2. Create ssh keys
  3. Upload ssh keys (and make sure to find and upload the correct file)
  4. `git clone git@gitea.example.com:user/dataset.git`
  5. `cd dataset`
  6. `git annex get`

This cuts that down to just the last three steps:

  1. `git clone https://gitea.example.com/user/dataset.git`
  2. `cd dataset`
  3. `git annex get`

This is significantly simpler for downstream users, especially for those
unfamiliar with the command line.

Unfortunately there's no uploading. While git-annex supports uploading
over HTTP to S3 and some other special remotes, it seems to fail on a
_plain_ HTTP remote. See https://github.com/neuropoly/gitea/issues/7
and https://git-annex.branchable.com/forum/HTTP_uploads/#comment-ce28adc128fdefe4c4c49628174d9b92.

This is not a major loss since no one wants uploading to be anonymous anyway.

To support private repos, I had to hunt down and patch a secret extra security
corner that Gitea only applies to HTTP for some reason (services/auth/basic.go).

This was guided by https://git-annex.branchable.com/tips/setup_a_public_repository_on_a_web_site/

Fixes https://github.com/neuropoly/gitea/issues/3

Co-authored-by: Mathieu Guay-Paquet <mathieu.guaypaquet@polymtl.ca>
2024-07-04 09:25:32 +02:00
Nick
b3e2afe101 git-annex: add configuration setting [annex].ENABLED (#18)
Fixes https://github.com/neuropoly/gitea/issues/8

Co-authored-by: Mathieu Guay-Paquet <mathieu.guaypaquet@gmail.com>
2024-07-04 09:25:32 +02:00
Matthias Riße
3e4f600e59 Fix failing tests
Multiple tests that worked fine on v1.20.4-1 started to fail after the
rebase onto v1.20.5-1. These tests are:
- TestGitAnnexPermissions/Private/Owner/HTTP/Init
- TestGitAnnexPermissions/Private/Owner/HTTP/Download
- TestGitAnnexPermissions/Private/Writer/HTTP/Init
- TestGitAnnexPermissions/Private/Writer/HTTP/Download
- TestGitAnnexPermissions/Private/Reader/HTTP/Init
- TestGitAnnexPermissions/Private/Reader/HTTP/Download

What these tests have in common is that they all operate on a private
repository via http with authentication.

They broke at some point between v1.20.4-1 and v1.20.5-1, so I did a
bisect between these two points running the offending tests. This
brought me to the conclusion that
ee48c0d5ea introduced the issue.

The thing is, this commit does not change any code, it only changes the
test environment. Among other things that didn't look as suspicious, it
changes the container image from a bespoke test_env image based on
debian bullseye to a node image based on debian bookworm. Obviously,
this means that there are many version differences between the two.

The first one I looked at was git. The previous bullseye image used a
manually installed git version 2.40.0, while the bookworm image has
2.39.2 installed. Updating git in the new image did not fix the issue,
however.

The next thing I looked at was the git-annex version. Bullseye had
8.20210223 installed and worked, while bookworm used 10.20230126 when
the tests broke. So I tried my luck upgrading to a more recent version
via neurodebian (10.20240227-1~ndall+1). This still worked fine on
bullseye and now also works fine on bookworm.

I have no idea why this specific version of git-annex broke the tests,
but at least there was a commit to pinpoint this to, which isn't always
the case with docker images silently changing beneath you...

Below are the versions as they are reported by git and git-annex:

bullseye (works):

    git version 2.30.2
    git-annex version: 8.20210223
    build flags: Assistant Webapp Pairing Inotify DBus DesktopNotify TorrentParser MagicMime Feeds Testsuite S3 WebDAV
    dependency versions: aws-0.22 bloomfilter-2.0.1.0 cryptonite-0.26 DAV-1.3.4 feed-1.3.0.1 ghc-8.8.4 http-client-0.6.4.1 persistent-sqlite-2.10.6.2 torrent-10000.1.1 uuid-1.3.13 yesod-1.6.1.0
    key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL X*
    remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs httpalso borg hook external
    operating system: linux x86_64
    supported repository versions: 8
    upgrade supported from repository versions: 0 1 2 3 4 5 6 7

bullseye + git-annex from neurodebian (works):

    git version 2.30.2
    git-annex version: 10.20240227-1~ndall+1
    build flags: Assistant Webapp Pairing Inotify DBus DesktopNotify TorrentParser MagicMime Benchmark Feeds Testsuite S3 WebDAV
    dependency versions: aws-0.22.1 bloomfilter-2.0.1.0 cryptonite-0.29 DAV-1.3.4 feed-1.3.2.1 ghc-9.0.2 http-client-0.7.13.1 persistent-sqlite-2.13.1.0 torrent-10000.1.1 uuid-1.3.15 yesod-1.6.2.1
    key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL X*
    remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs httpalso borg hook external
    operating system: linux x86_64
    supported repository versions: 8 9 10
    upgrade supported from repository versions: 0 1 2 3 4 5 6 7 8 9 10

bookworm (fails):

    git version 2.39.2
    git-annex version: 10.20230126
    build flags: Assistant Webapp Pairing Inotify DBus DesktopNotify TorrentParser MagicMime Benchmark Feeds Testsuite S3 WebDAV
    dependency versions: aws-0.22.1 bloomfilter-2.0.1.0 cryptonite-0.29 DAV-1.3.4 feed-1.3.2.1 ghc-9.0.2 http-client-0.7.13.1 persistent-sqlite-2.13.1.0 torrent-10000.1.1 uuid-1.3.15 yesod-1.6.2.1
    key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL X*
    remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs httpalso borg hook external
    operating system: linux x86_64
    supported repository versions: 8 9 10
    upgrade supported from repository versions: 0 1 2 3 4 5 6 7 8 9 10

bookworm + git-annex from neurodebian (works):

    git version 2.39.2
    git-annex version: 10.20240227-1~ndall+1
    build flags: Assistant Webapp Pairing Inotify DBus DesktopNotify TorrentParser MagicMime Benchmark Feeds Testsuite S3 WebDAV
    dependency versions: aws-0.22.1 bloomfilter-2.0.1.0 cryptonite-0.29 DAV-1.3.4 feed-1.3.2.1 ghc-9.0.2 http-client-0.7.13.1 persistent-sqlite-2.13.1.0 torrent-10000.1.1 uuid-1.3.15 yesod-1.6.2.1
    key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL X*
    remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs httpalso borg hook external
    operating system: linux x86_64
    supported repository versions: 8 9 10
    upgrade supported from repository versions: 0 1 2 3 4 5 6 7 8 9 10
2024-07-04 09:25:32 +02:00
Matthias Riße
c837fd38f9 Install git-annex in the testing workflow 2024-07-04 09:25:32 +02:00
Matthias Riße
e0041de2c5 Adapt patch to upstream changes
A dead code check started to complain because FileCmp was only used in
tests. Moved the function to test_utils.
2024-07-04 09:25:32 +02:00
Matthias Riße
29036ae52e Adapt patch to upstream changes
Repository creation now expects an objectFormat to be specified for git.
2024-07-04 09:25:32 +02:00
Nick
d82758e280 git-annex tests (#13)
Fixes https://github.com/neuropoly/gitea/issues/11

Tests:

* `git annex init`
* `git annex copy --from origin`
* `git annex copy --to origin`

over:

* ssh

for:

* the owner
* a collaborator
* a read-only collaborator
* a stranger

in a

* public repo
* private repo

And then confirms:

* Deletion of the remote repo (to ensure lockdown isn't messing with us: https://git-annex.branchable.com/internals/lockdown/#comment-0cc5225dc5abe8eddeb843bfd2fdc382)

------

To support all this:

* Add util.FileCmp()
* Patch withKeyFile() so it can be nested in other copies of itself

-------

Many thanks to Mathieu for giving style tips and catching several bugs,
including a subtle one in util.filecmp() which neutered it.

Co-authored-by: Mathieu Guay-Paquet <mathieu.guay-paquet@polymtl.ca>
2024-07-04 09:25:32 +02:00
Nick Guenther
954eb161d1 git-annex support
[git-annex](https://git-annex.branchable.com/) is a more complicated cousin to
git-lfs, storing large files in an optional-download side content.  Unlike lfs,
it allows mixing and matching storage remotes, so the content remote(s) doesn't
need to be on the same server as the git remote, making it feasible to scatter
a collection across cloud storage, old harddrives, or anywhere else storage can
be scavenged.  Since this can get complicated, fast, it has a content-tracking
database (`git annex whereis`) to help find everything later.

The use-case we imagine for including it in Gitea is just the simple case, where
we're primarily emulating git-lfs: each repo has its large content at the same URL.

Our motivation is so we can self-host https://www.datalad.org/ datasets, which
currently are only hostable by fragilely scrounging together cloud storage --
and having to manage all the credentials associated with all the pieces -- or at
https://openneuro.org which is fragile in its own ways.

Supporting git-annex also allows multiple Gitea instance to be annex remotes for
each other, mirroring the content or otherwise collaborating the split up the
hosting costs.

Enabling
--------

TODO

HTTP
----

TODO

Permission Checking
-------------------

This tweaks the API in routers/private/serv.go to expose the calling user's
computed permission, instead of just returning HTTP 403.

This doesn't fit in super well. It's the opposite from how the git-lfs support is
done, where there's a complete list of possible subcommands and their matching
permission levels, and then the API compares the requested with the actual level
and returns HTTP 403 if the check fails.

But it's necessary. The main git-annex verbs, 'git-annex-shell configlist' and
'git-annex-shell p2pstdio' are both either read-only or read-write operations,
depending on the state on disk on either end of the connection and what the user
asked it to ask for, with no way to know before git-annex examines the situation.
So tell the level via GIT_ANNEX_READONLY and trust it to handle itself.

In the older Gogs version, the permission was directly read in cmd/serv.go:

```
mode, err = db.UserAccessMode(user.ID, repo)
```
- 966e925cf3/internal/cmd/serv.go (L334)

but in Gitea permission enforcement has been centralized in the API layer.
(perhaps so the cmd layer can avoid making direct DB connections?)

Deletion
--------

git-annex has this "lockdown" feature where it tries
really quite very hard to prevent you deleting its
data, to the point that even an rm -rf won't do it:
each file in annex/objects/ is nested inside a
folder with read-only permissions.

The recommended workaround is to run chmod -R +w when
you're sure you actually want to delete a repo. See
https://git-annex.branchable.com/internals/lockdown

So we edit util.RemoveAll() to do just that, so now
it's `chmod -R +w && rm -rf` instead of just `rm -rf`.
2024-07-04 09:25:32 +02:00
Matthias Riße
95db75672a Fix name in package-lock.json
The frontend-checks job started failing because the declared name does
not match the repository name.
2024-07-04 09:25:32 +02:00
Earl Warren
65a89ce6be Merge pull request '[v7.0/forgejo] Fix wrong string used in a search box' (#4261) from bp-v7.0/forgejo-28ceec6 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4261
Reviewed-by: Otto <otto@codeberg.org>
2024-06-29 07:30:12 +00:00
0ko
d3a0eb3bdd ui: fix wrong string used in a search box (#4258)
Resolves https://codeberg.org/forgejo/forgejo/issues/4256.
Fixes regression caused by https://github.com/go-gitea/gitea/pull/29530/files#diff-b46ae540c8eb41d1ccaa1659489fcc47d72eee4c4f04dc83c5ccf4d6d1a3395eR45.

Preview:
Before - https://codeberg.org/forgejo/forgejo/attachments/d629f2e9-0d07-4719-9250-52d3ba9f4a9e
After - https://codeberg.org/forgejo/forgejo/attachments/6a5f5cb2-124d-4673-a387-8483125a89eb

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4258
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
(cherry picked from commit 28ceec6fad)
2024-06-28 16:29:11 +00:00
Earl Warren
6ef70edb0b Merge pull request '[v7.0/forgejo] Update module golang.org/x/image to v0.18.0' (#4248) from earl-warren/forgejo:wip-x-image into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4248
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-06-26 11:32:24 +00:00
Earl Warren
2c48693a60
[v7.0/forgejo] Update module golang.org/x/image to v0.18.0
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/4241
2024-06-26 12:46:03 +02:00
Earl Warren
2a493224e5 Merge pull request '[v7.0/forgejo] fix(security): GO-2024-2947' (#4249) from earl-warren/forgejo:wip-v7.0-retryhttp into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4249
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-06-26 10:41:49 +00:00
Earl Warren
c43689b852
[v7.0/forgejo] fix(security): GO-2024-2947
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/4245
2024-06-26 12:08:03 +02:00
Earl Warren
9763a7eadc Merge pull request '[gitea] week 2024-26-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#4215) from earl-warren/wcp/2024-26-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4215
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-06-25 06:16:30 +00:00
Earl Warren
637d6d5c5f Merge pull request '[v7.0/forgejo] test: coverage for /repos/{owner}/{repo}/issues?project=' (#4219) from bp-v7.0/forgejo-b18ba81 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4219
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-23 20:20:04 +00:00
Lunny Xiao
0a90bf51af
Fix bug filtering issues which have no project (#31337) (#31367)
(cherry picked from commit a9d1e4311e56855a6efc8defd3686f7f985617d0)
2024-06-23 21:49:37 +02:00
Twenty Panda
cc425ad87b test: coverage for /repos/{owner}/{repo}/issues?project=
Refs: https://codeberg.org/forgejo/forgejo/pulls/4215#issuecomment-2040651
(cherry picked from commit b18ba810a5)
2024-06-23 19:35:08 +00:00
charles
4ed5044dea
Fix markdown math brackets render problem (#31420)
Close #31371, support `($ ... $)` like GitHub

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 90a3c20e7996e2db577a51d37f2190e2e990a22a)

Conflicts:
	modules/markup/markdown/markdown_test.go
	trivial context conflict
(cherry picked from commit b53be9d45c)
(cherry picked from commit 7fbcc58062c5cad5c4c8674915ea0fffa659b51d)
2024-06-23 14:56:42 +02:00
Giteabot
e61aa25412
Reduce air verbosity (#31417) (#31425)
Backport #31417 by @silverwind

Make `air` log less. Uses the option added in
https://github.com/air-verse/air/pull/367.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 3813b2786295087b3a5ecb3562fc35d90c439bf0)
2024-06-23 14:54:21 +02:00
Earl Warren
04a8162e4f Merge pull request '[v7.0/forgejo] Improve wording in user blocking modal' (#4205) from bp-v7.0/forgejo-5d74125 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4205
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-22 13:34:58 +00:00
0ko
6e80db59f9 [I18N] Improve wording in user blocking modal
(cherry picked from commit 5d741259da)
2024-06-22 12:23:15 +00:00
Earl Warren
2b22c80738 Merge pull request '[v7.0/forgejo] [BUG] admin oauth2 source required check' (#4195) from bp-v7.0/forgejo-65f8c22 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4195
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-21 07:01:51 +00:00
oliverpool
6cef23db1d [BUG] admin oauth2 source required check (#4194)
#4059 was unfortunately incomplete: some custom_url fields are currently shown, even if they are not used by the provider. Moreover the `Use Custom URLs Instead of Default URLs` is always checked by default.

Manual testing:
- go to http://localhost:3000/admin/auths
- click on `Add authentication source`
- Choose `Authentication type`: `OAuth2`
- Choose `OAuth2 provider`: `GitLab`
- verify that the `Use Custom URLs Instead of Default URLs` option is **initially unchecked**
- enable the `Use Custom URLs Instead of Default URLs` checkbox
- verify that only the fields "Authorize", "Token" and "Profile" URLs are shown (no "Email URL", nor "Tenant").
- Switch the `OAuth2 provider` to `Azure AD v2`
- verify that the `Use Custom URLs Instead of Default URLs` option is **initially checked**
- verify that only the field "Tenant" is shown (with the default "organizations").

![image](/attachments/0e2b1508-861c-4b0e-ae6a-6eb24ce94911)

Note: this is loosely based on the upstream fix https://github.com/go-gitea/gitea/pull/31246 which I initially overlooked.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4194
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>
(cherry picked from commit 65f8c22cc7)
2024-06-21 06:22:03 +00:00
Earl Warren
664c8a99cb Merge pull request '[v7.0/forgejo] [SWAGGER] Make UserSettings definition an non-array' (#4184) from bp-v7.0/forgejo-5926ed1 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4184
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-19 09:55:17 +00:00
Earl Warren
cd7a0afc36 Merge pull request '[v7.0/backport] Update module github.com/gorilla/feeds to v1.2.0' (#4183) from earl-warren/forgejo:wip-v7.0-feed into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4183
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-06-19 06:45:24 +00:00
Gusted
dc228b4734 [SWAGGER] Make it consistent with reality
- Make the `UserSettings` definition an non-array, this is consistent
with the existing endpoints that uses this definition.
- Resolves #4179

(cherry picked from commit 5926ed1f73)
2024-06-19 06:40:17 +00:00
Earl Warren
74466215e4
[v7.0/backport] Update module github.com/gorilla/feeds to v1.2.0
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/4166

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/gorilla/feeds](https://github.com/gorilla/feeds) | require | minor | `v1.1.2` -> `v1.2.0` |

---

<details>
<summary>gorilla/feeds (github.com/gorilla/feeds)</summary>

[Compare Source](https://github.com/gorilla/feeds/compare/v1.1.2...v1.2.0)

-   Add the `isPermaLink` attribute to `guid` in RSS by [@&#8203;yardenshoham](https://github.com/yardenshoham) in https://github.com/gorilla/feeds/pull/107

-   [@&#8203;yardenshoham](https://github.com/yardenshoham) made their first contribution in https://github.com/gorilla/feeds/pull/107

**Full Changelog**: https://github.com/gorilla/feeds/compare/v1.1.2...v1.2.0

</details>

---

📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - "before 4am" (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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MDkuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQwOS4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiXX0=-->
2024-06-19 08:11:44 +02:00
Earl Warren
6cb63e03e1 Merge pull request '[v7.0/forgejo] Port: Fix Activity Page Contributors dropdown (gitea#31264)' (#4177) from bp-v7.0/forgejo-3544746 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4177
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-18 20:31:41 +00:00
wxiaoguang
7b443b6b54 Fix Activity Page Contributors dropdown (#31264)
Fix #31261

(cherry picked from commit e728fd741be7848d476663eec1c9caaf34b46e61)
(cherry picked from commit 35447463ba)
2024-06-18 19:42:31 +00:00
Earl Warren
34c970d4e5 Merge pull request '[gitea] week 2024-25-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#4146) from earl-warren/wcp/2024-25-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4146
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-06-18 07:55:54 +00:00
Earl Warren
fa54833436 Merge pull request '[v7.0/forgejo] test(dump): don't depend on directory listing order' (#4162) from bp-v7.0/forgejo-230a677 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4162
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-17 19:29:24 +00:00
emilylange
f01dc4b271 test(dump): don't depend on directory listing order
cmd/dump.go uses os.Readdir to list the directory.

This is fine on its own, but TestAddRecursiveExclude in cmd/dump_test.go
depends on the order of the directory listing, which is where the issue
lays.

Directory listings using os.Readdir (lstat) don't actually guarantee an
order. They can differ due to a number of factors. Most notably the OS,
file system and settings.

As such, the test should not check the /order of the files/ added to the
archive, but instead simply check whether the archive /contains/ them.

So this is precisely what this commit does.

Note that only TestAddRecursiveExclude/File_inside_directory/No_exclude
has been observed to fail due to this, but all TestAddRecursiveExclude
subtests have been updated for consistency.

(cherry picked from commit 230a677c74)
2024-06-17 18:53:34 +00:00
Earl Warren
2d42dbc495 Merge pull request '[v7.0/forgejo] [BUG] admin authentication source JS errors' (#4159) from bp-v7.0/forgejo-82ae746 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4159
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-17 10:39:29 +00:00
oliverpool
715bedbde7 [BUG] admin authentication source JS errors (#4059)
While trying to understand #1236, I was quite confused not to see the `Use Custom URLs` checkbox.

This checkbox disappeared in b95a893b22 (because `getElementById` does not expect a `#` as first char), fixed in 4e816e1326086ff0929c028f837f62ba1c747759.

After solving this, switching from `Nextcloud` to `OpenID Connect` triggered a JS error, which is addressed in 3efa4d836a300dc45b3ffece766b2b13539fc47c.

Manual testing:
- go to http://localhost:3000/admin/auths
- click on `Add authentication source`
- Choose `Authentication type`: `OAuth2`
- Choose `OAuth2 provider`: `Nextcloud`
- check that the `Use Custom URLs Instead of Default URLs` checkbox toggles the fields below
- let the checkbox be checked
- Switch the `OAuth2 provider` to `OpenID Connect`
- ensure that no JS error is shown
- Switch the `OAuth2 provider` to `Mastodon`
- check that the fields below `Use Custom URLs Instead of Default URLs` have the right defaults (mastodon.social)

![2024-06-07-101638.png](/attachments/5bd6692e-3457-4dd8-b1c1-50e9a95a3100)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4059
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
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>
(cherry picked from commit 82ae7460bf)
2024-06-17 10:06:34 +00:00