@electerm/electerm-react 1.60.46 → 1.60.50
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.
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* @param {Array} newArr - New array of objects to compare against
|
|
5
5
|
* @returns {Object} Object containing arrays of items to update, add, and remove
|
|
6
6
|
*/
|
|
7
|
+
|
|
8
|
+
import deepCopy from 'json-deep-copy'
|
|
9
|
+
|
|
7
10
|
export default function compare (oldArr, newArr) {
|
|
8
11
|
if (!oldArr || !newArr) {
|
|
9
12
|
return {
|
|
@@ -48,8 +51,8 @@ export default function compare (oldArr, newArr) {
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
return {
|
|
51
|
-
updated,
|
|
52
|
-
added,
|
|
53
|
-
removed
|
|
54
|
+
updated: deepCopy(updated),
|
|
55
|
+
added: deepCopy(added),
|
|
56
|
+
removed: deepCopy(removed)
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -1250,7 +1250,7 @@ clear\r`
|
|
|
1250
1250
|
items: this.renderContextMenu(),
|
|
1251
1251
|
onClick: this.onContextMenu
|
|
1252
1252
|
},
|
|
1253
|
-
trigger: ['contextMenu']
|
|
1253
|
+
trigger: this.props.config.pasteWhenContextMenu ? [] : ['contextMenu']
|
|
1254
1254
|
}
|
|
1255
1255
|
return (
|
|
1256
1256
|
<Dropdown {...dropdownProps}>
|
package/client/store/common.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* load data from db
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { dbNames,
|
|
5
|
+
import { dbNames, getData, fetchInitData } from '../common/db'
|
|
6
6
|
import parseInt10 from '../common/parse-int10'
|
|
7
7
|
import { infoTabs, statusMap, defaultEnvLang } from '../common/constants'
|
|
8
8
|
import fs from '../common/fs'
|
|
9
9
|
import generate from '../common/id-with-stamp'
|
|
10
10
|
import defaultSettings from '../common/default-setting'
|
|
11
11
|
import encodes from '../components/bookmark-form/encodes'
|
|
12
|
-
import runIdle from '../common/run-idle'
|
|
13
12
|
import { initWsCommon } from '../common/fetch-from-server'
|
|
14
13
|
import safeParse from '../common/parse-json-safe'
|
|
15
14
|
import initWatch from './watch'
|
|
@@ -107,27 +106,6 @@ export async function addTabFromCommandLine (store, opts) {
|
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
export default (Store) => {
|
|
110
|
-
Store.prototype.batchDbUpdate = async function (updates) {
|
|
111
|
-
runIdle(() => {
|
|
112
|
-
for (const u of updates) {
|
|
113
|
-
update(u.id, u.update, u.db, u.upsert)
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
Store.prototype.batchDbAdd = async function (adds) {
|
|
118
|
-
runIdle(() => {
|
|
119
|
-
for (const u of adds) {
|
|
120
|
-
insert(u.db, u.obj)
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
Store.prototype.batchDbDel = async function (dels) {
|
|
125
|
-
runIdle(() => {
|
|
126
|
-
for (const u of dels) {
|
|
127
|
-
remove(u.db, u.id)
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
109
|
Store.prototype.openInitSessions = function () {
|
|
132
110
|
const { store } = window
|
|
133
111
|
const arr = store.config.onStartSessions || []
|
|
@@ -193,9 +171,6 @@ export default (Store) => {
|
|
|
193
171
|
})
|
|
194
172
|
ext.lastDataUpdateTime = await getData('lastDataUpdateTime') || 0
|
|
195
173
|
Object.assign(store, ext)
|
|
196
|
-
await store.fixBookmarkGroups()
|
|
197
|
-
await store.fixProfiles()
|
|
198
|
-
|
|
199
174
|
store.checkDefaultTheme()
|
|
200
175
|
store.loadFontList()
|
|
201
176
|
store.fetchItermThemes()
|
|
@@ -203,6 +178,13 @@ export default (Store) => {
|
|
|
203
178
|
store.fetchSshConfigItems()
|
|
204
179
|
store.initCommandLine().catch(store.onError)
|
|
205
180
|
initWatch(store)
|
|
181
|
+
setTimeout(
|
|
182
|
+
() => {
|
|
183
|
+
store.fixProfiles()
|
|
184
|
+
store.fixBookmarkGroups()
|
|
185
|
+
},
|
|
186
|
+
1000
|
|
187
|
+
)
|
|
206
188
|
if (store.config.checkUpdateOnStart) {
|
|
207
189
|
store.onCheckUpdate(false)
|
|
208
190
|
}
|
package/client/store/sync.js
CHANGED
|
@@ -7,7 +7,7 @@ import copy from 'json-deep-copy'
|
|
|
7
7
|
import {
|
|
8
8
|
settingMap, packInfo, syncTypes, syncDataMaps
|
|
9
9
|
} from '../common/constants'
|
|
10
|
-
import {
|
|
10
|
+
import { dbNames, update, getData } from '../common/db'
|
|
11
11
|
import fetch from '../common/fetch-from-server'
|
|
12
12
|
import download from '../common/download'
|
|
13
13
|
import { fixBookmarks } from '../common/db-fix'
|
|
@@ -259,7 +259,6 @@ export default (Store) => {
|
|
|
259
259
|
token,
|
|
260
260
|
store.getProxySetting()
|
|
261
261
|
)
|
|
262
|
-
const toInsert = []
|
|
263
262
|
const { names, syncConfig } = store.getDataSyncNames()
|
|
264
263
|
for (const n of names) {
|
|
265
264
|
let str = get(gist, `files["${n}.json"].content`)
|
|
@@ -290,10 +289,6 @@ export default (Store) => {
|
|
|
290
289
|
return ai - bi
|
|
291
290
|
})
|
|
292
291
|
}
|
|
293
|
-
toInsert.push({
|
|
294
|
-
name: n,
|
|
295
|
-
value: arr
|
|
296
|
-
})
|
|
297
292
|
store.setItems(n, arr)
|
|
298
293
|
}
|
|
299
294
|
if (syncConfig) {
|
|
@@ -321,10 +316,6 @@ export default (Store) => {
|
|
|
321
316
|
up[type + 'SyncPassword'] = pass
|
|
322
317
|
}
|
|
323
318
|
store.updateSyncSetting(up)
|
|
324
|
-
for (const u of toInsert) {
|
|
325
|
-
await remove(u.name)
|
|
326
|
-
await insert(u.name, u.value)
|
|
327
|
-
}
|
|
328
319
|
store.isSyncingSetting = false
|
|
329
320
|
store.isSyncDownload = false
|
|
330
321
|
}
|
|
@@ -389,7 +380,6 @@ export default (Store) => {
|
|
|
389
380
|
.readFile(file.path)
|
|
390
381
|
const { store } = window
|
|
391
382
|
const objs = JSON.parse(txt)
|
|
392
|
-
const toInsert = []
|
|
393
383
|
const { names } = store.getDataSyncNames(true)
|
|
394
384
|
for (const n of names) {
|
|
395
385
|
let arr = objs[n]
|
|
@@ -398,16 +388,8 @@ export default (Store) => {
|
|
|
398
388
|
} else if (n === settingMap.bookmarks) {
|
|
399
389
|
arr = fixBookmarks(arr)
|
|
400
390
|
}
|
|
401
|
-
toInsert.push({
|
|
402
|
-
name: n,
|
|
403
|
-
value: arr
|
|
404
|
-
})
|
|
405
391
|
store.setItems(n, objs[n])
|
|
406
392
|
}
|
|
407
|
-
for (const u of toInsert) {
|
|
408
|
-
await remove(u.name)
|
|
409
|
-
await insert(u.name, u.value)
|
|
410
|
-
}
|
|
411
393
|
store.updateConfig(objs.config)
|
|
412
394
|
store.setTheme(objs.config.theme)
|
|
413
395
|
}
|
package/client/store/watch.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import createTitle from '../common/create-title'
|
|
6
6
|
import { autoRun } from 'manate'
|
|
7
|
-
import { update, remove, dbNamesForWatch } from '../common/db'
|
|
7
|
+
import { update, remove, insert, dbNamesForWatch } from '../common/db'
|
|
8
8
|
import {
|
|
9
9
|
sftpDefaultSortSettingKey,
|
|
10
10
|
checkedKeysLsKey,
|
|
@@ -50,12 +50,9 @@ export default store => {
|
|
|
50
50
|
for (const item of updated) {
|
|
51
51
|
await update(item.id, item, name, false)
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
obj: d
|
|
57
|
-
}
|
|
58
|
-
}))
|
|
53
|
+
for (const item of added) {
|
|
54
|
+
await insert(name, item)
|
|
55
|
+
}
|
|
59
56
|
await update(
|
|
60
57
|
`${name}:order`,
|
|
61
58
|
(n || []).map(d => d.id)
|