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
b9e79367
Commit
b9e79367
authored
Mar 07, 2018
by
zheng liu
Browse files
Options
Browse Files
Download
Plain Diff
Merged in dev (pull request #58)
Dev
parents
fcd8d80e
28767ea6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
118 additions
and
19 deletions
+118
-19
control.component.html
src/app/ControlPage/control/control.component.html
+2
-2
app.module.ts
src/app/app.module.ts
+2
-0
guacamole.component.html
src/app/elements/guacamole/guacamole.component.html
+1
-0
guacamole.component.scss
src/app/elements/guacamole/guacamole.component.scss
+6
-0
guacamole.component.spec.ts
src/app/elements/guacamole/guacamole.component.spec.ts
+25
-0
guacamole.component.ts
src/app/elements/guacamole/guacamole.component.ts
+58
-0
iframe.component.ts
src/app/elements/iframe/iframe.component.ts
+22
-16
globals.ts
src/app/globals.ts
+2
-1
No files found.
src/app/ControlPage/control/control.component.html
View file @
b9e79367
...
...
@@ -7,9 +7,9 @@
[
index
]="
i
"
*
ngIf=
"m.type=='ssh'"
>
</app-element-term>
<app-element-
ifram
e
[
host
]="
m
.
host
"
<app-element-
guacamol
e
[
host
]="
m
.
host
"
[
userid
]="
m
.
user
.
id
"
[
index
]="
i
"
*
ngIf=
"m.type=='rdp'"
>
</app-element-
ifram
e>
</app-element-
guacamol
e>
</div>
src/app/app.module.ts
View file @
b9e79367
...
...
@@ -65,6 +65,7 @@ import {SettingPageTerminalComponent} from './setting-page/terminal/terminal.com
import
{
SettingPageS3Component
}
from
'./setting-page/s3/s3.component'
;
import
{
TransPipe
}
from
'./trans.pipe'
;
import
{
MAT_LABEL_GLOBAL_OPTIONS
}
from
'@angular/material'
;
import
{
ElementGuacamoleComponent
}
from
'./elements/guacamole/guacamole.component'
;
@
NgModule
({
imports
:
[
...
...
@@ -93,6 +94,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
ElementTableComponent
,
ElementLeftbarComponent
,
ElementOfooterComponent
,
ElementGuacamoleComponent
,
LoginComponent
,
SearchComponent
,
SearchFilter
,
...
...
src/app/elements/guacamole/guacamole.component.html
0 → 100644
View file @
b9e79367
<iframe
[
src
]="
trust
(
target
)"
></iframe>
src/app/elements/guacamole/guacamole.component.scss
0 → 100644
View file @
b9e79367
iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
background-color
:
white
;
}
src/app/elements/guacamole/guacamole.component.spec.ts
0 → 100644
View file @
b9e79367
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ElementGuacamoleComponent
}
from
'./guacamole.component'
;
describe
(
'ElementGuacamoleComponent'
,
()
=>
{
let
component
:
ElementGuacamoleComponent
;
let
fixture
:
ComponentFixture
<
ElementGuacamoleComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
ElementGuacamoleComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ElementGuacamoleComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/elements/guacamole/guacamole.component.ts
0 → 100644
View file @
b9e79367
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
DataStore
,
User
}
from
'../../globals'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
NavList
}
from
'../../ControlPage/control/control.component'
;
@
Component
({
selector
:
'app-element-guacamole'
,
templateUrl
:
'./guacamole.component.html'
,
styleUrls
:
[
'./guacamole.component.scss'
]
})
export
class
ElementGuacamoleComponent
implements
OnInit
{
@
Input
()
host
:
any
;
@
Input
()
userid
:
any
;
@
Input
()
index
:
number
;
target
:
string
;
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
_logger
:
LogService
)
{
}
ngOnInit
()
{
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
const
base
=
window
.
btoa
(
this
.
host
.
id
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
if
(
environment
.
production
)
{
if
(
DataStore
.
guacamole_token
)
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
}
else
{
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
data
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
DataStore
.
guacamole_token
=
data
[
'authToken'
];
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
}
}
else
{
this
.
target
=
this
.
_cookie
.
get
(
'guacamole'
);
}
}
trust
(
url
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
}
Disconnect
()
{
NavList
.
List
[
this
.
index
].
connected
=
false
;
}
}
src/app/elements/iframe/iframe.component.ts
View file @
b9e79367
...
...
@@ -2,8 +2,10 @@ import {Component, Input, OnInit} from '@angular/core';
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
NavList
}
from
'../../ControlPage/control/control.component'
;
import
{
User
,
guacamol
e
}
from
'../../globals'
;
import
{
User
,
DataStor
e
}
from
'../../globals'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
@
Component
({
selector
:
'app-element-iframe'
,
...
...
@@ -15,30 +17,34 @@ export class ElementIframeComponent implements OnInit {
@
Input
()
userid
:
any
;
@
Input
()
index
:
number
;
target
:
string
;
guacamole
=
guacamole
;
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
_logger
:
LogService
)
{
}
ngOnInit
()
{
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
const
base
=
window
.
btoa
(
this
.
host
.
hostname
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
if
(
this
.
guacamole
.
token
)
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
this
.
guacamole
.
token
;
const
base
=
window
.
btoa
(
this
.
host
.
id
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
if
(
environment
.
production
)
{
if
(
DataStore
.
guacamole_token
)
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
}
else
{
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
data
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
DataStore
.
guacamole_token
=
data
[
'authToken'
];
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
}
}
else
{
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
data
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
this
.
guacamole
.
token
=
data
[
'authToken'
];
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
this
.
target
=
this
.
_cookie
.
get
(
'guacamole'
);
}
}
...
...
src/app/globals.ts
View file @
b9e79367
...
...
@@ -104,6 +104,7 @@ export let DataStore: {
leftbarshow
:
boolean
;
windowsize
:
Array
<
number
>
;
autologin
:
boolean
;
guacamole_token
:
string
;
}
=
{
socket
:
io
.
connect
(),
Nav
:
[{}],
...
...
@@ -115,6 +116,7 @@ export let DataStore: {
leftbarshow
:
true
,
windowsize
:
[],
autologin
:
false
,
guacamole_token
:
''
};
export
let
CSRF
=
''
;
...
...
@@ -147,4 +149,3 @@ export let wsEvent: {
export
const
i18n
=
new
Map
();
export
let
guacamole
:
{
token
:
string
}
=
{
token
:
''
};
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