From dc6daaad0dac39732dec981e457031167cf809fd Mon Sep 17 00:00:00 2001 From: Ludy Date: Fri, 6 Feb 2026 11:44:42 +0100 Subject: [PATCH] feat(desktop): show and reuse last used server URL in Setup Wizard (#5659) # Description of Changes This pull request enhances the server selection experience in the setup wizard by remembering and displaying the last used server URL. Users can now quickly reuse their previous server connection, improving usability and reducing repetitive input. **Server selection improvements:** * The last used server URL is now stored in `localStorage` and automatically displayed as a quick-select button in the `ServerSelection` component, allowing users to easily reconnect to their previous server. [[1]](diffhunk://#diff-3a9a7d483f3f7789dbe410067f4401aea5898ad6692755c63e7787585b923151R19-R25) [[2]](diffhunk://#diff-3a9a7d483f3f7789dbe410067f4401aea5898ad6692755c63e7787585b923151R212-R223) [[3]](diffhunk://#diff-3a9a7d483f3f7789dbe410067f4401aea5898ad6692755c63e7787585b923151R38) * A new translation string `useLast` was added to `frontend/public/locales/en-GB/translation.toml` to support the "Last used server" button label. image --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --- .../public/locales/en-GB/translation.toml | 1 + .../SetupWizard/ServerSelection.tsx | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/public/locales/en-GB/translation.toml b/frontend/public/locales/en-GB/translation.toml index 6e9f217ab..2fa1710b9 100644 --- a/frontend/public/locales/en-GB/translation.toml +++ b/frontend/public/locales/en-GB/translation.toml @@ -6564,6 +6564,7 @@ link = "or connect to a self-hosted account" title = "Connect to Server" subtitle = "Enter your self-hosted server URL" testing = "Testing connection..." +useLast = "Last used server: {{serverUrl}}" [setup.server.type] saas = "Stirling PDF SaaS" diff --git a/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx b/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx index 091c01d1e..497875091 100644 --- a/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx +++ b/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx @@ -16,12 +16,13 @@ export const ServerSelection: React.FC = ({ onSelect, load const [testing, setTesting] = useState(false); const [testError, setTestError] = useState(null); const [securityDisabled, setSecurityDisabled] = useState(false); + const serverUrl = localStorage.getItem('server_url') || ''; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); // Normalize and validate URL - let url = customUrl.trim().replace(/\/+$/, ''); + let url = customUrl.trim().replace(/\/+$/, '') || serverUrl; if (!url) { setTestError(t('setup.server.error.emptyUrl', 'Please enter a server URL')); @@ -34,6 +35,7 @@ export const ServerSelection: React.FC = ({ onSelect, load url = `https://${url}`; setCustomUrl(url); // Update the input field } + localStorage.setItem('server_url', url); // Validate URL format try { @@ -207,6 +209,21 @@ export const ServerSelection: React.FC = ({ onSelect, load )} + {serverUrl && ( +
+ +
+ )} +