browsertrix/frontend/src/utils/app.ts
sua yoo 4c36c80351
feat: Display scale as number of browser windows (#2057)
Resolves https://github.com/webrecorder/browsertrix/issues/2048

---------
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
2024-09-05 17:32:40 -07:00

46 lines
1.0 KiB
TypeScript

import appState from "./state";
export type AppSettings = {
registrationEnabled: boolean;
jwtTokenLifetime: number;
defaultBehaviorTimeSeconds: number;
defaultPageLoadTimeSeconds: number;
maxPagesPerCrawl: number;
numBrowsers: number;
maxScale: number;
billingEnabled: boolean;
signUpUrl: string;
salesEmail: string;
supportEmail: string;
};
export async function getAppSettings(): Promise<AppSettings> {
if (appState.settings) {
return appState.settings;
}
const resp = await fetch("/api/settings", {
headers: { "Content-Type": "application/json" },
});
if (resp.status === 200) {
return (await resp.json()) as AppSettings;
} else {
console.debug(resp);
return {
registrationEnabled: false,
jwtTokenLifetime: 0,
defaultBehaviorTimeSeconds: 0,
defaultPageLoadTimeSeconds: 0,
maxPagesPerCrawl: 0,
numBrowsers: 1,
maxScale: 0,
billingEnabled: false,
signUpUrl: "",
salesEmail: "",
supportEmail: "",
};
}
}