mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
* chore: remove nextjs-config * build fix * update readme * explicit nextjs env vars + remove feature-unrelated things and obsolete vars from config * full config removal * remove force-dynamic from pages * compile fix * restore claude-deleted tests * better .env.example --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
21 lines
705 B
TypeScript
21 lines
705 B
TypeScript
import { assertExistsAndNonEmptyString } from "./utils";
|
|
|
|
export const REFRESH_ACCESS_TOKEN_ERROR = "RefreshAccessTokenError" as const;
|
|
// 4 min is 1 min less than default authentic value. here we assume that authentic won't be set to access tokens < 4 min
|
|
export const REFRESH_ACCESS_TOKEN_BEFORE = 4 * 60 * 1000;
|
|
|
|
export const shouldRefreshToken = (accessTokenExpires: number): boolean => {
|
|
const timeLeft = accessTokenExpires - Date.now();
|
|
return timeLeft < REFRESH_ACCESS_TOKEN_BEFORE;
|
|
};
|
|
|
|
export const LOGIN_REQUIRED_PAGES = [
|
|
"/transcripts/[!new]",
|
|
"/browse(.*)",
|
|
"/rooms(.*)",
|
|
];
|
|
|
|
export const PROTECTED_PAGES = new RegExp(
|
|
LOGIN_REQUIRED_PAGES.map((page) => `^${page}$`).join("|"),
|
|
);
|