diff --git a/internal/config/room.go b/internal/config/room.go index b65dbfc..9e302db 100644 --- a/internal/config/room.go +++ b/internal/config/room.go @@ -31,6 +31,7 @@ type Room struct { NekoPrivilegedImages []string PathPrefix string Labels []string + WaitEnabled bool StorageEnabled bool StorageInternal string @@ -93,6 +94,11 @@ func (Room) Init(cmd *cobra.Command) error { return err } + cmd.PersistentFlags().Bool("wait_enabled", true, "enable active waiting for the room") + if err := viper.BindPFlag("wait_enabled", cmd.PersistentFlags().Lookup("wait_enabled")); err != nil { + return err + } + // Data cmd.PersistentFlags().Bool("storage.enabled", true, "whether storage is enabled, where peristent containers data will be stored") @@ -199,6 +205,7 @@ func (s *Room) Set() { s.NekoPrivilegedImages = viper.GetStringSlice("neko_privileged_images") s.PathPrefix = path.Join("/", path.Clean(viper.GetString("path_prefix"))) s.Labels = viper.GetStringSlice("labels") + s.WaitEnabled = viper.GetBool("wait_enabled") s.StorageEnabled = viper.GetBool("storage.enabled") s.StorageInternal = viper.GetString("storage.internal") diff --git a/internal/proxy/lobby.go b/internal/proxy/lobby.go index fc81add..23c294f 100644 --- a/internal/proxy/lobby.go +++ b/internal/proxy/lobby.go @@ -6,7 +6,41 @@ import ( "github.com/m1k1o/neko-rooms/internal/utils" ) -func RoomNotFound(w http.ResponseWriter, r *http.Request) { +func roomWait(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(``)) +} + +func RoomNotFound(w http.ResponseWriter, r *http.Request, waitEnabled bool) { utils.Swal2Response(w, `