Split keyboard and mouse permission (resolves #45)

This commit is contained in:
Yukino Song
2024-09-20 22:19:47 +08:00
parent 81de679fba
commit 5829bd1c76
5 changed files with 24 additions and 11 deletions

View File

@@ -44,8 +44,9 @@ namespace crypto {
input_controller = _input << 0, // Allow controller input
input_touch = _input << 1, // Allow touch input
input_pen = _input << 2, // Allow pen input
input_kbdm = _input << 3, // Allow kbd/mouse input
_all_inputs = input_controller | input_touch | input_pen | input_kbdm,
input_mouse = _input << 3, // Allow mouse input
input_kbd = _input << 4, // Allow keyboard input
_all_inputs = input_controller | input_touch | input_pen | input_mouse | input_kbd,
_operation = _input << 8, // Operation permission group
clipboard_set = _operation << 0, // Allow set clipboard from client

View File

@@ -1657,10 +1657,15 @@ namespace input {
case MOUSE_BUTTON_UP_EVENT_MAGIC_GEN5:
case SCROLL_MAGIC_GEN5:
case SS_HSCROLL_MAGIC:
if (!(permission & crypto::PERM::input_mouse)) {
return;
} else {
break;
}
case KEY_DOWN_EVENT_MAGIC:
case KEY_UP_EVENT_MAGIC:
case UTF8_TEXT_EVENT_MAGIC:
if (!(permission & crypto::PERM::input_kbdm)) {
if (!(permission & crypto::PERM::input_kbd)) {
return;
} else {
break;

View File

@@ -165,8 +165,9 @@
input_controller = _input << 0, // Allow controller input
input_touch = _input << 1, // Allow touch input
input_pen = _input << 2, // Allow pen input
input_kbdm = _input << 3, // Allow kbd/mouse input
_all_inputs = input_controller | input_touch | input_pen | input_kbdm,
input_mouse = _input << 3, // Allow mouse input
input_kbd = _input << 4, // Allow keyboard input
_all_inputs = input_controller | input_touch | input_pen | input_mouse | input_kbd,
_operation = _input << 8, // Operation permission group
clipboard_set = _operation << 0, // Allow set clipboard from client
@@ -194,8 +195,9 @@
input_controller: 0x00000100,
input_touch: 0x00000200,
input_pen: 0x00000400,
input_kbdm: 0x00000800,
_all_inputs: 0x00000F00,
input_mouse: 0x00000800,
input_kbd: 0x00001000,
_all_inputs: 0x00001F00,
// Operation permission group
clipboard_set: 0x00010000,
@@ -215,7 +217,7 @@
// Special permissions
_default: 0x03000000,
_no: 0x00000000,
_all: 0x071F0F00
_all: 0x071F1F00
};
const permissionGroups = [
@@ -248,7 +250,10 @@
name: 'input_pen',
suppressed_by: []
}, {
name: 'input_kbdm',
name: 'input_mouse',
suppressed_by: []
}, {
name: 'input_kbd',
suppressed_by: []
}
] },

View File

@@ -401,7 +401,8 @@
"input_controller": "Controller Input",
"input_touch": "Touch Input",
"input_pen": "Pen Input",
"input_kbdm": "Keyboard & Mouse Input",
"input_mouse": "Mouse Input",
"input_kbd": "Keyboard Input",
"clipboard_set": "Clipboard Set",
"clipboard_read": "Clipboard Read",
"file_upload": "File Upload",

View File

@@ -401,7 +401,8 @@
"input_controller": "手柄输入",
"input_touch": "触摸输入",
"input_pen": "笔输入",
"input_kbdm": "鼠输入",
"input_mouse": "鼠输入",
"input_kbd": "键盘输入",
"clipboard_set": "上传剪贴板",
"clipboard_read": "获取剪贴板",
"file_upload": "上传文件",