2024-11-24 15:55:29 +01:00
|
|
|
// place files you want to import through the `$lib` alias in this folder.
|
|
|
|
|
|
|
|
import type { Cookies } from "@sveltejs/kit";
|
2024-11-24 17:36:02 +01:00
|
|
|
import { DateTime } from "luxon";
|
2024-11-24 15:55:29 +01:00
|
|
|
|
|
|
|
export const TOKEN_COOKIE_NAME = "__Host-pronounscc-token";
|
|
|
|
|
|
|
|
export const setToken = (cookies: Cookies, token: string) =>
|
|
|
|
cookies.set(TOKEN_COOKIE_NAME, token, { path: "/" });
|
|
|
|
export const clearToken = (cookies: Cookies) => cookies.delete(TOKEN_COOKIE_NAME, { path: "/" });
|
|
|
|
|
|
|
|
// TODO: change this to something we actually clearly have the rights to use
|
|
|
|
export const DEFAULT_AVATAR = "https://pronouns.cc/default/512.webp";
|
2024-11-24 17:36:02 +01:00
|
|
|
|
|
|
|
export const idTimestamp = (id: string) =>
|
|
|
|
DateTime.fromMillis(parseInt(id, 10) / (1 << 22) + 1_640_995_200_000);
|