mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 18:44:05 +02:00
# Description of Changes Change jar files to contain frontend if provided with param, else doesnt... add release artifact -server version which wont have frontend --- ## 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.
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { isTauri } from '@tauri-apps/api/core';
|
|
|
|
/**
|
|
* Desktop override: Determine base URL depending on Tauri environment
|
|
*
|
|
* Priority (non-Tauri mode):
|
|
* 1. window.STIRLING_PDF_API_BASE_URL (runtime override - fixes hardcoded localhost issues)
|
|
* 2. import.meta.env.VITE_API_BASE_URL (build-time env var)
|
|
* 3. '/' (relative path - works for same-origin deployments)
|
|
*
|
|
* Note: In Tauri mode, the actual URL is determined dynamically by operationRouter
|
|
* based on connection mode and backend port. This initial baseURL is overridden
|
|
* by request interceptors in apiClientSetup.ts.
|
|
*/
|
|
export function getApiBaseUrl(): string {
|
|
if (!isTauri()) {
|
|
// Runtime override to fix hardcoded localhost in builds
|
|
if (typeof window !== 'undefined' && (window as any).STIRLING_PDF_API_BASE_URL) {
|
|
return (window as any).STIRLING_PDF_API_BASE_URL;
|
|
}
|
|
|
|
return import.meta.env.VITE_API_BASE_URL || '/';
|
|
}
|
|
|
|
// In Tauri mode, return empty string as placeholder
|
|
// The actual URL will be set dynamically by operationRouter based on:
|
|
// - Offline mode: dynamic port from tauriBackendService
|
|
// - Server mode: configured server URL from connectionModeService
|
|
return '';
|
|
}
|