feat: First iteration, multi themes, I18N

This commit is contained in:
gauvainboiche
2026-10-08 11:58:18 +02:00
parent 9240fa3c3c
commit aa9721ac2a
53 changed files with 3363 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
// Thin wrapper over document.cookie. Values must already be cookie-safe
// (see storage.js, which base64url-encodes everything).
const ONE_YEAR = 60 * 60 * 24 * 365;
export function readCookie(name) {
const prefix = `${name}=`;
for (const part of document.cookie.split('; ')) {
if (part.startsWith(prefix)) return part.slice(prefix.length);
}
return null;
}
export function writeCookie(name, value) {
const secure = location.protocol === 'https:' ? '; Secure' : '';
document.cookie = `${name}=${value}; Max-Age=${ONE_YEAR}; Path=/; SameSite=Lax${secure}`;
}
export function removeCookie(name) {
document.cookie = `${name}=; Max-Age=0; Path=/; SameSite=Lax`;
}