summaryrefslogtreecommitdiff
path: root/web/js/stream.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-11-07 05:28:10 +0300
committerDevaev Maxim <[email protected]>2018-11-07 05:28:10 +0300
commita319320152b5a6e9fcf95867b9030e101497857a (patch)
treec42cdd4b4bb63a86a174bd4de99799c9cfad626a /web/js/stream.js
parente9dad49ec4e538eddcd61232465854476d555e2d (diff)
using key cookie to determine client_id
Diffstat (limited to 'web/js/stream.js')
-rw-r--r--web/js/stream.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/web/js/stream.js b/web/js/stream.js
index f48dabff..041176c3 100644
--- a/web/js/stream.js
+++ b/web/js/stream.js
@@ -6,6 +6,7 @@ function Stream() {
var __prev_state = false;
var __resolution = {width: 640, height: 480};
var __size_factor = 1;
+ var __key = tools.makeId();
var __client_id = "";
var __fps = -1;
@@ -60,6 +61,8 @@ function Stream() {
$("stream-screenshot-button").disabled = true;
__setStreamerControlsDisabled(true);
__updateStreamHeader(false);
+ __key = tools.makeId();
+ __client_id = "";
__fps = -1;
__prev_state = false;
}
@@ -90,9 +93,10 @@ function Stream() {
}
}
- var client_id = tools.getCookie("stream_client_id");
- if (client_id) {
- __client_id = client_id;
+ var stream_client = tools.getCookie("stream_client");
+ if (!__client_id && stream_client && stream_client.startsWith(__key + "/")) {
+ tools.info("Stream: found acceptable stream_client cookie:", stream_client);
+ __client_id = stream_client.slice(stream_client.indexOf("/") + 1);
}
if (response.stream.clients_stat.hasOwnProperty(__client_id)) {
@@ -104,7 +108,7 @@ function Stream() {
__updateStreamHeader(true);
if (!__prev_state) {
- var path = "/streamer/stream?t=" + new Date().getTime();
+ var path = "/streamer/stream?key=" + __key;
if (tools.browser.is_chrome || tools.browser.is_blink) {
// uStreamer fix for Blink https://bugs.chromium.org/p/chromium/issues/detail?id=527446
tools.info("Stream: using advance_headers=1 to fix Blink MJPG bugs");