@electerm/electerm-react 1.100.56 → 1.101.10

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 (84) hide show
  1. package/client/common/check-skip-src.js +16 -0
  2. package/client/components/bookmark-form/{bookmark-select.jsx → common/bookmark-select.jsx} +11 -44
  3. package/client/components/bookmark-form/{bookmark-category-select.jsx → common/category-select.jsx} +10 -4
  4. package/client/components/bookmark-form/{color-picker-item.jsx → common/color-picker-item.jsx} +2 -3
  5. package/client/components/bookmark-form/{color-picker.jsx → common/color-picker.jsx} +10 -46
  6. package/client/components/bookmark-form/{render-connection-hopping.jsx → common/connection-hopping.jsx} +7 -7
  7. package/client/components/bookmark-form/common/fields.jsx +202 -0
  8. package/client/components/bookmark-form/common/hex-input.jsx +22 -0
  9. package/client/components/bookmark-form/common/init-values.js +83 -0
  10. package/client/components/bookmark-form/common/profile-item.jsx +34 -0
  11. package/client/components/bookmark-form/{proxy.jsx → common/proxy.jsx} +1 -1
  12. package/client/components/bookmark-form/{use-quick-commands.jsx → common/quick-commands.jsx} +1 -1
  13. package/client/components/bookmark-form/common/rdp-alert.jsx +13 -0
  14. package/client/components/bookmark-form/common/render-auth-ssh.jsx +119 -0
  15. package/client/components/bookmark-form/{render-delayed-scripts.jsx → common/run-scripts.jsx} +6 -2
  16. package/client/components/bookmark-form/common/serial-path-selector.jsx +39 -0
  17. package/client/components/bookmark-form/{render-auth-ssh.jsx → common/ssh-auth-selector.jsx} +3 -4
  18. package/client/components/bookmark-form/common/ssh-auth-type-selector.jsx +38 -0
  19. package/client/components/bookmark-form/common/ssh-host-selector.jsx +61 -0
  20. package/client/components/bookmark-form/{render-ssh-tunnel.jsx → common/ssh-tunnels.jsx} +4 -4
  21. package/client/components/bookmark-form/common/submit-buttons.jsx +42 -0
  22. package/client/components/bookmark-form/{render-bg.jsx → common/terminal-background.jsx} +2 -2
  23. package/client/components/bookmark-form/{x11.jsx → common/x11.jsx} +2 -2
  24. package/client/components/bookmark-form/config/common-fields.js +305 -0
  25. package/client/components/bookmark-form/config/ftp.js +40 -0
  26. package/client/components/bookmark-form/config/local.js +96 -0
  27. package/client/components/bookmark-form/config/rdp.js +39 -0
  28. package/client/components/bookmark-form/config/serial.js +69 -0
  29. package/client/components/bookmark-form/config/session-config.js +23 -0
  30. package/client/components/bookmark-form/config/ssh.js +47 -0
  31. package/client/components/bookmark-form/config/telnet.js +40 -0
  32. package/client/components/bookmark-form/config/vnc.js +44 -0
  33. package/client/components/bookmark-form/config/web.js +45 -0
  34. package/client/components/bookmark-form/form-renderer.jsx +328 -0
  35. package/client/components/bookmark-form/index.jsx +32 -91
  36. package/client/components/bookmark-form/render-form.jsx +11 -0
  37. package/client/components/common/password.jsx +21 -12
  38. package/client/components/footer/footer-entry.jsx +1 -1
  39. package/client/components/main/main.jsx +12 -2
  40. package/client/components/main/upgrade.jsx +3 -3
  41. package/client/components/profile/profile-form-ftp.jsx +35 -0
  42. package/client/components/profile/profile-form-ssh.jsx +3 -3
  43. package/client/components/profile/profile-form-telnet.jsx +1 -1
  44. package/client/components/profile/profile-tabs.jsx +4 -0
  45. package/client/components/setting-panel/setting-modal.jsx +1 -1
  46. package/client/components/setting-panel/setting-wrap.jsx +1 -1
  47. package/client/components/setting-panel/text-bg-modal.jsx +2 -2
  48. package/client/components/sidebar/info-modal.jsx +3 -3
  49. package/client/components/theme/theme-edit-slot.jsx +1 -1
  50. package/client/components/tree-list/category-color-picker.jsx +1 -1
  51. package/client/components/tree-list/move-item-modal.jsx +1 -1
  52. package/client/entry/basic.js +6 -1
  53. package/client/store/load-data.js +1 -1
  54. package/package.json +1 -1
  55. package/client/components/bookmark-form/form-ssh-common.jsx +0 -219
  56. package/client/components/bookmark-form/form-tabs.jsx +0 -66
  57. package/client/components/bookmark-form/ftp-form-ui.jsx +0 -160
  58. package/client/components/bookmark-form/ftp-form.jsx +0 -16
  59. package/client/components/bookmark-form/hex-input.jsx +0 -39
  60. package/client/components/bookmark-form/local-form-ui.jsx +0 -151
  61. package/client/components/bookmark-form/local-form.jsx +0 -16
  62. package/client/components/bookmark-form/profile-form-item.jsx +0 -43
  63. package/client/components/bookmark-form/quick-command-list.jsx +0 -31
  64. package/client/components/bookmark-form/quick-command.jsx +0 -227
  65. package/client/components/bookmark-form/rdp-form-ui.jsx +0 -179
  66. package/client/components/bookmark-form/rdp-form.jsx +0 -16
  67. package/client/components/bookmark-form/render-profile-item.jsx +0 -0
  68. package/client/components/bookmark-form/serial-form-ui.jsx +0 -309
  69. package/client/components/bookmark-form/serial-form.jsx +0 -20
  70. package/client/components/bookmark-form/sftp-enable.jsx +0 -41
  71. package/client/components/bookmark-form/ssh-form-ui.jsx +0 -121
  72. package/client/components/bookmark-form/ssh-form.jsx +0 -292
  73. package/client/components/bookmark-form/telnet-form-ui.jsx +0 -140
  74. package/client/components/bookmark-form/telnet-form.jsx +0 -16
  75. package/client/components/bookmark-form/use-form-funcs.jsx +0 -50
  76. package/client/components/bookmark-form/use-submit.jsx +0 -67
  77. package/client/components/bookmark-form/use-ui.jsx +0 -97
  78. package/client/components/bookmark-form/vnc-form-ui.jsx +0 -213
  79. package/client/components/bookmark-form/vnc-form.jsx +0 -16
  80. package/client/components/bookmark-form/web-form-ui.jsx +0 -143
  81. package/client/components/bookmark-form/web-form.jsx +0 -16
  82. /package/client/components/bookmark-form/{bookmark-group-tree-format.js → common/bookmark-group-tree-format.js} +0 -0
  83. /package/client/components/bookmark-form/{color-picker.styl → common/color-picker.styl} +0 -0
  84. /package/client/components/bookmark-form/{encodes.js → common/encodes.js} +0 -0
