Commit b5651bef authored by ibuler's avatar ibuler

[Update] 设置guacamole注册申请的token

parent e1a91142
......@@ -63,11 +63,14 @@ export class ElementGuacamoleComponent implements OnInit {
NavList.List[this.index].Rdp = this.el.nativeElement;
return null;
}
if (!DataStore.guacamole_token) {
const now = new Date();
const nowTime = now.getTime() / 1000;
if (!DataStore.guacamole_token || nowTime - DataStore.guacamole_token_time > 3600) {
this._http.get_guacamole_token(User.id, '').subscribe(
data => {
// /guacamole/client will redirect to http://guacamole/#/client
DataStore.guacamole_token = data['authToken'];
DataStore.guacamole_token_time = nowTime;
this.registerHost();
},
error => {
......
......@@ -91,6 +91,7 @@ export let DataStore: {
windowsize: Array<number>;
autologin: boolean;
guacamole_token: string;
guacamole_token_time: number;
} = {
socket: io.connect(),
Nav: [{}],
......@@ -102,7 +103,8 @@ export let DataStore: {
leftbarshow: true,
windowsize: [],
autologin: false,
guacamole_token: ''
guacamole_token: '',
guacamole_token_time: 0
};
export let CSRF = '';
......
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