@electerm/electerm-react 1.39.88 → 1.39.99

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 (101) hide show
  1. package/client/common/constants.js +2 -1
  2. package/client/common/create-title.jsx +2 -3
  3. package/client/common/init-setting-item.js +3 -6
  4. package/client/common/new-terminal.js +1 -2
  5. package/client/common/terminal-theme.js +2 -3
  6. package/client/components/auth/login.jsx +2 -3
  7. package/client/components/batch-op/batch-op.jsx +18 -36
  8. package/client/components/bookmark-form/form-ssh-common.jsx +4 -7
  9. package/client/components/bookmark-form/form-tabs.jsx +4 -8
  10. package/client/components/bookmark-form/index.jsx +5 -9
  11. package/client/components/bookmark-form/local-form-ui.jsx +3 -6
  12. package/client/components/bookmark-form/proxy.jsx +1 -2
  13. package/client/components/bookmark-form/quick-command.jsx +7 -8
  14. package/client/components/bookmark-form/rdp-form-ui.jsx +2 -4
  15. package/client/components/bookmark-form/render-auth-ssh.jsx +1 -2
  16. package/client/components/bookmark-form/render-connection-hopping.jsx +9 -11
  17. package/client/components/bookmark-form/render-delayed-scripts.jsx +1 -2
  18. package/client/components/bookmark-form/render-ssh-tunnel.jsx +9 -12
  19. package/client/components/bookmark-form/serial-form-ui.jsx +4 -8
  20. package/client/components/bookmark-form/sftp-enable.jsx +1 -2
  21. package/client/components/bookmark-form/telnet-form-ui.jsx +2 -4
  22. package/client/components/bookmark-form/tree-delete.jsx +3 -4
  23. package/client/components/bookmark-form/use-quick-commands.jsx +5 -6
  24. package/client/components/bookmark-form/use-submit.jsx +1 -2
  25. package/client/components/bookmark-form/use-ui.jsx +4 -6
  26. package/client/components/bookmark-form/vnc-form-ui.jsx +2 -4
  27. package/client/components/bookmark-form/web-form-ui.jsx +2 -4
  28. package/client/components/common/markdown.jsx +1 -1
  29. package/client/components/context-menu/context-menu.jsx +3 -4
  30. package/client/components/context-menu/menu-btn.jsx +13 -18
  31. package/client/components/footer/batch-input.jsx +1 -2
  32. package/client/components/footer/footer-entry.jsx +2 -3
  33. package/client/components/main/error-wrapper.jsx +2 -4
  34. package/client/components/main/upgrade.jsx +2 -4
  35. package/client/components/main/upgrade.styl +4 -1
  36. package/client/components/profile/profile-form-elem.jsx +28 -10
  37. package/client/components/quick-commands/quick-commands-box.jsx +1 -2
  38. package/client/components/quick-commands/quick-commands-form-elem.jsx +7 -12
  39. package/client/components/quick-commands/quick-commands-list-form.jsx +5 -6
  40. package/client/components/quick-commands/quick-commands-list.jsx +2 -3
  41. package/client/components/quick-commands/quick-commands-select.jsx +1 -2
  42. package/client/components/rdp/rdp-session.jsx +0 -3
  43. package/client/components/rdp/resolution-form.jsx +3 -6
  44. package/client/components/session/session.jsx +2 -4
  45. package/client/components/session/sessions.jsx +4 -6
  46. package/client/components/setting-panel/keywords-form.jsx +2 -3
  47. package/client/components/setting-panel/list.jsx +3 -6
  48. package/client/components/setting-panel/setting-common.jsx +10 -14
  49. package/client/components/setting-panel/setting-modal.jsx +7 -11
  50. package/client/components/setting-panel/setting-terminal.jsx +13 -16
  51. package/client/components/setting-panel/start-session-select.jsx +1 -2
  52. package/client/components/setting-panel/tab-history.jsx +2 -3
  53. package/client/components/setting-sync/data-import.jsx +4 -7
  54. package/client/components/setting-sync/data-select.jsx +4 -16
  55. package/client/components/setting-sync/setting-sync-form.jsx +8 -12
  56. package/client/components/sftp/address-bar.jsx +1 -2
  57. package/client/components/sftp/confirm-modal-store.jsx +1 -2
  58. package/client/components/sftp/file-item.jsx +6 -8
  59. package/client/components/sftp/file-mode-modal.jsx +1 -2
  60. package/client/components/sftp/file-props-modal.jsx +1 -2
  61. package/client/components/sftp/list-table-ui.jsx +1 -2
  62. package/client/components/sftp/permission-render.jsx +1 -2
  63. package/client/components/sftp/sftp-entry.jsx +21 -7
  64. package/client/components/sftp/transfer-tag.jsx +1 -2
  65. package/client/components/shortcuts/shortcuts.jsx +5 -28
  66. package/client/components/sidebar/bookmark.jsx +6 -9
  67. package/client/components/sidebar/history.jsx +4 -6
  68. package/client/components/sidebar/index.jsx +9 -16
  69. package/client/components/sidebar/info-modal.jsx +10 -15
  70. package/client/components/sidebar/transfer-history-modal.jsx +3 -6
  71. package/client/components/sidebar/transfer-list-control.jsx +1 -2
  72. package/client/components/sidebar/transfer-list.jsx +1 -2
  73. package/client/components/sidebar/transfer-modal.jsx +2 -4
  74. package/client/components/sidebar/transport-ui.jsx +1 -2
  75. package/client/components/tabs/index.jsx +28 -20
  76. package/client/components/tabs/tab.jsx +5 -9
  77. package/client/components/tabs/window-control.jsx +4 -5
  78. package/client/components/terminal/index.jsx +5 -7
  79. package/client/components/terminal/term-search.jsx +2 -3
  80. package/client/components/terminal/terminal-interactive.jsx +2 -4
  81. package/client/components/terminal-info/activity.jsx +4 -5
  82. package/client/components/terminal-info/base.jsx +3 -4
  83. package/client/components/terminal-info/terminal-info.styl +1 -0
  84. package/client/components/terminal-theme/index.jsx +6 -9
  85. package/client/components/terminal-theme/theme-list.jsx +1 -2
  86. package/client/components/text-editor/text-editor-form.jsx +4 -8
  87. package/client/components/text-editor/text-editor.jsx +2 -3
  88. package/client/components/tree-list/bookmark-transport.jsx +4 -7
  89. package/client/components/tree-list/tree-list-item.jsx +4 -7
  90. package/client/components/tree-list/tree-list.jsx +3 -6
  91. package/client/components/vnc/vnc-form.jsx +2 -4
  92. package/client/components/vnc/vnc-session.jsx +1 -2
  93. package/client/entry/basic.js +4 -6
  94. package/client/store/common.js +10 -12
  95. package/client/store/index.js +4 -7
  96. package/client/store/init-state.js +2 -3
  97. package/client/store/load-data.js +10 -0
  98. package/client/store/setting.js +2 -3
  99. package/client/store/system-menu.js +4 -6
  100. package/client/store/terminal-theme.js +2 -4
  101. package/package.json +1 -1
