scoresaber-reloadedv3/src/common/website-utils.ts
Liam 4b4e7f7f31
All checks were successful
Deploy SSR / deploy (push) Successful in 1m12s
add short time back to the build info
2024-09-13 21:19:59 +01:00

33 lines
743 B
TypeScript

/**
* Sets the player id cookie
*
* @param playerId the player id to set
*/
export function setPlayerIdCookie(playerId: string) {
document.cookie = `playerId=${playerId}`;
}
/**
* Gets if we're in production
*/
export function isProduction() {
return process.env.NODE_ENV === "production";
}
/**
* Gets the build information
*
* @returns the build information
*/
export function getBuildInformation() {
const buildId = process.env.NEXT_PUBLIC_BUILD_ID
? isProduction()
? process.env.NEXT_PUBLIC_BUILD_ID.slice(0, 7)
: "dev"
: "";
const buildTime = process.env.NEXT_PUBLIC_BUILD_TIME;
const buildTimeShort = process.env.NEXT_PUBLIC_BUILD_TIME_SHORT;
return { buildId, buildTime, buildTimeShort };
}