scoresaber-reloadedv3/src/common/website-utils.ts

33 lines
743 B
TypeScript
Raw Normal View History

/**
* Sets the player id cookie
*
* @param playerId the player id to set
*/
export function setPlayerIdCookie(playerId: string) {
document.cookie = `playerId=${playerId}`;
}
2024-09-13 19:52:27 +00:00
/**
* 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;
2024-09-13 20:19:59 +00:00
const buildTimeShort = process.env.NEXT_PUBLIC_BUILD_TIME_SHORT;
2024-09-13 19:52:27 +00:00
2024-09-13 20:19:59 +00:00
return { buildId, buildTime, buildTimeShort };
2024-09-13 19:52:27 +00:00
}