diff --git a/internal/api/room/control.go b/internal/api/room/control.go index 7de66153..a5855747 100644 --- a/internal/api/room/control.go +++ b/internal/api/room/control.go @@ -42,7 +42,7 @@ func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) if !session.CanHost() { - utils.HttpBadRequest(w, "Member is not allowed to host.") + utils.HttpBadRequest(w, "Session is not allowed to host.") return } @@ -54,12 +54,12 @@ func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) { func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) if !session.IsHost() { - utils.HttpUnprocessableEntity(w, "Member is not the host.") + utils.HttpUnprocessableEntity(w, "Session is not the host.") return } if !session.CanHost() { - utils.HttpBadRequest(w, "Member is not allowed to host.") + utils.HttpBadRequest(w, "Session is not allowed to host.") return } @@ -72,7 +72,7 @@ func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) { func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) if !session.CanHost() { - utils.HttpBadRequest(w, "Member is not allowed to host.") + utils.HttpBadRequest(w, "Session is not allowed to host.") return } @@ -82,16 +82,16 @@ func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) { } func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) { - memberId := chi.URLParam(r, "memberId") + sessionId := chi.URLParam(r, "sessionId") - target, ok := h.sessions.Get(memberId) + target, ok := h.sessions.Get(sessionId) if !ok { - utils.HttpNotFound(w, "Target member was not found.") + utils.HttpNotFound(w, "Target session was not found.") return } if !target.CanHost() { - utils.HttpBadRequest(w, "Target member is not allowed to host.") + utils.HttpBadRequest(w, "Target session is not allowed to host.") return } diff --git a/internal/websocket/handler/system.go b/internal/websocket/handler/system.go index 4a9d92d7..5f419ecb 100644 --- a/internal/websocket/handler/system.go +++ b/internal/websocket/handler/system.go @@ -23,11 +23,12 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error { return nil } + // TODO: Sessions. members := map[string]message.MemberData{} for _, session := range h.sessions.List() { - memberId := session.ID() - members[memberId] = message.MemberData{ - ID: memberId, + sessionId := session.ID() + members[sessionId] = message.MemberData{ + ID: sessionId, Profile: session.GetProfile(), State: session.GetState(), } @@ -36,6 +37,7 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error { return session.Send( message.SystemInit{ Event: event.SYSTEM_INIT, + // TODO: Session ID. MemberId: session.ID(), ControlHost: controlHost, ScreenSize: message.ScreenSize{ @@ -43,6 +45,7 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error { Height: size.Height, Rate: size.Rate, }, + // TODO: Sessions. Members: members, ImplicitHosting: h.sessions.ImplicitHosting(), })