@electerm/electerm-react 1.34.30 → 1.34.36
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.
- package/client/common/build-proxy.js +18 -0
- package/client/common/build-run-scripts.js +6 -0
- package/client/common/build-ssh-tunnel.js +7 -0
- package/client/common/constants.js +22 -1
- package/client/common/db-defaults.js +123 -0
- package/client/common/db-fix.js +3 -3
- package/client/common/default-setting.js +41 -0
- package/client/common/pass-enc.js +17 -1
- package/client/common/sftp.js +1 -2
- package/client/common/version-compare.js +25 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +1 -1
- package/client/components/bookmark-form/telnet-form-ui.jsx +1 -1
- package/client/components/bookmark-form/use-ui.jsx +1 -1
- package/client/components/main/upgrade.jsx +1 -1
- package/client/components/quick-commands/quick-command-transport-mod.jsx +1 -1
- package/client/components/setting-panel/bookmark-transport.jsx +1 -1
- package/client/components/setting-panel/setting.jsx +1 -1
- package/client/components/sftp/confirm-modal.jsx +1 -1
- package/client/components/sftp/file-item.jsx +1 -1
- package/client/components/sftp/file-mode-modal.jsx +1 -1
- package/client/components/sftp/file-props-modal.jsx +1 -1
- package/client/components/sidebar/transfer-history-modal.jsx +1 -1
- package/client/components/terminal-info/base.jsx +0 -1
- package/client/entry/index.jsx +2 -2
- package/client/store/load-data.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const buildProxyString = function (obj) {
|
|
2
|
+
if (!obj.proxyIp) {
|
|
3
|
+
return ''
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const proxyTypeMapping = {
|
|
7
|
+
5: 'socks5',
|
|
8
|
+
4: 'socks4',
|
|
9
|
+
0: 'http',
|
|
10
|
+
1: 'https'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const proxyType = proxyTypeMapping[obj.proxyType] || ''
|
|
14
|
+
const hasCredentials = obj.proxyUsername && obj.proxyPassword
|
|
15
|
+
const credentials = hasCredentials ? `${obj.proxyUsername}:${obj.proxyPassword}@` : ''
|
|
16
|
+
|
|
17
|
+
return `${proxyType}://${credentials}${obj.proxyIp}${obj.proxyPort ? `:${obj.proxyPort}` : ''}`
|
|
18
|
+
}
|
|
@@ -5,7 +5,7 @@ import { getUiThemeConfig } from './ui-theme'
|
|
|
5
5
|
import logoPath1Ref from '@electerm/electerm-resource/res/imgs/electerm-round-128x128.png'
|
|
6
6
|
import logoPath2Ref from '@electerm/electerm-resource/res/imgs/electerm.png'
|
|
7
7
|
import logoPath3Ref from '@electerm/electerm-resource/res/imgs/electerm-watermark.png'
|
|
8
|
-
import dbDefaults from '
|
|
8
|
+
import dbDefaults from './db-defaults'
|
|
9
9
|
import { get as _get } from 'lodash-es'
|
|
10
10
|
export const packInfo = typeof window.et.packInfo === 'undefined' ? window.pre.packInfo : window.et.packInfo
|
|
11
11
|
const buildConst = (props) => {
|
|
@@ -306,3 +306,24 @@ export const modals = {
|
|
|
306
306
|
setting: 1,
|
|
307
307
|
batchOps: 2
|
|
308
308
|
}
|
|
309
|
+
export const instSftpKeys = [
|
|
310
|
+
'connect',
|
|
311
|
+
'list',
|
|
312
|
+
'download',
|
|
313
|
+
'upload',
|
|
314
|
+
'mkdir',
|
|
315
|
+
'getHomeDir',
|
|
316
|
+
'rmdir',
|
|
317
|
+
'stat',
|
|
318
|
+
'lstat',
|
|
319
|
+
'chmod',
|
|
320
|
+
'rename',
|
|
321
|
+
'rm',
|
|
322
|
+
'touch',
|
|
323
|
+
'readlink',
|
|
324
|
+
'realpath',
|
|
325
|
+
'mv',
|
|
326
|
+
'cp',
|
|
327
|
+
'readFile',
|
|
328
|
+
'writeFile'
|
|
329
|
+
]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* database default should init
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function parsor (themeTxt) {
|
|
6
|
+
return themeTxt.split('\n').reduce((prev, line) => {
|
|
7
|
+
let [key = '', value = ''] = line.split('=')
|
|
8
|
+
key = key.trim()
|
|
9
|
+
value = value.trim()
|
|
10
|
+
if (!key || !value) {
|
|
11
|
+
return prev
|
|
12
|
+
}
|
|
13
|
+
prev[key] = value
|
|
14
|
+
return prev
|
|
15
|
+
}, {})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const defaultTheme = parsor(`
|
|
19
|
+
main = #141314
|
|
20
|
+
main-dark = #000
|
|
21
|
+
main-light = #2E3338
|
|
22
|
+
text = #ddd
|
|
23
|
+
text-light = #fff
|
|
24
|
+
text-dark = #888
|
|
25
|
+
text-disabled = #777
|
|
26
|
+
primary = #08c
|
|
27
|
+
info = #FFD166
|
|
28
|
+
success = #06D6A0
|
|
29
|
+
error = #EF476F
|
|
30
|
+
warn = #E55934
|
|
31
|
+
`)
|
|
32
|
+
const defaultThemeLight = parsor(`
|
|
33
|
+
main=#ededed
|
|
34
|
+
main-dark=#cccccc
|
|
35
|
+
main-light=#fefefe
|
|
36
|
+
text=#555
|
|
37
|
+
text-light=#777
|
|
38
|
+
text-dark=#444
|
|
39
|
+
text-disabled=#888
|
|
40
|
+
primary=#08c
|
|
41
|
+
info=#FFD166
|
|
42
|
+
success=#06D6A0
|
|
43
|
+
error=#EF476F
|
|
44
|
+
warn=#E55934
|
|
45
|
+
`)
|
|
46
|
+
const defaultThemeLightTerminal = parsor(`
|
|
47
|
+
foreground=#333333
|
|
48
|
+
background=#ededed
|
|
49
|
+
cursor=#b5bd68
|
|
50
|
+
cursorAccent=#1d1f21
|
|
51
|
+
selectionBackground=rgba(0, 0, 0, 0.3)
|
|
52
|
+
black=#575757
|
|
53
|
+
red=#FF2C6D
|
|
54
|
+
green=#19f9d8
|
|
55
|
+
yellow=#FFB86C
|
|
56
|
+
blue=#45A9F9
|
|
57
|
+
magenta=#FF75B5
|
|
58
|
+
cyan=#B084EB
|
|
59
|
+
white=#CDCDCD
|
|
60
|
+
brightBlack=#757575
|
|
61
|
+
brightRed=#FF2C6D
|
|
62
|
+
brightGreen=#19f9d8
|
|
63
|
+
brightYellow=#FFCC95
|
|
64
|
+
brightBlue=#6FC1FF
|
|
65
|
+
brightMagenta=#FF9AC1
|
|
66
|
+
brightCyan=#BCAAFE
|
|
67
|
+
brightWhite=#E6E6E6
|
|
68
|
+
`)
|
|
69
|
+
|
|
70
|
+
const defaultThemeTerminal = {
|
|
71
|
+
foreground: '#bbbbbb',
|
|
72
|
+
background: '#141314',
|
|
73
|
+
cursor: '#b5bd68',
|
|
74
|
+
cursorAccent: '#1d1f21',
|
|
75
|
+
selectionBackground: 'rgba(255, 255, 255, 0.3)',
|
|
76
|
+
black: '#575757',
|
|
77
|
+
red: '#FF2C6D',
|
|
78
|
+
green: '#19f9d8',
|
|
79
|
+
yellow: '#FFB86C',
|
|
80
|
+
blue: '#45A9F9',
|
|
81
|
+
magenta: '#FF75B5',
|
|
82
|
+
cyan: '#B084EB',
|
|
83
|
+
white: '#CDCDCD',
|
|
84
|
+
brightBlack: '#757575',
|
|
85
|
+
brightRed: '#FF2C6D',
|
|
86
|
+
brightGreen: '#19f9d8',
|
|
87
|
+
brightYellow: '#FFCC95',
|
|
88
|
+
brightBlue: '#6FC1FF',
|
|
89
|
+
brightMagenta: '#FF9AC1',
|
|
90
|
+
brightCyan: '#BCAAFE',
|
|
91
|
+
brightWhite: '#E6E6E6'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export default [
|
|
95
|
+
{
|
|
96
|
+
db: 'terminalThemes',
|
|
97
|
+
data: [
|
|
98
|
+
{
|
|
99
|
+
_id: 'default',
|
|
100
|
+
name: 'default',
|
|
101
|
+
themeConfig: defaultThemeTerminal,
|
|
102
|
+
uiThemeConfig: defaultTheme
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
_id: 'defaultLight',
|
|
106
|
+
name: 'default light',
|
|
107
|
+
themeConfig: defaultThemeLightTerminal,
|
|
108
|
+
uiThemeConfig: defaultThemeLight
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
db: 'bookmarkGroups',
|
|
114
|
+
data: [
|
|
115
|
+
{
|
|
116
|
+
_id: 'default',
|
|
117
|
+
title: 'default',
|
|
118
|
+
bookmarkIds: [],
|
|
119
|
+
bookmarkGroupIds: []
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
]
|
package/client/common/db-fix.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// make old data imported compatible
|
|
2
|
-
import { buildProxyString } from '
|
|
3
|
-
import { buildSshTunnels } from '
|
|
4
|
-
import { buildRunScripts } from '
|
|
2
|
+
import { buildProxyString } from './build-proxy.js'
|
|
3
|
+
import { buildSshTunnels } from './build-ssh-tunnel.js'
|
|
4
|
+
import { buildRunScripts } from './build-run-scripts.js'
|
|
5
5
|
|
|
6
6
|
export function fixBookmarks (arr) {
|
|
7
7
|
return arr.map(bookmark => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* default setting
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
hotkey: 'Control+2',
|
|
7
|
+
sshReadyTimeout: 50000,
|
|
8
|
+
scrollback: 3000,
|
|
9
|
+
onStartSessions: [],
|
|
10
|
+
fontSize: 16,
|
|
11
|
+
fontFamily: 'mono, courier-new, courier, monospace',
|
|
12
|
+
execWindows: 'System32/WindowsPowerShell/v1.0/powershell.exe',
|
|
13
|
+
execMac: 'zsh',
|
|
14
|
+
execLinux: 'bash',
|
|
15
|
+
execWindowsArgs: [],
|
|
16
|
+
execMacArgs: [],
|
|
17
|
+
execLinuxArgs: [],
|
|
18
|
+
enableGlobalProxy: false,
|
|
19
|
+
disableSshHistory: false,
|
|
20
|
+
disableTransferHistory: false,
|
|
21
|
+
terminalBackgroundImagePath: '',
|
|
22
|
+
terminalBackgroundFilterOpacity: 1,
|
|
23
|
+
terminalBackgroundFilterBlur: 0,
|
|
24
|
+
terminalBackgroundFilterBrightness: 1,
|
|
25
|
+
terminalBackgroundFilterGrayscale: 0,
|
|
26
|
+
terminalBackgroundFilterContrast: 1,
|
|
27
|
+
rendererType: 'canvas',
|
|
28
|
+
terminalType: 'xterm-256color',
|
|
29
|
+
keepaliveCountMax: 10,
|
|
30
|
+
saveTerminalLogToFile: false,
|
|
31
|
+
checkUpdateOnStart: true,
|
|
32
|
+
cursorBlink: false,
|
|
33
|
+
cursorStyle: 'block',
|
|
34
|
+
useSystemTitleBar: false,
|
|
35
|
+
opacity: 1,
|
|
36
|
+
defaultEditor: '',
|
|
37
|
+
confirmBeforeExit: false,
|
|
38
|
+
initDefaultTabOnStart: true,
|
|
39
|
+
screenReaderMode: false,
|
|
40
|
+
autoRefreshWhenSwitchToSftp: false
|
|
41
|
+
}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
const enc = (str) => {
|
|
2
|
+
if (typeof str !== 'string') {
|
|
3
|
+
return str
|
|
4
|
+
}
|
|
5
|
+
return str.split('').map((s, i) => {
|
|
6
|
+
return String.fromCharCode((s.charCodeAt(0) + i + 1) % 65536)
|
|
7
|
+
}).join('')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const dec = (str) => {
|
|
11
|
+
if (typeof str !== 'string') {
|
|
12
|
+
return str
|
|
13
|
+
}
|
|
14
|
+
return str.split('').map((s, i) => {
|
|
15
|
+
return String.fromCharCode((s.charCodeAt(0) - i - 1 + 65536) % 65536)
|
|
16
|
+
}).join('')
|
|
17
|
+
}
|
|
2
18
|
|
|
3
19
|
/**
|
|
4
20
|
* enc password
|
package/client/common/sftp.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import generate from './uid'
|
|
6
6
|
import Transfer from './transfer'
|
|
7
|
-
import { transferTypeMap } from './constants'
|
|
7
|
+
import { transferTypeMap, instSftpKeys as keys } from './constants'
|
|
8
8
|
import initWs from './ws'
|
|
9
|
-
import { instSftpKeys as keys } from '../../app/common/constants'
|
|
10
9
|
|
|
11
10
|
const transferKeys = Object.keys(transferTypeMap)
|
|
12
11
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* version compare
|
|
3
|
+
* @param {string} a
|
|
4
|
+
* @param {string} b
|
|
5
|
+
* @return {number}
|
|
6
|
+
*/
|
|
7
|
+
// compare version '1.0.0' '12.0.3'
|
|
8
|
+
// return 1 when a > b
|
|
9
|
+
// return -1 when a < b
|
|
10
|
+
// return 0 when a === b
|
|
11
|
+
export default function (a, b) {
|
|
12
|
+
const ar = a.split('.').map(n => Number(n.replace('v', '')))
|
|
13
|
+
const br = b.split('.').map(n => Number(n.replace('v', '')))
|
|
14
|
+
let res = 0
|
|
15
|
+
for (let i = 0, len = br.length; i < len; i++) {
|
|
16
|
+
if (br[i] < ar[i]) {
|
|
17
|
+
res = 1
|
|
18
|
+
break
|
|
19
|
+
} else if (br[i] > ar[i]) {
|
|
20
|
+
res = -1
|
|
21
|
+
break
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return res
|
|
25
|
+
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
newBookmarkIdPrefix
|
|
26
26
|
} from '../../common/constants'
|
|
27
27
|
import formatBookmarkGroups from './bookmark-group-tree-format'
|
|
28
|
-
import defaultSettings from '
|
|
28
|
+
import defaultSettings from '../../common/default-setting'
|
|
29
29
|
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
30
30
|
import useSubmit from './use-submit'
|
|
31
31
|
import useUI from './use-ui'
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '../../common/constants'
|
|
15
15
|
import { formItemLayout } from '../../common/form-layout'
|
|
16
16
|
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
17
|
-
import defaultSettings from '
|
|
17
|
+
import defaultSettings from '../../common/default-setting'
|
|
18
18
|
import useSubmit from './use-submit'
|
|
19
19
|
import useUI from './use-ui'
|
|
20
20
|
import useQm from './use-quick-commands'
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Form
|
|
14
14
|
} from 'antd'
|
|
15
15
|
import { formItemLayout } from '../../common/form-layout'
|
|
16
|
-
import defaultSettings from '
|
|
16
|
+
import defaultSettings from '../../common/default-setting'
|
|
17
17
|
import mapper from '../../common/auto-complete-data-mapper'
|
|
18
18
|
import { defaultEnvLang } from '../../common/constants'
|
|
19
19
|
|
|
@@ -3,7 +3,7 @@ import { CloseOutlined, MinusSquareOutlined, UpCircleOutlined } from '@ant-desig
|
|
|
3
3
|
import { Button } from 'antd'
|
|
4
4
|
import { getLatestReleaseInfo, getLatestReleaseVersion } from '../../common/update-check'
|
|
5
5
|
import upgrade from '../../common/upgrade'
|
|
6
|
-
import compare from '
|
|
6
|
+
import compare from '../../common/version-compare'
|
|
7
7
|
import Link from '../common/external-link'
|
|
8
8
|
import {
|
|
9
9
|
isMac,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BookmarkTransport from '../setting-panel/bookmark-transport'
|
|
2
2
|
import download from '../../common/download'
|
|
3
|
-
import time from '
|
|
3
|
+
import time from '../../common/time'
|
|
4
4
|
import copy from 'json-deep-copy'
|
|
5
5
|
|
|
6
6
|
export default class QmTransport extends BookmarkTransport {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@ant-design/icons'
|
|
11
11
|
import { Upload, Button } from 'antd'
|
|
12
12
|
import download from '../../common/download'
|
|
13
|
-
import time from '
|
|
13
|
+
import time from '../../common/time'
|
|
14
14
|
import copy from 'json-deep-copy'
|
|
15
15
|
import { find, uniq, isEqual } from 'lodash-es'
|
|
16
16
|
import { fixBookmarks } from '../../common/db-fix'
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
proxyHelpLink,
|
|
23
23
|
isWin
|
|
24
24
|
} from '../../common/constants'
|
|
25
|
-
import defaultSettings from '
|
|
25
|
+
import defaultSettings from '../../common/default-setting'
|
|
26
26
|
import ShowItem from '../common/show-item'
|
|
27
27
|
import { osResolve } from '../../common/resolve'
|
|
28
28
|
import Link from '../common/external-link'
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Modal, Button } from 'antd'
|
|
7
7
|
import { isString } from 'lodash-es'
|
|
8
8
|
import AnimateText from '../common/animate-text'
|
|
9
|
-
import formatTime from '
|
|
9
|
+
import formatTime from '../../common/time'
|
|
10
10
|
import { FolderOutlined, FileOutlined } from '@ant-design/icons'
|
|
11
11
|
import {
|
|
12
12
|
fileActions
|
|
@@ -31,7 +31,7 @@ import sorter from '../../common/index-sorter'
|
|
|
31
31
|
import { getFolderFromFilePath } from './file-read'
|
|
32
32
|
import { readClipboard, copy as copyToClipboard, hasFileInClipboardText } from '../../common/clipboard'
|
|
33
33
|
import fs from '../../common/fs'
|
|
34
|
-
import time from '
|
|
34
|
+
import time from '../../common/time'
|
|
35
35
|
import { filesize } from 'filesize'
|
|
36
36
|
import { createTransferProps } from './transfer-common'
|
|
37
37
|
import generate from '../../common/uid'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react'
|
|
6
6
|
import { Modal, Button } from 'antd'
|
|
7
7
|
import resolve from '../../common/resolve'
|
|
8
|
-
import time from '
|
|
8
|
+
import time from '../../common/time'
|
|
9
9
|
import { findIndex, update } from 'lodash-es'
|
|
10
10
|
import { mode2permission, permission2mode } from '../../common/mode2permission'
|
|
11
11
|
import { commonActions } from '../../common/constants'
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '../../common/constants'
|
|
15
15
|
import resolve from '../../common/resolve'
|
|
16
16
|
import { mode2permission } from '../../common/mode2permission'
|
|
17
|
-
import time from '
|
|
17
|
+
import time from '../../common/time'
|
|
18
18
|
import renderPermission from './permission-render'
|
|
19
19
|
import FileIcon from './file-icon'
|
|
20
20
|
import fs from '../../common/fs'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Component } from '../common/react-subx'
|
|
6
6
|
import { CloseOutlined } from '@ant-design/icons'
|
|
7
7
|
import { Table } from 'antd'
|
|
8
|
-
import time from '
|
|
8
|
+
import time from '../../common/time'
|
|
9
9
|
import Tag from '../sftp/transfer-tag'
|
|
10
10
|
import './transfer-history.styl'
|
|
11
11
|
import { get as _get } from 'lodash-es'
|
package/client/entry/index.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render } from 'react-dom'
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
2
|
+
import 'antd/dist/reset.css'
|
|
3
|
+
import 'xterm/css/xterm.css'
|
|
4
4
|
import '../common/trzsz'
|
|
5
5
|
import Main from '../components/main'
|
|
6
6
|
import { notification } from 'antd'
|
|
@@ -8,7 +8,7 @@ import parseInt10 from '../common/parse-int10'
|
|
|
8
8
|
import { infoTabs, statusMap, defaultEnvLang } from '../common/constants'
|
|
9
9
|
import fs from '../common/fs'
|
|
10
10
|
import generate from '../common/uid'
|
|
11
|
-
import defaultSettings from '
|
|
11
|
+
import defaultSettings from '../common/default-setting'
|
|
12
12
|
import encodes from '../components/bookmark-form/encodes'
|
|
13
13
|
import runIdle from '../common/run-idle'
|
|
14
14
|
import { initWsCommon } from '../common/fetch-from-server'
|