@electerm/electerm-react 1.39.76 → 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.
- package/client/common/constants.js +8 -0
- package/client/common/create-title.jsx +3 -4
- package/client/common/default-setting.js +2 -1
- package/client/common/init-setting-item.js +3 -6
- package/client/common/new-terminal.js +1 -2
- package/client/common/terminal-theme.js +2 -3
- package/client/components/auth/login.jsx +2 -3
- package/client/components/batch-op/batch-op.jsx +18 -36
- package/client/components/bookmark-form/color-picker.jsx +1 -1
- package/client/components/bookmark-form/form-ssh-common.jsx +4 -7
- package/client/components/bookmark-form/form-tabs.jsx +4 -8
- package/client/components/bookmark-form/index.jsx +5 -9
- package/client/components/bookmark-form/local-form-ui.jsx +3 -6
- package/client/components/bookmark-form/proxy.jsx +1 -2
- package/client/components/bookmark-form/quick-command.jsx +7 -8
- package/client/components/bookmark-form/rdp-form-ui.jsx +2 -4
- package/client/components/bookmark-form/render-auth-ssh.jsx +1 -2
- package/client/components/bookmark-form/render-connection-hopping.jsx +9 -11
- package/client/components/bookmark-form/render-delayed-scripts.jsx +36 -35
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +9 -12
- package/client/components/bookmark-form/serial-form-ui.jsx +4 -8
- package/client/components/bookmark-form/sftp-enable.jsx +1 -2
- package/client/components/bookmark-form/telnet-form-ui.jsx +2 -4
- package/client/components/bookmark-form/tree-delete.jsx +3 -4
- package/client/components/bookmark-form/use-quick-commands.jsx +5 -6
- package/client/components/bookmark-form/use-submit.jsx +1 -2
- package/client/components/bookmark-form/use-ui.jsx +4 -6
- package/client/components/bookmark-form/vnc-form-ui.jsx +2 -4
- package/client/components/bookmark-form/web-form-ui.jsx +2 -4
- package/client/components/common/markdown.jsx +1 -1
- package/client/components/context-menu/context-menu.jsx +3 -4
- package/client/components/context-menu/menu-btn.jsx +13 -18
- package/client/components/footer/batch-input.jsx +1 -2
- package/client/components/footer/footer-entry.jsx +2 -3
- package/client/components/footer/footer.styl +1 -1
- package/client/components/main/error-wrapper.jsx +2 -4
- package/client/components/main/upgrade.jsx +2 -4
- package/client/components/main/upgrade.styl +4 -1
- package/client/components/profile/profile-form-elem.jsx +28 -10
- package/client/components/quick-commands/quick-commands-box.jsx +1 -2
- package/client/components/quick-commands/quick-commands-form-elem.jsx +7 -12
- package/client/components/quick-commands/quick-commands-list-form.jsx +5 -6
- package/client/components/quick-commands/quick-commands-list.jsx +2 -3
- package/client/components/quick-commands/quick-commands-select.jsx +1 -2
- package/client/components/rdp/rdp-session.jsx +0 -3
- package/client/components/rdp/resolution-form.jsx +3 -6
- package/client/components/session/session.jsx +3 -5
- package/client/components/session/sessions.jsx +4 -6
- package/client/components/setting-panel/keywords-form.jsx +2 -3
- package/client/components/setting-panel/list.jsx +3 -6
- package/client/components/setting-panel/setting-common.jsx +10 -14
- package/client/components/setting-panel/setting-modal.jsx +7 -11
- package/client/components/setting-panel/setting-terminal.jsx +13 -16
- package/client/components/setting-panel/start-session-select.jsx +1 -2
- package/client/components/setting-panel/tab-history.jsx +2 -3
- package/client/components/setting-sync/data-import.jsx +4 -7
- package/client/components/setting-sync/data-select-item.jsx +25 -0
- package/client/components/setting-sync/data-select.jsx +39 -0
- package/client/components/setting-sync/setting-sync-form.jsx +8 -12
- package/client/components/setting-sync/setting-sync.jsx +12 -1
- package/client/components/sftp/address-bar.jsx +1 -2
- package/client/components/sftp/confirm-modal-store.jsx +1 -2
- package/client/components/sftp/file-item.jsx +8 -10
- package/client/components/sftp/file-mode-modal.jsx +1 -2
- package/client/components/sftp/file-props-modal.jsx +1 -2
- package/client/components/sftp/list-table-ui.jsx +1 -2
- package/client/components/sftp/permission-render.jsx +1 -2
- package/client/components/sftp/sftp-entry.jsx +21 -7
- package/client/components/sftp/transfer-tag.jsx +1 -2
- package/client/components/shortcuts/shortcuts.jsx +5 -28
- package/client/components/sidebar/bookmark.jsx +6 -9
- package/client/components/sidebar/history.jsx +4 -6
- package/client/components/sidebar/index.jsx +9 -16
- package/client/components/sidebar/info-modal.jsx +10 -15
- package/client/components/sidebar/side-panel.jsx +3 -2
- package/client/components/sidebar/transfer-history-modal.jsx +3 -6
- package/client/components/sidebar/transfer-list-control.jsx +1 -2
- package/client/components/sidebar/transfer-list.jsx +1 -2
- package/client/components/sidebar/transfer-modal.jsx +2 -4
- package/client/components/sidebar/transport-ui.jsx +1 -2
- package/client/components/tabs/index.jsx +28 -20
- package/client/components/tabs/tab-title.jsx +1 -1
- package/client/components/tabs/tab.jsx +30 -8
- package/client/components/tabs/tabs.styl +3 -0
- package/client/components/tabs/window-control.jsx +4 -5
- package/client/components/terminal/index.jsx +6 -8
- package/client/components/terminal/term-search.jsx +7 -7
- package/client/components/terminal/terminal-interactive.jsx +2 -4
- package/client/components/terminal-info/activity.jsx +4 -5
- package/client/components/terminal-info/base.jsx +3 -4
- package/client/components/terminal-info/data-cols-parser.jsx +13 -11
- package/client/components/terminal-info/terminal-info.styl +5 -4
- package/client/components/terminal-theme/index.jsx +6 -9
- package/client/components/terminal-theme/theme-list.jsx +1 -2
- package/client/components/text-editor/text-editor-form.jsx +4 -8
- package/client/components/text-editor/text-editor.jsx +2 -3
- package/client/components/tree-list/bookmark-transport.jsx +4 -7
- package/client/components/tree-list/tree-list-item.jsx +4 -7
- package/client/components/tree-list/tree-list.jsx +3 -6
- package/client/components/tree-list/tree-list.styl +3 -2
- package/client/components/vnc/vnc-form.jsx +2 -4
- package/client/components/vnc/vnc-session.jsx +1 -2
- package/client/entry/basic.js +4 -6
- package/client/store/common.js +10 -12
- package/client/store/index.js +4 -7
- package/client/store/init-state.js +2 -3
- package/client/store/load-data.js +10 -0
- package/client/store/setting.js +2 -3
- package/client/store/sync.js +104 -54
- package/client/store/system-menu.js +4 -6
- package/client/store/terminal-theme.js +2 -4
- package/package.json +1 -1
|
@@ -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
|
|
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(
|
|
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
|
-
{
|
|
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={
|
|
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={
|
|
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
|
-
>{
|
|
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
|
|
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
|
-
>{
|
|
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
|
-
>{
|
|
84
|
+
>{e('reset')}
|
|
89
85
|
</Button>
|
|
90
86
|
<Button
|
|
91
87
|
{...popsCancel}
|
|
92
|
-
>{
|
|
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
|
|
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 = `${
|
|
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
|
|
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={
|
|
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={
|
|
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={
|
|
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
|
|
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={
|
|
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={`${
|
|
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={
|
|
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
|
|
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={`${
|
|
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={`${
|
|
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
|
|
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
|
-
{
|
|
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
|
|
22
|
-
const e = prefix('form')
|
|
21
|
+
const e = window.translate
|
|
23
22
|
|
|
24
23
|
export default class VncSession extends RdpSession {
|
|
25
24
|
constructor (props) {
|
package/client/entry/basic.js
CHANGED
|
@@ -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.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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()
|
package/client/store/common.js
CHANGED
|
@@ -16,9 +16,7 @@ import {
|
|
|
16
16
|
} from '../common/constants'
|
|
17
17
|
import * as ls from '../common/safe-local-storage'
|
|
18
18
|
|
|
19
|
-
const
|
|
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 (
|
|
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
|
-
|
|
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:
|
|
182
|
-
okText:
|
|
183
|
-
cancelText:
|
|
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 (
|
|
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:
|
|
199
|
-
okText:
|
|
200
|
-
cancelText:
|
|
196
|
+
title: e('quit'),
|
|
197
|
+
okText: e('ok'),
|
|
198
|
+
cancelText: e('cancel'),
|
|
201
199
|
content: ''
|
|
202
200
|
})
|
|
203
201
|
}
|
package/client/store/index.js
CHANGED
|
@@ -41,10 +41,7 @@ import {
|
|
|
41
41
|
theme
|
|
42
42
|
} from 'antd'
|
|
43
43
|
|
|
44
|
-
const
|
|
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:
|
|
201
|
+
title: e('terminal')
|
|
205
202
|
},
|
|
206
203
|
{
|
|
207
204
|
id: settingShortcutsId,
|
|
208
|
-
title:
|
|
205
|
+
title: e('settingShortcuts')
|
|
209
206
|
},
|
|
210
207
|
{
|
|
211
208
|
id: settingSyncId,
|
|
212
|
-
title:
|
|
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
|
|
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:
|
|
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)
|
package/client/store/setting.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
163
|
+
e('sencondInstanceTip')
|
|
165
164
|
)
|
|
166
165
|
}
|
|
167
166
|
store.showModal = modals.setting
|
package/client/store/sync.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* sync data to github gist related
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { get, pick, debounce, findIndex } from 'lodash-es'
|
|
6
6
|
import copy from 'json-deep-copy'
|
|
7
7
|
import {
|
|
8
|
-
settingMap, packInfo, syncTypes
|
|
8
|
+
settingMap, packInfo, syncTypes, syncDataMaps
|
|
9
9
|
} from '../common/constants'
|
|
10
10
|
import { remove, dbNames, insert, update, getData } from '../common/db'
|
|
11
11
|
import fetch from '../common/fetch-from-server'
|
|
@@ -14,7 +14,6 @@ import { fixBookmarks } from '../common/db-fix'
|
|
|
14
14
|
import dayjs from 'dayjs'
|
|
15
15
|
import parseJsonSafe from '../common/parse-json-safe'
|
|
16
16
|
|
|
17
|
-
const names = without(dbNames, settingMap.history)
|
|
18
17
|
const {
|
|
19
18
|
version: packVer
|
|
20
19
|
} = packInfo
|
|
@@ -162,6 +161,7 @@ export default (Store) => {
|
|
|
162
161
|
}
|
|
163
162
|
const pass = store.getSyncPassword(type)
|
|
164
163
|
const objs = {}
|
|
164
|
+
const { names, syncConfig } = store.getDataSyncNames()
|
|
165
165
|
for (const n of names) {
|
|
166
166
|
let str = store.getItems(n)
|
|
167
167
|
const order = await getData(`${n}:order`)
|
|
@@ -182,14 +182,18 @@ export default (Store) => {
|
|
|
182
182
|
objs[`${n}.order.json`] = {
|
|
183
183
|
content: 'empty'
|
|
184
184
|
}
|
|
185
|
+
if (syncConfig) {
|
|
186
|
+
objs['userConfig.json'] = {
|
|
187
|
+
content: JSON.stringify(
|
|
188
|
+
store.getSyncConfig()
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
193
|
const res = await fetchData(type, 'update', [gistId, {
|
|
187
194
|
description: 'sync electerm data',
|
|
188
195
|
files: {
|
|
189
196
|
...objs,
|
|
190
|
-
'userConfig.json': {
|
|
191
|
-
content: JSON.stringify(pick(store.config, ['theme']))
|
|
192
|
-
},
|
|
193
197
|
'electerm-status.json': {
|
|
194
198
|
content: JSON.stringify({
|
|
195
199
|
lastSyncTime: Date.now(),
|
|
@@ -230,6 +234,7 @@ export default (Store) => {
|
|
|
230
234
|
store.getProxySetting()
|
|
231
235
|
)
|
|
232
236
|
const toInsert = []
|
|
237
|
+
const { names, syncConfig } = store.getDataSyncNames()
|
|
233
238
|
for (const n of names) {
|
|
234
239
|
let str = get(gist, `files["${n}.json"].content`)
|
|
235
240
|
if (!str) {
|
|
@@ -267,12 +272,18 @@ export default (Store) => {
|
|
|
267
272
|
})
|
|
268
273
|
store.setItems(n, arr)
|
|
269
274
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
if (syncConfig) {
|
|
276
|
+
const userConfig = parseJsonSafe(
|
|
277
|
+
get(gist, 'files["userConfig.json"].content')
|
|
278
|
+
)
|
|
279
|
+
if (userConfig) {
|
|
280
|
+
store.setConfig(userConfig)
|
|
281
|
+
}
|
|
282
|
+
if (userConfig && userConfig.theme) {
|
|
283
|
+
store.setTheme(userConfig.theme)
|
|
284
|
+
}
|
|
275
285
|
}
|
|
286
|
+
|
|
276
287
|
const up = {
|
|
277
288
|
[type + 'LastSyncTime']: Date.now()
|
|
278
289
|
}
|
|
@@ -331,6 +342,7 @@ export default (Store) => {
|
|
|
331
342
|
Store.prototype.handleExportAllData = async function () {
|
|
332
343
|
const { store } = window
|
|
333
344
|
const objs = {}
|
|
345
|
+
const names = store.getDataSyncNames(true)
|
|
334
346
|
for (const n of names) {
|
|
335
347
|
objs[n] = store.getItems(n)
|
|
336
348
|
const order = await getData(`${n}:order`)
|
|
@@ -342,49 +354,7 @@ export default (Store) => {
|
|
|
342
354
|
})
|
|
343
355
|
}
|
|
344
356
|
}
|
|
345
|
-
objs.config =
|
|
346
|
-
'theme',
|
|
347
|
-
'useSystemTitleBar',
|
|
348
|
-
'defaultEditor',
|
|
349
|
-
'checkUpdateOnStart',
|
|
350
|
-
'confirmBeforeExit',
|
|
351
|
-
'ctrlOrMetaOpenTerminalLink',
|
|
352
|
-
'cursorStyle',
|
|
353
|
-
'defaultEditor',
|
|
354
|
-
'disableSshHistory',
|
|
355
|
-
'disableTransferHistory',
|
|
356
|
-
'enableGlobalProxy',
|
|
357
|
-
'execLinux',
|
|
358
|
-
'execLinuxArgs',
|
|
359
|
-
'execMac',
|
|
360
|
-
'execMacArgs',
|
|
361
|
-
'execWindows',
|
|
362
|
-
'execWindowsArgs',
|
|
363
|
-
'fontFamily',
|
|
364
|
-
'fontSize',
|
|
365
|
-
'hotkey',
|
|
366
|
-
'keepaliveCountMax',
|
|
367
|
-
'keepaliveInterval',
|
|
368
|
-
'language',
|
|
369
|
-
'opacity',
|
|
370
|
-
'pasteWhenContextMenu',
|
|
371
|
-
'proxyIp',
|
|
372
|
-
'proxyPassword',
|
|
373
|
-
'proxyPort',
|
|
374
|
-
'proxyType',
|
|
375
|
-
'proxyUsername',
|
|
376
|
-
'rendererType',
|
|
377
|
-
'rightClickSelectsWord',
|
|
378
|
-
'saveTerminalLogToFile',
|
|
379
|
-
'scrollback',
|
|
380
|
-
'sshReadyTimeout',
|
|
381
|
-
'syncSetting',
|
|
382
|
-
'terminalTimeout',
|
|
383
|
-
'terminalType',
|
|
384
|
-
'theme',
|
|
385
|
-
'useSystemTitleBar',
|
|
386
|
-
'zoom'
|
|
387
|
-
])
|
|
357
|
+
objs.config = store.config
|
|
388
358
|
const text = JSON.stringify(objs)
|
|
389
359
|
const name = dayjs().format('YYYY-MM-DD-HH-mm-ss') + '-electerm-all-data.json'
|
|
390
360
|
download(name, text)
|
|
@@ -396,6 +366,7 @@ export default (Store) => {
|
|
|
396
366
|
const { store } = window
|
|
397
367
|
const objs = JSON.parse(txt)
|
|
398
368
|
const toInsert = []
|
|
369
|
+
const { names } = store.getDataSyncNames(true)
|
|
399
370
|
for (const n of names) {
|
|
400
371
|
let arr = objs[n]
|
|
401
372
|
if (n === settingMap.terminalThemes) {
|
|
@@ -423,4 +394,83 @@ export default (Store) => {
|
|
|
423
394
|
autoSync: v
|
|
424
395
|
})
|
|
425
396
|
}
|
|
397
|
+
|
|
398
|
+
Store.prototype.toggleDataSyncSelected = function (key) {
|
|
399
|
+
const { store } = window
|
|
400
|
+
const {
|
|
401
|
+
dataSyncSelected
|
|
402
|
+
} = store.config
|
|
403
|
+
let arr = dataSyncSelected && dataSyncSelected !== 'all'
|
|
404
|
+
? dataSyncSelected.split(',')
|
|
405
|
+
: Object.keys(syncDataMaps)
|
|
406
|
+
if (arr.includes(key)) {
|
|
407
|
+
arr = arr.filter(d => d !== key)
|
|
408
|
+
} else {
|
|
409
|
+
arr.push(key)
|
|
410
|
+
}
|
|
411
|
+
store.setConfig({
|
|
412
|
+
dataSyncSelected: arr.join(',')
|
|
413
|
+
})
|
|
414
|
+
}
|
|
415
|
+
Store.prototype.getDataSyncNames = function (all) {
|
|
416
|
+
const { store } = window
|
|
417
|
+
const {
|
|
418
|
+
dataSyncSelected
|
|
419
|
+
} = store.config
|
|
420
|
+
const syncAll = all || dataSyncSelected === 'all'
|
|
421
|
+
const keys = syncAll
|
|
422
|
+
? Object.keys(syncDataMaps)
|
|
423
|
+
: dataSyncSelected.split(',')
|
|
424
|
+
const names = keys
|
|
425
|
+
.filter(d => d !== 'settings')
|
|
426
|
+
.map(d => syncDataMaps[d]).flat()
|
|
427
|
+
const syncConfig = keys.includes('settings')
|
|
428
|
+
return {
|
|
429
|
+
names,
|
|
430
|
+
syncConfig
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
Store.prototype.getSyncConfig = function () {
|
|
434
|
+
const { store } = window
|
|
435
|
+
const configSyncKeys = [
|
|
436
|
+
'keepaliveInterval',
|
|
437
|
+
'rightClickSelectsWord',
|
|
438
|
+
'pasteWhenContextMenu',
|
|
439
|
+
'ctrlOrMetaOpenTerminalLink',
|
|
440
|
+
'hotkey',
|
|
441
|
+
'sshReadyTimeout',
|
|
442
|
+
'scrollback',
|
|
443
|
+
'fontSize',
|
|
444
|
+
'execWindows',
|
|
445
|
+
'execMac',
|
|
446
|
+
'execLinux',
|
|
447
|
+
'execWindowsArgs',
|
|
448
|
+
'execMacArgs',
|
|
449
|
+
'execLinuxArgs',
|
|
450
|
+
'disableSshHistory',
|
|
451
|
+
'disableTransferHistory',
|
|
452
|
+
'terminalType',
|
|
453
|
+
'keepaliveCountMax',
|
|
454
|
+
'saveTerminalLogToFile',
|
|
455
|
+
'checkUpdateOnStart',
|
|
456
|
+
'cursorBlink',
|
|
457
|
+
'cursorStyle',
|
|
458
|
+
'terminalWordSeparator',
|
|
459
|
+
'confirmBeforeExit',
|
|
460
|
+
'autoRefreshWhenSwitchToSftp',
|
|
461
|
+
'addTimeStampToTermLog',
|
|
462
|
+
'showHiddenFilesOnSftpStart',
|
|
463
|
+
'terminalInfos',
|
|
464
|
+
'filePropsEnabled',
|
|
465
|
+
'hideIP',
|
|
466
|
+
'terminalTimeout',
|
|
467
|
+
'theme',
|
|
468
|
+
'terminalTypes',
|
|
469
|
+
'language',
|
|
470
|
+
'copyWhenSelect',
|
|
471
|
+
'customCss',
|
|
472
|
+
'dataSyncSelected'
|
|
473
|
+
]
|
|
474
|
+
return pick(store.config, configSyncKeys)
|
|
475
|
+
}
|
|
426
476
|
}
|