@electerm/electerm-react 2.3.198 → 2.4.18

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 (72) hide show
  1. package/client/common/clipboard.js +1 -1
  2. package/client/common/constants.js +2 -2
  3. package/client/common/download.jsx +3 -2
  4. package/client/common/error-handler.jsx +5 -9
  5. package/client/common/fetch-from-server.js +1 -1
  6. package/client/common/fetch.jsx +5 -5
  7. package/client/common/icon-helpers.jsx +16 -0
  8. package/client/common/parse-json-safe.js +1 -1
  9. package/client/common/pre.js +0 -7
  10. package/client/common/sftp.js +1 -1
  11. package/client/common/terminal-theme.js +1 -1
  12. package/client/common/transfer.js +2 -2
  13. package/client/common/upgrade.js +2 -2
  14. package/client/components/ai/ai-chat.jsx +10 -1
  15. package/client/components/auth/login.jsx +1 -1
  16. package/client/components/bg/css-overwrite.jsx +1 -1
  17. package/client/components/bookmark-form/form-renderer.jsx +3 -2
  18. package/client/components/common/input-auto-focus.jsx +1 -1
  19. package/client/components/common/message.jsx +156 -0
  20. package/client/components/common/message.styl +56 -0
  21. package/client/components/common/modal.jsx +176 -0
  22. package/client/components/common/modal.styl +22 -0
  23. package/client/components/common/notification-with-details.jsx +1 -1
  24. package/client/components/common/notification.jsx +118 -0
  25. package/client/components/common/notification.styl +51 -0
  26. package/client/components/main/connection-hopping-warnning.jsx +1 -3
  27. package/client/components/main/error-wrapper.jsx +3 -2
  28. package/client/components/main/main.jsx +4 -11
  29. package/client/components/main/upgrade.jsx +6 -4
  30. package/client/components/profile/profile-form-elem.jsx +1 -1
  31. package/client/components/quick-commands/quick-commands-box.jsx +5 -2
  32. package/client/components/quick-commands/quick-commands-form-elem.jsx +1 -1
  33. package/client/components/rdp/rdp-session.jsx +2 -2
  34. package/client/components/session/session.jsx +4 -9
  35. package/client/components/setting-panel/deep-link-control.jsx +2 -1
  36. package/client/components/setting-panel/keyword-input.jsx +60 -0
  37. package/client/components/setting-panel/keywords-form.jsx +2 -7
  38. package/client/components/setting-panel/setting-common.jsx +1 -1
  39. package/client/components/setting-panel/setting-terminal.jsx +1 -1
  40. package/client/components/setting-panel/tab-settings.jsx +1 -1
  41. package/client/components/setting-sync/setting-sync-form.jsx +53 -3
  42. package/client/components/setting-sync/setting-sync.jsx +2 -1
  43. package/client/components/sftp/owner-list.js +6 -6
  44. package/client/components/sftp/sftp-entry.jsx +6 -4
  45. package/client/components/shortcuts/shortcut-editor.jsx +2 -2
  46. package/client/components/ssh-config/ssh-config-load-notify.jsx +3 -2
  47. package/client/components/tabs/tab.jsx +1 -1
  48. package/client/components/tabs/workspace-save-modal.jsx +2 -1
  49. package/client/components/terminal/attach-addon-custom.js +142 -26
  50. package/client/components/terminal/command-tracker-addon.js +164 -53
  51. package/client/components/terminal/highlight-addon.js +84 -43
  52. package/client/components/terminal/shell.js +164 -0
  53. package/client/components/terminal/terminal-command-dropdown.jsx +3 -0
  54. package/client/components/terminal/terminal.jsx +276 -118
  55. package/client/components/theme/theme-form.jsx +2 -1
  56. package/client/components/tree-list/bookmark-transport.jsx +27 -5
  57. package/client/components/vnc/vnc-session.jsx +1 -1
  58. package/client/components/widgets/widget-notification-with-details.jsx +1 -1
  59. package/client/store/common.js +5 -2
  60. package/client/store/db-upgrade.js +1 -1
  61. package/client/store/init-state.js +2 -1
  62. package/client/store/load-data.js +2 -2
  63. package/client/store/mcp-handler.js +9 -50
  64. package/client/store/setting.js +1 -3
  65. package/client/store/store.js +2 -1
  66. package/client/store/sync.js +14 -8
  67. package/client/store/system-menu.js +2 -1
  68. package/client/store/tab.js +1 -1
  69. package/client/store/widgets.js +1 -3
  70. package/package.json +1 -1
  71. package/client/common/track.js +0 -7
  72. package/client/components/batch-op/batch-op-entry.jsx +0 -13
@@ -35,7 +35,7 @@ function getHost (argv, opts) {
35
35
  }
36
36
 
37
37
  export async function addTabFromCommandLine (store, opts) {
38
- log.debug('command line params', opts)
38
+ console.debug('command line params', opts)
39
39
  if (!opts) {
40
40
  return false
41
41
  }
@@ -94,7 +94,7 @@ export async function addTabFromCommandLine (store, opts) {
94
94
  if (options.privateKeyPath) {
95
95
  conf.privateKey = await fs.readFile(options.privateKeyPath)
96
96
  }
97
- log.debug('command line opts', conf)
97
+ console.debug('command line opts', conf)
98
98
  if (
99
99
  (conf.username && conf.host) ||
100
100
  conf.fromCmdLine
@@ -5,6 +5,8 @@
5
5
 
6
6
  import uid from '../common/uid'
7
7
  import { settingMap } from '../common/constants'
8
+ import { refs } from '../components/common/ref'
9
+ import deepCopy from 'json-deep-copy'
8
10
 
9
11
  export default Store => {
10
12
  // Initialize MCP handler - called when MCP widget is started
@@ -142,27 +144,8 @@ export default Store => {
142
144
 
143
145
  // ==================== Bookmark APIs ====================
144
146
 
145
- Store.prototype.mcpListBookmarks = function (args = {}) {
146
- const { store } = window
147
- let bookmarks = store.bookmarks
148
-
149
- if (args.groupId) {
150
- const group = store.bookmarkGroups.find(g => g.id === args.groupId)
151
- if (group && group.bookmarkIds) {
152
- const idSet = new Set(group.bookmarkIds)
153
- bookmarks = bookmarks.filter(b => idSet.has(b.id))
154
- }
155
- }
156
-
157
- return bookmarks.map(b => ({
158
- id: b.id,
159
- title: b.title,
160
- host: b.host,
161
- port: b.port,
162
- username: b.username,
163
- type: b.type || 'ssh',
164
- color: b.color
165
- }))
147
+ Store.prototype.mcpListBookmarks = function () {
148
+ return deepCopy(window.store.bookmarks)
166
149
  }
167
150
 
168
151
  Store.prototype.mcpGetBookmark = function (args) {
@@ -171,9 +154,7 @@ export default Store => {
171
154
  if (!bookmark) {
172
155
  throw new Error(`Bookmark not found: ${args.id}`)
173
156
  }
174
- // Return bookmark without sensitive data
175
- const { password, passphrase, privateKey, ...safeBookmark } = bookmark
176
- return safeBookmark
157
+ return deepCopy(bookmark)
177
158
  }
178
159
 
179
160
  Store.prototype.mcpAddBookmark = async function (args) {
@@ -218,16 +199,11 @@ export default Store => {
218
199
 
219
200
  Store.prototype.mcpDeleteBookmark = function (args) {
220
201
  const { store } = window
221
- const bookmark = store.bookmarks.find(b => b.id === args.id)
222
- if (!bookmark) {
223
- throw new Error(`Bookmark not found: ${args.id}`)
224
- }
225
-
226
202
  store.delItem({ id: args.id }, settingMap.bookmarks)
227
203
 
228
204
  return {
229
205
  success: true,
230
- message: `Bookmark "${bookmark.title}" deleted`
206
+ message: `Bookmark "${args.id}" deleted`
231
207
  }
232
208
  }
233
209
 
@@ -249,14 +225,7 @@ export default Store => {
249
225
  // ==================== Bookmark Group APIs ====================
250
226
 
251
227
  Store.prototype.mcpListBookmarkGroups = function () {
252
- const { store } = window
253
- return store.bookmarkGroups.map(g => ({
254
- id: g.id,
255
- title: g.title,
256
- level: g.level,
257
- bookmarkCount: (g.bookmarkIds || []).length,
258
- subgroupCount: (g.bookmarkGroupIds || []).length
259
- }))
228
+ return deepCopy(window.store.bookmarkGroups)
260
229
  }
261
230
 
262
231
  Store.prototype.mcpAddBookmarkGroup = async function (args) {
@@ -281,15 +250,7 @@ export default Store => {
281
250
  // ==================== Quick Command APIs ====================
282
251
 
283
252
  Store.prototype.mcpListQuickCommands = function () {
284
- const { store } = window
285
- return store.quickCommands.map(q => ({
286
- id: q.id,
287
- name: q.name,
288
- command: q.command,
289
- commands: q.commands,
290
- inputOnly: q.inputOnly,
291
- labels: q.labels
292
- }))
253
+ return deepCopy(window.store.quickCommands)
293
254
  }
294
255
 
295
256
  Store.prototype.mcpAddQuickCommand = function (args) {
@@ -297,7 +258,7 @@ export default Store => {
297
258
  const qm = {
298
259
  id: uid(),
299
260
  name: args.name,
300
- command: args.command,
261
+ commands: args.commands,
301
262
  inputOnly: args.inputOnly || false,
302
263
  labels: args.labels || []
303
264
  }
@@ -475,7 +436,6 @@ export default Store => {
475
436
 
476
437
  Store.prototype.mcpGetTerminalSelection = function (args) {
477
438
  const { store } = window
478
- const { refs } = require('../components/common/ref')
479
439
  const tabId = args.tabId || store.activeTabId
480
440
 
481
441
  if (!tabId) {
@@ -497,7 +457,6 @@ export default Store => {
497
457
 
498
458
  Store.prototype.mcpGetTerminalOutput = function (args) {
499
459
  const { store } = window
500
- const { refs } = require('../components/common/ref')
501
460
  const tabId = args.tabId || store.activeTabId
502
461
  const lineCount = args.lines || 50
503
462
 
@@ -2,9 +2,7 @@
2
2
  * setting modal
3
3
  */
4
4
 
5
- import {
6
- message
7
- } from 'antd'
5
+ import message from '../components/common/message'
8
6
  import copy from 'json-deep-copy'
9
7
  import {
10
8
  settingMap,
@@ -234,7 +234,8 @@ class Store {
234
234
  colorSuccess: themeConf.success,
235
235
  colorWarning: themeConf.warn,
236
236
  colorTextBase: themeConf.text,
237
- colorLink: themeConf['text-light']
237
+ colorLink: themeConf['text-light'],
238
+ motion: false
238
239
  },
239
240
  algorithm: isColorDark(themeConf.main) ? theme.darkAlgorithm : theme.defaultAlgorithm
240
241
  }
@@ -80,6 +80,10 @@ export default (Store) => {
80
80
  return get(window.store.config, 'syncSetting.' + type + 'GistId')
81
81
  }
82
82
 
83
+ Store.prototype.getSyncProxy = function (type) {
84
+ return get(window.store.config, 'syncSetting.' + type + 'Proxy')
85
+ }
86
+
83
87
  Store.prototype.testSyncToken = async function (type) {
84
88
  const { store } = window
85
89
  store.isSyncingSetting = true
@@ -89,12 +93,14 @@ export default (Store) => {
89
93
  'test',
90
94
  [],
91
95
  token,
92
- store.getProxySetting()
93
- ).catch(
94
- log.error
96
+ store.getSyncProxy(type)
95
97
  )
98
+ .catch(err => {
99
+ console.error(err)
100
+ return err
101
+ })
96
102
  store.isSyncingSetting = false
97
- return !!gist
103
+ return gist
98
104
  }
99
105
 
100
106
  Store.prototype.createGist = async function (type) {
@@ -111,7 +117,7 @@ export default (Store) => {
111
117
  public: false
112
118
  }
113
119
  const res = await fetchData(
114
- type, 'create', [data], token, store.getProxySetting()
120
+ type, 'create', [data], token, store.getSyncProxy(type)
115
121
  ).catch(
116
122
  store.onError
117
123
  )
@@ -184,7 +190,7 @@ export default (Store) => {
184
190
  'getOne',
185
191
  [gistId],
186
192
  token,
187
- store.getProxySetting()
193
+ store.getSyncProxy(type)
188
194
  )
189
195
  updateSyncServerStatusFromGist(store, gist, type)
190
196
  }
@@ -254,7 +260,7 @@ export default (Store) => {
254
260
  'update',
255
261
  [gistId, gistData],
256
262
  token,
257
- store.getProxySetting()
263
+ store.getSyncProxy(type)
258
264
  )
259
265
  if (res) {
260
266
  store.updateSyncSetting({
@@ -290,7 +296,7 @@ export default (Store) => {
290
296
  'getOne',
291
297
  [gistId],
292
298
  token,
293
- store.getProxySetting()
299
+ store.getSyncProxy(type)
294
300
  )
295
301
  if (gist) {
296
302
  updateSyncServerStatusFromGist(store, gist, type)
@@ -2,7 +2,7 @@
2
2
  * system menu functions
3
3
  */
4
4
 
5
- import { Modal } from 'antd'
5
+ import Modal from '../components/common/modal'
6
6
  import { isString } from 'lodash-es'
7
7
  import getInitItem from '../common/init-setting-item'
8
8
  import {
@@ -64,6 +64,7 @@ export default Store => {
64
64
  Store.prototype.confirmExit = function (type) {
65
65
  const { store } = window
66
66
  let mod = null
67
+ console.log('confirmExit called')
67
68
  mod = Modal.confirm({
68
69
  onCancel: () => mod.destroy(),
69
70
  onOk: store.doExit,
@@ -10,7 +10,7 @@ import {
10
10
  maxHistory
11
11
  } from '../common/constants'
12
12
  import { refs, refsTabs } from '../components/common/ref'
13
- import { message } from 'antd'
13
+ import message from '../components/common/message'
14
14
  import * as ls from '../common/safe-local-storage'
15
15
  import deepCopy from 'json-deep-copy'
16
16
  import generate from '../common/id-with-stamp'
@@ -2,9 +2,7 @@
2
2
  * widgets related functions
3
3
  */
4
4
 
5
- import {
6
- message
7
- } from 'antd'
5
+ import message from '../components/common/message'
8
6
  import {
9
7
  settingMap
10
8
  } from '../common/constants'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "2.3.198",
3
+ "version": "2.4.18",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",
@@ -1,7 +0,0 @@
1
- export default (eventName, value) => {
2
- if (!window.gtag) {
3
- return
4
- }
5
- log.debug('track data', eventName, value)
6
- window.gtag('event', eventName, value)
7
- }
@@ -1,13 +0,0 @@
1
- import { lazy, Suspense } from 'react'
2
-
3
- // Lazy load BatchOp
4
- export const BatchOp = lazy(() => import('./batch-op'))
5
-
6
- // Wrap BatchOp with Suspense
7
- export default function BatchOpEntry (props) {
8
- return (
9
- <Suspense fallback={<>Loading...</>}>
10
- <BatchOp {...props} />
11
- </Suspense>
12
- )
13
- }