fix: update

parent fd19574a
......@@ -2,7 +2,7 @@ import {Component, Input, OnInit} from '@angular/core';
import {DomSanitizer} from '@angular/platform-browser';
import {NavList} from '../../ControlPage/control/control.component';
import {User, guacamole_token} from '../../globals';
import {User, guacamole} from '../../globals';
import {HttpService, LogService} from '../../app.service';
@Component({
......@@ -24,15 +24,15 @@ export class ElementIframeComponent implements OnInit {
ngOnInit() {
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
const base = window.btoa(this.host.hostname + '\0' + 'c' + '\0' + 'jumpserver');
if (guacamole_token) {
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + guacamole_token;
if (guacamole.token) {
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + 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'];
guacamole_token = data['authToken'];
guacamole.token = data['authToken'];
},
error2 => {
this._logger.error(error2);
......
......@@ -147,4 +147,4 @@ export let wsEvent: {
export const i18n = new Map();
export let guacamole_token: string;
export let guacamole: { token: string };
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