diff --git a/server/storage/storage.pb.go b/server/storage/storage.pb.go index 15d0756..7943b5d 100644 --- a/server/storage/storage.pb.go +++ b/server/storage/storage.pb.go @@ -159,11 +159,11 @@ type Stream struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` - Input string `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` - Recording bool `protobuf:"varint,3,opt,name=recording,proto3" json:"recording,omitempty"` - Website bool `protobuf:"varint,4,opt,name=website,proto3" json:"website,omitempty"` - Streams uint64 `protobuf:"varint,5,opt,name=streams,proto3" json:"streams,omitempty"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Input string `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` + Recording string `protobuf:"bytes,3,opt,name=recording,proto3" json:"recording,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` + Streams []string `protobuf:"bytes,5,rep,name=streams,proto3" json:"streams,omitempty"` } func (x *Stream) Reset() { @@ -212,25 +212,25 @@ func (x *Stream) GetInput() string { return "" } -func (x *Stream) GetRecording() bool { +func (x *Stream) GetRecording() string { if x != nil { return x.Recording } - return false + return "" } -func (x *Stream) GetWebsite() bool { +func (x *Stream) GetWebsite() string { if x != nil { return x.Website } - return false + return "" } -func (x *Stream) GetStreams() uint64 { +func (x *Stream) GetStreams() []string { if x != nil { return x.Streams } - return 0 + return nil } var File_storage_proto protoreflect.FileDescriptor @@ -256,11 +256,11 @@ var file_storage_proto_rawDesc = []byte{ 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, + 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x73, - 0x69, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, + 0x69, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x42, 0x29, 0x5a, 0x27, + 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x73, 0x74, 0x76, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/server/storage/storage.proto b/server/storage/storage.proto index afdaaa9..dfe45d6 100644 --- a/server/storage/storage.proto +++ b/server/storage/storage.proto @@ -18,7 +18,7 @@ message Stored { message Stream { string stream = 1; string input = 2; - bool recording = 3; - bool website = 4; - uint64 streams = 5; + string recording = 3; + string website = 4; + repeated string streams = 5; } diff --git a/server/views/resume.go b/server/views/resume.go index e1c8763..d9e3bdf 100644 --- a/server/views/resume.go +++ b/server/views/resume.go @@ -52,9 +52,9 @@ func (v *Views) ResumeFunc(c echo.Context) error { log.Printf("accepted resume: %s", unique) response.Response = "ACCEPTED!" - response.Website = stream.Website - response.Recording = stream.Recording - response.Streams = stream.Streams + response.Website = len(stream.Website) > 0 + response.Recording = len(stream.Recording) > 0 + response.Streams = uint64(len(stream.Streams)) return c.JSON(http.StatusOK, response) } return echo.NewHTTPError(http.StatusMethodNotAllowed, "invalid method") diff --git a/server/views/start.go b/server/views/start.go index 9947a2a..656f72c 100644 --- a/server/views/start.go +++ b/server/views/start.go @@ -45,11 +45,11 @@ func (v *Views) StartFunc(c echo.Context) error { Error string `json:"error"` } - recording := false - websiteStream := false + //recording := false + //websiteStream := false if c.FormValue("website_stream") == "on" { - websiteStream = true + //websiteStream = true if v.websiteCheck(c.FormValue("website_stream_endpoint")) { fStart.WebsiteOut = c.FormValue("website_stream_endpoint") } else { @@ -141,7 +141,7 @@ func (v *Views) StartFunc(c echo.Context) error { go func() { defer wg.Done() if c.FormValue("record") == "on" { - recording = true + //recording = true recorderTransporter := transporter recorderTransporter.Payload = rStart wsResponse, err := v.wsHelper(server.Recorder, recorderTransporter) @@ -194,9 +194,9 @@ func (v *Views) StartFunc(c echo.Context) error { s, err := v.store.AddStream(&storage.Stream{ Stream: string(b), Input: c.FormValue("stream_selector"), - Recording: recording, - Website: websiteStream, - Streams: uint64(len(streams)), + Recording: rStart.PathOut, + Website: fStart.WebsiteOut, + Streams: streams, }) if err != nil { log.Printf("invalid response from Forwarder for start: %s", response) diff --git a/server/views/startUnique.go b/server/views/startUnique.go index d19f1d7..17f57ce 100644 --- a/server/views/startUnique.go +++ b/server/views/startUnique.go @@ -110,11 +110,11 @@ func (v *Views) StartUniqueFunc(c echo.Context) error { PathOut: c.FormValue("save_path"), } - recording := false - websiteStream := false + //recording := false + //websiteStream := false if c.FormValue("website_stream") == "on" { - websiteStream = true + //websiteStream = true if v.websiteCheck(c.FormValue("website_stream_endpoint")) { fStart.WebsiteOut = c.FormValue("website_stream_endpoint") } else { @@ -155,7 +155,7 @@ func (v *Views) StartUniqueFunc(c echo.Context) error { go func() { defer wg.Done() if c.FormValue("record") == "on" { - recording = true + //recording = true recorderTransporter := transporter recorderTransporter.Payload = rStart var wsResponse commonTransporter.ResponseTransporter @@ -211,9 +211,9 @@ func (v *Views) StartUniqueFunc(c echo.Context) error { s, err = v.store.AddStream(&storage.Stream{ Stream: unique, Input: streamIn, - Recording: recording, - Website: websiteStream, - Streams: uint64(len(streams)), + Recording: rStart.PathOut, + Website: fStart.WebsiteOut, + Streams: streams, }) if err != nil { log.Printf("invalid response from Forwarder for start: %s", response) diff --git a/server/views/status.go b/server/views/status.go index b77c841..34aea34 100644 --- a/server/views/status.go +++ b/server/views/status.go @@ -66,13 +66,13 @@ func (v *Views) StatusFunc(c echo.Context) error { //nolint:staticcheck fStatus := commonTransporter.ForwarderStatus{ - Website: stream.Website, - Streams: int(stream.Streams), + Website: len(stream.Website) > 0, + Streams: len(stream.Streams), } var statusResponse StatusResponse var wg sync.WaitGroup - if stream.Recording { + if len(stream.Recording) > 0 { wg.Add(2) go func() { defer wg.Done() diff --git a/server/views/stop.go b/server/views/stop.go index 3e724dc..50fe158 100644 --- a/server/views/stop.go +++ b/server/views/stop.go @@ -58,9 +58,9 @@ func (v *Views) StopFunc(c echo.Context) error { _, rec := v.cache.Get(server.Recorder.String()) _, fow := v.cache.Get(server.Forwarder.String()) - if (!rec && stream.Recording) && !fow { + if (!rec && len(stream.Recording) > 0) && !fow { err = fmt.Errorf("no recorder or forwarder available") - } else if !rec && stream.Recording { + } else if !rec && len(stream.Recording) > 0 { err = fmt.Errorf("no recorder available") } else if !fow { err = fmt.Errorf("no forwarder available") @@ -69,7 +69,7 @@ func (v *Views) StopFunc(c echo.Context) error { wg.Add(2) go func() { defer wg.Done() - if stream.Recording { + if len(stream.Recording) > 0 { recorderTransporter := transporter var wsResponse commonTransporter.ResponseTransporter wsResponse, err = v.wsHelper(server.Recorder, recorderTransporter)