@@ -8,8 +8,7 @@ import {
8
8
  isMacJs
9
9
  } from '../../common/constants'
10
10
 
11
- const { prefix } = window
12
- const m = prefix('menu')
11
+ const e = window.translate
13
12
 
14
13
  export default class WindowControl extends Component {
15
14
  render () {
@@ -35,7 +34,7 @@ export default class WindowControl extends Component {
35
34
  return (
36
35
  <div className='window-controls'>
37
36
  <div className='window-control-box window-control-minimize' onClick={minimize}>
38
- <MinusOutlined title={m('minimize')} className='iblock font12 widnow-control-icon' />
37
+ <MinusOutlined title={e('minimize')} className='iblock font12 widnow-control-icon' />
39
38
  </div>
40
39
  <div
41
40
  className='window-control-box window-control-maximize'
@@ -45,7 +44,7 @@ export default class WindowControl extends Component {
45
44
  >
46
45
  <span
47
46
  title={
48
- isMaximized ? m('unmaximize') : m('maximize')
47
+ isMaximized ? e('unmaximize') : e('maximize')
49
48
  }
50
49
  className={
51
50
  'iblock font12 icon-maximize widnow-control-icon ' +
@@ -54,7 +53,7 @@ export default class WindowControl extends Component {
54
53
  />
55
54
  </div>
56
55
  <div className='window-control-box window-control-close' onClick={closeApp}>
57
- <CloseOutlined title={m('close')} className='iblock font12 widnow-control-icon' />
56
+ <CloseOutlined title={e('close')} className='iblock font12 widnow-control-icon' />
58
57
  </div>
59
58
  </div>
60
59
  )
@@ -53,9 +53,7 @@ import strip from '@electerm/strip-ansi'
53
53
  import { formatBytes } from '../../common/byte-format.js'
54
54
  import * as fs from './fs.js'
55
55
 
56
- const { prefix } = window
57
- const e = prefix('ssh')
58
- const m = prefix('menu')
56
+ const e = window.translate
59
57
 
60
58
  const computePos = (e) => {
61
59
  return {
@@ -837,14 +835,14 @@ class Term extends Component {
837
835
  {
838
836
  func: 'onCopy',
839
837
  icon: 'CopyOutlined',
840
- text: m('copy'),
838
+ text: e('copy'),
841
839
  disabled: !hasSlected,
842
840
  subText: copyShortcut
843
841
  },
844
842
  {
845
843
  func: 'onPaste',
846
844
  icon: 'SwitcherOutlined',
847
- text: m('paste'),
845
+ text: e('paste'),
848
846
  disabled: !copyed,
849
847
  subText: pasteShortcut
850
848
  },
@@ -1256,7 +1254,7 @@ class Term extends Component {
1256
1254
  this.props.delSplit(this.state.id)
1257
1255
  }}
1258
1256
  >
1259
- {m('close')}
1257
+ {e('close')}
1260
1258
  </Button>
1261
1259
  <Button
1262
1260
  icon={<ReloadOutlined />}
@@ -1267,7 +1265,7 @@ class Term extends Component {
1267
1265
  )
1268
1266
  }}
1269
1267
  >
1270
- {m('reload')}
1268
+ {e('reload')}
1271
1269
  </Button>
1272
1270
  </div>
1273
1271
  )
@@ -18,8 +18,7 @@ import copy from 'json-deep-copy'
18
18
  import { shortcutExtend } from '../shortcuts/shortcut-handler.js'
19
19
  import './term-search.styl'
20
20
 
21
- const { prefix } = window
22
- const s = prefix('ssh')
21
+ const e = window.translate
23
22
 
24
23
  class TermSearch extends Component {
25
24
  searchControls = [{
@@ -171,7 +170,7 @@ class TermSearch extends Component {
171
170
  return (
172
171
  <Tooltip
173
172
  key={id}
174
- title={s(id)}
173
+ title={e(id)}
175
174
  >
176
175
  <Icon
177
176
  className={cls}
@@ -9,9 +9,7 @@ import { tabActions } from '../../common/constants'
9
9
  import wait from '../../common/wait'
10
10
  import postMsg from '../../common/post-msg'
11
11
 
12
- const { prefix } = window
13
- const e = prefix('sftp')
14
- const c = prefix('common')
12
+ const e = window.translate
15
13
  const FormItem = Form.Item
16
14
 
17
15
  export default function TermInteractive () {
@@ -153,7 +151,7 @@ export default function TermInteractive () {
153
151
  className='mg1l'
154
152
  onClick={onIgnore}
155
153
  >
156
- {c('ignore')}
154
+ {e('ignore')}
157
155
  </Button>
158
156
  <Button
159
157
  className='mg1l'
@@ -7,8 +7,7 @@ import { isEmpty } from 'lodash-es'
7
7
  import { CloseCircleOutlined, BarsOutlined } from '@ant-design/icons'
8
8
  import colsParser from './data-cols-parser'
9
9
 
10
- const { prefix } = window
11
- const m = prefix('menu')
10
+ const e = window.translate
12
11
 
13
12
  export default function TerminalInfoActivities (props) {
14
13
  const { activities, isRemote, terminalInfos } = props
@@ -19,14 +18,14 @@ export default function TerminalInfoActivities (props) {
19
18
  col.unshift({
20
19
  dataIndex: 'kill',
21
20
  key: 'kill',
22
- title: m('close'),
21
+ title: e('close'),
23
22
  render: (txt, inst) => {
24
23
  return (
25
24
  <Tooltip
26
- title={m('close')}
25
+ title={e('close')}
27
26
  >
28
27
  <Popconfirm
29
- title={m('close') + ' pid:' + inst.pid + ' ?'}
28
+ title={e('close') + ' pid:' + inst.pid + ' ?'}
30
29
  onConfirm={() => props.killProcess(inst.pid)}
31
30
  >
32
31
  <CloseCircleOutlined
@@ -17,8 +17,7 @@ import postMsg from '../../common/post-msg'
17
17
  import { toggleTerminalLog, toggleTerminalLogTimestamp } from '../terminal/terminal-apis'
18
18
  import { ClockCircleOutlined, BorderlessTableOutlined, DatabaseOutlined, BarsOutlined, ApiOutlined, PartitionOutlined } from '@ant-design/icons'
19
19
 
20
- const { prefix } = window
21
- const st = prefix('setting')
20
+ const e = window.translate
22
21
 
23
22
  const mapper = {
24
23
  uptime: <ClockCircleOutlined />,
@@ -136,7 +135,7 @@ export default class TerminalInfoBase extends Component {
136
135
  if (!saveTerminalLogToFile) {
137
136
  return null
138
137
  }
139
- const name = st('addTimeStampToTermLog')
138
+ const name = e('addTimeStampToTermLog')
140
139
  return (
141
140
  <Switch
142
141
  checkedChildren={name}
@@ -186,7 +185,7 @@ export default class TerminalInfoBase extends Component {
186
185
  ? osResolve(appPath, 'electerm', 'session_logs')
187
186
  : window.et.sessionLogPath
188
187
  const path = osResolve(base, logName + '.log')
189
- const name = st('saveTerminalLogToFile')
188
+ const name = e('saveTerminalLogToFile')
190
189
  const to = saveTerminalLogToFile
191
190
  ? <ShowItem disabled={!saveTerminalLogToFile} to={path}>{path}</ShowItem>
192
191
  : path
@@ -31,6 +31,7 @@
31
31
  .activity-item
32
32
  max-height 1.6em
33
33
  line-height 1.6
34
+ overflow hidden
34
35
  &:hover
35
36
  max-height none
36
37
  .info-panel-wrap-pin
@@ -8,10 +8,7 @@ import InputAutoFocus from '../common/input-auto-focus'
8
8
 
9
9
  const { TextArea } = Input
10
10
  const FormItem = Form.Item
11
- const { prefix } = window
12
- const e = prefix('form')
13
- const s = prefix('setting')
14
- const t = prefix('terminalThemes')
11
+ const e = window.translate
15
12
 
16
13
  export default function ThemeForm (props) {
17
14
  const [form] = Form.useForm()
@@ -115,7 +112,7 @@ export default function ThemeForm (props) {
115
112
  formData.id || update1.id
116
113
  )
117
114
  }
118
- message.success(s('saved'))
115
+ message.success(e('saved'))
119
116
  action.current = 'submit'
120
117
  }
121
118
 
@@ -157,7 +154,7 @@ export default function ThemeForm (props) {
157
154
  type='dashed'
158
155
  onClick={exporter}
159
156
  >
160
- {t('export')}
157
+ {e('export')}
161
158
  </Button>
162
159
  </FormItem>
163
160
  )
@@ -187,7 +184,7 @@ export default function ThemeForm (props) {
187
184
  >
188
185
  {renderFuncs(id)}
189
186
  <FormItem
190
- label={t('themeName')}
187
+ label={e('themeName')}
191
188
  hasFeedback
192
189
  name='themeName'
193
190
  rules={[{
@@ -203,7 +200,7 @@ export default function ThemeForm (props) {
203
200
  />
204
201
  </FormItem>
205
202
  <FormItem
206
- label={t('themeConfig')}
203
+ label={e('themeConfig')}
207
204
  >
208
205
  <div className='pd1b'>
209
206
  <Upload
@@ -245,7 +242,7 @@ export default function ThemeForm (props) {
245
242
  type='primary'
246
243
  htmlType='submit'
247
244
  className='mg1r mg1b'
248
- >{t('saveAndApply')}
245
+ >{e('saveAndApply')}
249
246
  </Button>
250
247
  <Button
251
248
  type='dashed'
@@ -10,8 +10,7 @@ import { defaultTheme } from '../../common/constants'
10
10
  import highlight from '../common/highlight'
11
11
  import './terminal-theme-list.styl'
12
12
 
13
- const { prefix } = window
14
- const e = prefix('terminalThemes')
13
+ const e = window.translate
15
14
 
16
15
  export default class ThemeList extends List {
17
16
  del = (item, e) => {
@@ -6,11 +6,7 @@ import { useEffect } from 'react'
6
6
  import { Input, Form, Button } from 'antd'
7
7
 
8
8
  const FormItem = Form.Item
9
-
10
- const { prefix } = window
11
- const e = prefix('form')
12
- const c = prefix('common')
13
- const s = prefix('sftp')
9
+ const e = window.translate
14
10
 
15
11
  export default function TextEditorForm (props) {
16
12
  const [form] = Form.useForm()
@@ -71,7 +67,7 @@ export default function TextEditorForm (props) {
71
67
  <div className='pd1t pd2b'>
72
68
  <Button
73
69
  {...popsEdit}
74
- >{s('editWithSystemEditor')}
70
+ >{e('editWithSystemEditor')}
75
71
  </Button>
76
72
  <Button
77
73
  type='primary'
@@ -85,11 +81,11 @@ export default function TextEditorForm (props) {
85
81
  className='mg1r mg1b'
86
82
  disabled={loading}
87
83
  onClick={reset}
88
- >{s('reset')}
84
+ >{e('reset')}
89
85
  </Button>
90
86
  <Button
91
87
  {...popsCancel}
92
- >{c('cancel')}
88
+ >{e('cancel')}
93
89
  </Button>
94
90
  </div>
95
91
  </Form>
@@ -9,8 +9,7 @@ import resolve from '../../common/resolve'
9
9
  import { commonActions } from '../../common/constants'
10
10
  import postMsg from '../../common/post-msg'
11
11
 
12
- const { prefix } = window
13
- const s = prefix('sftp')
12
+ const e = window.translate
14
13
 
15
14
  export default class TextEditor extends PureComponent {
16
15
  state = {
@@ -152,7 +151,7 @@ export default class TextEditor extends PureComponent {
152
151
  if (!file) {
153
152
  return null
154
153
  }
155
- const title = `${s('edit')} ${s('remote')} ${s('file')}: ${path}`
154
+ const title = `${e('edit')} ${e('remote')} ${e('file')}: ${path}`
156
155
  const propsAll = {
157
156
  footer: null,
158
157
  title,
@@ -15,10 +15,7 @@ import copy from 'json-deep-copy'
15
15
  import { find, uniq, isEqual } from 'lodash-es'
16
16
  import { fixBookmarks } from '../../common/db-fix'
17
17
 
18
- const { prefix } = window
19
- const f = prefix('form')
20
- const t = prefix('terminalThemes')
21
- const m = prefix('menu')
18
+ const e = window.translate
22
19
 
23
20
  export default class BookmarkTransport extends Component {
24
21
  beforeUpload = async (file) => {
@@ -118,7 +115,7 @@ export default class BookmarkTransport extends Component {
118
115
  <Button
119
116
  icon={<EditOutlined />}
120
117
  onClick={this.handleToggleEdit}
121
- title={m('edit')}
118
+ title={e('edit')}
122
119
  key='edit-and-del'
123
120
  />
124
121
  )
@@ -130,7 +127,7 @@ export default class BookmarkTransport extends Component {
130
127
  <Button
131
128
  icon={<DownloadOutlined />}
132
129
  onClick={this.handleDownload}
133
- title={t('export')}
130
+ title={e('export')}
134
131
  key='export'
135
132
  />,
136
133
  <Upload
@@ -140,7 +137,7 @@ export default class BookmarkTransport extends Component {
140
137
  >
141
138
  <Button
142
139
  icon={<UploadOutlined />}
143
- title={f('importFromFile')}
140
+ title={e('importFromFile')}
144
141
  />
145
142
  </Upload>
146
143
  ]
@@ -24,10 +24,7 @@ import uid from '../../common/uid'
24
24
  import { memo } from 'react'
25
25
  import './tree-list.styl'
26
26
 
27
- const { prefix } = window
28
- const e = prefix('menu')
29
- const c = prefix('common')
30
- const s = prefix('setting')
27
+ const e = window.translate
31
28
 
32
29
  export default memo(function TreeListItem (props) {
33
30
  const handleDel = (e) => {
@@ -43,7 +40,7 @@ export default memo(function TreeListItem (props) {
43
40
  title={e('del') + '?'}
44
41
  onConfirm={handleDel}
45
42
  okText={e('del')}
46
- cancelText={c('cancel')}
43
+ cancelText={e('cancel')}
47
44
  placement='top'
48
45
  >
49
46
  <CloseOutlined title={e('del')} className='pointer tree-control-btn' />
@@ -86,7 +83,7 @@ export default memo(function TreeListItem (props) {
86
83
  return (
87
84
  <FolderAddOutlined
88
85
  key='new-tree'
89
- title={`${s('new')} ${c('bookmarkCategory')}`}
86
+ title={`${e('new')} ${e('bookmarkCategory')}`}
90
87
  onClick={handleAddSubCat}
91
88
  className='pointer tree-control-btn'
92
89
  />
@@ -129,7 +126,7 @@ export default memo(function TreeListItem (props) {
129
126
  return null
130
127
  }
131
128
  return (
132
- <Tooltip title={s('openAll')}>
129
+ <Tooltip title={e('openAll')}>
133
130
  <FolderOpenOutlined
134
131
  key='open-all-tree'
135
132
  onClick={handleOpenAll}
@@ -42,10 +42,7 @@ import './tree-list.styl'
42
42
  import TreeExpander from './tree-expander'
43
43
  import TreeListItem from './tree-list-item'
44
44
 
45
- const { prefix } = window
46
- const e = prefix('menu')
47
- const c = prefix('common')
48
- const s = prefix('setting')
45
+ const e = window.translate
49
46
 
50
47
  export default class ItemListTree extends Component {
51
48
  constructor (props) {
@@ -902,13 +899,13 @@ export default class ItemListTree extends Component {
902
899
  <Space.Compact>
903
900
  <Button
904
901
  onClick={this.handleNewBookmark}
905
- title={`${s('new')} ${c('bookmarks')}`}
902
+ title={`${e('new')} ${e('bookmarks')}`}
906
903
  >
907
904
  <BookOutlined className='with-plus' />
908
905
  </Button>
909
906
  <Button
910
907
  onClick={this.handleNewBookmarkGroup}
911
- title={`${s('new')} ${c('bookmarkCategory')}`}
908
+ title={`${e('new')} ${e('bookmarkCategory')}`}
912
909
  >
913
910
  <FolderOutlined className='with-plus' />
914
911
  </Button>
@@ -10,9 +10,7 @@ import {
10
10
  import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
11
11
 
12
12
  const FormItem = Form.Item
13
- const { prefix } = window
14
- const e = prefix('form')
15
- const s = prefix('sftp')
13
+ const e = window.translate
16
14
 
17
15
  export default function VncForm (props) {
18
16
  const [form] = Form.useForm()
@@ -57,7 +55,7 @@ export default function VncForm (props) {
57
55
  type='primary'
58
56
  htmlType='submit'
59
57
  >
60
- {s('submit')}
58
+ {e('submit')}
61
59
  </Button>
62
60
  </FormItem>
63
61
  </div>
@@ -18,8 +18,7 @@ import resolutions from '../rdp/resolutions'
18
18
  import RFB from '@novnc/novnc/core/rfb'
19
19
  import VncForm from './vnc-form'
20
20
 
21
- const { prefix } = window
22
- const e = prefix('form')
21
+ const e = window.translate
23
22
 
24
23
  export default class VncSession extends RdpSession {
25
24
  constructor (props) {
@@ -43,12 +43,10 @@ async function load () {
43
43
  window.getLang = (lang = window.store?.config.language || 'en_us') => {
44
44
  return _get(window.langMap, `[${lang}].lang`)
45
45
  }
46
- window.prefix = prefix => {
47
- return (id) => {
48
- const lang = window.getLang()
49
- const str = _get(lang, `[${prefix}][${id}]`) || id
50
- return window.capitalizeFirstLetter(str)
51
- }
46
+ window.translate = txt => {
47
+ const lang = window.getLang()
48
+ const str = _get(lang, `[${txt}]`) || txt
49
+ return window.capitalizeFirstLetter(str)
52
50
  }
53
51
  await loadWorker()
54
52
  loadScript()
@@ -16,9 +16,7 @@ import {
16
16
  } from '../common/constants'
17
17
  import * as ls from '../common/safe-local-storage'
18
18
 
19
- const { prefix } = window
20
- const m = prefix('menu')
21
- const c = prefix('common')
19
+ const e = window.translate
22
20
 
23
21
  export default Store => {
24
22
  Store.prototype.storeAssign = function (updates) {
@@ -160,14 +158,14 @@ export default Store => {
160
158
  ls.setItem(dismissDelKeyTipLsKey, 'y')
161
159
  window.store.hideDelKeyTip = true
162
160
  }
163
- Store.prototype.beforeExit = function (e) {
161
+ Store.prototype.beforeExit = function (evt) {
164
162
  const { confirmBeforeExit } = window.store.config
165
163
  if (
166
164
  (confirmBeforeExit &&
167
165
  !window.confirmExit) ||
168
166
  window.store.isTransporting
169
167
  ) {
170
- e.returnValue = false
168
+ evt.returnValue = false
171
169
  let mod = null
172
170
  mod = Modal.confirm({
173
171
  onCancel: () => {
@@ -178,14 +176,14 @@ export default Store => {
178
176
  window.confirmExit = true
179
177
  window.store[window.exitFunction]()
180
178
  },
181
- title: m('quit'),
182
- okText: c('ok'),
183
- cancelText: c('cancel'),
179
+ title: e('quit'),
180
+ okText: e('ok'),
181
+ cancelText: e('cancel'),
184
182
  content: ''
185
183
  })
186
184
  }
187
185
  }
188
- Store.prototype.beforeExitApp = function (e, name) {
186
+ Store.prototype.beforeExitApp = function (evt, name) {
189
187
  let mod = null
190
188
  mod = Modal.confirm({
191
189
  onCancel: () => {
@@ -195,9 +193,9 @@ export default Store => {
195
193
  onOk: () => {
196
194
  window.pre.runGlobalAsync(name)
197
195
  },
198
- title: m('quit'),
199
- okText: c('ok'),
200
- cancelText: c('cancel'),
196
+ title: e('quit'),
197
+ okText: e('ok'),
198
+ cancelText: e('cancel'),
201
199
  content: ''
202
200
  })
203
201
  }
@@ -41,10 +41,7 @@ import {
41
41
  theme
42
42
  } from 'antd'
43
43
 
44
- const { prefix } = window
45
- const ss = prefix('settingSync')
46
- const s = prefix('setting')
47
- const sss = prefix('ssh')
44
+ const e = window.translate
48
45
 
49
46
  function getReverseColor (hex) {
50
47
  // Check if the input is a valid hex color code
@@ -201,15 +198,15 @@ class Store {
201
198
  return [
202
199
  {
203
200
  id: settingTerminalId,
204
- title: sss('terminal')
201
+ title: e('terminal')
205
202
  },
206
203
  {
207
204
  id: settingShortcutsId,
208
- title: s('settingShortcuts')
205
+ title: e('settingShortcuts')
209
206
  },
210
207
  {
211
208
  id: settingSyncId,
212
- title: ss('settingSync')
209
+ title: e('settingSync')
213
210
  }
214
211
  ]
215
212
  }
@@ -25,13 +25,12 @@ import { buildDefaultThemes } from '../common/terminal-theme'
25
25
  import * as ls from '../common/safe-local-storage'
26
26
  import initSettingItem from '../common/init-setting-item'
27
27
 
28
- const { prefix } = window
29
- const t = prefix('terminalThemes')
28
+ const e = window.translate
30
29
 
31
30
  function getDefaultBookmarkGroups (bookmarks) {
32
31
  return [
33
32
  JSON.stringify({
34
- title: t(defaultBookmarkGroupId),
33
+ title: e(defaultBookmarkGroupId),
35
34
  id: defaultBookmarkGroupId,
36
35
  bookmarkIds: bookmarks.map(d => d.id)
37
36
  })
@@ -11,6 +11,7 @@ import defaultSettings from '../common/default-setting'
11
11
  import encodes from '../components/bookmark-form/encodes'
12
12
  import runIdle from '../common/run-idle'
13
13
  import { initWsCommon } from '../common/fetch-from-server'
14
+ import safeParse from '../common/parse-json-safe'
14
15
 
15
16
  function getHost (argv, opts) {
16
17
  const arr = argv
@@ -75,6 +76,15 @@ export async function addTabFromCommandLine (store, opts) {
75
76
  if (options.port && parseInt10(options.port)) {
76
77
  update.port = parseInt10(options.port)
77
78
  }
79
+ if (options.opts) {
80
+ const opts = safeParse(options.opts)
81
+ if (opts !== options.opts) {
82
+ Object.assign(update, opts)
83
+ }
84
+ }
85
+ if (options.type) {
86
+ update.type = options.type
87
+ }
78
88
  Object.assign(conf, update)
79
89
  if (options.privateKeyPath) {
80
90
  conf.privateKey = await fs.readFile(options.privateKeyPath)
@@ -18,8 +18,7 @@ import { buildNewTheme } from '../common/terminal-theme'
18
18
  import getInitItem from '../common/init-setting-item'
19
19
  import newTerm from '../common/new-terminal'
20
20
 
21
- const { prefix } = window
22
- const m = prefix('menu')
21
+ const e = window.translate
23
22
 
24
23
  export default Store => {
25
24
  Store.prototype.setConfig = function (conf) {
@@ -161,7 +160,7 @@ export default Store => {
161
160
  const { store } = window
162
161
  if (store.isSencondInstance) {
163
162
  return message.warning(
164
- m('sencondInstanceTip')
163
+ e('sencondInstanceTip')
165
164
  )
166
165
  }
167
166
  store.showModal = modals.setting
@@ -11,9 +11,7 @@ import {
11
11
  minZoom
12
12
  } from '../common/constants'
13
13
 
14
- const { prefix } = window
15
- const m = prefix('menu')
16
- const c = prefix('common')
14
+ const e = window.translate
17
15
 
18
16
  export default Store => {
19
17
  Store.prototype.zoom = function (level = 1, plus = false, zoomOnly) {
@@ -83,9 +81,9 @@ export default Store => {
83
81
  mod = Modal.confirm({
84
82
  onCancel: () => mod.destroy(),
85
83
  onOk: store.doExit,
86
- title: m('quit'),
87
- okText: c('ok'),
88
- cancelText: c('cancel'),
84
+ title: e('quit'),
85
+ okText: e('ok'),
86
+ cancelText: e('cancel'),
89
87
  content: ''
90
88
  })
91
89
  }
@@ -12,9 +12,7 @@ import {
12
12
  import copy from 'json-deep-copy'
13
13
  import { convertTheme } from '../common/terminal-theme'
14
14
 
15
- const { terminalThemes } = settingMap
16
- const { prefix } = window
17
- const t = prefix(terminalThemes)
15
+ const e = window.translate
18
16
 
19
17
  export default Store => {
20
18
  Store.prototype.getTerminalThemes = function () {
@@ -105,7 +103,7 @@ export default Store => {
105
103
  }
106
104
  )
107
105
  message.info(
108
- `${t('default')} ${t('themeConfig')} ${t('updated')}`
106
+ `${e('default')} ${e('themeConfig')} ${e('updated')}`
109
107
  )
110
108
  }
111
109
  const hasLightTheme = find(store.getTerminalThemes(), d => d.id === defaultThemeLight.id)