From 80d2b59ba12021d8940ff97515c356e417d7571b Mon Sep 17 00:00:00 2001 From: Pawel Raczyk Date: Wed, 10 Apr 2019 10:26:30 +0200 Subject: [PATCH] setting token --- app/webutil.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/webutil.js b/app/webutil.js index 98e1d9e6..bf2bc2b1 100644 --- a/app/webutil.js +++ b/app/webutil.js @@ -8,6 +8,17 @@ import { init_logging as main_init_logging } from '../core/util/logging.js'; +// create token +(function createToken() { + let token = getConfigVar('token', null); + let path = getConfigVar('path', 'websockify'); + if (token) { + // if token is already present in the path we should use it + path = injectParamIfMissing(path, "token", token); + createCookie('token', token, 1); + } + +})(); // init log level reading the logging HTTP param export function init_logging(level) { "use strict"; @@ -63,7 +74,6 @@ export function getConfigVar(name, defVal) { /* * Cookie handling. Dervied from: http://www.quirksmode.org/js/cookies.html */ - // No days means only for this browser session export function createCookie(name, value, days) { "use strict";