Commit 51d5f055 authored by ibuler's avatar ibuler

[Update] 修改token

parent e0613f81
......@@ -26,6 +26,30 @@ export class ElementGuacamoleComponent implements OnInit {
private _logger: LogService) {
}
registerHost() {
if (this.remoteAppId) {
this._http.guacamole_add_remote_app(User.id, this.remoteAppId).subscribe(
data => {
const base = data.result;
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + DataStore.guacamole_token;
},
error => {
this._logger.error(error);
}
);
} else {
this._http.guacamole_add_asset(User.id, this.host.id, this.userid).subscribe(
data => {
const base = data.result;
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + DataStore.guacamole_token;
},
error2 => {
this._logger.error(error2);
}
);
}
}
ngOnInit() {
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
if (this.target) {
......@@ -43,6 +67,7 @@ export class ElementGuacamoleComponent implements OnInit {
data => {
// /guacamole/client will redirect to http://guacamole/#/client
DataStore.guacamole_token = data['authToken'];
this.registerHost();
},
error => {
this._logger.error(error);
......@@ -50,27 +75,8 @@ export class ElementGuacamoleComponent implements OnInit {
return null;
}
);
}
if (this.remoteAppId !== '') {
this._http.guacamole_add_remote_app(User.id, this.remoteAppId).subscribe(
data => {
const base = data.result;
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + DataStore.guacamole_token;
},
error => {
this._logger.error(error);
}
);
} else {
this._http.guacamole_add_asset(User.id, this.host.id, this.userid).subscribe(
data => {
const base = data.result;
this.target = document.location.origin + '/guacamole/#/client/' + base + '?token=' + DataStore.guacamole_token;
},
error2 => {
this._logger.error(error2);
}
);
this.registerHost();
}
NavList.List[this.index].Rdp = this.el.nativeElement;
......
......@@ -19,7 +19,7 @@ export class View {
closed: boolean;
host: any;
user: any;
remoteApp: any;
remoteApp: string;
room: string;
Rdp: any;
Term: any;
......
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