mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
fix: enhance sandbox compatibility checks in sdk-options and improve login view effect handling
- Added additional cloud storage path patterns for macOS and Linux to the checkSandboxCompatibility function, ensuring better compatibility with sandbox environments. - Revised the login view to simplify the initial server/session check logic, removing unnecessary ref guard and improving responsiveness during component unmounting.
This commit is contained in:
@@ -60,14 +60,21 @@ export function checkSandboxCompatibility(
|
|||||||
|
|
||||||
// Check for cloud storage paths that may not be compatible with sandbox
|
// Check for cloud storage paths that may not be compatible with sandbox
|
||||||
const cloudStoragePatterns = [
|
const cloudStoragePatterns = [
|
||||||
|
// macOS mounted volumes
|
||||||
/^\/Volumes\/GoogleDrive/i,
|
/^\/Volumes\/GoogleDrive/i,
|
||||||
/^\/Volumes\/Dropbox/i,
|
/^\/Volumes\/Dropbox/i,
|
||||||
/^\/Volumes\/OneDrive/i,
|
/^\/Volumes\/OneDrive/i,
|
||||||
/^\/Volumes\/iCloud/i,
|
/^\/Volumes\/iCloud/i,
|
||||||
|
// macOS home directory
|
||||||
/^\/Users\/[^/]+\/Google Drive/i,
|
/^\/Users\/[^/]+\/Google Drive/i,
|
||||||
/^\/Users\/[^/]+\/Dropbox/i,
|
/^\/Users\/[^/]+\/Dropbox/i,
|
||||||
/^\/Users\/[^/]+\/OneDrive/i,
|
/^\/Users\/[^/]+\/OneDrive/i,
|
||||||
/^\/Users\/[^/]+\/Library\/Mobile Documents/i, // iCloud
|
/^\/Users\/[^/]+\/Library\/Mobile Documents/i, // iCloud
|
||||||
|
// Linux home directory
|
||||||
|
/^\/home\/[^/]+\/Google Drive/i,
|
||||||
|
/^\/home\/[^/]+\/Dropbox/i,
|
||||||
|
/^\/home\/[^/]+\/OneDrive/i,
|
||||||
|
// Windows
|
||||||
/^C:\\Users\\[^\\]+\\Google Drive/i,
|
/^C:\\Users\\[^\\]+\\Google Drive/i,
|
||||||
/^C:\\Users\\[^\\]+\\Dropbox/i,
|
/^C:\\Users\\[^\\]+\\Dropbox/i,
|
||||||
/^C:\\Users\\[^\\]+\\OneDrive/i,
|
/^C:\\Users\\[^\\]+\\OneDrive/i,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* checking_setup → redirecting
|
* checking_setup → redirecting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useReducer, useEffect, useRef } from 'react';
|
import { useReducer, useEffect } from 'react';
|
||||||
import { useNavigate } from '@tanstack/react-router';
|
import { useNavigate } from '@tanstack/react-router';
|
||||||
import { login, getHttpApiClient, getServerUrlSync } from '@/lib/http-api-client';
|
import { login, getHttpApiClient, getServerUrlSync } from '@/lib/http-api-client';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@@ -232,13 +232,12 @@ export function LoginView() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const setAuthState = useAuthStore((s) => s.setAuthState);
|
const setAuthState = useAuthStore((s) => s.setAuthState);
|
||||||
const [state, dispatch] = useReducer(reducer, initialState);
|
const [state, dispatch] = useReducer(reducer, initialState);
|
||||||
const initialCheckDone = useRef(false);
|
|
||||||
|
|
||||||
// Run initial server/session check once on mount
|
// Run initial server/session check on mount.
|
||||||
|
// IMPORTANT: Do not "run once" via a ref guard here.
|
||||||
|
// In React StrictMode (dev), effects mount -> cleanup -> mount.
|
||||||
|
// If we abort in cleanup and also skip the second run, we'll get stuck forever on "Connecting...".
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialCheckDone.current) return;
|
|
||||||
initialCheckDone.current = true;
|
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
checkServerAndSession(dispatch, setAuthState, controller.signal);
|
checkServerAndSession(dispatch, setAuthState, controller.signal);
|
||||||
|
|
||||||
@@ -272,7 +271,6 @@ export function LoginView() {
|
|||||||
|
|
||||||
// Handle retry button for server errors
|
// Handle retry button for server errors
|
||||||
const handleRetry = () => {
|
const handleRetry = () => {
|
||||||
initialCheckDone.current = false;
|
|
||||||
dispatch({ type: 'RETRY_SERVER_CHECK' });
|
dispatch({ type: 'RETRY_SERVER_CHECK' });
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
checkServerAndSession(dispatch, setAuthState, controller.signal);
|
checkServerAndSession(dispatch, setAuthState, controller.signal);
|
||||||
|
|||||||
Reference in New Issue
Block a user