From 0371a7dc4c578e5097aa9f042010ff4add0eaab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 4 Oct 2022 20:28:07 +0200 Subject: [PATCH] Add NoVnc keyboard (#13) * novnc wip. * remove blacklistKeys. * eslint ignore all js files. * ad common keyboard interface. * upgrade novnc. * fix novnc. * fix novnc keyboard. * fix keyboard remapping. * conditionally include novnc at build time. --- .eslintrc | 3 +- README.md | 10 + src/component/overlay.vue | 12 +- src/component/utils/keyboard-remapping.ts | 14 +- src/component/utils/keyboard.ts | 17 + .../guacamole.js} | 3026 ++++++++--------- .../guacamole.ts} | 16 +- src/component/utils/keyboards/novnc.js | 2 + src/component/utils/keyboards/novnc.ts | 50 + .../utils/keyboards/novnc/browser.js | 42 + .../utils/keyboards/novnc/domkeytable.js | 311 ++ .../utils/keyboards/novnc/fixedkeys.js | 129 + .../utils/keyboards/novnc/keyboard.js | 293 ++ src/component/utils/keyboards/novnc/keysym.js | 616 ++++ .../utils/keyboards/novnc/keysymdef.js | 688 ++++ src/component/utils/keyboards/novnc/util.js | 191 ++ src/component/utils/keyboards/novnc/vkeys.js | 116 + vue.config.js | 10 + 18 files changed, 4014 insertions(+), 1532 deletions(-) create mode 100644 src/component/utils/keyboard.ts rename src/component/utils/{guacamole-keyboard.js => keyboards/guacamole.js} (96%) rename src/component/utils/{guacamole-keyboard.ts => keyboards/guacamole.ts} (86%) create mode 100644 src/component/utils/keyboards/novnc.js create mode 100644 src/component/utils/keyboards/novnc.ts create mode 100644 src/component/utils/keyboards/novnc/browser.js create mode 100644 src/component/utils/keyboards/novnc/domkeytable.js create mode 100644 src/component/utils/keyboards/novnc/fixedkeys.js create mode 100644 src/component/utils/keyboards/novnc/keyboard.js create mode 100644 src/component/utils/keyboards/novnc/keysym.js create mode 100644 src/component/utils/keyboards/novnc/keysymdef.js create mode 100644 src/component/utils/keyboards/novnc/util.js create mode 100644 src/component/utils/keyboards/novnc/vkeys.js diff --git a/.eslintrc b/.eslintrc index 34b791bd..654c3bf4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,5 +14,6 @@ "no-dupe-class-members": "off", "no-console": "off", "no-empty": "off" - } + }, + "ignorePatterns": ["**/*.js"] } diff --git a/README.md b/README.md index b9acd68e..5c6fb19f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ echo @demodesk:registry=https://npm.pkg.github.com >> .npmrc # yarn command echo \"@demodesk:registry\" \"https://npm.pkg.github.com\" >> .yarnrc ``` +### Build + +You can set keyboard provider at build time, either `novnc` or the default `guacamole`. + +```bash +# by default uses guacamole keybaord +npm run build +# uses novnc keybaord +KEYBOARD=novnc npm run build +``` ### Example API consists of accessing Vue reactive state, calling various methods and subscribing to events. Simple usage: diff --git a/src/component/overlay.vue b/src/component/overlay.vue index 54cc6579..077ed168 100644 --- a/src/component/overlay.vue +++ b/src/component/overlay.vue @@ -45,7 +45,7 @@