fix(styles): persist accent cookies on localhost
This commit is contained in:
@@ -588,7 +588,7 @@
|
|||||||
},
|
},
|
||||||
"packages/styles": {
|
"packages/styles": {
|
||||||
"name": "@wrnexus/styles",
|
"name": "@wrnexus/styles",
|
||||||
"version": "0.8.10",
|
"version": "0.8.14",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@wrnexus/core": "workspace:*",
|
"@wrnexus/core": "workspace:*",
|
||||||
"@wrnexus/plugin": "workspace:*",
|
"@wrnexus/plugin": "workspace:*",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@wrnexus/styles",
|
"name": "@wrnexus/styles",
|
||||||
"version": "0.8.13",
|
"version": "0.8.14",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -667,7 +667,12 @@ export function renderThemeRuntime(theme: ResolvedTheme): string {
|
|||||||
options=options||{};
|
options=options||{};
|
||||||
var path=options.path||"/";
|
var path=options.path||"/";
|
||||||
var sameSite=options.sameSite||"Lax";
|
var sameSite=options.sameSite||"Lax";
|
||||||
var domain=options.domain?";domain="+options.domain:"";
|
// localhost is not a registrable parent domain. Some browsers reject a
|
||||||
|
// Domain=localhost cookie entirely, so keep it host-only in local dev.
|
||||||
|
var configuredDomain=options.domain;
|
||||||
|
var domain=configuredDomain&&configuredDomain!=="localhost"
|
||||||
|
?";domain="+configuredDomain
|
||||||
|
:"";
|
||||||
var secure=options.secure===true||(options.secure!==false&&location.protocol==="https:")?";secure":"";
|
var secure=options.secure===true||(options.secure!==false&&location.protocol==="https:")?";secure":"";
|
||||||
return ";path="+path+";samesite="+sameSite+domain+secure;
|
return ";path="+path+";samesite="+sameSite+domain+secure;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ describe("theme accents", () => {
|
|||||||
expect(runtime).toContain('"domain":"localhost"');
|
expect(runtime).toContain('"domain":"localhost"');
|
||||||
expect(runtime).toContain("deleteCookie(ACCENT_COOKIE);");
|
expect(runtime).toContain("deleteCookie(ACCENT_COOKIE);");
|
||||||
expect(runtime).toContain("writeCookie(ACCENT_COOKIE,name,ACCENT_COOKIE_OPTIONS)");
|
expect(runtime).toContain("writeCookie(ACCENT_COOKIE,name,ACCENT_COOKIE_OPTIONS)");
|
||||||
|
expect(runtime).toContain('configuredDomain!=="localhost"');
|
||||||
expect(runtime).not.toContain("setInterval(syncSharedAccent");
|
expect(runtime).not.toContain("setInterval(syncSharedAccent");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user