Fix: fuck udp

This commit is contained in:
2025-10-16 08:09:19 +08:00
committed by ytshih
parent 0dea850cfa
commit 8fb294cd5d
7 changed files with 61 additions and 64 deletions

View File

@@ -6,11 +6,22 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
)
var playerCmd = &cobra.Command{
Use: "player",
Run: func(cmd *cobra.Command, args []string) {
logger, _ := zap.Config{
Level: zap.NewAtomicLevelAt(zap.InfoLevel),
Encoding: "json",
OutputPaths: []string{"logs/player-stdout.log"},
ErrorOutputPaths: []string{"logs/player-stderr.log"},
EncoderConfig: zap.NewProductionEncoderConfig(),
}.Build()
undo := zap.ReplaceGlobals(logger)
defer undo()
base := stages.NewBaseModel(viper.GetString("auth-endpoint"))
p := tea.NewProgram(stages.NewLandingModel(base))
base.Push(types.Program{
@@ -28,6 +39,8 @@ var playerCmd = &cobra.Command{
}
func init() {
playerCmd.Flags().
String("host", "127.0.0.1", "")
playerCmd.Flags().
Int("udp-listen-port", 18787, "")
playerCmd.Flags().