From 250979e2711d26684227461221f2eb9ebb1783ab Mon Sep 17 00:00:00 2001 From: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:55:37 +0000 Subject: [PATCH] Desktop Self-hosted guidance improvements (#5060) Removed timeout when waiting for backend port to allow for slow backend spinups image image image --- .../public/locales/en-GB/translation.toml | 9 +++- .../components/SetupWizard/LoginForm.tsx | 44 ++++++++++++++++++- .../components/SetupWizard/ModeSelection.tsx | 2 +- .../desktop/services/tauriBackendService.ts | 11 ++--- scripts/build-tauri-jlink.bat | 2 + scripts/build-tauri-jlink.sh | 1 + 6 files changed, 59 insertions(+), 10 deletions(-) diff --git a/frontend/public/locales/en-GB/translation.toml b/frontend/public/locales/en-GB/translation.toml index a1d055ecc..d1ef09e6f 100644 --- a/frontend/public/locales/en-GB/translation.toml +++ b/frontend/public/locales/en-GB/translation.toml @@ -5777,7 +5777,7 @@ description = "Sign in with your Stirling account" [setup.mode.selfhosted] title = "Self-Hosted Server" -description = "Connect to your own Stirling PDF server" +description = "Connect to your own Stirling PDF server with your personal account" [setup.saas] title = "Sign in to Stirling" @@ -5813,6 +5813,13 @@ submit = "Login" signInWith = "Sign in with" oauthPending = "Opening browser for authentication..." orContinueWith = "Or continue with email" +serverRequirement = "Note: The server must have login enabled." +showInstructions = "How to enable?" +hideInstructions = "Hide instructions" +instructions = "To enable login on your Stirling PDF server:" +instructionsEnvVar = "Set the environment variable:" +instructionsOrYml = "Or in settings.yml:" +instructionsRestart = "Then restart your server for the changes to take effect." [setup.login.username] label = "Username" diff --git a/frontend/src/desktop/components/SetupWizard/LoginForm.tsx b/frontend/src/desktop/components/SetupWizard/LoginForm.tsx index cee522cbf..4ad388822 100644 --- a/frontend/src/desktop/components/SetupWizard/LoginForm.tsx +++ b/frontend/src/desktop/components/SetupWizard/LoginForm.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Stack, TextInput, PasswordInput, Button, Text, Divider, Group } from '@mantine/core'; +import { Stack, TextInput, PasswordInput, Button, Text, Divider, Group, Collapse, Anchor, Box } from '@mantine/core'; import { useTranslation } from 'react-i18next'; import { authService } from '@app/services/authService'; import { STIRLING_SAAS_URL } from '@app/constants/connection'; @@ -19,6 +19,7 @@ export const LoginForm: React.FC = ({ serverUrl, isSaaS = false, const [password, setPassword] = useState(''); const [validationError, setValidationError] = useState(null); const [oauthLoading, setOauthLoading] = useState(false); + const [showInstructions, setShowInstructions] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -92,6 +93,47 @@ export const LoginForm: React.FC = ({ serverUrl, isSaaS = false, {t('setup.login.connectingTo', 'Connecting to:')} {isSaaS ? 'stirling.com' : serverUrl} + {/* Login requirement note for self-hosted servers */} + {!isSaaS && ( + + + {t('setup.login.serverRequirement', 'Note: The server must have login enabled.')}{' '} + setShowInstructions(!showInstructions)} + style={{ cursor: 'pointer' }} + > + {showInstructions + ? t('setup.login.hideInstructions', 'Hide instructions') + : t('setup.login.showInstructions', 'How to enable?')} + + + + + + + {t('setup.login.instructions', 'To enable login on your Stirling PDF server:')} + + + {t('setup.login.instructionsEnvVar', 'Set the environment variable:')} + + + SECURITY_ENABLELOGIN=true + + + {t('setup.login.instructionsOrYml', 'Or in settings.yml:')} + + + security.enableLogin: true + + + {t('setup.login.instructionsRestart', 'Then restart your server for the changes to take effect.')} + + + + + )} + {/* OAuth Login Buttons - Only show for SaaS */} {isSaaS && ( <> diff --git a/frontend/src/desktop/components/SetupWizard/ModeSelection.tsx b/frontend/src/desktop/components/SetupWizard/ModeSelection.tsx index 89de6d2f9..8242fa5ed 100644 --- a/frontend/src/desktop/components/SetupWizard/ModeSelection.tsx +++ b/frontend/src/desktop/components/SetupWizard/ModeSelection.tsx @@ -63,7 +63,7 @@ export const ModeSelection: React.FC = ({ onSelect, loading
{t('setup.mode.selfhosted.title', 'Self-Hosted Server')} - {t('setup.mode.selfhosted.description', 'Connect to your own Stirling PDF server')} + {t('setup.mode.selfhosted.description', 'Connect to your own Stirling PDF server with your personal account')}
diff --git a/frontend/src/desktop/services/tauriBackendService.ts b/frontend/src/desktop/services/tauriBackendService.ts index abd5dd236..7cd5c0942 100644 --- a/frontend/src/desktop/services/tauriBackendService.ts +++ b/frontend/src/desktop/services/tauriBackendService.ts @@ -101,8 +101,8 @@ export class TauriBackendService { return this.startPromise; } - private async waitForPort(maxAttempts = 30): Promise { - for (let i = 0; i < maxAttempts; i++) { + private async waitForPort(): Promise { + while (true) { try { const port = await invoke('get_backend_port'); if (port) { @@ -114,7 +114,6 @@ export class TauriBackendService { } await new Promise(resolve => setTimeout(resolve, 500)); } - throw new Error('Failed to detect backend port after 15 seconds'); } /** @@ -208,16 +207,14 @@ export class TauriBackendService { } } - private async waitForHealthy(maxAttempts = 60): Promise { - for (let i = 0; i < maxAttempts; i++) { + private async waitForHealthy(): Promise { + while (true) { const isHealthy = await this.checkBackendHealth(); if (isHealthy) { return; } await new Promise(resolve => setTimeout(resolve, 1000)); } - this.setStatus('unhealthy'); - throw new Error('Backend failed to become healthy after 60 seconds'); } /** diff --git a/scripts/build-tauri-jlink.bat b/scripts/build-tauri-jlink.bat index d3a73f058..16d143c10 100644 --- a/scripts/build-tauri-jlink.bat +++ b/scripts/build-tauri-jlink.bat @@ -20,6 +20,8 @@ if errorlevel 1 ( echo ✅ Java and jlink detected echo ▶ Building Stirling-PDF JAR... + +set DISABLE_ADDITIONAL_FEATURES=true call gradlew.bat clean bootJar --no-daemon if errorlevel 1 ( echo ❌ Failed to build Stirling-PDF JAR diff --git a/scripts/build-tauri-jlink.sh b/scripts/build-tauri-jlink.sh index 2b83bb87a..ef39615d1 100755 --- a/scripts/build-tauri-jlink.sh +++ b/scripts/build-tauri-jlink.sh @@ -60,6 +60,7 @@ fi # Clean and build the Stirling-PDF JAR print_step "Building Stirling-PDF JAR..." +export DISABLE_ADDITIONAL_FEATURES=true ./gradlew clean bootJar --no-daemon if [ ! -f compgen -G "app/core/build/libs/stirling-pdf-*.jar" ]; then