2024-02-23 23:46:42 +05:30
|
|
|
package stirling.software.SPDF;
|
|
|
|
|
2024-02-24 00:01:20 +05:30
|
|
|
import java.io.IOException;
|
2025-01-06 12:41:30 +00:00
|
|
|
import java.net.URISyntaxException;
|
2024-01-03 17:59:04 +00:00
|
|
|
import java.nio.file.Files;
|
2024-02-24 00:01:20 +05:30
|
|
|
import java.nio.file.Path;
|
2024-01-03 17:59:04 +00:00
|
|
|
import java.nio.file.Paths;
|
|
|
|
import java.util.Collections;
|
2024-05-03 20:43:48 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
2024-12-11 21:54:05 +00:00
|
|
|
import java.util.Properties;
|
2025-06-18 13:11:14 +01:00
|
|
|
|
2024-02-23 23:46:42 +05:30
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2024-01-03 17:59:04 +00:00
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
2025-06-18 13:11:14 +01:00
|
|
|
|
|
|
|
import io.github.pixee.security.SystemCommand;
|
|
|
|
|
|
|
|
import jakarta.annotation.PostConstruct;
|
|
|
|
import jakarta.annotation.PreDestroy;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
2024-12-11 21:54:05 +00:00
|
|
|
import stirling.software.SPDF.UI.WebBrowser;
|
2025-06-09 12:51:41 +01:00
|
|
|
import stirling.software.common.configuration.AppConfig;
|
2025-05-27 13:01:52 +01:00
|
|
|
import stirling.software.common.configuration.ConfigInitializer;
|
|
|
|
import stirling.software.common.configuration.InstallationPathConfig;
|
|
|
|
import stirling.software.common.model.ApplicationProperties;
|
|
|
|
import stirling.software.common.util.UrlUtils;
|
2024-01-03 17:59:04 +00:00
|
|
|
|
2024-12-11 21:54:05 +00:00
|
|
|
@Slf4j
|
2025-01-06 18:58:26 +00:00
|
|
|
@EnableScheduling
|
2025-05-27 13:01:52 +01:00
|
|
|
@SpringBootApplication(
|
2025-05-27 19:55:15 +01:00
|
|
|
scanBasePackages = {
|
|
|
|
"stirling.software.SPDF",
|
2025-06-09 12:51:41 +01:00
|
|
|
"stirling.software.common",
|
|
|
|
"stirling.software.proprietary"
|
2025-05-27 13:01:52 +01:00
|
|
|
})
|
2025-01-06 18:58:26 +00:00
|
|
|
public class SPDFApplication {
|
2024-01-03 17:59:04 +00:00
|
|
|
|
2024-02-26 01:15:03 +01:00
|
|
|
private static String serverPortStatic;
|
2025-01-06 18:58:26 +00:00
|
|
|
private static String baseUrlStatic;
|
2025-03-20 08:53:29 +01:00
|
|
|
private static String contextPathStatic;
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2025-06-09 12:51:41 +01:00
|
|
|
private final AppConfig appConfig;
|
2024-12-24 09:52:53 +00:00
|
|
|
private final Environment env;
|
|
|
|
private final ApplicationProperties applicationProperties;
|
|
|
|
private final WebBrowser webBrowser;
|
2024-02-26 01:15:03 +01:00
|
|
|
|
2025-01-06 18:58:26 +00:00
|
|
|
public SPDFApplication(
|
2025-06-09 12:51:41 +01:00
|
|
|
AppConfig appConfig,
|
2024-12-24 09:52:53 +00:00
|
|
|
Environment env,
|
|
|
|
ApplicationProperties applicationProperties,
|
|
|
|
@Autowired(required = false) WebBrowser webBrowser) {
|
2025-06-09 12:51:41 +01:00
|
|
|
this.appConfig = appConfig;
|
2024-12-24 09:52:53 +00:00
|
|
|
this.env = env;
|
|
|
|
this.applicationProperties = applicationProperties;
|
|
|
|
this.webBrowser = webBrowser;
|
2024-09-23 04:17:11 +05:30
|
|
|
}
|
|
|
|
|
2024-02-24 00:01:20 +05:30
|
|
|
public static void main(String[] args) throws IOException, InterruptedException {
|
2025-01-06 18:58:26 +00:00
|
|
|
SpringApplication app = new SpringApplication(SPDFApplication.class);
|
|
|
|
|
2024-12-11 22:09:35 +00:00
|
|
|
Properties props = new Properties();
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-12-13 11:31:49 +00:00
|
|
|
if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
|
2024-12-11 23:13:23 +00:00
|
|
|
System.setProperty("java.awt.headless", "false");
|
|
|
|
app.setHeadless(false);
|
2024-12-13 11:31:49 +00:00
|
|
|
props.put("java.awt.headless", "false");
|
|
|
|
props.put("spring.main.web-application-type", "servlet");
|
2025-02-24 10:19:43 +00:00
|
|
|
|
|
|
|
int desiredPort = 8080;
|
|
|
|
String port = UrlUtils.findAvailablePort(desiredPort);
|
|
|
|
props.put("server.port", port);
|
|
|
|
System.setProperty("server.port", port);
|
|
|
|
log.info("Desktop UI mode: Using port {}", port);
|
2024-12-11 21:56:50 +00:00
|
|
|
}
|
2025-01-06 18:58:26 +00:00
|
|
|
|
|
|
|
app.setAdditionalProfiles(getActiveProfile(args));
|
2025-01-06 12:41:30 +00:00
|
|
|
|
|
|
|
ConfigInitializer initializer = new ConfigInitializer();
|
|
|
|
try {
|
|
|
|
initializer.ensureConfigExists();
|
|
|
|
} catch (IOException | URISyntaxException e) {
|
|
|
|
log.error("Error initialising configuration", e);
|
|
|
|
}
|
2024-05-03 20:43:48 +01:00
|
|
|
Map<String, String> propertyFiles = new HashMap<>();
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-09-23 04:17:11 +05:30
|
|
|
// External config files
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
Path settingsPath = Paths.get(InstallationPathConfig.getSettingsPath());
|
|
|
|
log.info("Settings file: {}", settingsPath.toString());
|
|
|
|
if (Files.exists(settingsPath)) {
|
|
|
|
propertyFiles.put(
|
|
|
|
"spring.config.additional-location", "file:" + settingsPath.toString());
|
2024-02-23 23:46:42 +05:30
|
|
|
} else {
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
log.warn("External configuration file '{}' does not exist.", settingsPath.toString());
|
2024-02-23 23:46:42 +05:30
|
|
|
}
|
2025-01-06 18:58:26 +00:00
|
|
|
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
Path customSettingsPath = Paths.get(InstallationPathConfig.getCustomSettingsPath());
|
|
|
|
log.info("Custom settings file: {}", customSettingsPath.toString());
|
|
|
|
if (Files.exists(customSettingsPath)) {
|
2024-08-08 21:13:59 +01:00
|
|
|
String existingLocation =
|
|
|
|
propertyFiles.getOrDefault("spring.config.additional-location", "");
|
2024-07-31 13:25:48 -07:00
|
|
|
if (!existingLocation.isEmpty()) {
|
|
|
|
existingLocation += ",";
|
2024-05-03 20:43:48 +01:00
|
|
|
}
|
|
|
|
propertyFiles.put(
|
|
|
|
"spring.config.additional-location",
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
existingLocation + "file:" + customSettingsPath.toString());
|
2024-05-03 20:43:48 +01:00
|
|
|
} else {
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
log.warn(
|
|
|
|
"Custom configuration file '{}' does not exist.",
|
|
|
|
customSettingsPath.toString());
|
2024-05-03 20:43:48 +01:00
|
|
|
}
|
2024-12-11 22:09:35 +00:00
|
|
|
Properties finalProps = new Properties();
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-12-11 23:13:23 +00:00
|
|
|
if (!propertyFiles.isEmpty()) {
|
|
|
|
finalProps.putAll(
|
|
|
|
Collections.singletonMap(
|
|
|
|
"spring.config.additional-location",
|
|
|
|
propertyFiles.get("spring.config.additional-location")));
|
|
|
|
}
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-12-13 11:31:49 +00:00
|
|
|
if (!props.isEmpty()) {
|
2024-12-11 23:13:23 +00:00
|
|
|
finalProps.putAll(props);
|
|
|
|
}
|
2024-12-11 22:09:35 +00:00
|
|
|
app.setDefaultProperties(finalProps);
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-02-23 23:46:42 +05:30
|
|
|
app.run(args);
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2024-09-23 04:17:11 +05:30
|
|
|
// Ensure directories are created
|
2024-02-24 00:01:20 +05:30
|
|
|
try {
|
2025-01-06 12:41:30 +00:00
|
|
|
Files.createDirectories(Path.of(InstallationPathConfig.getTemplatesPath()));
|
|
|
|
Files.createDirectories(Path.of(InstallationPathConfig.getStaticPath()));
|
Refactor Path Handling (#3041)
# Description of Changes
Please provide a summary of the changes, including:
What was changed:
- Refactored path constructions in multiple classes (e.g.,
SPDFApplication.java, InstallationPathConfig.java,
RuntimePathConfig.java) to use Java NIO’s Paths.get() and Path.of()
instead of manual string concatenation.
Why the change was made:
- To improve code readability, maintainability, and robustness by
leveraging modern Java NIO utilities.
- To ensure better portability across different operating systems by
avoiding hardcoded file separators.
Challenges encountered:
- Maintaining backward compatibility while transitioning from manual
string concatenation to using Paths for file path construction.
- Ensuring that the refactored path resolution works consistently across
all supported environments (Windows, macOS, Linux, and Docker).
@Frooodle can you check the docker path `/.dockerenv`?
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [x] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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/DeveloperGuide.md#6-testing)
for more details.
2025-02-25 22:31:20 +01:00
|
|
|
} catch (IOException e) {
|
2024-12-17 10:26:18 +01:00
|
|
|
log.error("Error creating directories: {}", e.getMessage());
|
2024-02-24 00:01:20 +05:30
|
|
|
}
|
2024-12-24 09:52:53 +00:00
|
|
|
|
2025-01-06 18:58:26 +00:00
|
|
|
printStartupLogs();
|
2024-12-24 09:52:53 +00:00
|
|
|
}
|
2024-12-11 21:54:05 +00:00
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
public void init() {
|
2025-06-09 12:51:41 +01:00
|
|
|
String baseUrl = appConfig.getBaseUrl();
|
|
|
|
String contextPath = appConfig.getContextPath();
|
|
|
|
String serverPort = appConfig.getServerPort();
|
|
|
|
baseUrlStatic = baseUrl;
|
|
|
|
contextPathStatic = contextPath;
|
|
|
|
serverPortStatic = serverPort;
|
2025-03-20 08:53:29 +01:00
|
|
|
String url = baseUrl + ":" + getStaticPort() + contextPath;
|
2025-06-09 12:51:41 +01:00
|
|
|
|
2024-12-13 11:31:49 +00:00
|
|
|
if (webBrowser != null
|
|
|
|
&& Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
|
2024-12-11 21:54:05 +00:00
|
|
|
webBrowser.initWebUI(url);
|
2024-12-13 16:58:34 +00:00
|
|
|
} else {
|
2024-12-17 10:26:18 +01:00
|
|
|
String browserOpenEnv = env.getProperty("BROWSER_OPEN");
|
2024-12-13 16:58:34 +00:00
|
|
|
boolean browserOpen = browserOpenEnv != null && "true".equalsIgnoreCase(browserOpenEnv);
|
|
|
|
if (browserOpen) {
|
|
|
|
try {
|
|
|
|
String os = System.getProperty("os.name").toLowerCase();
|
|
|
|
Runtime rt = Runtime.getRuntime();
|
2025-06-09 12:51:41 +01:00
|
|
|
|
2024-12-13 16:58:34 +00:00
|
|
|
if (os.contains("win")) {
|
|
|
|
// For Windows
|
|
|
|
SystemCommand.runCommand(rt, "rundll32 url.dll,FileProtocolHandler " + url);
|
|
|
|
} else if (os.contains("mac")) {
|
|
|
|
SystemCommand.runCommand(rt, "open " + url);
|
|
|
|
} else if (os.contains("nix") || os.contains("nux")) {
|
|
|
|
SystemCommand.runCommand(rt, "xdg-open " + url);
|
|
|
|
}
|
Improved Configuration and YAML Management (#2966)
# Description of Changes
**What was changed:**
- **Configuration Updates:**
Replaced all calls to `GeneralUtils.saveKeyToConfig` with the new
`GeneralUtils.saveKeyToSettings` method across multiple classes (e.g.,
`LicenseKeyChecker`, `InitialSetup`, `SettingsController`, etc.). This
update ensures consistent management of configuration settings.
- **File Path and Exception Handling:**
Updated file path handling in `SPDFApplication` by creating `Path`
objects from string paths and logging these paths for clarity. Also
refined exception handling by catching more specific exceptions (e.g.,
using `IOException` instead of a generic `Exception`).
- **Analytics Flag and Rate Limiting:**
Changed the analytics flag in the application properties from a `String`
to a `Boolean`, and updated related logic in `AppConfig` and
`PostHogService`. The rate-limiting property retrieval in `AppConfig`
was also refined for clarity.
- **YAML Configuration Management:**
Replaced the previous manual, line-based YAML merging logic in
`ConfigInitializer` with a new `YamlHelper` class. This helper leverages
the SnakeYAML engine to load, update, and save YAML configurations more
robustly while preserving comments and formatting.
**Why the change was made:**
- **Improved Maintainability:**
Consolidating configuration update logic into a single utility method
(`saveKeyToSettings`) reduces code duplication and simplifies future
maintenance.
- **Enhanced Robustness:**
The new `YamlHelper` class ensures that configuration files are merged
accurately and safely, minimizing risks of data loss or format
corruption.
- **Better Type Safety and Exception Handling:**
Switching the analytics flag to a Boolean and refining exception
handling improves code robustness and debugging efficiency.
- **Clarity and Consistency:**
Standardizing file path handling and logging practices enhances code
readability across the project.
**Challenges encountered:**
- **YAML Merging Complexity:**
Integrating the new `YamlHelper` required careful handling to preserve
existing settings, comments, and formatting during merges.
- **Type Conversion and Backward Compatibility:**
Updating the analytics flag from a string to a Boolean required
extensive testing to ensure backward compatibility and proper
functionality.
- **Exception Granularity:**
Refactoring exception handling from a generic to a more specific
approach involved a detailed review to cover all edge cases.
Closes #<issue_number>
---
## Checklist
- [x] 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/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/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2025-02-25 22:52:59 +01:00
|
|
|
} catch (IOException e) {
|
2024-12-17 10:26:18 +01:00
|
|
|
log.error("Error opening browser: {}", e.getMessage());
|
2024-12-13 16:58:34 +00:00
|
|
|
}
|
|
|
|
}
|
2024-12-11 21:54:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-02-24 10:19:43 +00:00
|
|
|
public static void setServerPortStatic(String port) {
|
2025-01-06 18:58:26 +00:00
|
|
|
if ("auto".equalsIgnoreCase(port)) {
|
|
|
|
// Use Spring Boot's automatic port assignment (server.port=0)
|
|
|
|
SPDFApplication.serverPortStatic =
|
|
|
|
"0"; // This will let Spring Boot assign an available port
|
|
|
|
} else {
|
|
|
|
SPDFApplication.serverPortStatic = port;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-11 21:54:05 +00:00
|
|
|
@PreDestroy
|
|
|
|
public void cleanup() {
|
|
|
|
if (webBrowser != null) {
|
|
|
|
webBrowser.cleanup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-06 18:58:26 +00:00
|
|
|
private static void printStartupLogs() {
|
|
|
|
log.info("Stirling-PDF Started.");
|
2025-03-20 08:53:29 +01:00
|
|
|
String url = baseUrlStatic + ":" + getStaticPort() + contextPathStatic;
|
2025-01-06 18:58:26 +00:00
|
|
|
log.info("Navigate to {}", url);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String[] getActiveProfile(String[] args) {
|
2025-06-11 17:21:37 +01:00
|
|
|
// 1. Check for explicitly passed profiles
|
|
|
|
if (args != null) {
|
|
|
|
for (String arg : args) {
|
|
|
|
if (arg.startsWith("--spring.profiles.active=")) {
|
|
|
|
String[] provided = arg.substring(arg.indexOf('=') + 1).split(",");
|
|
|
|
if (provided.length > 0) {
|
|
|
|
return provided;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Auditing support (#3739)
# Description of Changes
This pull request introduces a comprehensive auditing system to the
application, along with minor updates to existing utilities and
dependencies. The most significant changes include the addition of
audit-related classes and enums, updates to the `ApplicationProperties`
model to support auditing configuration, and enhancements to utility
methods for handling static and trackable resources.
### Audit System Implementation:
* **Audit Aspect for Method Annotations**: Added `AuditAspect` to
process the new `@Audited` annotation, enabling detailed logging of
method execution, HTTP requests, and operation results based on
configurable audit levels.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditAspect.java`)
* **Audit Event Types**: Introduced `AuditEventType` enum to define
standardized event types for auditing, such as authentication events,
file operations, and HTTP requests.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditEventType.java`)
* **Audit Levels**: Added `AuditLevel` enum to define different levels
of audit logging (OFF, BASIC, STANDARD, VERBOSE), providing granular
control over the amount of data logged.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditLevel.java`)
### Application Properties Update:
* **Audit Configuration in `ProFeatures`**: Updated the `ProFeatures`
class in `ApplicationProperties` to include support for auditing with
configurable retention days, levels, and enablement flags.
(`common/src/main/java/stirling/software/common/model/ApplicationProperties.java`)
### Utility Enhancements:
* **Static and Trackable Resource Handling**: Extended `RequestUriUtils`
methods (`isStaticResource` and `isTrackableResource`) to recognize
`.txt` files as valid static and trackable resources.
(`common/src/main/java/stirling/software/common/util/RequestUriUtils.java`)
[[1]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR22)
[[2]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR39)
### Dependency Update:
* **Spring Validation Starter**: Added `spring-boot-starter-validation`
to project dependencies to support validation mechanisms required for
auditing features. (`proprietary/build.gradle`)
Dashboard WIP



---
## 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/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/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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: a <a>
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2025-06-18 13:11:36 +01:00
|
|
|
|
2025-06-11 17:21:37 +01:00
|
|
|
// 2. Detect if SecurityConfiguration is present on classpath
|
|
|
|
if (isClassPresent(
|
|
|
|
"stirling.software.proprietary.security.configuration.SecurityConfiguration")) {
|
Auditing support (#3739)
# Description of Changes
This pull request introduces a comprehensive auditing system to the
application, along with minor updates to existing utilities and
dependencies. The most significant changes include the addition of
audit-related classes and enums, updates to the `ApplicationProperties`
model to support auditing configuration, and enhancements to utility
methods for handling static and trackable resources.
### Audit System Implementation:
* **Audit Aspect for Method Annotations**: Added `AuditAspect` to
process the new `@Audited` annotation, enabling detailed logging of
method execution, HTTP requests, and operation results based on
configurable audit levels.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditAspect.java`)
* **Audit Event Types**: Introduced `AuditEventType` enum to define
standardized event types for auditing, such as authentication events,
file operations, and HTTP requests.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditEventType.java`)
* **Audit Levels**: Added `AuditLevel` enum to define different levels
of audit logging (OFF, BASIC, STANDARD, VERBOSE), providing granular
control over the amount of data logged.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditLevel.java`)
### Application Properties Update:
* **Audit Configuration in `ProFeatures`**: Updated the `ProFeatures`
class in `ApplicationProperties` to include support for auditing with
configurable retention days, levels, and enablement flags.
(`common/src/main/java/stirling/software/common/model/ApplicationProperties.java`)
### Utility Enhancements:
* **Static and Trackable Resource Handling**: Extended `RequestUriUtils`
methods (`isStaticResource` and `isTrackableResource`) to recognize
`.txt` files as valid static and trackable resources.
(`common/src/main/java/stirling/software/common/util/RequestUriUtils.java`)
[[1]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR22)
[[2]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR39)
### Dependency Update:
* **Spring Validation Starter**: Added `spring-boot-starter-validation`
to project dependencies to support validation mechanisms required for
auditing features. (`proprietary/build.gradle`)
Dashboard WIP



---
## 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/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/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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: a <a>
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2025-06-18 13:11:36 +01:00
|
|
|
log.info("Additional features in jar");
|
2025-06-11 17:21:37 +01:00
|
|
|
return new String[] {"security"};
|
|
|
|
} else {
|
Auditing support (#3739)
# Description of Changes
This pull request introduces a comprehensive auditing system to the
application, along with minor updates to existing utilities and
dependencies. The most significant changes include the addition of
audit-related classes and enums, updates to the `ApplicationProperties`
model to support auditing configuration, and enhancements to utility
methods for handling static and trackable resources.
### Audit System Implementation:
* **Audit Aspect for Method Annotations**: Added `AuditAspect` to
process the new `@Audited` annotation, enabling detailed logging of
method execution, HTTP requests, and operation results based on
configurable audit levels.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditAspect.java`)
* **Audit Event Types**: Introduced `AuditEventType` enum to define
standardized event types for auditing, such as authentication events,
file operations, and HTTP requests.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditEventType.java`)
* **Audit Levels**: Added `AuditLevel` enum to define different levels
of audit logging (OFF, BASIC, STANDARD, VERBOSE), providing granular
control over the amount of data logged.
(`proprietary/src/main/java/stirling/software/proprietary/audit/AuditLevel.java`)
### Application Properties Update:
* **Audit Configuration in `ProFeatures`**: Updated the `ProFeatures`
class in `ApplicationProperties` to include support for auditing with
configurable retention days, levels, and enablement flags.
(`common/src/main/java/stirling/software/common/model/ApplicationProperties.java`)
### Utility Enhancements:
* **Static and Trackable Resource Handling**: Extended `RequestUriUtils`
methods (`isStaticResource` and `isTrackableResource`) to recognize
`.txt` files as valid static and trackable resources.
(`common/src/main/java/stirling/software/common/util/RequestUriUtils.java`)
[[1]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR22)
[[2]](diffhunk://#diff-de3599037908683f2cd8f170939547612c6fc2203e9207eb4d7966508f92bbcbR39)
### Dependency Update:
* **Spring Validation Starter**: Added `spring-boot-starter-validation`
to project dependencies to support validation mechanisms required for
auditing features. (`proprietary/build.gradle`)
Dashboard WIP



---
## 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/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/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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### 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/DeveloperGuide.md#6-testing)
for more details.
---------
Co-authored-by: a <a>
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2025-06-18 13:11:36 +01:00
|
|
|
log.info("Without additional features in jar");
|
2025-01-06 18:58:26 +00:00
|
|
|
return new String[] {"default"};
|
|
|
|
}
|
2025-06-11 17:21:37 +01:00
|
|
|
}
|
2025-01-06 18:58:26 +00:00
|
|
|
|
2025-06-11 17:21:37 +01:00
|
|
|
private static boolean isClassPresent(String className) {
|
|
|
|
try {
|
|
|
|
Class.forName(className, false, SPDFApplication.class.getClassLoader());
|
|
|
|
return true;
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
return false;
|
2025-01-06 18:58:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getStaticBaseUrl() {
|
|
|
|
return baseUrlStatic;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getStaticPort() {
|
|
|
|
return serverPortStatic;
|
|
|
|
}
|
2025-03-20 08:53:29 +01:00
|
|
|
|
|
|
|
public static String getStaticContextPath() {
|
|
|
|
return contextPathStatic;
|
|
|
|
}
|
2024-01-03 17:59:04 +00:00
|
|
|
}
|