feat: add registry config, image upload/download, and OCI format support
Backend: - Add registry_address configuration API (GET/POST) - Add tar image upload with OCI and Docker format support - Add image download with streaming optimization - Fix blob download using c.Send (Fiber v3 SendStream bug) - Add registry_address prefix stripping for all OCI v2 endpoints - Add AGENTS.md for project documentation Frontend: - Add settings store with Snackbar notifications - Add image upload dialog with progress bar - Add download state tracking with multi-stage feedback - Replace alert() with MUI Snackbar messages - Display image names without registry_address prefix 🤖 Generated with [Qoder](https://qoder.com)
This commit is contained in:
@@ -2,11 +2,13 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/api"
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/opt"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/database/db"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/store"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/tool"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -16,7 +18,9 @@ func Run(ctx context.Context) error {
|
||||
Short: "Cluster is a lightweight OCI registry implementation written in Go using Fiber v3.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
err error
|
||||
stopFns = []func(context.Context) error{}
|
||||
stopApi func(context.Context) error
|
||||
)
|
||||
|
||||
if err = opt.Init(cmd.Context()); err != nil {
|
||||
@@ -31,11 +35,16 @@ func Run(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = api.Init(cmd.Context(), opt.GlobalAddress, db.Default, store.Default); err != nil {
|
||||
if stopApi, err = api.Init(cmd.Context(), opt.GlobalAddress, db.Default, store.Default); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
stopFns = append(stopFns, stopApi)
|
||||
|
||||
<-cmd.Context().Done()
|
||||
log.Println("[W] 收到退出信号,开始退出...")
|
||||
|
||||
tool.MustStop(tool.Timeout(5), stopFns...)
|
||||
|
||||
return nil
|
||||
},
|
||||
@@ -45,5 +54,5 @@ func Run(ctx context.Context) error {
|
||||
_cmd.PersistentFlags().StringVarP(&opt.GlobalAddress, "address", "A", "0.0.0.0:9119", "API server listen address")
|
||||
_cmd.PersistentFlags().StringVarP(&opt.GlobalDataDir, "data-dir", "D", "./x-storage", "Data directory for storing all data")
|
||||
|
||||
return _cmd.Execute()
|
||||
return _cmd.ExecuteContext(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user