@electerm/electerm-react 1.34.30
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/LICENSE +21 -0
- package/README.md +31 -0
- package/client/common/auto-complete-data-mapper.js +6 -0
- package/client/common/byte-format.js +14 -0
- package/client/common/class.js +52 -0
- package/client/common/clipboard.js +49 -0
- package/client/common/constants.js +308 -0
- package/client/common/create-lang-edit-link.js +7 -0
- package/client/common/create-title.js +29 -0
- package/client/common/db-fix.js +24 -0
- package/client/common/db.js +155 -0
- package/client/common/download-mirrors.js +10 -0
- package/client/common/download.js +16 -0
- package/client/common/error-handler.jsx +27 -0
- package/client/common/fetch-from-server.js +47 -0
- package/client/common/fetch.jsx +71 -0
- package/client/common/find-bookmark-group-id.js +15 -0
- package/client/common/find-parent.js +30 -0
- package/client/common/form-layout.js +27 -0
- package/client/common/fs.js +21 -0
- package/client/common/get-proxy.js +8 -0
- package/client/common/id-with-stamp.js +10 -0
- package/client/common/index-sorter.js +4 -0
- package/client/common/init-setting-item.js +32 -0
- package/client/common/is-absolute-path.js +3 -0
- package/client/common/is-ip.js +16 -0
- package/client/common/is-valid-path.js +7 -0
- package/client/common/key-control-pressed.js +13 -0
- package/client/common/key-pressed.js +13 -0
- package/client/common/key-shift-pressed.js +7 -0
- package/client/common/mode2permission.js +81 -0
- package/client/common/new-terminal.js +31 -0
- package/client/common/parse-int10.js +3 -0
- package/client/common/parse-json-safe.js +11 -0
- package/client/common/pass-enc.js +25 -0
- package/client/common/post-msg.js +3 -0
- package/client/common/pre.js +156 -0
- package/client/common/promise-timeout.js +27 -0
- package/client/common/resolve.js +31 -0
- package/client/common/run-idle.js +1 -0
- package/client/common/safe-local-storage.js +35 -0
- package/client/common/safe-name.js +19 -0
- package/client/common/sftp.js +74 -0
- package/client/common/terminal-theme.js +158 -0
- package/client/common/test-connection.js +12 -0
- package/client/common/time.js +30 -0
- package/client/common/to-simple-obj.js +5 -0
- package/client/common/track.js +7 -0
- package/client/common/transfer.js +76 -0
- package/client/common/trzsz.js +62 -0
- package/client/common/ui-theme.js +44 -0
- package/client/common/uid.js +5 -0
- package/client/common/update-check.js +79 -0
- package/client/common/upgrade.js +68 -0
- package/client/common/wait.js +8 -0
- package/client/common/ws.js +161 -0
- package/client/components/batch-op/batch-op.jsx +650 -0
- package/client/components/bookmark-form/bookmark-form.styl +8 -0
- package/client/components/bookmark-form/bookmark-group-tree-format.js +39 -0
- package/client/components/bookmark-form/encodes.js +44 -0
- package/client/components/bookmark-form/form-ssh-common.jsx +208 -0
- package/client/components/bookmark-form/form-tabs.jsx +69 -0
- package/client/components/bookmark-form/index.jsx +159 -0
- package/client/components/bookmark-form/local-form-ui.jsx +152 -0
- package/client/components/bookmark-form/local-form.jsx +16 -0
- package/client/components/bookmark-form/proxy.jsx +49 -0
- package/client/components/bookmark-form/quick-command-list.jsx +31 -0
- package/client/components/bookmark-form/quick-command.jsx +228 -0
- package/client/components/bookmark-form/render-auth-ssh.jsx +104 -0
- package/client/components/bookmark-form/render-connection-hopping.jsx +229 -0
- package/client/components/bookmark-form/render-delayed-scripts.jsx +88 -0
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +116 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +311 -0
- package/client/components/bookmark-form/serial-form.jsx +20 -0
- package/client/components/bookmark-form/sftp-enable.jsx +33 -0
- package/client/components/bookmark-form/ssh-form-ui.jsx +100 -0
- package/client/components/bookmark-form/ssh-form.jsx +348 -0
- package/client/components/bookmark-form/telnet-form-ui.jsx +154 -0
- package/client/components/bookmark-form/telnet-form.jsx +16 -0
- package/client/components/bookmark-form/tree-delete.jsx +87 -0
- package/client/components/bookmark-form/use-form-funcs.jsx +50 -0
- package/client/components/bookmark-form/use-quick-commands.jsx +83 -0
- package/client/components/bookmark-form/use-submit.jsx +77 -0
- package/client/components/bookmark-form/use-ui.jsx +82 -0
- package/client/components/bookmark-form/x11.jsx +23 -0
- package/client/components/common/animate-text.jsx +37 -0
- package/client/components/common/animate-text.styl +54 -0
- package/client/components/common/external-link.jsx +28 -0
- package/client/components/common/help-icon.jsx +25 -0
- package/client/components/common/highlight.jsx +23 -0
- package/client/components/common/highlight.styl +3 -0
- package/client/components/common/input-auto-focus.jsx +68 -0
- package/client/components/common/input-confirm.jsx +66 -0
- package/client/components/common/logo-elem.jsx +22 -0
- package/client/components/common/markdown.jsx +27 -0
- package/client/components/common/react-subx.jsx +1 -0
- package/client/components/common/resize-wrap.jsx +222 -0
- package/client/components/common/resize-wrap.styl +9 -0
- package/client/components/common/search.jsx +9 -0
- package/client/components/common/show-item.jsx +27 -0
- package/client/components/context-menu/boomarks.jsx +15 -0
- package/client/components/context-menu/context-menu.jsx +340 -0
- package/client/components/context-menu/context-menu.styl +90 -0
- package/client/components/context-menu/history.jsx +27 -0
- package/client/components/context-menu/icon-holder.jsx +5 -0
- package/client/components/context-menu/menu-btn.jsx +224 -0
- package/client/components/context-menu/sub-tab-menu.jsx +23 -0
- package/client/components/context-menu/tabs.jsx +22 -0
- package/client/components/context-menu/zoom.jsx +40 -0
- package/client/components/footer/batch-input.jsx +177 -0
- package/client/components/footer/footer-entry.jsx +141 -0
- package/client/components/footer/footer.styl +47 -0
- package/client/components/icons/match-case.jsx +10 -0
- package/client/components/icons/match-whole-word.jsx +13 -0
- package/client/components/icons/regular-exp.jsx +10 -0
- package/client/components/main/css-overwrite.jsx +92 -0
- package/client/components/main/error-wrapper.jsx +59 -0
- package/client/components/main/index.jsx +11 -0
- package/client/components/main/loading.jsx +25 -0
- package/client/components/main/main.jsx +149 -0
- package/client/components/main/term-fullscreen-control.jsx +21 -0
- package/client/components/main/term-fullscreen.styl +27 -0
- package/client/components/main/ui-theme.jsx +31 -0
- package/client/components/main/upgrade.jsx +351 -0
- package/client/components/main/upgrade.styl +27 -0
- package/client/components/main/wrapper.styl +41 -0
- package/client/components/quick-commands/qm.styl +29 -0
- package/client/components/quick-commands/quick-command-item.jsx +36 -0
- package/client/components/quick-commands/quick-command-transport-mod.jsx +54 -0
- package/client/components/quick-commands/quick-command-transport.jsx +12 -0
- package/client/components/quick-commands/quick-commands-box.jsx +233 -0
- package/client/components/quick-commands/quick-commands-form-elem.jsx +119 -0
- package/client/components/quick-commands/quick-commands-form.jsx +33 -0
- package/client/components/quick-commands/quick-commands-list.jsx +128 -0
- package/client/components/quick-commands/quick-commands-select.jsx +38 -0
- package/client/components/session/session.jsx +533 -0
- package/client/components/session/session.styl +53 -0
- package/client/components/session/sessions.jsx +445 -0
- package/client/components/setting-panel/bookmark-transport.jsx +148 -0
- package/client/components/setting-panel/bookmark-tree-list.jsx +14 -0
- package/client/components/setting-panel/col.jsx +18 -0
- package/client/components/setting-panel/list.jsx +186 -0
- package/client/components/setting-panel/list.styl +33 -0
- package/client/components/setting-panel/on-tree-drop.js +222 -0
- package/client/components/setting-panel/setting-modal.jsx +163 -0
- package/client/components/setting-panel/setting-wrap.jsx +37 -0
- package/client/components/setting-panel/setting-wrap.styl +52 -0
- package/client/components/setting-panel/setting.jsx +858 -0
- package/client/components/setting-panel/setting.styl +4 -0
- package/client/components/setting-panel/start-session-select.jsx +91 -0
- package/client/components/setting-panel/tab-bookmarks.jsx +37 -0
- package/client/components/setting-panel/tab-history.jsx +44 -0
- package/client/components/setting-panel/tab-quick-commands.jsx +38 -0
- package/client/components/setting-panel/tab-settings.jsx +42 -0
- package/client/components/setting-panel/tab-themes.jsx +34 -0
- package/client/components/setting-panel/tree-list.jsx +978 -0
- package/client/components/setting-panel/tree-list.styl +57 -0
- package/client/components/setting-sync/data-import.jsx +65 -0
- package/client/components/setting-sync/setting-sync-form.jsx +271 -0
- package/client/components/setting-sync/setting-sync.jsx +81 -0
- package/client/components/setting-sync/sync.styl +7 -0
- package/client/components/sftp/address-bar.jsx +139 -0
- package/client/components/sftp/address-bookmark-item.jsx +47 -0
- package/client/components/sftp/address-bookmark.jsx +81 -0
- package/client/components/sftp/address-bookmark.styl +8 -0
- package/client/components/sftp/confirm-modal.jsx +184 -0
- package/client/components/sftp/file-icon.jsx +22 -0
- package/client/components/sftp/file-item.jsx +1226 -0
- package/client/components/sftp/file-mode-modal.jsx +205 -0
- package/client/components/sftp/file-props-modal.jsx +211 -0
- package/client/components/sftp/file-read.js +81 -0
- package/client/components/sftp/list-table-ui.jsx +547 -0
- package/client/components/sftp/owner-list.js +97 -0
- package/client/components/sftp/paged-list.jsx +60 -0
- package/client/components/sftp/permission-render.jsx +42 -0
- package/client/components/sftp/sftp-entry.jsx +1069 -0
- package/client/components/sftp/sftp.styl +217 -0
- package/client/components/sftp/transfer-common.js +9 -0
- package/client/components/sftp/transfer-conflict.jsx +315 -0
- package/client/components/sftp/transfer-speed-format.js +60 -0
- package/client/components/sftp/transfer-tag.jsx +40 -0
- package/client/components/sftp/transfer-tag.styl +11 -0
- package/client/components/sftp/transfer.styl +55 -0
- package/client/components/sftp/transport-action.jsx +410 -0
- package/client/components/sftp/transport-entry.jsx +108 -0
- package/client/components/sftp/transport-types.js +8 -0
- package/client/components/sftp/transports-action.jsx +111 -0
- package/client/components/sftp/transports-ui.jsx +93 -0
- package/client/components/sftp/zip.js +42 -0
- package/client/components/sidebar/bookmark-select.jsx +48 -0
- package/client/components/sidebar/bookmark.jsx +82 -0
- package/client/components/sidebar/history.jsx +66 -0
- package/client/components/sidebar/index.jsx +230 -0
- package/client/components/sidebar/info-modal.jsx +250 -0
- package/client/components/sidebar/info.styl +27 -0
- package/client/components/sidebar/side-icon.jsx +25 -0
- package/client/components/sidebar/sidebar.styl +128 -0
- package/client/components/sidebar/transfer-history-modal.jsx +110 -0
- package/client/components/sidebar/transfer-history.styl +3 -0
- package/client/components/sidebar/transfer-list-control.jsx +205 -0
- package/client/components/sidebar/transfer-list.jsx +55 -0
- package/client/components/sidebar/transfer-modal.jsx +76 -0
- package/client/components/sidebar/transfer.styl +8 -0
- package/client/components/sidebar/transport-ui.jsx +109 -0
- package/client/components/tabs/index.jsx +320 -0
- package/client/components/tabs/tab.jsx +427 -0
- package/client/components/tabs/tabs.styl +220 -0
- package/client/components/tabs/window-control.jsx +55 -0
- package/client/components/terminal/attach-addon-custom.js +70 -0
- package/client/components/terminal/build-ls-term-id.js +5 -0
- package/client/components/terminal/index.jsx +1358 -0
- package/client/components/terminal/normal-buffer.jsx +33 -0
- package/client/components/terminal/term-search.jsx +224 -0
- package/client/components/terminal/term-search.styl +15 -0
- package/client/components/terminal/terminal-apis.js +31 -0
- package/client/components/terminal/terminal-interactive.jsx +148 -0
- package/client/components/terminal/terminal.styl +96 -0
- package/client/components/terminal/xterm-zmodem.js +48 -0
- package/client/components/terminal/zmodem-transfer.jsx +98 -0
- package/client/components/terminal/zmodem.styl +14 -0
- package/client/components/terminal-info/activity.jsx +54 -0
- package/client/components/terminal-info/base.jsx +25 -0
- package/client/components/terminal-info/content.jsx +101 -0
- package/client/components/terminal-info/data-cols-parser.jsx +50 -0
- package/client/components/terminal-info/disk.jsx +29 -0
- package/client/components/terminal-info/index.jsx +25 -0
- package/client/components/terminal-info/network.jsx +114 -0
- package/client/components/terminal-info/resource.jsx +80 -0
- package/client/components/terminal-info/run-cmd.jsx +273 -0
- package/client/components/terminal-info/terminal-info.styl +29 -0
- package/client/components/terminal-info/up.jsx +15 -0
- package/client/components/terminal-theme/index.jsx +264 -0
- package/client/components/terminal-theme/terminal-theme-list.styl +3 -0
- package/client/components/terminal-theme/theme-list.jsx +146 -0
- package/client/components/text-editor/text-editor-form.jsx +97 -0
- package/client/components/text-editor/text-editor.jsx +182 -0
- package/client/css/antd-overwrite.styl +14 -0
- package/client/css/basic.styl +38 -0
- package/client/css/includes/box.styl +154 -0
- package/client/css/includes/font-size.styl +6 -0
- package/client/css/includes/index.styl +3 -0
- package/client/css/includes/text.styl +31 -0
- package/client/css/includes/theme-default.styl +20 -0
- package/client/entry/basic.js +58 -0
- package/client/entry/index.jsx +15 -0
- package/client/entry/worker.js +137 -0
- package/client/store/address-bookmark.js +25 -0
- package/client/store/app-upgrade.js +23 -0
- package/client/store/batch-input-history.js +26 -0
- package/client/store/bookmark-group.js +128 -0
- package/client/store/bookmark.js +22 -0
- package/client/store/common.js +140 -0
- package/client/store/context-menu.js +23 -0
- package/client/store/db-upgrade.js +43 -0
- package/client/store/event.js +70 -0
- package/client/store/index.js +335 -0
- package/client/store/init-state.js +191 -0
- package/client/store/item.js +120 -0
- package/client/store/load-data.js +198 -0
- package/client/store/quick-command.js +43 -0
- package/client/store/session.js +54 -0
- package/client/store/setting.js +208 -0
- package/client/store/sidebar.js +48 -0
- package/client/store/sync.js +390 -0
- package/client/store/system-menu.js +120 -0
- package/client/store/tab.js +74 -0
- package/client/store/terminal-theme.js +116 -0
- package/client/store/transfer-history.js +27 -0
- package/client/store/transfer-list.js +20 -0
- package/client/store/ui-theme.js +71 -0
- package/client/store/watch.js +116 -0
- package/client/views/index.pug +58 -0
- package/package.json +34 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { PureComponent } from 'react'
|
|
2
|
+
import { CloseOutlined, MinusSquareOutlined, UpCircleOutlined } from '@ant-design/icons'
|
|
3
|
+
import { Button } from 'antd'
|
|
4
|
+
import { getLatestReleaseInfo, getLatestReleaseVersion } from '../../common/update-check'
|
|
5
|
+
import upgrade from '../../common/upgrade'
|
|
6
|
+
import compare from '../../../app/common/version-compare'
|
|
7
|
+
import Link from '../common/external-link'
|
|
8
|
+
import {
|
|
9
|
+
isMac,
|
|
10
|
+
isWin,
|
|
11
|
+
packInfo,
|
|
12
|
+
commonActions,
|
|
13
|
+
srcsSkipUpgradeCheck,
|
|
14
|
+
downloadUpgradeTimeout,
|
|
15
|
+
mirrors
|
|
16
|
+
} from '../../common/constants'
|
|
17
|
+
import newTerm from '../../common/new-terminal'
|
|
18
|
+
import Markdown from '../common/markdown'
|
|
19
|
+
import downloadMirrors from '../../common/download-mirrors'
|
|
20
|
+
import './upgrade.styl'
|
|
21
|
+
|
|
22
|
+
const { prefix } = window
|
|
23
|
+
const {
|
|
24
|
+
homepage
|
|
25
|
+
} = packInfo
|
|
26
|
+
const e = prefix('updater')
|
|
27
|
+
const c = prefix('common')
|
|
28
|
+
|
|
29
|
+
export default class Upgrade extends PureComponent {
|
|
30
|
+
state = {
|
|
31
|
+
showCount: 0,
|
|
32
|
+
mirror: mirrors.github
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
downloadTimer = null
|
|
36
|
+
|
|
37
|
+
componentDidMount () {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
getLatestReleaseVersion(1)
|
|
40
|
+
}, 5000)
|
|
41
|
+
this.watch()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentWillUnmount () {
|
|
45
|
+
this.unwatch()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
watch = () => {
|
|
49
|
+
window.addEventListener('message', this.onEvent)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
unwatch = () => {
|
|
53
|
+
window.removeEventListener('message', this.onEvent)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onEvent = (e) => {
|
|
57
|
+
if (e && e.data && e.data.action === commonActions.appUpdateCheck) {
|
|
58
|
+
this.setState(old => {
|
|
59
|
+
return {
|
|
60
|
+
showCount: old.showCount + 1
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
this.getLatestRelease(true)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
changeProps = (update) => {
|
|
68
|
+
window.store.storeAssign({
|
|
69
|
+
_upgradeInfo: JSON.stringify({
|
|
70
|
+
...this.props.upgradeInfo,
|
|
71
|
+
...update
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
handleMinimize = () => {
|
|
77
|
+
this.changeProps({
|
|
78
|
+
showUpgradeModal: false
|
|
79
|
+
})
|
|
80
|
+
window.store.focus()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
handleClose = () => {
|
|
84
|
+
window.store.storeAssign({
|
|
85
|
+
_upgradeInfo: '{}'
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onData = (upgradePercent) => {
|
|
90
|
+
clearTimeout(this.downloadTimer)
|
|
91
|
+
if (upgradePercent >= 100) {
|
|
92
|
+
this.update && this.update.destroy()
|
|
93
|
+
return this.close()
|
|
94
|
+
}
|
|
95
|
+
this.changeProps({
|
|
96
|
+
upgradePercent
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
onError = (e) => {
|
|
101
|
+
this.changeProps({
|
|
102
|
+
error: e.message
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
cancel = () => {
|
|
107
|
+
this.update && this.update.destroy()
|
|
108
|
+
this.changeProps({
|
|
109
|
+
upgrading: false,
|
|
110
|
+
upgradePercent: 0
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
timeout = () => {
|
|
115
|
+
const { mirror } = this.state
|
|
116
|
+
this.cancel()
|
|
117
|
+
const next = mirror === mirrors.github
|
|
118
|
+
? this.doUpgrade
|
|
119
|
+
: undefined
|
|
120
|
+
const nextMirror = mirror === mirrors.github
|
|
121
|
+
? mirrors.sourceforge
|
|
122
|
+
: mirrors.github
|
|
123
|
+
this.setState({
|
|
124
|
+
mirror: nextMirror
|
|
125
|
+
}, next)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
onEnd = () => {
|
|
129
|
+
this.close()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
doUpgrade = async () => {
|
|
133
|
+
const { installSrc } = this.props
|
|
134
|
+
if (!isMac && !isWin && installSrc === 'npm') {
|
|
135
|
+
return window.store.addTab(
|
|
136
|
+
{
|
|
137
|
+
...newTerm(),
|
|
138
|
+
loginScript: 'npm i -g electerm'
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
this.changeProps({
|
|
143
|
+
upgrading: true
|
|
144
|
+
})
|
|
145
|
+
const proxy = window.store.getProxySetting()
|
|
146
|
+
this.update = await upgrade({
|
|
147
|
+
mirror: this.state.mirror,
|
|
148
|
+
proxy,
|
|
149
|
+
onData: this.onData,
|
|
150
|
+
onEnd: this.onEnd,
|
|
151
|
+
onError: this.onError
|
|
152
|
+
})
|
|
153
|
+
this.downloadTimer = setTimeout(this.timeout, downloadUpgradeTimeout)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
handleSkipVersion = () => {
|
|
157
|
+
window.store.config.skipVersion = this.props.upgradeInfo.remoteVersion
|
|
158
|
+
this.close()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getLatestRelease = async (noSkipVersion = false) => {
|
|
162
|
+
const { installSrc } = this.props
|
|
163
|
+
if (srcsSkipUpgradeCheck.includes(installSrc)) {
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
this.changeProps({
|
|
167
|
+
checkingRemoteVersion: true,
|
|
168
|
+
error: ''
|
|
169
|
+
})
|
|
170
|
+
const releaseVer = await getLatestReleaseVersion()
|
|
171
|
+
this.changeProps({
|
|
172
|
+
checkingRemoteVersion: false
|
|
173
|
+
})
|
|
174
|
+
if (!releaseVer) {
|
|
175
|
+
return this.changeProps({
|
|
176
|
+
error: 'Can not get version info'
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
const { skipVersion = 'v0.0.0' } = this.props
|
|
180
|
+
const currentVer = 'v' + window.et.version.split('-')[0]
|
|
181
|
+
const latestVer = releaseVer.tag_name
|
|
182
|
+
if (!noSkipVersion && compare(skipVersion, latestVer) >= 0) {
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
const shouldUpgrade = compare(currentVer, latestVer) < 0
|
|
186
|
+
const canAutoUpgrade = installSrc || isWin || isMac
|
|
187
|
+
let releaseInfo
|
|
188
|
+
if (canAutoUpgrade) {
|
|
189
|
+
releaseInfo = await getLatestReleaseInfo()
|
|
190
|
+
}
|
|
191
|
+
this.changeProps({
|
|
192
|
+
shouldUpgrade,
|
|
193
|
+
releaseInfo,
|
|
194
|
+
remoteVersion: latestVer,
|
|
195
|
+
canAutoUpgrade,
|
|
196
|
+
showUpgradeModal: true
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
renderError = (err) => {
|
|
201
|
+
return (
|
|
202
|
+
<div className='upgrade-panel'>
|
|
203
|
+
<div className='upgrade-panel-title'>
|
|
204
|
+
<CloseOutlined className='pointer font16 close-upgrade-panel' onClick={this.handleClose} />
|
|
205
|
+
{e('fail')}: {err}
|
|
206
|
+
</div>
|
|
207
|
+
<div className='upgrade-panel-body'>
|
|
208
|
+
You can visit
|
|
209
|
+
<Link
|
|
210
|
+
to={homepage}
|
|
211
|
+
className='mg1x'
|
|
212
|
+
>{homepage}
|
|
213
|
+
</Link> to download new version.
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
renderCanNotUpgrade = () => {
|
|
220
|
+
const {
|
|
221
|
+
showUpgradeModal
|
|
222
|
+
} = this.props.upgradeInfo
|
|
223
|
+
const cls = `animate upgrade-panel${showUpgradeModal ? '' : ' upgrade-panel-hide'}`
|
|
224
|
+
return (
|
|
225
|
+
<div className={cls}>
|
|
226
|
+
<div className='upgrade-panel-title'>
|
|
227
|
+
<CloseOutlined className='pointer font16 close-upgrade-panel' onClick={this.handleClose} />
|
|
228
|
+
{e('noNeed')}
|
|
229
|
+
</div>
|
|
230
|
+
<div className='upgrade-panel-body'>
|
|
231
|
+
{e('noNeedDesc')}
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
renderChangeLog = () => {
|
|
238
|
+
const {
|
|
239
|
+
releaseInfo
|
|
240
|
+
} = this.props.upgradeInfo
|
|
241
|
+
if (!releaseInfo) {
|
|
242
|
+
return null
|
|
243
|
+
}
|
|
244
|
+
return (
|
|
245
|
+
<div className='pd1t'>
|
|
246
|
+
<div className='bold'>Changelog:</div>
|
|
247
|
+
<Markdown text={releaseInfo} />
|
|
248
|
+
<Link
|
|
249
|
+
to={packInfo.releases}
|
|
250
|
+
>{e('moreChangeLog')}
|
|
251
|
+
</Link>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
renderSkipVersion = () => {
|
|
257
|
+
return (
|
|
258
|
+
<Button
|
|
259
|
+
onClick={this.handleSkipVersion}
|
|
260
|
+
icon={<CloseOutlined />}
|
|
261
|
+
className='mg1l mg1b'
|
|
262
|
+
>
|
|
263
|
+
{e('skipThisVersion')}
|
|
264
|
+
</Button>
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
render () {
|
|
269
|
+
const {
|
|
270
|
+
showCount
|
|
271
|
+
} = this.state
|
|
272
|
+
const { installSrc } = this.props
|
|
273
|
+
const {
|
|
274
|
+
remoteVersion,
|
|
275
|
+
upgrading,
|
|
276
|
+
checkingRemoteVersion,
|
|
277
|
+
showUpgradeModal,
|
|
278
|
+
upgradePercent,
|
|
279
|
+
shouldUpgrade,
|
|
280
|
+
error
|
|
281
|
+
} = this.props.upgradeInfo
|
|
282
|
+
if (error) {
|
|
283
|
+
return this.renderError(error)
|
|
284
|
+
}
|
|
285
|
+
if (!shouldUpgrade && showCount < 2) {
|
|
286
|
+
return null
|
|
287
|
+
}
|
|
288
|
+
if (!shouldUpgrade && showCount > 1) {
|
|
289
|
+
return this.renderCanNotUpgrade()
|
|
290
|
+
}
|
|
291
|
+
if (checkingRemoteVersion) {
|
|
292
|
+
return null
|
|
293
|
+
}
|
|
294
|
+
const cls = `animate upgrade-panel${showUpgradeModal ? '' : ' upgrade-panel-hide'}`
|
|
295
|
+
const func = upgrading
|
|
296
|
+
? this.cancel
|
|
297
|
+
: this.doUpgrade
|
|
298
|
+
const getLink = (
|
|
299
|
+
<div>
|
|
300
|
+
<p>
|
|
301
|
+
{e('manuallyDownloadFrom')}:
|
|
302
|
+
{
|
|
303
|
+
downloadMirrors.map((d) => {
|
|
304
|
+
return (
|
|
305
|
+
<Link to={d.url} className='mg1l' key={d.url}>{d.name}</Link>
|
|
306
|
+
)
|
|
307
|
+
})
|
|
308
|
+
}
|
|
309
|
+
</p>
|
|
310
|
+
{this.renderChangeLog()}
|
|
311
|
+
</div>
|
|
312
|
+
)
|
|
313
|
+
const skip = srcsSkipUpgradeCheck.includes(installSrc)
|
|
314
|
+
return (
|
|
315
|
+
<div className={cls}>
|
|
316
|
+
<div className='upgrade-panel-title'>
|
|
317
|
+
<MinusSquareOutlined className='pointer font16 close-upgrade-panel' onClick={this.handleMinimize} />
|
|
318
|
+
{e('newVersion')} <b>{remoteVersion}</b>
|
|
319
|
+
</div>
|
|
320
|
+
<div className='upgrade-panel-body'>
|
|
321
|
+
{
|
|
322
|
+
!skip
|
|
323
|
+
? (
|
|
324
|
+
<div>
|
|
325
|
+
<Button
|
|
326
|
+
type='primary'
|
|
327
|
+
icon={<UpCircleOutlined />}
|
|
328
|
+
loading={checkingRemoteVersion}
|
|
329
|
+
disabled={checkingRemoteVersion}
|
|
330
|
+
onClick={func}
|
|
331
|
+
className='mg1b'
|
|
332
|
+
>
|
|
333
|
+
{
|
|
334
|
+
upgrading
|
|
335
|
+
? <span>{`${e('upgrading')}... ${upgradePercent || 0}% ${c('cancel')}`}</span>
|
|
336
|
+
: e('upgrade')
|
|
337
|
+
}
|
|
338
|
+
</Button>
|
|
339
|
+
{this.renderSkipVersion()}
|
|
340
|
+
<div className='pd1t'>
|
|
341
|
+
{getLink}
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
)
|
|
345
|
+
: getLink
|
|
346
|
+
}
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@require '../../css/includes/theme-default'
|
|
2
|
+
.upgrade-panel
|
|
3
|
+
position fixed
|
|
4
|
+
right 10px
|
|
5
|
+
bottom 10px
|
|
6
|
+
z-index 9999
|
|
7
|
+
background main
|
|
8
|
+
color text
|
|
9
|
+
box-shadow 0px 0px 5px 5px alpha(main, .25)
|
|
10
|
+
padding 0
|
|
11
|
+
width 440px
|
|
12
|
+
.upgrade-panel-hide
|
|
13
|
+
left -600px
|
|
14
|
+
top 400px
|
|
15
|
+
right auto
|
|
16
|
+
bottom auto
|
|
17
|
+
.close-upgrade-panel
|
|
18
|
+
position absolute
|
|
19
|
+
right 5px
|
|
20
|
+
top 8px
|
|
21
|
+
&:hover
|
|
22
|
+
color success
|
|
23
|
+
.upgrade-panel-title
|
|
24
|
+
.upgrade-panel-body
|
|
25
|
+
padding 10px 15px
|
|
26
|
+
.upgrade-panel-title
|
|
27
|
+
border-bottom 1px solid main-dark
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@require '../../css/includes/theme-default'
|
|
2
|
+
#container
|
|
3
|
+
min-width 600px
|
|
4
|
+
.common-err-desc
|
|
5
|
+
&:hover
|
|
6
|
+
text-overflow clip
|
|
7
|
+
overflow-x hidden
|
|
8
|
+
white-space pre
|
|
9
|
+
max-height 300px
|
|
10
|
+
overflow scroll
|
|
11
|
+
.sessions
|
|
12
|
+
margin-left 43px
|
|
13
|
+
.pinned .sessions
|
|
14
|
+
margin-left 343px
|
|
15
|
+
.error-wrapper
|
|
16
|
+
background main-light
|
|
17
|
+
height 100%
|
|
18
|
+
position fixed
|
|
19
|
+
color text
|
|
20
|
+
.init-wrap
|
|
21
|
+
.loading-data
|
|
22
|
+
position fixed
|
|
23
|
+
left 0
|
|
24
|
+
top 0
|
|
25
|
+
width 100%
|
|
26
|
+
height 100%
|
|
27
|
+
background-color main-light
|
|
28
|
+
.loading-data
|
|
29
|
+
text-align center
|
|
30
|
+
font-size 30px
|
|
31
|
+
color text
|
|
32
|
+
padding 50px
|
|
33
|
+
z-index 210
|
|
34
|
+
.ant-tag
|
|
35
|
+
border-radius 3px
|
|
36
|
+
padding 4px
|
|
37
|
+
font-size 14px
|
|
38
|
+
.loaded
|
|
39
|
+
.loading-data
|
|
40
|
+
display none
|
|
41
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@require '../../css/includes/theme-default'
|
|
2
|
+
.qm-list-wrap
|
|
3
|
+
max-height calc(100vh - 100px)
|
|
4
|
+
overflow-y scroll
|
|
5
|
+
.qm-wrap-tooltip
|
|
6
|
+
background main
|
|
7
|
+
position absolute
|
|
8
|
+
left 43px
|
|
9
|
+
right 0
|
|
10
|
+
color text
|
|
11
|
+
z-index 200
|
|
12
|
+
height auto
|
|
13
|
+
bottom 36px
|
|
14
|
+
background alpha(main-dark, .9)
|
|
15
|
+
.qm-pinned
|
|
16
|
+
.qm-wrap-tooltip
|
|
17
|
+
height 180px
|
|
18
|
+
.qm-list-wrap
|
|
19
|
+
max-height 100px
|
|
20
|
+
|
|
21
|
+
.fil-keyword
|
|
22
|
+
.fil-label
|
|
23
|
+
.qm-item
|
|
24
|
+
opacity .4
|
|
25
|
+
.qm-item
|
|
26
|
+
&.name-match
|
|
27
|
+
&.label-match
|
|
28
|
+
font-weight bold
|
|
29
|
+
opacity 1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* quick commands footer selection
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
PureComponent
|
|
7
|
+
} from 'react'
|
|
8
|
+
import {
|
|
9
|
+
Button
|
|
10
|
+
} from 'antd'
|
|
11
|
+
import classNames from 'classnames'
|
|
12
|
+
|
|
13
|
+
export default class QuickCommandsItem extends PureComponent {
|
|
14
|
+
handleSelect = (id) => {
|
|
15
|
+
this.props.onSelect(
|
|
16
|
+
this.props.item.id
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render () {
|
|
21
|
+
const { name, id, nameMatch, labelMatch } = this.props.item
|
|
22
|
+
const cls = classNames('qm-item mg1r mg1b', {
|
|
23
|
+
'name-match': nameMatch,
|
|
24
|
+
'label-match': labelMatch
|
|
25
|
+
})
|
|
26
|
+
return (
|
|
27
|
+
<Button
|
|
28
|
+
key={id}
|
|
29
|
+
className={cls}
|
|
30
|
+
onClick={this.handleSelect}
|
|
31
|
+
>
|
|
32
|
+
{name}
|
|
33
|
+
</Button>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import BookmarkTransport from '../setting-panel/bookmark-transport'
|
|
2
|
+
import download from '../../common/download'
|
|
3
|
+
import time from '../../../app/common/time'
|
|
4
|
+
import copy from 'json-deep-copy'
|
|
5
|
+
|
|
6
|
+
export default class QmTransport extends BookmarkTransport {
|
|
7
|
+
beforeUpload = async (file) => {
|
|
8
|
+
const { store } = this.props
|
|
9
|
+
const txt = await window.fs.readFileSync(file.path)
|
|
10
|
+
try {
|
|
11
|
+
const quickCommands = JSON.parse(txt)
|
|
12
|
+
const quickCommandsOld = copy(store.quickCommands)
|
|
13
|
+
const bmTreeOld = quickCommandsOld.reduce((p, v) => {
|
|
14
|
+
return {
|
|
15
|
+
...p,
|
|
16
|
+
[v.id]: v
|
|
17
|
+
}
|
|
18
|
+
}, {})
|
|
19
|
+
const add = []
|
|
20
|
+
const dbAdd = []
|
|
21
|
+
quickCommands.forEach(bg => {
|
|
22
|
+
if (!bmTreeOld[bg.id]) {
|
|
23
|
+
quickCommandsOld.push(bg)
|
|
24
|
+
add.push(bg)
|
|
25
|
+
dbAdd.push({
|
|
26
|
+
db: 'quickCommands',
|
|
27
|
+
obj: bg
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
store.storeAssign({
|
|
32
|
+
quickCommands: quickCommandsOld
|
|
33
|
+
})
|
|
34
|
+
store.batchDbAdd(dbAdd)
|
|
35
|
+
} catch (e) {
|
|
36
|
+
store.onError(e)
|
|
37
|
+
}
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
renderEdit () {
|
|
42
|
+
return null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
handleDownload = () => {
|
|
46
|
+
const { store } = this.props
|
|
47
|
+
const {
|
|
48
|
+
quickCommands
|
|
49
|
+
} = store
|
|
50
|
+
const txt = JSON.stringify(quickCommands, null, 2)
|
|
51
|
+
const stamp = time(undefined, 'YYYY-MM-DD-HH-mm-ss')
|
|
52
|
+
download('quickCommands-' + stamp + '.json', txt)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import QmTransportMod from './quick-command-transport-mod'
|
|
2
|
+
import { Component } from '../common/react-subx'
|
|
3
|
+
|
|
4
|
+
export default class QmTransport extends Component {
|
|
5
|
+
render () {
|
|
6
|
+
return (
|
|
7
|
+
<div className='pd1b'>
|
|
8
|
+
<QmTransportMod store={this.props.store} />
|
|
9
|
+
</div>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
}
|