Adds a `yoink serve` command that starts an HTTP server with a Sonarr/MeTube-inspired dark UI. Features a URL input bar for triggering downloads, a 150x300 cover grid with filter and sort controls, a live download queue strip, and toast notifications. Includes Dockerfile (multi-stage, distroless runtime) and docker-compose.yml for easy deployment.
37 lines
669 B
Go
37 lines
669 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/spf13/cobra"
|
|
"yoink/web"
|
|
)
|
|
|
|
var serveCmd = &cobra.Command{
|
|
Use: "serve",
|
|
Short: "Start the Yoink web UI",
|
|
Args: cobra.NoArgs,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
library, ok := os.LookupEnv("YOINK_LIBRARY")
|
|
if !ok {
|
|
userHome, _ := os.UserHomeDir()
|
|
library = filepath.Join(userHome, ".yoink")
|
|
}
|
|
|
|
port, _ := cmd.Flags().GetString("port")
|
|
addr := fmt.Sprintf(":%s", port)
|
|
|
|
if err := web.Listen(addr, library); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
serveCmd.Flags().StringP("port", "p", "8080", "Port to listen on")
|
|
cli.AddCommand(serveCmd)
|
|
}
|