Add samesite=strict to all Cookie setting

This commit is contained in:
Isaac Connor 2020-10-07 11:26:18 -04:00
parent b683d5326a
commit 95b09ad182
6 changed files with 33 additions and 33 deletions

View File

@ -378,10 +378,10 @@ if ( currentView != 'none' && currentView != 'login' ) {
var flip = $j("#flip");
if ( flip.html() == 'keyboard_arrow_up' ) {
flip.html('keyboard_arrow_down');
Cookie.write('zmHeaderFlip', 'down', {duration: 10*365} );
Cookie.write('zmHeaderFlip', 'down', {duration: 10*365, samesite: 'strict'} );
} else {
flip.html('keyboard_arrow_up');
Cookie.write('zmHeaderFlip', 'up', {duration: 10*365} );
Cookie.write('zmHeaderFlip', 'up', {duration: 10*365, samesite: 'strict'} );
}
});
// Manage the web console filter bar minimize chevron
@ -390,10 +390,10 @@ if ( currentView != 'none' && currentView != 'login' ) {
var fbflip = $j("#fbflip");
if ( fbflip.html() == 'keyboard_arrow_up' ) {
fbflip.html('keyboard_arrow_down');
Cookie.write('zmFilterBarFlip', 'down', {duration: 10*365} );
Cookie.write('zmFilterBarFlip', 'down', {duration: 10*365, samesite: 'strict'} );
} else {
fbflip.html('keyboard_arrow_up');
Cookie.write('zmFilterBarFlip', 'up', {duration: 10*365} );
Cookie.write('zmFilterBarFlip', 'up', {duration: 10*365, samesite: 'strict'} );
$j('.chosen').chosen("destroy");
$j('.chosen').chosen();
}
@ -405,10 +405,10 @@ if ( currentView != 'none' && currentView != 'login' ) {
var mfbflip = $j("#mfbflip");
if ( mfbflip.html() == 'keyboard_arrow_up' ) {
mfbflip.html('keyboard_arrow_down');
Cookie.write('zmMonitorFilterBarFlip', 'up', {duration: 10*365} );
Cookie.write('zmMonitorFilterBarFlip', 'up', {duration: 10*365, samesite: 'strict'} );
} else {
mfbflip.html('keyboard_arrow_up');
Cookie.write('zmMonitorFilterBarFlip', 'down', {duration: 10*365} );
Cookie.write('zmMonitorFilterBarFlip', 'down', {duration: 10*365, samesite: 'strict'} );
$j('.chosen').chosen("destroy");
$j('.chosen').chosen();
}
@ -720,7 +720,7 @@ function setCookie(name, value, days) {
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=strict";
}
function getCookie(name) {

View File

@ -77,18 +77,18 @@ function changeSize() {
console.log('Did not find liveStream'+monitorData[monIdx].id);
}
$('scale').set('value', '');
Cookie.write('zmCycleScale', '', {duration: 10*365});
Cookie.write('zmCycleWidth', width, {duration: 10*365});
Cookie.write('zmCycleHeight', height, {duration: 10*365});
Cookie.write('zmCycleScale', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', width, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', height, {duration: 10*365, samesite: 'strict'});
} // end function changeSize()
function changeScale() {
var scale = $('scale').get('value');
$('width').set('value', 'auto');
$('height').set('value', 'auto');
Cookie.write('zmCycleScale', scale, {duration: 10*365});
Cookie.write('zmCycleWidth', 'auto', {duration: 10*365});
Cookie.write('zmCycleHeight', 'auto', {duration: 10*365});
Cookie.write('zmCycleScale', scale, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', 'auto', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', 'auto', {duration: 10*365, samesite: 'strict'});
var newWidth = ( monitorData[monIdx].width * scale ) / SCALE_BASE;
var newHeight = ( monitorData[monIdx].height * scale ) / SCALE_BASE;

View File

@ -177,9 +177,9 @@ function changeScale() {
alarmCue.html(renderAlarmCues(eventViewer));//just re-render alarmCues. skip ajax call
}
if ( scale == '0' ) {
Cookie.write('zmEventScaleAuto', 'auto', {duration: 10*365});
Cookie.write('zmEventScaleAuto', 'auto', {duration: 10*365, samesite: 'strict'});
} else {
Cookie.write('zmEventScale'+eventData.MonitorId, scale, {duration: 10*365});
Cookie.write('zmEventScale'+eventData.MonitorId, scale, {duration: 10*365, samesite: 'strict'});
Cookie.dispose('zmEventScaleAuto');
}
} // end function changeScale
@ -187,7 +187,7 @@ function changeScale() {
function changeReplayMode() {
var replayMode = $('replayMode').get('value');
Cookie.write('replayMode', replayMode, {duration: 10*365});
Cookie.write('replayMode', replayMode, {duration: 10*365, samesite: 'strict'});
refreshWindow();
}
@ -215,7 +215,7 @@ function changeRate() {
vid.playbackRate(rate/100);
}
}
Cookie.write('zmEventRate', rate, {duration: 10*365});
Cookie.write('zmEventRate', rate, {duration: 10*365, samesite: 'strict'});
} // end function changeRate
var streamParms = "view=request&request=stream&connkey="+connKey;
@ -265,7 +265,7 @@ function getCmdResponse( respObj, respText ) {
streamPause( );
} else {
$j('select[name="rate"]').val(streamStatus.rate*100);
Cookie.write('zmEventRate', streamStatus.rate*100, {duration: 10*365});
Cookie.write('zmEventRate', streamStatus.rate*100, {duration: 10*365, samesite: 'strict'});
streamPlay( );
}
$j('#progressValue').html(secsToTime(parseInt(streamStatus.progress)));
@ -341,7 +341,7 @@ function vjsPlay() { //catches if we change mode programatically
stopFastRev();
}
$j('select[name="rate"]').val(vid.playbackRate()*100);
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365, samesite: 'strict'});
streamPlay();
}
@ -368,7 +368,7 @@ function streamFastFwd( action ) {
setButtonState($('fastFwdBtn'), 'unavail');
}
$j('select[name="rate"]').val(vid.playbackRate()*100);
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365, samesite: 'strict'});
} else {
streamReq.send(streamParms+"&command="+CMD_FASTFWD);
}
@ -395,7 +395,7 @@ function stopFastRev() {
clearInterval(intervalRewind);
vid.playbackRate(1);
$j('select[name="rate"]').val(vid.playbackRate()*100);
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365, samesite: 'strict'});
revSpeed = .5;
}
@ -413,7 +413,7 @@ function streamFastRev( action ) {
}
clearInterval(intervalRewind);
$j('select[name="rate"]').val(-revSpeed*100);
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365, samesite: 'strict'});
intervalRewind = setInterval(function() {
if (vid.currentTime() <= 0) {
clearInterval(intervalRewind);
@ -1094,7 +1094,7 @@ function initPage() {
handleClick(event);
});
vid.on('volumechange', function() {
Cookie.write('volume', vid.volume(), {duration: 10*365});
Cookie.write('volume', vid.volume(), {duration: 10*365, samesite: 'strict'});
});
if ( Cookie.read('volume') != null ) {
vid.volume(Cookie.read('volume'));

View File

@ -24,7 +24,7 @@ function changeScale() {
img.css('width', newWidth + 'px');
img.css('height', newHeight + 'px');
}
Cookie.write('zmWatchScale', scale, {duration: 10*365});
Cookie.write('zmWatchScale', scale, {duration: 10*365, samesite: 'strict'});
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
if ( anchor ) {
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));

View File

@ -48,9 +48,9 @@ function selectLayout(element) {
if ( ! layout ) {
return;
}
Cookie.write('zmMontageLayout', layout_id, {duration: 10*365});
Cookie.write('zmMontageLayout', layout_id, {duration: 10*365, samesite: 'strict'});
if ( layouts[layout_id].Name != 'Freeform' ) { // 'montage_freeform.css' ) {
Cookie.write('zmMontageScale', '', {duration: 10*365});
Cookie.write('zmMontageScale', '', {duration: 10*365, samesite: 'strict'});
$('scale').set('value', '');
$('width').set('value', '0');
} else {
@ -133,9 +133,9 @@ function changeSize() {
}
}
$('scale').set('value', '');
Cookie.write('zmMontageScale', '', {duration: 10*365});
Cookie.write('zmMontageWidth', width, {duration: 10*365});
Cookie.write('zmMontageHeight', height, {duration: 10*365});
Cookie.write('zmMontageScale', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageWidth', width, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageHeight', height, {duration: 10*365, samesite: 'strict'});
jQuery("#zmMontageLayout option:selected").removeAttr("selected");
//selectLayout('#zmMontageLayout');
} // end function changeSize()
@ -147,9 +147,9 @@ function changeScale() {
var scale = $('scale').get('value');
$('width').set('value', '0'); //auto
$('height').set('value', '0'); //auto
Cookie.write('zmMontageScale', scale, {duration: 10*365});
Cookie.write('zmMontageWidth', '', {duration: 10*365});
Cookie.write('zmMontageHeight', '', {duration: 10*365});
Cookie.write('zmMontageScale', scale, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageWidth', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageHeight', '', {duration: 10*365, samesite: 'strict'});
if ( scale == '' ) {
selectLayout('#zmMontageLayout');
return;

View File

@ -38,7 +38,7 @@ function changeScale() {
newHeight = monitorHeight * scale / SCALE_BASE;
}
Cookie.write('zmWatchScale'+monitorId, scale, {duration: 10*365});
Cookie.write('zmWatchScale'+monitorId, scale, {duration: 10*365, samesite: 'strict'});
/*Stream could be an applet so can't use moo tools*/
var streamImg = $('liveStream'+monitorId);