@electerm/electerm-react 5.0.7 → 5.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/client/common/constants.js +2 -0
  2. package/client/common/default-setting.js +10 -1
  3. package/client/common/left-sidebar-icon-defs.js +36 -0
  4. package/client/components/ai/ai-config-props.js +8 -0
  5. package/client/components/bookmark-form/common/fields.jsx +3 -2
  6. package/client/components/bookmark-form/common/ssh-agent.jsx +3 -2
  7. package/client/components/bookmark-form/common/x11.jsx +2 -2
  8. package/client/components/common/logo-elem.jsx +1 -1
  9. package/client/components/common/logo.styl +8 -2
  10. package/client/components/common/switch.jsx +63 -0
  11. package/client/components/common/switch.styl +7 -0
  12. package/client/components/footer/cmd-history.jsx +10 -8
  13. package/client/components/footer/cmd-history.styl +8 -0
  14. package/client/components/layout/layout.jsx +8 -5
  15. package/client/components/main/main.jsx +7 -2
  16. package/client/components/profile/profile-form-elem.jsx +2 -2
  17. package/client/components/quick-commands/quick-commands-box.jsx +2 -19
  18. package/client/components/quick-commands/quick-commands-form-elem.jsx +2 -2
  19. package/client/components/quick-commands/quick-commands-select.jsx +10 -20
  20. package/client/components/rdp/rdp-session.jsx +3 -4
  21. package/client/components/setting-panel/setting-common.jsx +9 -5
  22. package/client/components/setting-panel/setting-left-sidebar-icons.jsx +54 -0
  23. package/client/components/setting-panel/setting-terminal.jsx +3 -4
  24. package/client/components/setting-sync/data-import.jsx +3 -4
  25. package/client/components/setting-sync/setting-sync-form.jsx +3 -2
  26. package/client/components/sftp/file-compare-modal.jsx +1 -1
  27. package/client/components/sidebar/history.jsx +9 -11
  28. package/client/components/sidebar/index.jsx +22 -71
  29. package/client/components/sidebar/left-sidebar-icons.jsx +148 -0
  30. package/client/components/sidebar/sidebar.styl +6 -0
  31. package/client/components/sidebar/transfer-list.jsx +1 -1
  32. package/client/components/spice/spice-session.jsx +4 -5
  33. package/client/components/tabs/no-session.jsx +1 -1
  34. package/client/components/tabs/no-session.styl +31 -8
  35. package/client/components/terminal/shortcut-bar-defs.js +131 -0
  36. package/client/components/terminal/shortcut-bar-edit.jsx +205 -0
  37. package/client/components/terminal/shortcut-bar-entry.jsx +34 -0
  38. package/client/components/terminal/shortcut-bar.jsx +150 -0
  39. package/client/components/terminal/shortcut-bar.styl +186 -0
  40. package/client/components/terminal/terminal-color-query.mjs +47 -0
  41. package/client/components/terminal/terminal.jsx +39 -1
  42. package/client/components/terminal/terminal.styl +8 -0
  43. package/client/components/terminal-info/base.jsx +5 -7
  44. package/client/components/widgets/widget-form.jsx +3 -2
  45. package/client/css/mobile.styl +18 -6
  46. package/client/store/init-state.js +3 -0
  47. package/client/store/mcp-handler.js +29 -1
  48. package/package.json +1 -1
@@ -34,6 +34,14 @@
34
34
  background transparent
35
35
  .xterm-viewport
36
36
  background-color transparent !important
37
+ // xterm's DOM renderer paints the background of selected text cells directly
38
+ // on the <span> as an opaque 6-digit hex (dropping alpha), while empty cells
39
+ // use the translucent .xterm-selection overlay behind the rows. xterm marks
40
+ // those spans with .xterm-decoration-top ("rendered above the selection"),
41
+ // so neutralise that inline background to let the corrected selection overlay
42
+ // show through uniformly across both empty and text cells.
43
+ .xterm-decoration-top
44
+ background-color transparent !important
37
45
  .xterm-screen::before
38
46
  content ''
39
47
  position absolute
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import { Component } from 'react'
5
5
  import {
6
- Switch,
7
6
  Space,
8
7
  Button
9
8
  } from 'antd'
9
+ import SwitchLabel from '../common/switch'
10
10
  import defaults from '../../common/default-setting'
11
11
  import { toggleTerminalLog, toggleTerminalLogTimestamp } from '../terminal/terminal-apis'
