diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 4e85315..f309f05 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -12,11 +12,10 @@ export const Login: React.FC = () => { const pollIntervalRef = useRef(null); const navigate = useNavigate(); - // Check if already authenticated + // Check if already authenticated (ssl login check) useEffect(() => { checkAuth(); return () => { - // Cleanup polling on unmount if (pollIntervalRef.current) { clearInterval(pollIntervalRef.current); } @@ -34,35 +33,34 @@ export const Login: React.FC = () => { } }; - // Get the VNC URL (same host, port 6080) const getVncUrl = () => { const host = window.location.hostname; - return `http://${host}:6080/vnc.html?autoconnect=true&resize=scale`; + // autoconnect=true, resize=scale to fit, quality=9 for clear text + return `http://${host}:6080/vnc.html?autoconnect=true&resize=scale&quality=9`; }; - // Start VNC login const handleVncLogin = async () => { setError(''); setIsLoading(true); - setVncStatus('Starting browser...'); + setVncStatus('Initializing secure browser...'); try { + // Start the VNC session (SSL Login flow) const res = await axios.post(`${API_BASE_URL}/auth/start-vnc`); if (res.data.status === 'started') { setShowVnc(true); setIsLoading(false); - setVncStatus('Login on the browser below, then wait...'); + setVncStatus('Waiting for login...'); - // Start polling for login completion + // Poll for completion pollIntervalRef.current = window.setInterval(async () => { try { const checkRes = await axios.get(`${API_BASE_URL}/auth/check-vnc`); if (checkRes.data.logged_in) { - // Success! clearInterval(pollIntervalRef.current!); - setVncStatus('Success! Redirecting...'); + setVncStatus('Login successful! Redirecting...'); setTimeout(() => navigate('/'), 1000); } } catch (err) { @@ -74,12 +72,11 @@ export const Login: React.FC = () => { setIsLoading(false); } } catch (err: any) { - setError(err.response?.data?.detail || 'Failed to start VNC login'); + setError(err.response?.data?.detail || 'Failed to start login session'); setIsLoading(false); } }; - // Cancel VNC login const handleCancelVnc = async () => { if (pollIntervalRef.current) { clearInterval(pollIntervalRef.current); @@ -93,10 +90,8 @@ export const Login: React.FC = () => { setVncStatus(''); }; - // Manual sessionid login (fallback) const handleManualLogin = async () => { if (!sessionId.trim()) return; - setError(''); setIsLoading(true); @@ -121,48 +116,45 @@ export const Login: React.FC = () => { } }; - // VNC View + // Full Screen VNC View if (showVnc) { return ( -
- {/* Header */} -
+
+ {/* Floating Control Bar */} +
-
- - - -
-
-

Login to TikTok

-

{vncStatus}

-
+
+ Secure Browser Active
+
- {/* VNC Iframe */} -
-