diff --git a/.gitattributes b/.gitattributes
index c498408ab..f72c204bd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,10 +1,10 @@
* text=auto eol=lf
# Ignore all JavaScript files in a directory
-src/main/resources/static/pdfjs/* linguist-vendored
-src/main/resources/static/pdfjs/** linguist-vendored
-src/main/resources/static/pdfjs-legacy/* linguist-vendored
-src/main/resources/static/pdfjs-legacy/** linguist-vendored
-src/main/resources/static/css/bootstrap-icons.css linguist-vendored
-src/main/resources/static/css/bootstrap.min.css linguist-vendored
-src/main/resources/static/css/fonts/* linguist-vendored
+stirling-pdf/src/main/resources/static/pdfjs/* linguist-vendored
+stirling-pdf/src/main/resources/static/pdfjs/** linguist-vendored
+stirling-pdf/src/main/resources/static/pdfjs-legacy/* linguist-vendored
+stirling-pdf/src/main/resources/static/pdfjs-legacy/** linguist-vendored
+stirling-pdf/src/main/resources/static/css/bootstrap-icons.css linguist-vendored
+stirling-pdf/src/main/resources/static/css/bootstrap.min.css linguist-vendored
+stirling-pdf/src/main/resources/static/css/fonts/* linguist-vendored
diff --git a/.github/labeler-config.yml b/.github/labeler-config.yml
index 60ef1c3b3..21f06e16c 100644
--- a/.github/labeler-config.yml
+++ b/.github/labeler-config.yml
@@ -29,22 +29,7 @@ Back End:
Security:
- changed-files:
-# todo: fix these
- - any-glob-to-any-file: 'src/main/java/stirling/software/spdf/config/security/**/*' # fixme
- # todo: check if correct
- any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/**/*'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/exception/**/*'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/controller/**/*'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/oauth2/provider/**/*'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/service/DatabaseServiceInterface.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/service/DatabaseService.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/api/Email.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/AuthenticationType.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/ApiKeyAuthenticationToken.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/AttemptCounter.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/Authority.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/PersistentLogin.java'
-# - any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/model/SessionEntity.java'
- any-glob-to-any-file: 'scripts/download-security-jar.sh'
- any-glob-to-any-file: '.github/workflows/dependency-review.yml'
- any-glob-to-any-file: '.github/workflows/scorecards.yml'
diff --git a/.github/scripts/check_language_properties.py b/.github/scripts/check_language_properties.py
index 10e6fb650..8ae7dbfc1 100644
--- a/.github/scripts/check_language_properties.py
+++ b/.github/scripts/check_language_properties.py
@@ -317,7 +317,7 @@ def check_for_differences(reference_file, file_list, branch, actor):
report.append("## ❌ Overall Check Status: **_Failed_**")
report.append("")
report.append(
- f"@{actor} please check your translation if it conforms to the standard. Follow the format of [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)"
+ f"@{actor} please check your translation if it conforms to the standard. Follow the format of [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/messages_en_GB.properties)"
)
else:
report.append("## ✅ Overall Check Status: **_Success_**")
diff --git a/.github/workflows/PR-Demo-Comment-with-react.yml b/.github/workflows/PR-Demo-Comment-with-react.yml
index 7457e4896..a971eac2f 100644
--- a/.github/workflows/PR-Demo-Comment-with-react.yml
+++ b/.github/workflows/PR-Demo-Comment-with-react.yml
@@ -200,11 +200,11 @@ jobs:
run: |
# Set security settings based on flags
if [ "${{ needs.check-comment.outputs.enable_security }}" == "true" ]; then
- DOCKER_SECURITY="true"
+ ADDITIONAL_FEATURES="true"
LOGIN_SECURITY="true"
SECURITY_STATUS="🔒 Security Enabled"
else
- DOCKER_SECURITY="false"
+ ADDITIONAL_FEATURES="false"
LOGIN_SECURITY="false"
SECURITY_STATUS="Security Disabled"
fi
@@ -223,7 +223,7 @@ jobs:
- /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/config:/configs:rw
- /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/logs:/logs:rw
environment:
- ADDITIONAL_FEATURES: "${DOCKER_SECURITY}"
+ ADDITIONAL_FEATURES: "${ADDITIONAL_FEATURES}"
SECURITY_ENABLELOGIN: "${LOGIN_SECURITY}"
SYSTEM_DEFAULTLOCALE: en-GB
UI_APPNAME: "Stirling-PDF PR#${{ needs.check-comment.outputs.pr_number }}"
diff --git a/.github/workflows/check_properties.yml b/.github/workflows/check_properties.yml
index 6825f59f9..7015abe42 100644
--- a/.github/workflows/check_properties.yml
+++ b/.github/workflows/check_properties.yml
@@ -4,7 +4,7 @@ on:
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- - "src/main/resources/messages_*.properties"
+ - "stirling-pdf/src/main/resources/messages_*.properties"
permissions:
contents: read # Allow read access to repository content
@@ -58,7 +58,7 @@ jobs:
run: |
echo "Fetching PR changed files..."
echo "Getting list of changed files from PR..."
- gh pr view ${{ steps.get-pr-data.outputs.pr_number }} --json files -q ".files[].path" | grep -E '^src/main/resources/messages_[a-zA-Z_]{2}_[a-zA-Z_]{2,7}\.properties$' > changed_files.txt # Filter only matching property files
+ gh pr view ${{ steps.get-pr-data.outputs.pr_number }} --json files -q ".files[].path" | grep -E '^stirling-pdf/src/main/resources/messages_[a-zA-Z_]{2}_[a-zA-Z_]{2,7}\.properties$' > changed_files.txt # Filter only matching property files
- name: Determine reference file test
id: determine-file
@@ -137,12 +137,12 @@ jobs:
// Determine reference file
let referenceFilePath;
- if (changedFiles.includes("src/main/resources/messages_en_GB.properties")) {
+ if (changedFiles.includes("stirling-pdf/src/main/resources/messages_en_GB.properties")) {
console.log("Using PR branch reference file.");
const { data: fileContent } = await github.rest.repos.getContent({
owner: prRepoOwner,
repo: prRepoName,
- path: "src/main/resources/messages_en_GB.properties",
+ path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
ref: branch,
});
@@ -154,7 +154,7 @@ jobs:
const { data: fileContent } = await github.rest.repos.getContent({
owner: repoOwner,
repo: repoName,
- path: "src/main/resources/messages_en_GB.properties",
+ path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
ref: "main",
});
diff --git a/.github/workflows/licenses-update.yml b/.github/workflows/licenses-update.yml
index a810dbeb0..a6d6598ea 100644
--- a/.github/workflows/licenses-update.yml
+++ b/.github/workflows/licenses-update.yml
@@ -54,7 +54,7 @@ jobs:
- name: Move and Rename License File
run: |
- mv build/reports/dependency-license/index.json src/main/resources/static/3rdPartyLicenses.json
+ mv build/reports/dependency-license/index.json stirling-pdf/src/main/resources/static/3rdPartyLicenses.json
- name: Set up git config
run: |
@@ -63,7 +63,7 @@ jobs:
- name: Run git add
run: |
- git add src/main/resources/static/3rdPartyLicenses.json
+ git add stirling-pdf/src/main/resources/static/3rdPartyLicenses.json
git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
- name: Create Pull Request
diff --git a/.github/workflows/sync_files.yml b/.github/workflows/sync_files.yml
index fe790c65b..26453aeb3 100644
--- a/.github/workflows/sync_files.yml
+++ b/.github/workflows/sync_files.yml
@@ -8,8 +8,8 @@ on:
paths:
- "build.gradle"
- "README.md"
- - "src/main/resources/messages_*.properties"
- - "src/main/resources/static/3rdPartyLicenses.json"
+ - "stirling-pdf/src/main/resources/messages_*.properties"
+ - "stirling-pdf/src/main/resources/static/3rdPartyLicenses.json"
- "scripts/ignore_translation.toml"
permissions:
@@ -78,7 +78,7 @@ jobs:
- name: Sync translation property files
run: |
- python .github/scripts/check_language_properties.py --reference-file "src/main/resources/messages_en_GB.properties" --branch main
+ python .github/scripts/check_language_properties.py --reference-file "stirling-pdf/src/main/resources/messages_en_GB.properties" --branch main
- name: Set up git config
run: |
@@ -87,7 +87,7 @@ jobs:
- name: Run git add
run: |
- git add src/main/resources/messages_*.properties
+ git add stirling-pdf/src/main/resources/messages_*.properties
git diff --staged --quiet || git commit -m ":memo: Sync translation files" || echo "no changes"
- name: Install dependencies
@@ -142,4 +142,4 @@ jobs:
sign-commits: true
add-paths: |
README.md
- src/main/resources/messages_*.properties
+ stirling-pdf/src/main/resources/messages_*.properties
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c792e50a0..a689c6baa 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -20,7 +20,7 @@ repos:
- --skip="./.*,*.csv,*.json,*.ambr"
- --quiet-level=2
files: \.(html|css|js|py|md)$
- exclude: (.vscode|.devcontainer|src/main/resources|Dockerfile|.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js)
+ exclude: (.vscode|.devcontainer|stirling-pdf/src/main/resources|Dockerfile|.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js)
- repo: https://github.com/gitleaks/gitleaks
rev: v8.24.3
hooks:
diff --git a/DeveloperGuide.md b/DeveloperGuide.md
index d6f9d52c2..9e9929305 100644
--- a/DeveloperGuide.md
+++ b/DeveloperGuide.md
@@ -332,7 +332,7 @@ Thymeleaf is a server-side Java HTML template engine. It is used in Stirling-PDF
### Thymeleaf overview
-In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content.
+In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `stirling-pdf/src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content.
Some examples of this are:
@@ -384,7 +384,7 @@ This would generate n entries of tr for each person in exampleData
### Adding a New Feature to the Backend (API)
1. **Create a New Controller:**
- - Create a new Java class in the `src/main/java/stirling/software/spdf/controller/api` directory.
+ - Create a new Java class in the `stirling-pdf/src/main/java/stirling/software/spdf/controller/api` directory.
- Annotate the class with `@RestController` and `@RequestMapping` to define the API endpoint.
- Ensure to add API documentation annotations like `@Tag(name = "General", description = "General APIs")` and `@Operation(summary = "Crops a PDF document", description = "This operation takes an input PDF file and crops it according to the given coordinates. Input:PDF Output:PDF Type:SISO")`.
@@ -411,7 +411,7 @@ This would generate n entries of tr for each person in exampleData
```
2. **Define the Service Layer:** (Not required but often useful)
- - Create a new service class in the `src/main/java/stirling/software/spdf/service` directory.
+ - Create a new service class in the `stirling-pdf/src/main/java/stirling/software/spdf/service` directory.
- Implement the business logic for the new feature.
```java
@@ -463,7 +463,7 @@ This would generate n entries of tr for each person in exampleData
### Adding a New Feature to the Frontend (UI)
1. **Create a New Thymeleaf Template:**
- - Create a new HTML file in the `src/main/resources/templates` directory.
+ - Create a new HTML file in the `stirling-pdf/src/main/resources/templates` directory.
- Use Thymeleaf attributes to dynamically generate content.
- Use `extract-page.html` as a base example for the HTML template, which is useful to ensure importing of the general layout, navbar, and footer.
@@ -507,7 +507,7 @@ This would generate n entries of tr for each person in exampleData
```
2. **Create a New Controller for the UI:**
- - Create a new Java class in the `src/main/java/stirling/software/spdf/controller/ui` directory.
+ - Create a new Java class in the `stirling-pdf/src/main/java/stirling/software/spdf/controller/ui` directory.
- Annotate the class with `@Controller` and `@RequestMapping` to define the UI endpoint.
```java
@@ -537,7 +537,7 @@ This would generate n entries of tr for each person in exampleData
3. **Update the Navigation Bar:**
- Add a link to the new feature page in the navigation bar.
- - Update the `src/main/resources/templates/fragments/navbar.html` file.
+ - Update the `stirling-pdf/src/main/resources/templates/fragments/navbar.html` file.
```html
@@ -551,7 +551,7 @@ When adding a new feature or modifying existing ones in Stirling-PDF, you'll nee
### 1. Locate Existing Language Files
-Find the existing `messages.properties` files in the `src/main/resources` directory. You'll see files like:
+Find the existing `messages.properties` files in the `stirling-pdf/src/main/resources` directory. You'll see files like:
- `messages.properties` (default, usually English)
- `messages_en_GB.properties`
diff --git a/Dockerfile b/Dockerfile
index c045ed0e7..a0ad92c29 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff45
# Copy necessary files
COPY scripts /scripts
COPY pipeline /pipeline
-COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
+COPY stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
#COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/
COPY build/libs/*.jar app.jar
diff --git a/Dockerfile.fat b/Dockerfile.fat
index 77352967c..31e027647 100644
--- a/Dockerfile.fat
+++ b/Dockerfile.fat
@@ -24,7 +24,7 @@ FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff45
# Copy necessary files
COPY scripts /scripts
COPY pipeline /pipeline
-COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
+COPY stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
COPY --from=build /app/build/libs/*.jar app.jar
ARG VERSION_TAG
diff --git a/HowToAddNewLanguage.md b/HowToAddNewLanguage.md
index c1fb7c127..cdc4729a2 100644
--- a/HowToAddNewLanguage.md
+++ b/HowToAddNewLanguage.md
@@ -10,7 +10,7 @@ Fork Stirling-PDF and create a new branch out of `main`.
Then add a reference to the language in the navbar by adding a new language entry to the dropdown:
-- Edit the file: [languages.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/languages.html)
+- Edit the file: [languages.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/templates/fragments/languages.html)
For example, to add Polish, you would add:
@@ -25,7 +25,7 @@ The `data-bs-language-code` is the code used to reference the file in the next s
Start by copying the existing English property file:
-- [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)
+- [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/messages_en_GB.properties)
Copy and rename it to `messages_{your data-bs-language-code here}.properties`. In the Polish example, you would set the name to `messages_pl_PL.properties`.
diff --git a/LICENSE b/LICENSE
index 07c21cee3..2aa88ade7 100644
--- a/LICENSE
+++ b/LICENSE
@@ -4,7 +4,7 @@ Copyright (c) 2024 Stirling Tools
Portions of this software are licensed as follows:
-* All content that resides under the "enterprise/" directory of this repository, if that directory exists, is licensed under the license defined in "enterprise/LICENSE".
+* All content that resides under the "proprietary/" directory of this repository, if that directory exists, is licensed under the license defined in "proprietary/LICENSE".
* Content outside of the above mentioned directories or restrictions above is available under the MIT License as defined below.
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/build.gradle b/build.gradle
index 532288777..ad2e9d3e7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -57,7 +57,7 @@ sourceSets {
test {
java {
- if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false') {
+ if (System.getenv('ADDITIONAL_FEATURES') == 'false') {
exclude 'stirling/software/proprietary/security/**'
}
@@ -167,7 +167,7 @@ jpackage {
appVersion = project.version
vendor = "Stirling PDF Inc"
appDescription = "Stirling PDF - Your Local PDF Editor"
- icon = "src/main/resources/static/favicon.ico"
+ icon = "stirling-pdf/src/main/resources/static/favicon.ico"
verbose = true
// mainClass = "org.springframework.boot.loader.launch.JarLauncher"
@@ -208,7 +208,7 @@ jpackage {
// MacOS-specific configuration
mac {
appVersion = getMacVersion(project.version.toString())
- icon = "src/main/resources/static/favicon.icns"
+ icon = "stirling-pdf/src/main/resources/static/favicon.icns"
type = "dmg"
macPackageIdentifier = "Stirling PDF"
macPackageName = "Stirling PDF"
@@ -230,7 +230,7 @@ jpackage {
// Linux-specific configuration
linux {
appVersion = project.version
- icon = "src/main/resources/static/favicon.png"
+ icon = "stirling-pdf/src/main/resources/static/favicon.png"
type = "deb" // Can also use "rpm" for Red Hat-based systems
// Debian package configuration
@@ -307,7 +307,7 @@ tasks.register('jpackageMacX64') {
'--main-class', 'org.springframework.boot.loader.launch.JarLauncher',
'--runtime-image', file(jrePath + "/zulu-17.jre/Contents/Home"),
'--dest', 'build/jpackage/x86_64',
- '--icon', 'src/main/resources/static/favicon.icns',
+ '--icon', 'stirling-pdf/src/main/resources/static/favicon.icns',
'--app-version', getMacVersion(project.version.toString()),
'--mac-package-name', 'Stirling PDF (x86_64)',
'--mac-package-identifier', 'Stirling PDF (x86_64)',
@@ -392,7 +392,7 @@ tasks.register('cleanTempJre') {
}
launch4j {
- icon = "${projectDir}/src/main/resources/static/favicon.ico"
+ icon = "${projectDir}/stirling-pdf/src/main/resources/static/favicon.ico"
outfile="Stirling-PDF.exe"
@@ -443,9 +443,9 @@ sonar {
property "sonar.projectKey", "Stirling-Tools_Stirling-PDF"
property "sonar.organization", "stirling-tools"
- property "sonar.exclusions", "**/build-wrapper-dump.json, src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
- property "sonar.coverage.exclusions", "src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
- property "sonar.cpd.exclusions", "src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
+ property "sonar.exclusions", "**/build-wrapper-dump.json, **/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
+ property "sonar.coverage.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
+ property "sonar.cpd.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
}
}
diff --git a/common/src/main/java/stirling/software/common/configuration/AppConfig.java b/common/src/main/java/stirling/software/common/configuration/AppConfig.java
index 5daf0da9e..771efa9dc 100644
--- a/common/src/main/java/stirling/software/common/configuration/AppConfig.java
+++ b/common/src/main/java/stirling/software/common/configuration/AppConfig.java
@@ -62,7 +62,7 @@ public class AppConfig {
@Bean
public boolean activeSecurity() {
- return env.getProperty("DOCKER_SECURITY_ENABLED", Boolean.class, true);
+ return env.getProperty("ADDITIONAL_FEATURES", Boolean.class, true);
}
@Bean(name = "appName")
diff --git a/common/src/main/java/stirling/software/common/configuration/YamlConfig.java b/common/src/main/java/stirling/software/common/configuration/YamlConfig.java
deleted file mode 100644
index b03b184ca..000000000
--- a/common/src/main/java/stirling/software/common/configuration/YamlConfig.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package stirling.software.common.configuration;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.PropertySource;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.EncodedResource;
-
-@Slf4j
-@Configuration
-public class YamlConfig {
-
- @Bean
- public PropertySource> dynamicYamlPropertySource(ConfigurableEnvironment environment)
- throws IOException {
- String configPath = InstallationPathConfig.getSettingsPath();
- log.debug("Attempting to load settings from: {}", configPath);
-
- File file = new File(configPath);
- if (!file.exists()) {
- log.error("Warning: Settings file does not exist at: {}", configPath);
- }
-
- Resource resource = new FileSystemResource(configPath);
- if (!resource.exists()) {
- throw new FileNotFoundException("Settings file not found at: " + configPath);
- }
-
- EncodedResource encodedResource = new EncodedResource(resource);
- PropertySource> propertySource =
- new YamlPropertySourceFactory().createPropertySource(null, encodedResource);
- environment.getPropertySources().addFirst(propertySource);
-
- log.debug("Loaded properties: {}", propertySource.getSource());
-
- return propertySource;
- }
-
-}
diff --git a/common/src/main/java/stirling/software/common/model/ApplicationProperties.java b/common/src/main/java/stirling/software/common/model/ApplicationProperties.java
index 2e453806e..39825ab17 100644
--- a/common/src/main/java/stirling/software/common/model/ApplicationProperties.java
+++ b/common/src/main/java/stirling/software/common/model/ApplicationProperties.java
@@ -1,5 +1,7 @@
package stirling.software.common.model;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
@@ -14,26 +16,63 @@ import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.PropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.EncodedResource;
import org.springframework.stereotype.Component;
+import stirling.software.common.configuration.InstallationPathConfig;
+import stirling.software.common.configuration.YamlPropertySourceFactory;
import stirling.software.common.model.exception.UnsupportedProviderException;
import stirling.software.common.util.ValidationUtil;
import stirling.software.common.model.oauth2.provider.GitHubProvider;
import stirling.software.common.model.oauth2.provider.GoogleProvider;
import stirling.software.common.model.oauth2.provider.KeycloakProvider;
import stirling.software.common.model.oauth2.provider.Provider;
+import static stirling.software.common.util.ValidationUtil.isCollectionEmpty;
+import static stirling.software.common.util.ValidationUtil.isStringEmpty;
-@Data
-@Component
-@Order(Ordered.HIGHEST_PRECEDENCE)
+@Configuration
@ConfigurationProperties(prefix = "")
+@Data
+@Order(Ordered.HIGHEST_PRECEDENCE)
+@Slf4j
public class ApplicationProperties {
+ @Bean
+ public PropertySource> dynamicYamlPropertySource(ConfigurableEnvironment environment)
+ throws IOException {
+ String configPath = InstallationPathConfig.getSettingsPath();
+ log.info("Attempting to load settings from: " + configPath);
+
+ File file = new File(configPath);
+ if (!file.exists()) {
+ log.error("Warning: Settings file does not exist at: " + configPath);
+ }
+
+ Resource resource = new FileSystemResource(configPath);
+ if (!resource.exists()) {
+ throw new FileNotFoundException("Settings file not found at: " + configPath);
+ }
+
+ EncodedResource encodedResource = new EncodedResource(resource);
+ PropertySource> propertySource =
+ new YamlPropertySourceFactory().createPropertySource(null, encodedResource);
+ environment.getPropertySources().addFirst(propertySource);
+
+ log.info("Loaded properties: " + propertySource.getSource());
+
+ return propertySource;
+ }
+
private Legal legal = new Legal();
private Security security = new Security();
private System system = new System();
@@ -99,19 +138,19 @@ public class ApplicationProperties {
public boolean isUserPass() {
return (loginMethod.equalsIgnoreCase(LoginMethods.NORMAL.toString())
- || loginMethod.equalsIgnoreCase(LoginMethods.ALL.toString()));
+ || loginMethod.equalsIgnoreCase(LoginMethods.ALL.toString()));
}
public boolean isOauth2Active() {
return (oauth2 != null
- && oauth2.getEnabled()
- && !loginMethod.equalsIgnoreCase(LoginMethods.NORMAL.toString()));
+ && oauth2.getEnabled()
+ && !loginMethod.equalsIgnoreCase(LoginMethods.NORMAL.toString()));
}
public boolean isSaml2Active() {
return (saml2 != null
- && saml2.getEnabled()
- && !loginMethod.equalsIgnoreCase(LoginMethods.NORMAL.toString()));
+ && saml2.getEnabled()
+ && !loginMethod.equalsIgnoreCase(LoginMethods.NORMAL.toString()));
}
@Data
@@ -140,7 +179,7 @@ public class ApplicationProperties {
public InputStream getIdpMetadataUri() throws IOException {
if (idpMetadataUri.startsWith("classpath:")) {
return new ClassPathResource(idpMetadataUri.substring("classpath".length()))
- .getInputStream();
+ .getInputStream();
}
try {
URI uri = new URI(idpMetadataUri);
@@ -195,7 +234,7 @@ public class ApplicationProperties {
public void setScopes(String scopes) {
List scopesList =
- Arrays.stream(scopes.split(",")).map(String::trim).toList();
+ Arrays.stream(scopes.split(",")).map(String::trim).toList();
this.scopes.addAll(scopesList);
}
@@ -208,11 +247,11 @@ public class ApplicationProperties {
}
public boolean isSettingsValid() {
- return !ValidationUtil.isStringEmpty(this.getIssuer())
- && !ValidationUtil.isStringEmpty(this.getClientId())
- && !ValidationUtil.isStringEmpty(this.getClientSecret())
- && !ValidationUtil.isCollectionEmpty(this.getScopes())
- && !ValidationUtil.isStringEmpty(this.getUseAsUsername());
+ return !isStringEmpty(this.getIssuer())
+ && !isStringEmpty(this.getClientId())
+ && !isStringEmpty(this.getClientSecret())
+ && !isCollectionEmpty(this.getScopes())
+ && !isStringEmpty(this.getUseAsUsername());
}
@Data
@@ -227,11 +266,11 @@ public class ApplicationProperties {
case "github" -> getGithub();
case "keycloak" -> getKeycloak();
default ->
- throw new UnsupportedProviderException(
- "Logout from the provider "
- + registrationId
- + " is not supported. "
- + "Report it at https://github.com/Stirling-Tools/Stirling-PDF/issues");
+ throw new UnsupportedProviderException(
+ "Logout from the provider "
+ + registrationId
+ + " is not supported. "
+ + "Report it at https://github.com/Stirling-Tools/Stirling-PDF/issues");
};
}
}
@@ -309,7 +348,7 @@ public class ApplicationProperties {
driverName='%s'
}
"""
- .formatted(driverName);
+ .formatted(driverName);
}
}
@@ -326,14 +365,14 @@ public class ApplicationProperties {
public String getHomeDescription() {
return homeDescription != null && homeDescription.trim().length() > 0
- ? homeDescription
- : null;
+ ? homeDescription
+ : null;
}
public String getAppNameNavbar() {
return appNameNavbar != null && appNameNavbar.trim().length() > 0
- ? appNameNavbar
- : null;
+ ? appNameNavbar
+ : null;
}
}
@@ -419,8 +458,8 @@ public class ApplicationProperties {
public String getProducer() {
return producer == null || producer.trim().isEmpty()
- ? "Stirling-PDF"
- : producer;
+ ? "Stirling-PDF"
+ : producer;
}
}
diff --git a/proprietary/LICENSE b/proprietary/LICENSE-proprietary
similarity index 100%
rename from proprietary/LICENSE
rename to proprietary/LICENSE-proprietary
diff --git a/proprietary/build.gradle b/proprietary/build.gradle
index 43e4e982f..c3109339c 100644
--- a/proprietary/build.gradle
+++ b/proprietary/build.gradle
@@ -29,7 +29,7 @@ sourceSets {
test {
java {
- if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false') {
+ if (System.getenv('ADDITIONAL_FEATURES') == 'false') {
exclude 'stirling/software/proprietary/security/**'
}
diff --git a/scripts/download-security-jar.sh b/scripts/download-security-jar.sh
index 8c5c9122b..3a71d3f25 100644
--- a/scripts/download-security-jar.sh
+++ b/scripts/download-security-jar.sh
@@ -1,6 +1,6 @@
echo "Running Stirling PDF with ADDITIONAL_FEATURES=${ADDITIONAL_FEATURES} and VERSION_TAG=${VERSION_TAG}"
# Check for ADDITIONAL_FEATURES and download the appropriate JAR if required
-if [ "$ADDITIONAL_FEATURES" = "true" ] && [ "$VERSION_TAG" != "alpha" ]; then
+if [ "ADDITIONAL_FEATURES" = "true" ] && [ "$VERSION_TAG" != "alpha" ]; then
if [ ! -f app-security.jar ]; then
echo "Trying to download from: https://files.stirlingpdf.com/v$VERSION_TAG/Stirling-PDF-with-login.jar"
curl -L -o app-security.jar https://files.stirlingpdf.com/v$VERSION_TAG/Stirling-PDF-with-login.jar
diff --git a/stirling-pdf/build.gradle b/stirling-pdf/build.gradle
index 98a206e01..e0424abe3 100644
--- a/stirling-pdf/build.gradle
+++ b/stirling-pdf/build.gradle
@@ -68,5 +68,48 @@ dependencies {
// runtimeOnly "com.twelvemonkeys.imageio:imageio-thumbsdb:$imageioVersion"
// runtimeOnly "com.twelvemonkeys.imageio:imageio-xwd:$imageioVersion"
- developmentOnly "org.springframework.boot:spring-boot-devtools:$springBootVersion"
+ developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
+
+sourceSets {
+ main {
+ resources {
+ srcDirs += ['../configs']
+ }
+ }
+}
+
+jar {
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+
+ from {
+ configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+ }
+
+ manifest {
+ attributes(
+ 'Main-Class': 'stirling.software.spdf.SPDFApplication',
+ "Implementation-Title": "Stirling-PDF",
+ "Implementation-Version": project.version
+ )
+ }
+}
+
+shadowJar {
+ archiveClassifier.set('shadow')
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+
+ manifest {
+ attributes(
+ 'Main-Class': 'stirling.software.spdf.SPDFApplication'
+ )
+ }
+ zip64 = true
+ mergeServiceFiles()
+}
+
+build.dependsOn shadowJar
+jar.dependsOn ':common:jar'
+shadowJar.dependsOn ':common:jar'
+jar.dependsOn ':proprietary:jar'
+shadowJar.dependsOn ':proprietary:jar'
diff --git a/stirling-pdf/build/resources/main/application.properties b/stirling-pdf/build/resources/main/application.properties
index 0fd3751f0..64b658906 100644
--- a/stirling-pdf/build/resources/main/application.properties
+++ b/stirling-pdf/build/resources/main/application.properties
@@ -17,6 +17,7 @@ server.error.include-message=always
#logging.level.org.springframework.web=DEBUG
#logging.level.org.springframework=DEBUG
#logging.level.org.springframework.security=DEBUG
+
spring.servlet.multipart.max-file-size=2000MB
spring.servlet.multipart.max-request-size=2000MB
server.servlet.session.tracking-modes=cookie
@@ -29,6 +30,8 @@ spring.web.resources.mime-mappings.webmanifest=application/manifest+json
spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
management.endpoints.web.exposure.include=beans
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+#spring.config.additional-location=classpath:configs/settings.yml
spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB-2.3.232;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
diff --git a/stirling-pdf/src/main/java/stirling/software/spdf/SPDFApplication.java b/stirling-pdf/src/main/java/stirling/software/spdf/SPDFApplication.java
index 08e12b695..8f4d1a9c4 100644
--- a/stirling-pdf/src/main/java/stirling/software/spdf/SPDFApplication.java
+++ b/stirling-pdf/src/main/java/stirling/software/spdf/SPDFApplication.java
@@ -40,10 +40,6 @@ import stirling.software.common.util.UrlUtils;
"stirling.software.common",
"stirling.software.proprietary",
"stirling.software.proprietary.configuration"
- },
- exclude = {
- DataSourceAutoConfiguration.class,
- DataSourceTransactionManagerAutoConfiguration.class
})
public class SPDFApplication {
diff --git a/stirling-pdf/src/main/resources/application.properties b/stirling-pdf/src/main/resources/application.properties
index 0fd3751f0..64b658906 100644
--- a/stirling-pdf/src/main/resources/application.properties
+++ b/stirling-pdf/src/main/resources/application.properties
@@ -17,6 +17,7 @@ server.error.include-message=always
#logging.level.org.springframework.web=DEBUG
#logging.level.org.springframework=DEBUG
#logging.level.org.springframework.security=DEBUG
+
spring.servlet.multipart.max-file-size=2000MB
spring.servlet.multipart.max-request-size=2000MB
server.servlet.session.tracking-modes=cookie
@@ -29,6 +30,8 @@ spring.web.resources.mime-mappings.webmanifest=application/manifest+json
spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
management.endpoints.web.exposure.include=beans
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+#spring.config.additional-location=classpath:configs/settings.yml
spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB-2.3.232;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa