Initial
This commit is contained in:
commit
2ca7a264b3
53 files changed
+7113
No files matched your search
@@ -0,0 +1,14 @@
|
||||
// This document exists only under the private cookie path.
|
||||
addEventListener("message", event => {
|
||||
if (event.origin !== location.origin || event.source !== parent || !event.ports[0]) return;
|
||||
const name="vzlet_demo_v1", next=event.data, port=event.ports[0];
|
||||
try {
|
||||
if(next!==null){
|
||||
if(typeof next!=="string" || !/^[a-zA-Z0-9_=-]{1,3500}$/.test(next)) throw Error("Некорректная позиция");
|
||||
document.cookie=name+"="+next+"; Path="+location.pathname+"; SameSite=Strict; Max-Age=2592000"+(location.protocol==="https:"?"; Secure":"");
|
||||
}
|
||||
const value=document.cookie.split("; ").find(item=>item.startsWith(name+"="))?.slice(name.length+1)||"";
|
||||
if(next!==null && value!==next)throw Error("Браузер заблокировал cookie");
|
||||
port.postMessage({value});
|
||||
} catch(err){port.postMessage({error:err.message});}
|
||||
});
|
||||
Reference in new issue
Block a user