@@ -0,0 +1,13 @@
1
+ import { Alert } from 'antd'
2
+ import { rdpWikiLink } from '../../../common/constants'
3
+ import Link from '../../common/external-link'
4
+
5
+ export default function RdpAlert () {
6
+ return (
7
+ <Alert
8
+ message={<Link to={rdpWikiLink}>WIKI: {rdpWikiLink}</Link>}
9
+ type='warning'
10
+ className='mg2y'
11
+ />
12
+ )
13
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * bookmark form auth renderer (copied from legacy)
3
+ */
4
+ import {
5
+ Button,
6
+ Input,
7
+ Upload,
8
+ AutoComplete,
9
+ Form,
10
+ Select
11
+ } from 'antd'
12
+ import { formItemLayout } from '../../../common/form-layout'
13
+ import { uniqBy } from 'lodash-es'
14
+ import Password from '../../common/password'
15
+ import { getFilePath } from '../../../common/file-drop-utils'
16
+
17
+ const { TextArea } = Input
18
+ const FormItem = Form.Item
19
+ const e = window.translate
20
+
21
+ export default function renderAuth (props) {
22
+ const {
23
+ store,
24
+ form,
25
+ authType,
26
+ formItemName = 'password',
27
+ profileFilter = (d) => d
28
+ } = props
29
+ const beforeUpload = async (file) => {
30
+ const filePath = getFilePath(file)
31
+ const privateKey = await window.fs.readFile(filePath)
32
+ form.setFieldsValue({
33
+ privateKey
34
+ })
35
+ return false
36
+ }
37
+ if (authType === 'password') {
38
+ const opts = {
39
+ options: uniqBy(
40
+ store.bookmarks
41
+ .filter(d => d.password),
42
+ (d) => d.password
43
+ )
44
+ .map(d => ({
45
+ label: `${d.title ? `(${d.title})` : ''}${d.username || ''}:${d.host}-******`,
46
+ value: d.password
47
+ })),
48
+ placeholder: e('password'),
49
+ allowClear: false
50
+ }
51
+ return (
52
+ <FormItem
53
+ {...formItemLayout}
54
+ label={e('password')}
55
+ name={formItemName}
56
+ hasFeedback
57
+ rules={[{
58
+ max: 1024, message: '1024 chars max'
59
+ }]}
60
+ >
61
+ <AutoComplete {...opts}>
62
+ <Password />
63
+ </AutoComplete>
64
+ </FormItem>
65
+ )
66
+ }
67
+ if (authType === 'profiles') {
68
+ const opts = {
69
+ options: store.profiles
70
+ .filter(profileFilter)
71
+ .map(d => ({ label: d.name, value: d.id })),
72
+ placeholder: e('profiles'),
73
+ allowClear: true
74
+ }
75
+ return (
76
+ <FormItem
77
+ {...formItemLayout}
78
+ label={e('profiles')}
79
+ name='profile'
80
+ hasFeedback
81
+ >
82
+ <Select {...opts} />
83
+ </FormItem>
84
+ )
85
+ }
86
+ return [
87
+ <FormItem
88
+ {...formItemLayout}
89
+ label={e('privateKey')}
90
+ hasFeedback
91
+ key='privateKey'
92
+ className='mg1b'
93
+ rules={[{
94
+ max: 13000, message: '13000 chars max'
95
+ }]}
96
+ >
97
+ <FormItem noStyle name='privateKey'>
98
+ <TextArea placeholder={e('privateKeyDesc')} autoSize={{ minRows: 1 }} />
99
+ </FormItem>
100
+ <Upload beforeUpload={beforeUpload} fileList={[]}>
101
+ <Button type='dashed' className='mg2b mg1t'>
102
+ {e('importFromFile')}
103
+ </Button>
104
+ </Upload>
105
+ </FormItem>,
106
+ <FormItem
107
+ key='passphrase'
108
+ {...formItemLayout}
109
+ label={e('passphrase')}
110
+ name='passphrase'
111
+ hasFeedback
112
+ rules={[{
113
+ max: 1024, message: '1024 chars max'
114
+ }]}
115
+ >
116
+ <Password placeholder={e('passphraseDesc')} />
117
+ </FormItem>
118
+ ]
119
+ }
@@ -6,7 +6,7 @@ import {
6
6
  Input
7
7
  } from 'antd'
8
8
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'
9
- import { formItemLayout } from '../../common/form-layout'
9
+ import { formItemLayout } from '../../../common/form-layout'
10
10
 
11
11
  const FormItem = Form.Item
12
12
  const FormList = Form.List
@@ -30,6 +30,7 @@ export default function renderRunScripts () {
30
30
  step={1}
31
31
  max={65535}
32
32
  addonBefore={e('loginScriptDelay')}
33
+ rules={[{ required: true, message: e('loginScriptDelay') + ' required' }]}
33
34
  className='compact-input'
34
35
  />
35
36
  </FormItem>
@@ -72,7 +73,10 @@ export default function renderRunScripts () {
72
73
  <FormItem>
73
74
  <Button
74
75
  type='dashed'
75
- onClick={() => add()}
76
+ onClick={() => add({
77
+ delay: 500,
78
+ script: ''
79
+ })}
76
80
  block
77
81
  icon={<PlusOutlined />}
78
82
  >
@@ -0,0 +1,39 @@
1
+ import { ReloadOutlined } from '@ant-design/icons'
2
+ import { AutoComplete, Spin, Form } from 'antd'
3
+ import { formItemLayout } from '../../../common/form-layout'
4
+
5
+ const FormItem = Form.Item
6
+ const e = window.translate
7
+
8
+ export default function SerialPathSelector ({
9
+ serials = [],
10
+ loaddingSerials,
11
+ store = window.store,
12
+ ...props
13
+ }) {
14
+ return (
15
+ <FormItem
16
+ {...formItemLayout}
17
+ label='path'
18
+ rules={[{
19
+ required: true, message: 'path required'
20
+ }]}
21
+ normalize={props.trim}
22
+ >
23
+ <FormItem noStyle name='path'>
24
+ <AutoComplete
25
+ options={serials.map(d => {
26
+ return {
27
+ value: d.path
28
+ }
29
+ })}
30
+ />
31
+ </FormItem>
32
+ <Spin spinning={loaddingSerials}>
33
+ <span onClick={store.handleGetSerials}>
34
+ <ReloadOutlined /> {e('reload')} serials
35
+ </span>
36
+ </Spin>
37
+ </FormItem>
38
+ )
39
+ }
@@ -9,11 +9,10 @@ import {
9
9
  Form,
10
10
  Select
11
11
  } from 'antd'
12
- import { formItemLayout } from '../../common/form-layout'
12
+ import { formItemLayout } from '../../../common/form-layout'
13
13
  import { uniqBy } from 'lodash-es'
14
- import './bookmark-form.styl'
15
- import Password from '../common/password'
16
- import { getFilePath } from '../../common/file-drop-utils'
14
+ import Password from '../../common/password'
15
+ import { getFilePath } from '../../../common/file-drop-utils'
17
16
 
18
17
  const { TextArea } = Input
19
18
  const FormItem = Form.Item
@@ -0,0 +1,38 @@
1
+ import { Radio, Form } from 'antd'
2
+ import { authTypeMap } from '../../../common/constants'
3
+ import { tailFormItemLayout } from '../../../common/form-layout'
4
+
5
+ const authTypes = Object.keys(authTypeMap).map(k => {
6
+ return k
7
+ })
8
+ const RadioButton = Radio.Button
9
+ const RadioGroup = Radio.Group
10
+ const e = window.translate
11
+ const FormItem = Form.Item
12
+
13
+ export default function SshAuthTypeSelector ({ handleChangeAuthType, filterAuthType = a => a, value, ...props }) {
14
+ const authTypesFiltered = authTypes.filter(filterAuthType)
15
+ return (
16
+ <FormItem
17
+ {...tailFormItemLayout}
18
+ className='mg1b'
19
+ name='authType'
20
+ >
21
+ <RadioGroup
22
+ size='small'
23
+ onChange={handleChangeAuthType}
24
+ buttonStyle='solid'
25
+ >
26
+ {
27
+ authTypesFiltered.map(t => {
28
+ return (
29
+ <RadioButton value={t} key={t}>
30
+ {e(t)}
31
+ </RadioButton>
32
+ )
33
+ })
34
+ }
35
+ </RadioGroup>
36
+ </FormItem>
37
+ )
38
+ }
@@ -0,0 +1,61 @@
1
+ import { Form } from 'antd'
2
+ import InputAutoFocus from '../../common/input-auto-focus.jsx'
3
+ import { ColorPickerItem } from './color-picker-item.jsx'
4
+ import { formItemLayout } from '../../../common/form-layout.js'
5
+
6
+ const FormItem = Form.Item
7
+ const e = window.translate
8
+
9
+ export default function SshHostSelector ({ ips = [], useIp, form, onBlur, onPaste, trim, ...props }) {
10
+ // ips is ipaddress string[]
11
+ function renderIps () {
12
+ return ips.map(ip => {
13
+ return (
14
+ <div
15
+ key={ip}
16
+ className='iblock mg2r pointer ip-item'
17
+ onClick={() => useIp(form, ip)}
18
+ >
19
+ <b>{ip}</b>
20
+ <span
21
+ className='mg1l item-item-use'
22
+ >
23
+ {e('use')}
24
+ </span>
25
+ </div>
26
+ )
27
+ })
28
+ }
29
+
30
+ return (
31
+ <FormItem
32
+ {...formItemLayout}
33
+ label={e('host')}
34
+ hasFeedback
35
+ rules={[{
36
+ max: 520, message: '520 chars max'
37
+ }, {
38
+ required: true, message: 'host required'
39
+ }]}
40
+ normalize={props.trim}
41
+ >
42
+ {
43
+ ips.length
44
+ ? renderIps()
45
+ : (
46
+ <div className='dns-section'>
47
+ hostname or ip
48
+ </div>
49
+ )
50
+ }
51
+ <FormItem noStyle name='host'>
52
+ <InputAutoFocus
53
+ name='host'
54
+ onBlur={props.onBlur}
55
+ onPaste={e => props.onPaste(e, form)}
56
+ addonBefore={<ColorPickerItem />}
57
+ />
58
+ </FormItem>
59
+ </FormItem>
60
+ )
61
+ }
@@ -10,8 +10,8 @@ import {
10
10
  } from 'antd'
11
11
  import { useState } from 'react'
12
12
  import { PlusOutlined, QuestionCircleOutlined, MinusCircleFilled, UserOutlined } from '@ant-design/icons'
13
- import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
14
- import uid from '../../common/uid'
13
+ import { formItemLayout, tailFormItemLayout } from '../../../common/form-layout'
14
+ import uid from '../../../common/uid'
15
15
 
16
16
  const FormItem = Form.Item
17
17
  const {
@@ -47,7 +47,7 @@ export default function renderSshTunnels (props) {
47
47
  id: uid()
48
48
  }
49
49
  const v = [
50
- ...form.getFieldValue('sshTunnels'),
50
+ ...(form.getFieldValue('sshTunnels') || []),
51
51
  nd
52
52
  ]
53
53
  form.setFieldsValue({
@@ -66,7 +66,7 @@ export default function renderSshTunnels (props) {
66
66
  setList(old => {
67
67
  return old.filter(i => i.id !== id)
68
68
  })
69
- const v = form.getFieldValue('sshTunnels').filter(i => i.id !== id)
69
+ const v = (form.getFieldValue('sshTunnels') || []).filter(i => i.id !== id)
70
70
  form.setFieldsValue({
71
71
  sshTunnels: v
72
72
  })
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Common submit buttons component for bookmark forms
3
+ * Provides save, connect, and test functionality
4
+ */
5
+ import React from 'react'
6
+ import { Button, Form } from 'antd'
7
+ import { tailFormItemLayout } from '../../../common/form-layout'
8
+
9
+ const FormItem = Form.Item
10
+ const e = window.translate
11
+
12
+ export default function SubmitButtons ({
13
+ onSave,
14
+ onSaveAndCreateNew,
15
+ onConnect,
16
+ onTestConnection,
17
+ onSaveAndConnect
18
+ }) {
19
+ return (
20
+ <FormItem {...tailFormItemLayout}>
21
+ <p>
22
+ <Button type='primary' htmlType='submit' className='mg1r mg1b'>
23
+ {e('saveAndConnect')}
24
+ </Button>
25
+ <Button type='primary' className='mg1r mg1b' onClick={onSaveAndCreateNew}>
26
+ {e('saveAndCreateNew')}
27
+ </Button>
28
+ <Button type='dashed' className='mg1r mg1b' onClick={onSave}>
29
+ {e('save')}
30
+ </Button>
31
+ </p>
32
+ <p>
33
+ <Button type='dashed' onClick={onConnect} className='mg1r mg1b'>
34
+ {e('connect')}
35
+ </Button>
36
+ <Button type='dashed' onClick={onTestConnection} className='mg1r mg1b'>
37
+ {e('testConnection')}
38
+ </Button>
39
+ </p>
40
+ </FormItem>
41
+ )
42
+ }
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import React from 'react'
5
5
  import { Form } from 'antd'
6
- import TerminalBackgroundConfig from '../setting-panel/terminal-bg-config'
7
- import { formItemLayout } from '../../common/form-layout'
6
+ import TerminalBackgroundConfig from '../../setting-panel/terminal-bg-config'
7
+ import { formItemLayout } from '../../../common/form-layout'
8
8
 
9
9
  const FormItem = Form.Item
10
10
 
@@ -7,7 +7,7 @@ import {
7
7
  Button,
8
8
  Select
9
9
  } from 'antd'
10
- import { formItemLayout } from '../../common/form-layout'
10
+ import { formItemLayout } from '../../../common/form-layout'
11
11
 
12
12
  const FormItem = Form.Item
13
13
  const { Option } = Select
@@ -77,7 +77,7 @@ const defaultServerHostKeyOptions = [
77
77
  'rsa-sha2-256'
78
78
  ]
79
79
 
80
- export default function renderX11 (form) {
80
+ export default function renderX11 ({ form }) {
81
81
  function setDefaults () {
82
82
  form.setFieldValue('cipher', defaultCipherOptions)
83
83
  form.setFieldValue('serverHostKey', defaultServerHostKeyOptions)