@electerm/electerm-react 2.13.0 → 2.13.6
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/components/rdp/rdp-session.jsx +24 -15
- package/client/components/rdp/rdp.styl +21 -1
- package/client/components/sftp/file-item.jsx +1 -0
- package/client/components/sftp/file-read.js +58 -3
- package/client/components/spice/spice-session.jsx +9 -6
- package/client/components/spice/spice.styl +27 -9
- package/client/components/tree-list/bookmark-toolbar.jsx +6 -2
- package/client/components/tree-list/tree-list.jsx +0 -5
- package/client/components/vnc/vnc-session.jsx +9 -5
- package/client/components/vnc/vnc.styl +17 -0
- package/package.json +1 -1
|
@@ -601,35 +601,44 @@ export default class RdpSession extends PureComponent {
|
|
|
601
601
|
|
|
602
602
|
render () {
|
|
603
603
|
const { width: w, height: h } = this.props
|
|
604
|
-
const rdpProps = {
|
|
605
|
-
style: {
|
|
606
|
-
width: w + 'px',
|
|
607
|
-
height: h + 'px'
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
604
|
const { width, height, loading, scaleViewport } = this.state
|
|
605
|
+
const innerWidth = w - 10
|
|
606
|
+
const innerHeight = h - 80
|
|
607
|
+
const wrapperStyle = {
|
|
608
|
+
width: innerWidth + 'px',
|
|
609
|
+
height: innerHeight + 'px',
|
|
610
|
+
overflow: scaleViewport ? 'hidden' : 'auto'
|
|
611
|
+
}
|
|
611
612
|
const canvasProps = {
|
|
612
613
|
width,
|
|
613
614
|
height,
|
|
614
615
|
tabIndex: 0
|
|
615
616
|
}
|
|
616
|
-
if (scaleViewport) {
|
|
617
|
-
canvasProps.className = 'scale-viewport'
|
|
618
|
-
}
|
|
619
617
|
const cls = `rdp-session-wrap session-v-wrap${scaleViewport ? ' scale-viewport' : ''}`
|
|
618
|
+
const sessProps = {
|
|
619
|
+
className: cls,
|
|
620
|
+
style: {
|
|
621
|
+
width: w + 'px',
|
|
622
|
+
height: h + 'px'
|
|
623
|
+
}
|
|
624
|
+
}
|
|
620
625
|
const controlProps = this.getControlProps()
|
|
621
626
|
return (
|
|
622
627
|
<Spin spinning={loading}>
|
|
623
628
|
<div
|
|
624
|
-
{...
|
|
625
|
-
className={cls}
|
|
629
|
+
{...sessProps}
|
|
626
630
|
>
|
|
627
631
|
{this.renderControl()}
|
|
628
|
-
<canvas
|
|
629
|
-
{...canvasProps}
|
|
630
|
-
ref={this.canvasRef}
|
|
631
|
-
/>
|
|
632
632
|
<RemoteFloatControl {...controlProps} />
|
|
633
|
+
<div
|
|
634
|
+
style={wrapperStyle}
|
|
635
|
+
className='rdp-scroll-wrapper s-scroll-wrapper'
|
|
636
|
+
>
|
|
637
|
+
<canvas
|
|
638
|
+
{...canvasProps}
|
|
639
|
+
ref={this.canvasRef}
|
|
640
|
+
/>
|
|
641
|
+
</div>
|
|
633
642
|
</div>
|
|
634
643
|
</Spin>
|
|
635
644
|
)
|
|
@@ -9,7 +9,27 @@
|
|
|
9
9
|
left: 0
|
|
10
10
|
width: 100%
|
|
11
11
|
&.scale-viewport
|
|
12
|
-
canvas
|
|
12
|
+
.rdp-scroll-wrapper canvas
|
|
13
13
|
width: 100% !important
|
|
14
|
+
height: 100% !important
|
|
14
15
|
object-fit: contain
|
|
15
16
|
|
|
17
|
+
.s-scroll-wrapper
|
|
18
|
+
&::-webkit-scrollbar
|
|
19
|
+
width 16px
|
|
20
|
+
height 16px
|
|
21
|
+
background var(--main-darker)
|
|
22
|
+
&::-webkit-scrollbar-track
|
|
23
|
+
background var(--main-darker)
|
|
24
|
+
box-shadow inset 0 0 5px var(--main-darker)
|
|
25
|
+
&::-webkit-scrollbar-thumb
|
|
26
|
+
background var(--primary)
|
|
27
|
+
border-radius 0
|
|
28
|
+
&::-webkit-scrollbar-corner
|
|
29
|
+
background var(--main-darker)
|
|
30
|
+
.rdp-scroll-wrapper
|
|
31
|
+
position relative
|
|
32
|
+
background var(--main)
|
|
33
|
+
z-index 299
|
|
34
|
+
|
|
35
|
+
|
|
@@ -22,6 +22,61 @@ export const getFileExt = fileName => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const modeDirectoryMask = 0o170000
|
|
26
|
+
const modeDirectoryValue = 0o040000
|
|
27
|
+
|
|
28
|
+
const toIsDirectory = (stat) => {
|
|
29
|
+
if (!stat) {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (typeof stat.isDirectory === 'function') {
|
|
34
|
+
return stat.isDirectory()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof stat.isDirectory === 'boolean') {
|
|
38
|
+
return stat.isDirectory
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof stat.type === 'string') {
|
|
42
|
+
return stat.type === 'd'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (typeof stat.type === 'number') {
|
|
46
|
+
return stat.type === 2
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (typeof stat.mode === 'number') {
|
|
50
|
+
return (stat.mode & modeDirectoryMask) === modeDirectoryValue
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const toIsSymbolicLink = (stat) => {
|
|
57
|
+
if (!stat) {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof stat.isSymbolicLink === 'function') {
|
|
62
|
+
return stat.isSymbolicLink()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (typeof stat.isSymbolicLink === 'boolean') {
|
|
66
|
+
return stat.isSymbolicLink
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (typeof stat.type === 'string') {
|
|
70
|
+
return stat.type === 'l'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (typeof stat.type === 'number') {
|
|
74
|
+
return stat.type === 3
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return false
|
|
78
|
+
}
|
|
79
|
+
|
|
25
80
|
export const getFolderFromFilePath = (filePath, isRemote) => {
|
|
26
81
|
const sep = isRemote ? '/' : window.pre.sep
|
|
27
82
|
const arr = filePath.split(sep)
|
|
@@ -54,8 +109,8 @@ export const getLocalFileInfo = async (filePath) => {
|
|
|
54
109
|
type: 'local',
|
|
55
110
|
...getFolderFromFilePath(filePath, false),
|
|
56
111
|
id: generate(),
|
|
57
|
-
isDirectory: statr
|
|
58
|
-
isSymbolicLink: stat
|
|
112
|
+
isDirectory: toIsDirectory(statr),
|
|
113
|
+
isSymbolicLink: toIsSymbolicLink(stat)
|
|
59
114
|
}
|
|
60
115
|
}
|
|
61
116
|
|
|
@@ -71,6 +126,6 @@ export const getRemoteFileInfo = async (sftp, filePath) => {
|
|
|
71
126
|
type: 'remote',
|
|
72
127
|
...getFolderFromFilePath(filePath, true),
|
|
73
128
|
id: generate(),
|
|
74
|
-
isDirectory: stat
|
|
129
|
+
isDirectory: toIsDirectory(stat)
|
|
75
130
|
}
|
|
76
131
|
}
|
|
@@ -269,20 +269,23 @@ export default class SpiceSession extends PureComponent {
|
|
|
269
269
|
}
|
|
270
270
|
const cls = `spice-session-wrap session-v-wrap${scaleViewport ? ' scale-viewport' : ''}`
|
|
271
271
|
const contrlProps = this.getControlProps()
|
|
272
|
+
const sessProps = {
|
|
273
|
+
className: cls,
|
|
274
|
+
style: {
|
|
275
|
+
width: w + 'px',
|
|
276
|
+
height: h + 'px'
|
|
277
|
+
}
|
|
278
|
+
}
|
|
272
279
|
return (
|
|
273
280
|
<Spin spinning={loading}>
|
|
274
281
|
<div
|
|
275
|
-
|
|
276
|
-
style={{
|
|
277
|
-
width: w + 'px',
|
|
278
|
-
height: h + 'px'
|
|
279
|
-
}}
|
|
282
|
+
{...sessProps}
|
|
280
283
|
>
|
|
281
284
|
{this.renderControl()}
|
|
282
285
|
<RemoteFloatControl {...contrlProps} />
|
|
283
286
|
<div
|
|
284
287
|
style={wrapperStyle}
|
|
285
|
-
className='spice-scroll-wrapper'
|
|
288
|
+
className='spice-scroll-wrapper s-scroll-wrapper'
|
|
286
289
|
>
|
|
287
290
|
<div
|
|
288
291
|
ref={this.domRef}
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
.spice-session-wrap
|
|
2
|
-
canvas
|
|
3
|
-
width: 100% !important
|
|
4
|
-
object-fit: contain
|
|
5
|
-
.spice-scroll-wrapper
|
|
6
|
-
display block
|
|
7
|
-
.spice-scroll-wrapper
|
|
1
|
+
.spice-session-wrap
|
|
8
2
|
display: flex
|
|
9
3
|
flex-direction: column
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
align-items: center
|
|
5
|
+
.session-v-info
|
|
6
|
+
position: relative
|
|
7
|
+
width: 100%
|
|
8
|
+
z-index: 300
|
|
9
|
+
&.scale-viewport
|
|
10
|
+
.spice-scroll-wrapper
|
|
11
|
+
display flex
|
|
12
|
+
align-items center
|
|
13
|
+
justify-content center
|
|
14
|
+
> div
|
|
15
|
+
width 100% !important
|
|
16
|
+
height 100% !important
|
|
17
|
+
display flex
|
|
18
|
+
align-items center
|
|
19
|
+
justify-content center
|
|
20
|
+
canvas
|
|
21
|
+
width 100% !important
|
|
22
|
+
height 100% !important
|
|
23
|
+
max-width 100% !important
|
|
24
|
+
max-height 100% !important
|
|
25
|
+
object-fit contain
|
|
26
|
+
.spice-scroll-wrapper
|
|
27
|
+
position relative
|
|
28
|
+
background var(--main)
|
|
29
|
+
z-index 299
|
|
@@ -23,7 +23,6 @@ export default function BookmarkToolbar (props) {
|
|
|
23
23
|
const {
|
|
24
24
|
onNewBookmark,
|
|
25
25
|
onNewBookmarkGroup,
|
|
26
|
-
onImport,
|
|
27
26
|
onExport,
|
|
28
27
|
onSshConfigs,
|
|
29
28
|
bookmarkGroups,
|
|
@@ -121,7 +120,12 @@ export default function BookmarkToolbar (props) {
|
|
|
121
120
|
},
|
|
122
121
|
{
|
|
123
122
|
label: e('import'),
|
|
124
|
-
onClick:
|
|
123
|
+
onClick: () => {
|
|
124
|
+
const fileInput = document.querySelector('.upload-bookmark-icon')
|
|
125
|
+
if (fileInput) {
|
|
126
|
+
fileInput.click()
|
|
127
|
+
}
|
|
128
|
+
},
|
|
125
129
|
icon: <ImportOutlined />
|
|
126
130
|
},
|
|
127
131
|
{
|
|
@@ -680,10 +680,6 @@ export default class ItemListTree extends Component {
|
|
|
680
680
|
)
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
handleImport = () => {
|
|
684
|
-
document.querySelector('.upload-bookmark-icon input')?.click()
|
|
685
|
-
}
|
|
686
|
-
|
|
687
683
|
handleExport = () => {
|
|
688
684
|
document.querySelector('.download-bookmark-icon')?.click()
|
|
689
685
|
}
|
|
@@ -697,7 +693,6 @@ export default class ItemListTree extends Component {
|
|
|
697
693
|
<NewButtonsGroup
|
|
698
694
|
onNewBookmark={this.handleNewBookmark}
|
|
699
695
|
onNewBookmarkGroup={this.handleNewBookmarkGroup}
|
|
700
|
-
onImport={this.handleImport}
|
|
701
696
|
onExport={this.handleExport}
|
|
702
697
|
onSshConfigs={this.handleSshConfigs}
|
|
703
698
|
bookmarkGroups={this.props.bookmarkGroups}
|
|
@@ -18,6 +18,7 @@ import Modal from '../common/modal'
|
|
|
18
18
|
import { copy } from '../../common/clipboard'
|
|
19
19
|
import VncForm from './vnc-form'
|
|
20
20
|
import RemoteFloatControl from '../common/remote-float-control'
|
|
21
|
+
import './vnc.styl'
|
|
21
22
|
|
|
22
23
|
// noVNC module imports — loaded dynamically
|
|
23
24
|
async function loadVncModule () {
|
|
@@ -602,14 +603,17 @@ export default class VncSession extends PureComponent {
|
|
|
602
603
|
className: 'vnc-session-wrap session-v-wrap'
|
|
603
604
|
}
|
|
604
605
|
const contrlProps = this.getControlProps()
|
|
606
|
+
const sessProps = {
|
|
607
|
+
className: 'vnc-session-wrap',
|
|
608
|
+
style: {
|
|
609
|
+
width: w + 'px',
|
|
610
|
+
height: h + 'px'
|
|
611
|
+
}
|
|
612
|
+
}
|
|
605
613
|
return (
|
|
606
614
|
<Spin spinning={loading}>
|
|
607
615
|
<div
|
|
608
|
-
|
|
609
|
-
style={{
|
|
610
|
-
width: w + 'px',
|
|
611
|
-
height: h + 'px'
|
|
612
|
-
}}
|
|
616
|
+
{...sessProps}
|
|
613
617
|
>
|
|
614
618
|
{this.renderControl()}
|
|
615
619
|
<RemoteFloatControl
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.vnc-session-wrap
|
|
2
|
+
display: flex
|
|
3
|
+
flex-direction: column
|
|
4
|
+
justify-content: center
|
|
5
|
+
align-items: center
|
|
6
|
+
.session-v-info
|
|
7
|
+
position: absolute
|
|
8
|
+
top: 0
|
|
9
|
+
left: 0
|
|
10
|
+
width: 100%
|
|
11
|
+
&.scale-viewport
|
|
12
|
+
.rdp-scroll-wrapper canvas
|
|
13
|
+
width: 100% !important
|
|
14
|
+
height: 100% !important
|
|
15
|
+
object-fit: contain
|
|
16
|
+
> div
|
|
17
|
+
background: transparent !important
|