12
12
  import {
@@ -123,9 +123,8 @@ export default class TerminalInfoBase extends Component {
123
123
  }
124
124
  const name = e('addTimeStampToTermLog')
125
125
  return (
126
- <Switch
127
- checkedChildren={name}
128
- unCheckedChildren={name}
126
+ <SwitchLabel
127
+ label={name}
129
128
  checked={addTimeStampToTermLog}
130
129
  onChange={this.handleToggleTimestamp}
131
130
  className='mg1b'
@@ -176,9 +175,8 @@ export default class TerminalInfoBase extends Component {
176
175
  <b>ID:</b> {id}
177
176
  </div>
178
177
  <div className='pd1b'>
179
- <Switch
180
- checkedChildren={name}
181
- unCheckedChildren={name}
178
+ <SwitchLabel
179
+ label={name}
182
180
  checked={saveTerminalLogToFile}
183
181
  onChange={this.handleToggle}
184
182
  className='mg1r mg1b'
@@ -2,8 +2,9 @@
2
2
  * Widget form component
3
3
  */
4
4
  import React, { useState, useEffect } from 'react'
5
- import { Form, Input, InputNumber, Switch, Select, Button, Tooltip, Alert, Space } from 'antd'
5
+ import { Form, Input, InputNumber, Select, Button, Tooltip, Alert, Space } from 'antd'
6
6
  import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
7
+ import SwitchLabel from '../common/switch'
7
8
  import HelpIcon from '../common/help-icon'
8
9
  import { nanoid } from 'nanoid'
9
10
  import BatchOpEditor from '../batch-op/batch-op-editor'
@@ -91,7 +92,7 @@ export default function WidgetForm ({ widget, onSubmit, loading, hasRunningInsta
91
92
  valuePropName='checked'
92
93
  tooltip={description}
93
94
  >
94
- <Switch />
95
+ <SwitchLabel />
95
96
  </Form.Item>
96
97
  )
97
98
  default:
@@ -178,12 +178,21 @@
178
178
 
179
179
  // ---------------------------------------------------------------------------
180
180
  // Touch-primary devices only (feature-detected via pointer media query, not
181
- // UA sniffing or viewport width). iOS Safari and Android Chrome auto-zoom the
182
- // page when focusing an input with font-size < 16px, and never zoom back out
183
- // on blur, leaving the page stuck zoomed. Desktop browsers (even with
184
- // touchscreens or narrow windows) report pointer: fine and never force-zoom,
185
- // so this never matches them. Force 16px on all focusable form fields (antd
186
- // inputs default to 14px) to prevent the zoom.
181
+ // UA sniffing or viewport width). Desktop browsers (even with touchscreens or
182
+ // narrow windows) report pointer: fine, so this never matches them.
183
+ //
184
+ // 1. iOS Safari and Android Chrome auto-zoom the page when focusing an input
185
+ // with font-size < 16px, and never zoom back out on blur, leaving the page
186
+ // stuck zoomed. Force 16px on all focusable form fields (antd inputs default
187
+ // to 14px) to prevent the zoom.
188
+ //
189
+ // 2. Mobile browsers also inflate text to improve readability
190
+ // (-webkit-text-size-adjust defaults to auto). Inside a fixed-size container
191
+ // this makes the text taller than its wrapper, so it gets clipped — the
192
+ // clearest victim is the antd small Switch, whose track is only 16px tall /
193
+ // 28px wide with overflow:hidden; the "sort by frequency" label gets blown
194
+ // past the track and chopped. Pin to 100% so the declared font-size is
195
+ // honored.
187
196
  // ---------------------------------------------------------------------------
188
197
  @media (pointer: coarse)
189
198
  input,
@@ -194,3 +203,6 @@
194
203
  .ant-input-number-input,
195
204
  .ant-select-selection-search-input
196
205
  font-size 16px !important
206
+ html
207
+ -webkit-text-size-adjust 100%
208
+ text-size-adjust 100%
@@ -167,6 +167,9 @@ export default () => {
167
167
  pinnedQuickCommandBar: ls.getItem(pinnedQuickCommandBarKey) === 'y',
168
168
  qmSortByFrequency: ls.getItem(qmSortByFrequencyKey) === 'yes',
169
169
 
170
+ // touch-only shortcut bar (see components/terminal/shortcut-bar-entry.jsx)
171
+ shortcutBarVisible: false,
172
+
170
173
  // sidebar
171
174
  openedSideBar: ls.getItem(openedSidebarKey) || '',
172
175
  _leftSidePanelWidth: parseInt(ls.getItem(leftSidePanelWidthKey), 10) || 300,
@@ -18,6 +18,30 @@ import {
18
18
  } from '../components/bookmark-form/fix-bookmark-default'
19
19
  import newTerm from '../common/new-terminal'
20
20
 
21
+ // Dangerous props that must not be accepted from MCP/AI tool calls.
22
+ // Mirrors the blocklist in src/client/store/tab.js (dangerousTabProps).
23
+ // These allow arbitrary command execution if set (e.g. execLinux/execLinuxArgs
24
+ // override the shell binary, setEnv injects environment variables, runScripts
25
+ // executes scripts, interactiveValues injects interactive prompts).
26
+ const dangerousTabProps = [
27
+ 'execLinux',
28
+ 'execMac',
29
+ 'execWindows',
30
+ 'execWindowsArgs',
31
+ 'execMacArgs',
32
+ 'execLinuxArgs',
33
+ 'setEnv',
34
+ 'runScripts',
35
+ 'interactiveValues'
36
+ ]
37
+
38
+ // Strip dangerous props from an object, returning a safe copy.
39
+ function stripDangerousTabProps (obj) {
40
+ return Object.fromEntries(
41
+ Object.entries(obj).filter(([key]) => !dangerousTabProps.includes(key))
42
+ )
43
+ }
44
+
21
45
  export default Store => {
22
46
  // Initialize MCP handler - called when MCP widget is started
23
47
  Store.prototype.initMcpHandler = function () {
@@ -497,7 +521,11 @@ export default Store => {
497
521
 
498
522
  Store.prototype.mcpOpenTab = function (args) {
499
523
  const { store } = window
500
- const data = fixBookmarkData({ ...args })
524
+ // Strip dangerous execution-related props before any processing.
525
+ // This prevents MCP/AI callers from injecting execLinux/execLinuxArgs,
526
+ // setEnv, runScripts, etc. to spawn arbitrary local processes.
527
+ const safeArgs = stripDangerousTabProps({ ...args })
528
+ const data = fixBookmarkData(safeArgs)
501
529
 
502
530
  const { valid, errors } = validateBookmarkData(data)
503
531
  if (!valid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "5.0.7",
3
+ "version": "5.1.6",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",