Commit fcd8d80e authored by zheng liu's avatar zheng liu

Merged in dev (pull request #57)

fix: update
parents 5d9f823f 2af98186
...@@ -15,6 +15,7 @@ export class ElementIframeComponent implements OnInit { ...@@ -15,6 +15,7 @@ export class ElementIframeComponent implements OnInit {
@Input() userid: any; @Input() userid: any;
@Input() index: number; @Input() index: number;
target: string; target: string;
guacamole = guacamole;
constructor(private sanitizer: DomSanitizer, constructor(private sanitizer: DomSanitizer,
private _http: HttpService, private _http: HttpService,
...@@ -24,15 +25,15 @@ export class ElementIframeComponent implements OnInit { ...@@ -24,15 +25,15 @@ export class ElementIframeComponent implements OnInit {
ngOnInit() { ngOnInit() {
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens // /guacamole/api/tokens will redirect to http://guacamole/api/tokens
const base = window.btoa(this.host.hostname + '\0' + 'c' + '\0' + 'jumpserver'); const base = window.btoa(this.host.hostname + '\0' + 'c' + '\0' + 'jumpserver');
if (guacamole.token) { if (this.guacamole.token) {
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + guacamole.token; this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + this.guacamole.token;
} else { } else {
this._http.get_guacamole_token(User.name, this.host.id, this.userid).subscribe( this._http.get_guacamole_token(User.name, this.host.id, this.userid).subscribe(
data => { data => {
// /guacamole/client will redirect to http://guacamole/#/client // /guacamole/client will redirect to http://guacamole/#/client
this.target = document.location.origin + this.target = document.location.origin +
'/guacamole/#/client/' + base + '?token=' + data['authToken']; '/guacamole/#/client/' + base + '?token=' + data['authToken'];
guacamole.token = data['authToken']; this.guacamole.token = data['authToken'];
}, },
error2 => { error2 => {
this._logger.error(error2); this._logger.error(error2);
......
...@@ -147,4 +147,4 @@ export let wsEvent: { ...@@ -147,4 +147,4 @@ export let wsEvent: {
export const i18n = new Map(); export const i18n = new Map();
export let guacamole: { token: string }; export let guacamole: { token: string } = {token: ''};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment