admin: split monitor list in 3, add sending text selection to monitor

This commit is contained in:
ducklet 2021-02-24 23:52:33 +01:00
parent 893f3dc87b
commit e7ecde32a2
5 changed files with 90 additions and 16 deletions

View file

@ -128,6 +128,7 @@ function setup_ws() {
me,
monitored = []
const sid = session_id()
const overlay = q('#text-overlay')
conn = new Connection()
conn.on("helo", () => {
conn.send("name", "Monitor")
@ -149,10 +150,17 @@ function setup_ws() {
clients[client.id] = client
redraw_clients(clients, monitored)
})
conn.on("control", ({ value: {payload: {action, targets}} }) => {
if (action === 'monitor' && Array.isArray(targets)) {
monitored = targets
conn.on("control", ({ value: {payload: {action, ...args}} }) => {
if (action === 'monitor' && Array.isArray(args.targets)) {
monitored = args.targets
redraw_clients(clients, monitored)
} else if (action === 'text' && args.text !== undefined) {
if (args.text.length) {
overlay.textContent = args.text
overlay.classList.remove('hidden')
} else {
overlay.classList.add('hidden')
}
}
})
conn.connect(session_url(sid))