chore: sync local workspace changes
This commit is contained in:
@@ -21,6 +21,7 @@ export type AppConfig = {
|
||||
codexLiveMaxExecutionSeconds: number;
|
||||
codexLiveIdleTimeoutSeconds: number;
|
||||
receiveRoomNotifications: boolean;
|
||||
restartReservationCompletionDelaySeconds: number;
|
||||
};
|
||||
automation: {
|
||||
autoRefreshEnabled: boolean;
|
||||
@@ -76,6 +77,7 @@ export const DEFAULT_APP_CONFIG: AppConfig = {
|
||||
codexLiveMaxExecutionSeconds: 600,
|
||||
codexLiveIdleTimeoutSeconds: 180,
|
||||
receiveRoomNotifications: true,
|
||||
restartReservationCompletionDelaySeconds: 10,
|
||||
},
|
||||
automation: {
|
||||
autoRefreshEnabled: true,
|
||||
@@ -265,6 +267,14 @@ function normalizeCodexLiveIdleTimeoutSeconds(value: number | undefined, fallbac
|
||||
return Math.min(3600, Math.max(30, Math.round(value)));
|
||||
}
|
||||
|
||||
function normalizeRestartReservationCompletionDelaySeconds(value: number | undefined, fallback: number) {
|
||||
if (value === undefined || !Number.isFinite(value)) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return Math.min(300, Math.max(1, Math.round(value)));
|
||||
}
|
||||
|
||||
function normalizeBooleanValue(value: boolean | undefined, fallback: boolean) {
|
||||
if (typeof value !== 'boolean') {
|
||||
return fallback;
|
||||
@@ -300,6 +310,10 @@ function normalizeConfig(raw?: Partial<AppConfig>): AppConfig {
|
||||
chat?.receiveRoomNotifications,
|
||||
DEFAULT_APP_CONFIG.chat.receiveRoomNotifications,
|
||||
),
|
||||
restartReservationCompletionDelaySeconds: normalizeRestartReservationCompletionDelaySeconds(
|
||||
chat?.restartReservationCompletionDelaySeconds,
|
||||
DEFAULT_APP_CONFIG.chat.restartReservationCompletionDelaySeconds,
|
||||
),
|
||||
},
|
||||
automation: {
|
||||
autoRefreshEnabled: automation?.autoRefreshEnabled ?? DEFAULT_APP_CONFIG.automation.autoRefreshEnabled,
|
||||
@@ -423,6 +437,22 @@ function mergeAutomationNotificationSettings(
|
||||
});
|
||||
}
|
||||
|
||||
function getCurrentAppOrigin() {
|
||||
if (typeof window === 'undefined') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return window.location.origin;
|
||||
}
|
||||
|
||||
function getCurrentAppDomain() {
|
||||
if (typeof window === 'undefined') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return window.location.hostname;
|
||||
}
|
||||
|
||||
function emitConfigChange() {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
@@ -485,6 +515,17 @@ async function requestAppConfigOnce<T>(baseUrl: string, path: string, init?: Req
|
||||
headers.set('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
const appOrigin = getCurrentAppOrigin();
|
||||
const appDomain = getCurrentAppDomain();
|
||||
|
||||
if (appOrigin && !headers.has('X-App-Origin')) {
|
||||
headers.set('X-App-Origin', appOrigin);
|
||||
}
|
||||
|
||||
if (appDomain && !headers.has('X-App-Domain')) {
|
||||
headers.set('X-App-Domain', appDomain);
|
||||
}
|
||||
|
||||
let response: Response;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user