1
0
Fork 0
forgejo/services/packages
merlleu a587d25261
Add auth-required to config.json for Cargo http registry (#26729)
Cargo registry-auth feature requires config.json to have a property
auth-required set to true in order to send token to all registry
requests.
This is ok for git index because you can manually edit the config.json
file to add the auth-required, but when using sparse
(setting index url to
"sparse+https://git.example.com/api/packages/{owner}/cargo/"), the
config.json is dynamically rendered, and does not reflect changes to the
config.json file in the repo.

I see two approaches:
- Serve the real config.json file when fetching the config.json on the
cargo service.
- Automatically detect if the registry requires authorization. (This is
what I implemented in this PR).

What the PR does:
- When a cargo index repository is created, on the config.json, set
auth-required to wether or not the repository is private.
- When the cargo/config.json endpoint is called, set auth-required to
wether or not the request was authorized using an API token.
2023-08-28 07:05:39 +00:00
..
alpine Add Alpine package registry (#23714) 2023-05-12 17:27:50 +00:00
cargo Add auth-required to config.json for Cargo http registry (#26729) 2023-08-28 07:05:39 +00:00
cleanup Allow package cleanup from admin page (#25307) 2023-08-08 00:46:10 +00:00
container Introduce path Clean/Join helper functions (#23495) 2023-03-21 16:02:49 -04:00
debian Prevent newline errors with Debian packages (#26332) 2023-08-05 10:59:52 +02:00
rpm Fix version in rpm repodata/primary.xml.gz (#26009) 2023-07-21 19:41:38 +00:00
auth.go Bump github.com/golang-jwt/jwt to v5 (#25975) 2023-07-19 09:57:10 +00:00
packages.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00