Fix: stop web dialogs closing on text-selection drags
All modal overlays closed on a click whose target was the backdrop, but browsers dispatch that click to the nearest common ancestor of mousedown and mouseup: selecting text inside an input and releasing outside the card closed the dialog. The overlays now ignore backdrop clicks and close only from their own buttons (x / Cancel / confirm); app-dialog keeps Escape. Review follow-ups in the same flow: a late set_device_remark/group reply is applied only to the dialog still open for the same device (failure replies now echo the device id, and the success path no longer fetches the list twice), Save reports "not connected" instead of doing nothing while the socket reconnects, and the remark/group menu icons get their colours. Also escape client-reported card fields for HTML and attribute contexts (screen, transfer/active-window titles, audit timestamp title), so a modified host cannot inject markup into the admin page. Verified: node --check on the inline script; go build ./... and go test ./web/ pass; the embedded asset copy is in sync. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
034b11fa6a
commit
4b96885016
2 files changed
+34
-17
No files matched your search
@@ -1806,7 +1806,9 @@ func (h *wsHub) handleSetDeviceRemark(c *wsClient, raw []byte) {
|
||||
"reason": reason,
|
||||
"error": msg,
|
||||
})
|
||||
c.queue(mustJSON(map[string]any{"cmd": replyCmd, "ok": false, "msg": msg}))
|
||||
// id lets the page drop a late reply meant for a dialog it has since
|
||||
// closed and replaced with another device's.
|
||||
c.queue(mustJSON(map[string]any{"cmd": replyCmd, "ok": false, "id": id, "msg": msg}))
|
||||
}
|
||||
// An unparsable payload (e.g. a non-string remark) must be rejected, not
|
||||
// treated as an empty remark: empty clears the label.
|
||||
@@ -1877,7 +1879,9 @@ func (h *wsHub) handleSetDeviceGroup(c *wsClient, raw []byte) {
|
||||
"reason": reason,
|
||||
"error": msg,
|
||||
})
|
||||
c.queue(mustJSON(map[string]any{"cmd": replyCmd, "ok": false, "msg": msg}))
|
||||
// id lets the page drop a late reply meant for a dialog it has since
|
||||
// closed and replaced with another device's.
|
||||
c.queue(mustJSON(map[string]any{"cmd": replyCmd, "ok": false, "id": id, "msg": msg}))
|
||||
}
|
||||
if err := json.Unmarshal(raw, &in); err != nil {
|
||||
fail("Invalid request", "invalid_request")
|
||||
|
||||
Reference in new issue
Block a user