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)
39 lines
684 B
Go
39 lines
684 B
Go
package tool
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
func Timeout(seconds ...int) (ctx context.Context) {
|
|
var (
|
|
duration time.Duration
|
|
)
|
|
|
|
if len(seconds) > 0 && seconds[0] > 0 {
|
|
duration = time.Duration(seconds[0]) * time.Second
|
|
} else {
|
|
duration = time.Duration(30) * time.Second
|
|
}
|
|
|
|
ctx, _ = context.WithTimeout(context.Background(), duration)
|
|
|
|
return
|
|
}
|
|
|
|
func TimeoutCtx(ctx context.Context, seconds ...int) context.Context {
|
|
var (
|
|
duration time.Duration
|
|
)
|
|
|
|
if len(seconds) > 0 && seconds[0] > 0 {
|
|
duration = time.Duration(seconds[0]) * time.Second
|
|
} else {
|
|
duration = time.Duration(30) * time.Second
|
|
}
|
|
|
|
nctx, _ := context.WithTimeout(ctx, duration)
|
|
|
|
return nctx
|
|
}
|