Hello world

First open source release of Campfire 🎉
This commit is contained in:
Kevin McConnell
2025-08-15 11:02:42 +01:00
commit df76a227dc
664 changed files with 36235 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
export function getCookie(name) {
const cookies = document.cookie ? document.cookie.split("; ") : []
const prefix = `${encodeURIComponent(name)}=`
const cookie = cookies.find(cookie => cookie.startsWith(prefix))
if (cookie) {
const value = cookie.split("=").slice(1).join("=")
return value ? decodeURIComponent(value) : undefined
}
}
const twentyYears = 20 * 365 * 24 * 60 * 60 * 1000
export function setCookie(name, value) {
const body = [ name, value ].map(encodeURIComponent).join("=")
const expires = new Date(Date.now() + twentyYears).toUTCString()
const cookie = `${body}; path=/; expires=${expires}`
document.cookie = cookie
}