setting token in light version

This commit is contained in:
Pawel Raczyk 2019-04-10 10:32:15 +02:00
parent c33a668f07
commit 9a9645829a
1 changed files with 14 additions and 2 deletions

View File

@ -78,6 +78,7 @@
<script type="module" crossorigin="anonymous"> <script type="module" crossorigin="anonymous">
// RFB holds the API to connect and communicate with a VNC server // RFB holds the API to connect and communicate with a VNC server
import RFB from './core/rfb.js'; import RFB from './core/rfb.js';
import * as WebUtil from './app/webutil.js';
let rfb; let rfb;
let desktopName; let desktopName;
@ -152,12 +153,23 @@
const host = readQueryVariable('host', window.location.hostname); const host = readQueryVariable('host', window.location.hostname);
let port = readQueryVariable('port', window.location.port); let port = readQueryVariable('port', window.location.port);
const password = readQueryVariable('password', ''); const password = readQueryVariable('password', '');
const path = readQueryVariable('path', 'websockify'); let path = readQueryVariable('path', 'websockify');
// | | | | | | // | | | | | |
// | | | Connect | | | // | | | Connect | | |
// v v v v v v // v v v v v v
// If a token variable is passed in, set the parameter in a cookie.
// This is used by nova-novncproxy.
let token = WebUtil.getConfigVar('token', null);
if (token) {
// if token is already present in the path we should use it
path = WebUtil.injectParamIfMissing(path, "token", token);
WebUtil.createCookie('token', token, 1)
}
status("Connecting"); status("Connecting");
// Build the websocket URL used to connect // Build the websocket URL used to connect