Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
15bc1ba9
Unverified
Commit
15bc1ba9
authored
Jul 06, 2019
by
BaiJiangJie
Committed by
GitHub
Jul 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #78 from jumpserver/dev
Dev
parents
9e58a870
2e97efbc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
32 deletions
+40
-32
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+13
-2
guacamole.component.html
src/app/elements/guacamole/guacamole.component.html
+1
-1
guacamole.component.ts
src/app/elements/guacamole/guacamole.component.ts
+25
-28
environment.prod.ts
src/environments/environment.prod.ts
+1
-1
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
15bc1ba9
...
...
@@ -160,14 +160,25 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
onRightClick
(
event
,
treeId
,
treeNode
)
{
if
(
!
treeNode
||
treeNode
.
isParent
)
{
return
null
;
}
const
host
=
treeNode
.
meta
.
asset
;
if
(
host
.
protocol
.
toLowerCase
()
===
'rdp'
)
{
let
findSSHProtocol
=
false
;
const
protocols
=
host
.
protocols
||
[];
if
(
host
.
protocol
)
{
protocols
.
push
(
host
.
protocol
);
}
for
(
let
i
=
0
;
i
<
protocols
.
length
;
i
++
)
{
const
protocol
=
protocols
[
i
];
if
(
protocol
&&
protocol
.
startsWith
(
'ssh'
))
{
findSSHProtocol
=
true
;
}
}
if
(
!
findSSHProtocol
)
{
alert
(
'Windows 请使用Ctrl+Shift+Alt呼出侧边栏上传下载'
);
}
if
(
!
treeNode
&&
event
.
target
.
tagName
.
toLowerCase
()
!==
'button'
&&
$
(
event
.
target
).
parents
(
'a'
).
length
===
0
)
{
this
.
zTree
.
cancelSelectedNode
();
this
.
showRMenu
(
event
.
clientX
,
event
.
clientY
);
...
...
src/app/elements/guacamole/guacamole.component.html
View file @
15bc1ba9
<!--<iframe #rdp [src]="trust('https://inews.gtimg.com/newsapp_bt/0/3460971429/1000')" width="100%" height="100%" (mouseenter)="active()"></iframe>-->
<iframe
#
rdp
[
src
]="
trust
(
target
)"
width=
"100%"
height=
"100%"
(
mouseenter
)="
active
()"
></iframe>
<iframe
*
ngIf=
"target"
#
rdp
[
src
]="
trust
(
target
)"
width=
"100%"
height=
"100%"
(
mouseenter
)="
active
()"
></iframe>
src/app/elements/guacamole/guacamole.component.ts
View file @
15bc1ba9
...
...
@@ -18,6 +18,7 @@ export class ElementGuacamoleComponent implements OnInit {
@
Input
()
target
:
string
;
@
Input
()
index
:
number
;
@
ViewChild
(
'rdp'
)
el
:
ElementRef
;
registered
=
false
;
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
...
...
@@ -26,30 +27,44 @@ export class ElementGuacamoleComponent implements OnInit {
}
registerHost
()
{
let
action
:
any
;
if
(
this
.
remoteAppId
)
{
this
.
_http
.
guacamole_add_remote_app
(
User
.
id
,
this
.
remoteAppId
).
subscribe
(
action
=
this
.
_http
.
guacamole_add_remote_app
(
User
.
id
,
this
.
remoteAppId
);
}
else
{
action
=
this
.
_http
.
guacamole_add_asset
(
User
.
id
,
this
.
host
.
id
,
this
.
userid
);
}
action
.
subscribe
(
data
=>
{
const
base
=
data
.
result
;
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
NavList
.
List
[
this
.
index
].
Rdp
=
this
.
el
.
nativeElement
;
},
error
=>
{
this
.
_logger
.
error
(
error
);
if
(
!
this
.
registered
)
{
console
.
log
(
'Register host error, register token then connect'
);
this
.
registerToken
();
}
}
);
}
else
{
this
.
_http
.
guacamole_add_asset
(
User
.
id
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
}
registerToken
()
{
const
now
=
new
Date
();
const
nowTime
=
now
.
getTime
()
/
1000
;
this
.
registered
=
true
;
this
.
_http
.
get_guacamole_token
(
User
.
id
,
''
).
subscribe
(
data
=>
{
const
base
=
data
.
result
;
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
NavList
.
List
[
this
.
index
].
Rdp
=
this
.
el
.
nativeElement
;
// /guacamole/client will redirect to http://guacamole/#/client
DataStore
.
guacamole_token
=
data
[
'authToken'
];
DataStore
.
guacamole_token_time
=
nowTime
;
this
.
registerHost
();
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
error
=>
{
this
.
_logger
.
error
(
error
);
return
null
;
}
);
}
}
ngOnInit
()
{
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
...
...
@@ -63,26 +78,8 @@ export class ElementGuacamoleComponent implements OnInit {
NavList
.
List
[
this
.
index
].
Rdp
=
this
.
el
.
nativeElement
;
return
null
;
}
const
now
=
new
Date
();
const
nowTime
=
now
.
getTime
()
/
1000
;
if
(
!
DataStore
.
guacamole_token
||
nowTime
-
DataStore
.
guacamole_token_time
>
3600
)
{
this
.
_http
.
get_guacamole_token
(
User
.
id
,
''
).
subscribe
(
data
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
DataStore
.
guacamole_token
=
data
[
'authToken'
];
DataStore
.
guacamole_token_time
=
nowTime
;
this
.
registerHost
();
},
error
=>
{
this
.
_logger
.
error
(
error
);
alert
(
error
.
message
);
return
null
;
}
);
}
else
{
this
.
registerHost
();
}
}
trust
(
url
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
...
...
src/environments/environment.prod.ts
View file @
15bc1ba9
...
...
@@ -2,5 +2,5 @@ export const environment = {
production
:
true
};
// export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
export
const
version
=
'1.5.
0
-101 GPLv2.'
;
export
const
version
=
'1.5.
1
-101 GPLv2.'
;
// export const version = '1.4.1-{{BUILD_NUMBER}} GPLv2.';
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment