wip
This commit is contained in:
@@ -171,22 +171,24 @@ export function setupIpcHandlers(mainWindow: BrowserWindow): void {
|
||||
return { success: false, error: connectionResult.error };
|
||||
}
|
||||
logger.info('Browser connection established');
|
||||
|
||||
|
||||
const checkAuthUseCase = container.getCheckAuthenticationUseCase();
|
||||
if (checkAuthUseCase) {
|
||||
const authResult = await checkAuthUseCase.execute();
|
||||
const authResult = await checkAuthUseCase.execute({
|
||||
verifyPageContent: true,
|
||||
});
|
||||
if (authResult.isOk()) {
|
||||
const authState = authResult.unwrap();
|
||||
if (authState !== AuthenticationState.AUTHENTICATED) {
|
||||
logger.warn('Not authenticated - automation cannot proceed', { authState });
|
||||
logger.warn('Not authenticated or session expired - automation cannot proceed', { authState });
|
||||
return {
|
||||
success: false,
|
||||
error: 'Not authenticated. Please login first.',
|
||||
error: 'Not authenticated or session expired. Please login first.',
|
||||
authRequired: true,
|
||||
authState,
|
||||
};
|
||||
}
|
||||
logger.info('Authentication verified');
|
||||
logger.info('Authentication verified (cookies and page state)');
|
||||
} else {
|
||||
logger.warn('Auth check failed, proceeding anyway', { error: authResult.unwrapErr().message });
|
||||
}
|
||||
|
||||
@@ -142,10 +142,19 @@ export function App() {
|
||||
|
||||
if (result.success && result.sessionId) {
|
||||
setSessionId(result.sessionId);
|
||||
} else {
|
||||
setIsRunning(false);
|
||||
alert(`Failed to start automation: ${result.error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsRunning(false);
|
||||
|
||||
if ((result as any).authRequired) {
|
||||
const nextAuthState = (result as any).authState as AuthState | undefined;
|
||||
setAuthState(nextAuthState ?? 'EXPIRED');
|
||||
setAuthError(result.error ?? 'Authentication required before starting automation.');
|
||||
return;
|
||||
}
|
||||
|
||||
alert(`Failed to start automation: ${result.error}`);
|
||||
};
|
||||
|
||||
const handleStopAutomation = async () => {
|
||||
|
||||
Reference in New Issue
Block a user