summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-10-02 01:05:55 +0300
committerMaxim Devaev <[email protected]>2024-10-02 02:45:59 +0300
commit4e1d9815cdf79f8bc5ad1d9c9f4057136fd6238e (patch)
tree4c7dc161d59c20b8ffacb311db19d6535907097e /web
parent8209ee2eb0bd411c74d7d7dbf7b1b79e46dd79c0 (diff)
pikvm/pikvm#1407: Save keymap on macro recording
Diffstat (limited to 'web')
-rw-r--r--web/share/js/kvm/hid.js2
-rw-r--r--web/share/js/kvm/recorder.js13
2 files changed, 11 insertions, 4 deletions
diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js
index 68c19e37..e95d92c2 100644
--- a/web/share/js/kvm/hid.js
+++ b/web/share/js/kvm/hid.js
@@ -262,7 +262,7 @@ export function Hid(__getGeometry, __recorder) {
} else if (http.status !== 200) {
wm.error("HID paste error", http.responseText);
} else if (http.status === 200) {
- __recorder.recordPrintEvent(text);
+ __recorder.recordPrintEvent(text, keymap);
}
}, text, "text/plain");
};
diff --git a/web/share/js/kvm/recorder.js b/web/share/js/kvm/recorder.js
index f32b5a2e..822aa972 100644
--- a/web/share/js/kvm/recorder.js
+++ b/web/share/js/kvm/recorder.js
@@ -67,8 +67,8 @@ export function Recorder() {
__recordEvent(event);
};
- self.recordPrintEvent = function(text) {
- __recordEvent({"event_type": "print", "event": {"text": text}});
+ self.recordPrintEvent = function(text, keymap) {
+ __recordEvent({"event_type": "print", "event": {"text": text, "keymap": keymap}});
};
self.recordAtxButtonEvent = function(button) {
@@ -159,6 +159,9 @@ export function Recorder() {
} else if (event.event_type === "print") {
__checkType(event.event.text, "string", "Non-string print text");
+ if (event.event.keymap) {
+ __checkType(event.event.keymap, "string", "Non-string keymap");
+ }
} else if (event.event_type === "key") {
__checkType(event.event.key, "string", "Non-string key code");
@@ -280,7 +283,11 @@ export function Recorder() {
return;
} else if (event.event_type === "print") {
- tools.httpPost("/api/hid/print", {"limit": 0}, function(http) {
+ let params = {"limit": 0};
+ if (event.event.keymap) {
+ params["keymap"] = event.event.keymap;
+ }
+ tools.httpPost("/api/hid/print", params, function(http) {
if (http.status === 413) {
wm.error("Too many text for paste!");
__stopProcess();