@electerm/electerm-react 2.11.6 → 2.12.0

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.
@@ -32,6 +32,7 @@ export default {
32
32
  enableSixel: true,
33
33
  terminalType: 'xterm-256color',
34
34
  keepaliveCountMax: 10,
35
+ keyword2FA: 'verification code,otp,one-time,two-factor,2fa,totp,authenticator,duo,yubikey,security code,mfa,passcode',
35
36
  saveTerminalLogToFile: false,
36
37
  checkUpdateOnStart: true,
37
38
  cursorBlink: false,
@@ -30,7 +30,7 @@ export async function handleErr (res) {
30
30
  }
31
31
  console.debug(text, 'fetch err info')
32
32
  notification.error({
33
- message: 'http request error',
33
+ message: 'error',
34
34
  description: (
35
35
  <div className='common-err'>
36
36
  {text}
@@ -118,7 +118,11 @@ export default class CssOverwrite extends Component {
118
118
  const selector = `#container .sessions .session-${tab.id} .xterm-screen::before`
119
119
  const styles = []
120
120
  if (st === 'index') {
121
- styles.push(`content: '${tab.tabCount}'`)
121
+ styles.push(
122
+ `content: '${tab.tabCount}'`,
123
+ 'background-image: none',
124
+ 'opacity: 0.1'
125
+ )
122
126
  } else if (st === 'text') {
123
127
  const text = bg.terminalBackgroundText || this.props.terminalBackgroundText || ''
124
128
  const size = bg.terminalBackgroundTextSize || this.props.terminalBackgroundTextSize || 48
@@ -25,7 +25,6 @@ import { fixBookmarkData } from './fix-bookmark-default.js'
25
25
  import generate from '../../common/id-with-stamp'
26
26
  import AiHistory, { addHistoryItem } from '../ai/ai-history.jsx'
27
27
  import { getItem, setItem } from '../../common/safe-local-storage'
28
- import newTerminal from '../../common/new-terminal'
29
28
 
30
29
  const STORAGE_KEY_DESC = 'ai_bookmark_description'
31
30
  const STORAGE_KEY_HISTORY = 'ai_bookmark_history'
@@ -110,12 +109,12 @@ export default function AIBookmarkForm (props) {
110
109
  }
111
110
 
112
111
  function getGeneratedData () {
113
- if (!editorText) return message.warning(e('noData') || 'No data')
112
+ if (!editorText) return []
114
113
  let parsed = null
115
114
  try {
116
115
  parsed = fixBookmarkData(JSON.parse(editorText))
117
116
  } catch (err) {
118
- return message.error(e('invalidJson') || 'Invalid JSON')
117
+ return []
119
118
  }
120
119
  if (!parsed) return []
121
120
  return Array.isArray(parsed) ? parsed : [parsed]
@@ -182,7 +181,6 @@ export default function AIBookmarkForm (props) {
182
181
 
183
182
  const tabOptions = {
184
183
  ...bm,
185
- ...newTerminal(),
186
184
  from: 'quickConnect'
187
185
  }
188
186
 
@@ -48,7 +48,7 @@ export default auto(function Index (props) {
48
48
  ipcOnEvent('open-about', store.openAbout)
49
49
  ipcOnEvent('new-ssh', store.onNewSsh)
50
50
  ipcOnEvent('add-tab-from-command-line', store.addTabFromCommandLine)
51
- ipcOnEvent('open-tab', store.addTab)
51
+ ipcOnEvent('open-tab', (e, parsed) => store.addTab(parsed))
52
52
  ipcOnEvent('openSettings', store.openSetting)
53
53
  ipcOnEvent('selectall', store.selectall)
54
54
  ipcOnEvent('focused', store.focus)
@@ -65,7 +65,7 @@ export default function DeepLinkControl () {
65
65
  }
66
66
 
67
67
  const renderTooltipContent = () => {
68
- const protocols = ['ssh', 'telnet', 'rdp', 'vnc', 'serial', 'spice', 'electerm']
68
+ const protocols = ['ssh', 'telnet', 'rdp', 'vnc', 'serial', 'spice', 'electerm', 'ftp']
69
69
  const tip = `Register electerm to handle protocol URLs (${protocols.join('://, ')})`
70
70
 
71
71
  return (
@@ -584,6 +584,10 @@ export default class SettingCommon extends Component {
584
584
  {
585
585
  this.renderTextExec('execLinux')
586
586
  }
587
+ <div className='pd1b'>{e('keyword2FA')}</div>
588
+ {
589
+ this.renderText('keyword2FA')
590
+ }
587
591
  {
588
592
  [
589
593
  'autoRefreshWhenSwitchToSftp',
@@ -302,7 +302,7 @@ export default class Sftp extends Component {
302
302
  }, () => this[`${type}List`]())
303
303
  }
304
304
 
305
- updateCwd = (cwd) => {
305
+ updateCwd = (cwd = this.props.cwd) => {
306
306
  if (!this.state.inited) {
307
307
  return
308
308
  }
@@ -219,6 +219,27 @@ class ShortcutControl extends React.PureComponent {
219
219
  }
220
220
  }, 1000)
221
221
 
222
+ clickSftpIcon = () => {
223
+ const icon = document.querySelector('.session-current .sftp-follow-ssh-icon')
224
+ if (!icon) return
225
+ icon.click()
226
+ }
227
+
228
+ syncSftpPathShortcut = throttle((e) => {
229
+ e.stopPropagation()
230
+ const { activeTabId } = window.store
231
+ if (!activeTabId) return
232
+ // Get the SFTP component which can sync the path
233
+ const sftp = refs.get('sftp-' + activeTabId)
234
+ if (!sftp) return
235
+ this.clickSftpIcon()
236
+ // Wait for the path to be synced
237
+ setTimeout(() => {
238
+ this.clickSftpIcon()
239
+ sftp.updateCwd()
240
+ }, 100)
241
+ }, 1000)
242
+
222
243
  render () {
223
244
  return null
224
245
  }
@@ -115,6 +115,11 @@ export default () => {
115
115
  name: 'terminal_zoomoutTerminal',
116
116
  shortcut: 'ctrl+▼',
117
117
  shortcutMac: 'meta+▼'
118
+ },
119
+ {
120
+ name: 'terminal_syncSftpPath',
121
+ shortcut: 'alt+shift+f11',
122
+ shortcutMac: 'alt+shift+f11'
118
123
  }
119
124
  ]
120
125
  }
@@ -3,7 +3,6 @@ import { Button, Space } from 'antd'
3
3
  import { ArrowRightOutlined, ThunderboltOutlined } from '@ant-design/icons'
4
4
  import message from '../common/message'
5
5
  import InputAutoFocus from '../common/input-auto-focus'
6
- import newTerminal from '../../common/new-terminal'
7
6
  import HelpIcon from '../common/help-icon'
8
7
 
9
8
  const e = window.translate
@@ -17,7 +16,6 @@ function connectWithOptions (opts, batch) {
17
16
  const { store } = window
18
17
  const tabOptions = {
19
18
  ...opts,
20
- ...newTerminal(),
21
19
  from: 'quickConnect',
22
20
  batch
23
21
  }
@@ -61,7 +59,6 @@ export default function QuickConnect ({ batch, inputOnly }) {
61
59
  }
62
60
 
63
61
  const opts = window.store.parseQuickConnect(inputValue)
64
- console.log('quick connect opts', opts)
65
62
  if (!opts) {
66
63
  return message.error('Format error, please check the input', 10)
67
64
  }
@@ -1097,6 +1097,7 @@ class Term extends Component {
1097
1097
  'execWindowsArgs',
1098
1098
  'execMacArgs',
1099
1099
  'execLinuxArgs',
1100
+ 'keyword2FA',
1100
1101
  'debug'
1101
1102
  ]),
1102
1103
  keepaliveInterval: tab.keepaliveInterval || config.keepaliveInterval,
@@ -220,7 +220,7 @@ export default (Store) => {
220
220
  Store.prototype.checkPendingDeepLink = async function () {
221
221
  const pending = await window.pre.runGlobalAsync('getPendingDeepLink')
222
222
  if (pending) {
223
- addTabFromCommandLine(window.store, pending)
223
+ window.store.addTab(pending)
224
224
  }
225
225
  }
226
226
  Store.prototype.parseQuickConnect = function (url) {
@@ -341,6 +341,15 @@ export default Store => {
341
341
  const { tabs } = store
342
342
  newTab.tabCount = store.nextTabCount()
343
343
  newTab.batch = batch ?? newTab.batch ?? window.openTabBatch ?? window.store.currentLayoutBatch
344
+ if (!newTab.id) {
345
+ newTab.id = generate()
346
+ }
347
+ if (!newTab.status) {
348
+ newTab.status = statusMap.processing
349
+ }
350
+ if (!newTab.pane) {
351
+ newTab.pane = paneMap.terminal
352
+ }
344
353
  if (typeof index === 'number' && index >= 0 && index <= tabs.length) {
345
354
  tabs.splice(index, 0, newTab)
346
355
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "2.11.6",
3
+ "version": "2.12.0",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",