Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions build/test/prepare-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,29 @@ else
fi

# Build
cd .. && git clone -b ${GIT_BRANCH} https://github.com/mattermost/mattermost-plugin-calls && \
cd mattermost-plugin-calls && \
git fetch --tags && \
cd standalone && npm ci && cd .. && \
cd webapp && npm ci && cd .. && \
cd ..
if [ -d "mattermost-plugin-calls" ]; then
echo "Directory mattermost-plugin-calls already exists, using existing checkout"
cd mattermost-plugin-calls
git fetch origin
git checkout ${GIT_BRANCH}
git pull origin ${GIT_BRANCH}
else
git clone -b ${GIT_BRANCH} https://github.com/mattermost/mattermost-plugin-calls
cd mattermost-plugin-calls
fi
git fetch --tags

# Ensure mattermost-webapp dependencies are set up
if [ ! -d "webapp/mattermost-webapp" ]; then
echo "mattermost-webapp directory not found, running install_mattermost_webapp.sh"
cd webapp && ./install_mattermost_webapp.sh && cd ..
else
echo "mattermost-webapp directory exists, skipping install_mattermost_webapp.sh"
fi

cd standalone && npm install && cd .. && \
cd webapp && npm install && cd .. && \
echo "replace github.com/mattermost/rtcd => ../rtcd" >> go.mod && \
go mod tidy && \
make dist MM_SERVICESETTINGS_ENABLEDEVELOPER=true
Expand Down
10 changes: 10 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const (
WSCallLoweredHandEvent EventType = "WSCallLoweredHand"
WSCallScreenOnEvent EventType = "WSCallScreenOn"
WSCallScreenOffEvent EventType = "WSCallScreenOff"

// Host control events
WSCallHostMuteEvent EventType = "WSCallHostMute"
WSCallHostScreenOffEvent EventType = "WSCallHostScreenOff"
WSCallHostLowerHandEvent EventType = "WSCallHostLowerHand"
WSCallHostRemovedEvent EventType = "WSCallHostRemoved"
WSCallUserReactedEvent EventType = "WSCallUserReacted"
)

func (e EventType) IsValid() bool {
Expand All @@ -58,6 +65,9 @@ func (e EventType) IsValid() bool {
WSCallUnmutedEvent, WSCallMutedEvent,
WSCallRaisedHandEvent, WSCallLoweredHandEvent,
WSCallScreenOnEvent, WSCallScreenOffEvent,
WSCallHostMuteEvent, WSCallHostScreenOffEvent,
WSCallHostLowerHandEvent, WSCallHostRemovedEvent,
WSCallUserReactedEvent,
WSCallJobStateEvent,
WSJobStopEvent:
return true
Expand Down
68 changes: 68 additions & 0 deletions client/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const (
wsEventUserScreenOn = wsEvPrefix + "user_screen_on"
wsEventUserScreenOff = wsEvPrefix + "user_screen_off"
wsEventUserReacted = wsEvPrefix + "user_reacted"

// Host control events
wsEventHostMute = wsEvPrefix + "host_mute"
wsEventHostScreenOff = wsEvPrefix + "host_screen_off"
wsEventHostLowerHand = wsEvPrefix + "host_lower_hand"
wsEventHostRemoved = wsEvPrefix + "host_removed"
)

var (
Expand Down Expand Up @@ -297,6 +303,68 @@ func (c *Client) handleWSMsg(msg ws.Message) error {
evType = WSCallScreenOffEvent
}
c.emit(evType, sessionID)
case wsEventHostMute:
channelID := ev.GetBroadcast().ChannelId
if channelID == "" {
channelID, _ = ev.GetData()["channelID"].(string)
}
if channelID != c.cfg.ChannelID {
return nil
}
sessionID, _ := ev.GetData()["session_id"].(string)
if sessionID == "" {
return fmt.Errorf("missing session_id from %s event", ev.EventType())
}
c.emit(WSCallHostMuteEvent, sessionID)
case wsEventHostScreenOff:
channelID := ev.GetBroadcast().ChannelId
if channelID == "" {
channelID, _ = ev.GetData()["channelID"].(string)
}
if channelID != c.cfg.ChannelID {
return nil
}
sessionID, _ := ev.GetData()["session_id"].(string)
if sessionID == "" {
return fmt.Errorf("missing session_id from %s event", ev.EventType())
}
c.emit(WSCallHostScreenOffEvent, sessionID)
case wsEventHostLowerHand:
channelID := ev.GetBroadcast().ChannelId
if channelID == "" {
channelID, _ = ev.GetData()["channelID"].(string)
}
if channelID != c.cfg.ChannelID {
return nil
}
sessionID, _ := ev.GetData()["session_id"].(string)
if sessionID == "" {
return fmt.Errorf("missing session_id from %s event", ev.EventType())
}
c.emit(WSCallHostLowerHandEvent, sessionID)
case wsEventHostRemoved:
channelID := ev.GetBroadcast().ChannelId
if channelID == "" {
channelID, _ = ev.GetData()["channelID"].(string)
}
if channelID != c.cfg.ChannelID {
return nil
}
sessionID, _ := ev.GetData()["session_id"].(string)
if sessionID == "" {
return fmt.Errorf("missing session_id from %s event", ev.EventType())
}
c.emit(WSCallHostRemovedEvent, sessionID)
case wsEventUserReacted:
channelID := ev.GetBroadcast().ChannelId
if channelID == "" {
channelID, _ = ev.GetData()["channelID"].(string)
}
if channelID != c.cfg.ChannelID {
return nil
}
// User reactions don't require session_id validation since they're broadcast events
c.emit(WSCallUserReactedEvent, ev.GetData())
default:
}
case ws.BinaryMessage:
Expand Down