mirror of
https://github.com/iv-org/invidious.git
synced 2024-06-07 19:40:52 +00:00
Fix prefs cookies in player (#3276)
This commit is contained in:
parent
b0bb156918
commit
4c1a5f84fa
@ -259,7 +259,7 @@ function updateCookie(newVolume, newSpeed) {
|
|||||||
|
|
||||||
// Set expiration in 2 year
|
// Set expiration in 2 year
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setTime(date.getTime() + 63115200);
|
date.setFullYear(date.getFullYear() + 2);
|
||||||
|
|
||||||
var ipRegex = /^((\d+\.){3}\d+|[A-Fa-f0-9]*:[A-Fa-f0-9:]*:[A-Fa-f0-9:]+)$/;
|
var ipRegex = /^((\d+\.){3}\d+|[A-Fa-f0-9]*:[A-Fa-f0-9:]*:[A-Fa-f0-9:]+)$/;
|
||||||
var domainUsed = location.hostname;
|
var domainUsed = location.hostname;
|
||||||
@ -268,8 +268,10 @@ function updateCookie(newVolume, newSpeed) {
|
|||||||
if (domainUsed.charAt(0) !== '.' && !ipRegex.test(domainUsed) && domainUsed !== 'localhost')
|
if (domainUsed.charAt(0) !== '.' && !ipRegex.test(domainUsed) && domainUsed !== 'localhost')
|
||||||
domainUsed = '.' + location.hostname;
|
domainUsed = '.' + location.hostname;
|
||||||
|
|
||||||
document.cookie = 'PREFS=' + cookieData + '; SameSite=Strict; path=/; domain=' +
|
var secure = location.protocol.startsWith("https") ? " Secure;" : "";
|
||||||
domainUsed + '; expires=' + date.toGMTString() + ';';
|
|
||||||
|
document.cookie = 'PREFS=' + cookieData + '; SameSite=Lax; path=/; domain=' +
|
||||||
|
domainUsed + '; expires=' + date.toGMTString() + ';' + secure;
|
||||||
|
|
||||||
video_data.params.volume = volumeValue;
|
video_data.params.volume = volumeValue;
|
||||||
video_data.params.speed = speedValue;
|
video_data.params.speed = speedValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user