aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/container
Commit message (Collapse)AuthorAgeFilesLines
* Fix error logs and improve some comments/messages (#35105)wxiaoguang2025-07-172-7/+4
|
* Improve package API log handling (#35100)wxiaoguang2025-07-161-4/+3
| | | Simplify code and fix log processing logic
* Redirect to a presigned URL of HEAD for HEAD requests (#35088)Risu2025-07-161-1/+1
| | | | | | | Resolves https://github.com/go-gitea/gitea/issues/35086. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor container package (#34877)wxiaoguang2025-06-294-138/+76
| | | Use standard db.WithTx and introduce db.WithTx2
* enforce explanation for necessary nolints and fix bugs (#34883)TheFox0x72025-06-271-1/+1
| | | | | | | Follows up https://github.com/go-gitea/gitea/pull/34851 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor packages (#34777)wxiaoguang2025-06-223-5/+13
|
* Fix container range bug (#34795)wxiaoguang2025-06-211-1/+3
| | | Fix #34792 and add new tests
* Fix OCI manifest parser (#34797)wxiaoguang2025-06-211-18/+6
| | | Do not parse the media type we don't know.
* Refactor packages (func name & UI) (#34773)wxiaoguang2025-06-181-1/+1
| | | | | | 1. Use `OpenXxx` instead of `GetXxx` because the returned readers should be correctly closed, and clarify the behaviors of the functions: they increase the download counter 2. Use `packages-content` styles instead of `issue-content`
* Fix some package registry problems (#34759)wxiaoguang2025-06-191-33/+9
| | | | 1. Fix #33787 2. Fix container image display
* Improve nuget/rubygems package registries (#34741)wxiaoguang2025-06-172-5/+5
| | | | | | | | 1. Add some missing (optional) fields for nuget v2, and sort the fields to make it easier to maintain 2. Add missing "platform" for rubygems: `VERSION-PLATFORM` and `VERSION_PLATFORM` Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor container and UI (#34736)wxiaoguang2025-06-163-65/+103
|
* Fix container range bug (#34725)wxiaoguang2025-06-151-8/+15
| | | Fix #34724
* Fix "oras" OCI client compatibility (#34666)wxiaoguang2025-06-091-7/+8
| | | | | | Fix #25846 1. the ImageConfig can be empty, fall back to default 2. the blob size can be empty, it still needs "Content-Length" header
* Ignore "Close" error when uploading container blob (#34620)wxiaoguang2025-06-091-11/+5
|
* Fix some trivial problems (#34579)wxiaoguang2025-06-021-1/+1
|
* Enable addtional linters (#34085)TheFox0x72025-04-012-2/+2
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add a config option to block "expensive" pages for anonymous users (#34024)wxiaoguang2025-03-301-2/+2
| | | | | | | | | | | Fix #33966 ``` ;; User must sign in to view anything. ;; It could be set to "expensive" to block anonymous users accessing some pages which consume a lot of resources, ;; for example: block anonymous AI crawlers from accessing repo code pages. ;; The "expensive" mode is experimental and subject to change. ;REQUIRE_SIGNIN_VIEW = false ```
* Refactor package (routes and error handling, npm peer dependency) (#33111)wxiaoguang2025-01-063-29/+29
|
* Fix `missing signature key` error when pulling Docker images with ↵Zettat1232024-10-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SERVE_DIRECT` enabled (#32365) Fix #28121 I did some tests and found that the `missing signature key` error is caused by an incorrect `Content-Type` header. Gitea correctly sets the `Content-Type` header when serving files. https://github.com/go-gitea/gitea/blob/348d1d0f322ca57c459acd902f54821d687ca804/routers/api/packages/container/container.go#L712-L717 However, when `SERVE_DIRECT` is enabled, the `Content-Type` header may be set to an incorrect value by the storage service. To fix this issue, we can use query parameters to override response header values. https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html <img width="600px" src="https://github.com/user-attachments/assets/f2ff90f0-f1df-46f9-9680-b8120222c555" /> In this PR, I introduced a new parameter to the `URL` method to support additional parameters. ``` URL(path, name string, reqParams url.Values) (*url.URL, error) ``` --- Most S3-like services support specifying the content type when storing objects. However, Gitea always use `application/octet-stream`. Therefore, I believe we also need to improve the `Save` method to support storing objects with the correct content type. https://github.com/go-gitea/gitea/blob/b7fb20e73e63b8edc9b90c52073e248bef428fcc/modules/storage/minio.go#L214-L221
* Use per package global lock for container uploads instead of memory lock ↵Lunny Xiao2024-10-111-8/+18
| | | | | | (#31860) This PR uses a per-package lock instead of a global lock for container uploads. So that different packages can be uploaded simultaneously.
* Fix nuget/conan/container packages upload bugs (#31967)Lunny Xiao2024-09-052-4/+24
|
* Refactor names (#31405)wxiaoguang2024-06-191-17/+17
| | | | | | | This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
* Fix duplicate sub-path for avatars (#31365)wxiaoguang2024-06-151-1/+1
| | | | | | | | | | | Fix #31361, and add tests And this PR introduces an undocumented & debug-purpose-only config option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps the development of sub-path related problems. And also fix #31366 Co-authored-by: @ExplodingDragon
* Enable `unparam` linter (#31277)silverwind2024-06-111-1/+1
| | | | | | | | | | | | Enable [unparam](https://github.com/mvdan/unparam) linter. Often I could not tell the intention why param is unused, so I put `//nolint` for those cases like webhook request creation functions never using `ctx`. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Remove sub-path from container registry realm (#31293)wxiaoguang2024-06-091-3/+3
| | | | Container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed
* Improve reverse proxy documents and clarify the AppURL guessing behavior ↵wxiaoguang2024-05-191-0/+2
| | | | | | | | | | | | (#31003) Fix #31002 1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea 2. Clarify the basic requirements and move the "general configuration" to the top 3. Add a comment for the "container registry" 4. Use 1.21 behavior if the reverse proxy is not correctly configured Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Refactor AppURL usage (#30885)wxiaoguang2024-05-071-1/+2
| | | | | | | | Fix #30883 Fix #29591 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Enable more `revive` linter rules (#30608)silverwind2024-04-221-3/+3
| | | | | | | | | | | Noteable additions: - `redefines-builtin-id` forbid variable names that shadow go builtins - `empty-lines` remove unnecessary empty lines that `gofumpt` does not remove for some reason - `superfluous-else` eliminate more superfluous `else` branches Rules are also sorted alphabetically and I cleaned up various parts of `.golangci.yml`.
* Move context from modules to services (#29440)Lunny Xiao2024-02-271-1/+1
| | | | | | | | | | | | | | | Since `modules/context` has to depend on `models` and many other packages, it should be moved from `modules/context` to `services/context` according to design principles. There is no logic code change on this PR, only move packages. - Move `code.gitea.io/gitea/modules/context` to `code.gitea.io/gitea/services/context` - Move `code.gitea.io/gitea/modules/contexttest` to `code.gitea.io/gitea/services/contexttest` because of depending on context - Move `code.gitea.io/gitea/modules/upload` to `code.gitea.io/gitea/services/context/upload` because of depending on context
* Prevent anonymous container access if `RequireSignInView` is enabled (#28877)KN4CK3R2024-01-211-5/+14
| | | | | Fixes #28875 If `RequireSignInView` is enabled, the ghost user has no access rights.
* Add endpoint for not implemented Docker auth (#28457)KN4CK3R2023-12-131-0/+11
| | | | | | | | | | Recently Docker started to use the optional `POST /v2/token` endpoint which should respond with a `404 Not Found` status code instead of the current `405 Method Not Allowed`. > Note: Not all token servers implement oauth2. If the request to the endpoint returns 404 using the HTTP POST method, refer to Token Documentation for using the HTTP GET method supported by all token servers.
* Another round of `db.DefaultContext` refactor (#27103)JakobDev2023-09-251-1/+1
| | | | | | | Part of #27065 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Move notification interface to services layer (#26915)Lunny Xiao2023-09-051-2/+2
| | | Extract from #22266
* Remove `Named` interface (#26913)KN4CK3R2023-09-051-0/+2
| | | | `Named` is implemented by every `Method` and future implementations should implement the method too.
* Remove `db.DefaultContext` in `routers/` and `cmd/` (#26076)delvh2023-07-233-27/+27
| | | | | | Now, the only remaining usages of `models.db.DefaultContext` are in - `modules` - `models` - `services`
* Test if container blob is accessible before mounting (#22759)KN4CK3R2023-07-091-7/+15
| | | | | | | | | | related #16865 This PR adds an accessibility check before mounting container blobs. --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: silverwind <me@silverwind.io>
* Replace `interface{}` with `any` (#25686)silverwind2023-07-041-1/+1
| | | | | Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`. Basically the same [as golang did](https://github.com/golang/go/commit/2580d0e08d5e9f979b943758d3c49877fb2324cb).
* Add direct serving of package content (#25543)KN4CK3R2023-07-031-32/+32
| | | | | | | Fixes #24723 Direct serving of content aka HTTP redirect is not mentioned in any of the package registry specs but lots of official registries do that so it should be supported by the usual clients.
* Add Debian package registry (#24426)KN4CK3R2023-05-022-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: @awkwardbunny This PR adds a Debian package registry. You can follow [this tutorial](https://www.baeldung.com/linux/create-debian-package) to build a *.deb package for testing. Source packages are not supported at the moment and I did not find documentation of the architecture "all" and how these packages should be treated. ![grafik](https://user-images.githubusercontent.com/1666336/218126879-eb80a866-775c-4c8e-8529-5797203a64e6.png) Part of #20751. Revised copy of #22854. --------- Co-authored-by: Brian Hong <brian@hongs.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Revert "Add Debian package registry" (#24412)Yarden Shoham2023-04-282-6/+6
| | | Reverts go-gitea/gitea#22854
* Add Debian package registry (#22854)KN4CK3R2023-04-282-6/+6
| | | | | | | | | | | | | | Co-authored-by: @awkwardbunny This PR adds a Debian package registry. You can follow [this tutorial](https://www.baeldung.com/linux/create-debian-package) to build a *.deb package for testing. Source packages are not supported at the moment and I did not find documentation of the architecture "all" and how these packages should be treated. --------- Co-authored-by: Brian Hong <brian@hongs.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add actions support to package auth verification (#23729)yp053272023-04-101-5/+2
| | | | | | | | | | | Partly fixes https://github.com/go-gitea/gitea/issues/23642 Error info: ![image](https://user-images.githubusercontent.com/18380374/227827027-4280a368-ec9e-49e0-bb93-6b496ada7cd9.png) ActionsUser (userID -2) is used to login in to docker in action jobs. Due to we have no permission policy settings of ActionsUser now, ActionsUser can only access public registry by this quick fix.
* Display image size for multiarch container images (#23821)KN4CK3R2023-04-021-5/+16
| | | | | | | | Fixes #23771 Changes the display of different architectures for multiarch images to show the image size: ![grafik](https://user-images.githubusercontent.com/1666336/228781477-cc76c4d1-4728-434f-8a27-fc008790d924.png)
* Notify on container image create (#22806)KN4CK3R2023-02-181-4/+22
| | | | | | | Fixes #22791 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use import of OCI structs (#22765)KN4CK3R2023-02-062-41/+59
| | | | | | Fixes #22758 Otherwise we would need to rewrite the structs in `oci.go`.
* Check quota limits for container uploads (#22450)KN4CK3R2023-01-293-7/+48
| | | | The test coverage has revealed that container packages were not checked against the quota limits.
* Fix container blob mount (#22226)KN4CK3R2023-01-162-55/+83
|
* refactor auth interface to return error when verify failure (#22119)Lunny Xiao2022-12-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | This PR changed the Auth interface signature from `Verify(http *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) *user_model.User` to `Verify(http *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) (*user_model.User, error)`. There is a new return argument `error` which means the verification condition matched but verify process failed, we should stop the auth process. Before this PR, when return a `nil` user, we don't know the reason why it returned `nil`. If the match condition is not satisfied or it verified failure? For these two different results, we should have different handler. If the match condition is not satisfied, we should try next auth method and if there is no more auth method, it's an anonymous user. If the condition matched but verify failed, the auth process should be stop and return immediately. This will fix #20563 Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Jason Song <i@wolfogre.com>
* refactor some functions to support ctx as first parameter (#21878)Lunny Xiao2022-12-031-1/+1
| | | | Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lauris BH <lauris@nix.lv>