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
9f0b3b42
Unverified
Commit
9f0b3b42
authored
Dec 04, 2019
by
BaiJiangJie
Committed by
GitHub
Dec 04, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #133 from jumpserver/1.5.5
[Update] 修改支持guacamole闲时超时
parents
457a6d5a
73909059
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
10 deletions
+44
-10
proxy.conf.json
proxy.conf.json
+1
-1
guacamole.component.html
src/app/elements/guacamole/guacamole.component.html
+3
-0
guacamole.component.scss
src/app/elements/guacamole/guacamole.component.scss
+6
-0
guacamole.component.ts
src/app/elements/guacamole/guacamole.component.ts
+31
-8
model.ts
src/app/model.ts
+1
-0
zh.json
src/assets/i18n/zh.json
+2
-1
No files found.
proxy.conf.json
View file @
9f0b3b42
...
...
@@ -13,7 +13,7 @@
"secure"
:
false
},
"/guacamole/"
:
{
"target"
:
"http://127.0.0.1:808
3
"
,
"target"
:
"http://127.0.0.1:808
1
"
,
"secure"
:
false
,
"ws"
:
true
,
"pathRewrite"
:
{
...
...
src/app/elements/guacamole/guacamole.component.html
View file @
9f0b3b42
<div
class=
"rdpIframe"
>
<iframe
#
rdpRef
*
ngIf=
"target"
[
src
]="
trust
(
target
)"
width=
"100%"
height=
"100%"
(
mouseenter
)="
active
()"
></iframe>
<div
*
ngIf=
"isIdleTimeout"
class=
"idleTimeout"
>
{{ idleTimeoutMsg | trans }}
</div>
</div>
src/app/elements/guacamole/guacamole.component.scss
View file @
9f0b3b42
...
...
@@ -6,3 +6,9 @@ iframe {
.rdpIframe
{
height
:
100%
;
}
.idleTimeout
{
padding
:
50px
;
color
:
red
;
font-size
:
30px
;
}
src/app/elements/guacamole/guacamole.component.ts
View file @
9f0b3b42
import
{
Component
,
ElementRef
,
Input
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
HttpService
,
LogService
}
from
'@app/services'
;
import
{
HttpService
,
LogService
,
SettingService
}
from
'@app/services'
;
import
{
DataStore
,
User
}
from
'@app/globals'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
View
}
from
'@app/model'
;
...
...
@@ -19,16 +19,22 @@ export class ElementGuacamoleComponent implements OnInit {
@
Input
()
index
:
number
;
@
ViewChild
(
'rdpRef'
)
el
:
ElementRef
;
registered
=
false
;
iframeWindow
:
any
;
idleTimeout
:
number
;
idleTTL
=
1000
*
3600
;
isIdleTimeout
=
false
;
idleTimeoutMsg
=
'Idle timeout, connection has been disconnected'
;
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
settingSvc
:
SettingService
,
private
_logger
:
LogService
)
{
this
.
idleTTL
=
this
.
settingSvc
.
globalSetting
.
SECURITY_MAX_IDLE_TIME
*
60
*
1000
;
}
registerHost
()
{
let
action
:
any
;
console
.
log
(
this
.
sysUser
);
if
(
this
.
remoteAppId
)
{
action
=
this
.
_http
.
guacamoleAddRemoteApp
(
User
.
id
,
this
.
remoteAppId
,
this
.
sysUser
.
id
,
this
.
sysUser
.
username
,
this
.
sysUser
.
password
);
}
else
{
...
...
@@ -38,6 +44,7 @@ export class ElementGuacamoleComponent implements OnInit {
data
=>
{
const
base
=
data
.
result
;
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamoleToken
;
setTimeout
(()
=>
this
.
setIdleTimeout
(),
500
);
},
error
=>
{
if
(
!
this
.
registered
)
{
...
...
@@ -73,15 +80,31 @@ export class ElementGuacamoleComponent implements OnInit {
if
(
this
.
target
)
{
return
null
;
}
// if (!environment.production) {
// this.target = this._cookie.get('guacamole');
// NavList.List[this.index].Rdp = this.el.nativeElement;
// return null;
// }
this
.
registerHost
();
}
setIdleTimeout
()
{
this
.
iframeWindow
=
this
.
el
.
nativeElement
.
contentWindow
;
this
.
resetIdleTimeout
();
this
.
iframeWindow
.
onclick
=
()
=>
this
.
resetIdleTimeout
();
this
.
iframeWindow
.
onkeyup
=
()
=>
this
.
resetIdleTimeout
();
console
.
log
(
this
.
iframeWindow
);
}
resetIdleTimeout
()
{
if
(
this
.
idleTimeout
)
{
clearTimeout
(
this
.
idleTimeout
);
this
.
idleTimeout
=
null
;
}
this
.
idleTimeout
=
setTimeout
(()
=>
this
.
disconnect
(),
this
.
idleTTL
);
}
disconnect
()
{
this
.
_logger
.
debug
(
'Disconnect guacamole'
);
this
.
target
=
''
;
this
.
isIdleTimeout
=
true
;
}
trust
(
url
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
}
...
...
src/app/model.ts
View file @
9f0b3b42
...
...
@@ -188,6 +188,7 @@ export class Monitor {
export
class
GlobalSetting
{
WINDOWS_SKIP_ALL_MANUAL_PASSWORD
:
boolean
;
SECURITY_MAX_IDLE_TIME
:
number
;
}
export
class
Setting
{
...
...
src/assets/i18n/zh.json
View file @
9f0b3b42
...
...
@@ -79,5 +79,6 @@
"rows"
:
"行数"
,
"favorite"
:
"收藏"
,
"disfavor"
:
"取消收藏"
,
"success"
:
"成功"
"success"
:
"成功"
,
"idle timeout, connection has been disconnected"
:
"空闲超时,链接已断开"
}
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