updating paths (DOCKER_SECURITY_ENABLE > ADDITIONAL_FEATURES)

This commit is contained in:
Dario Ghunney Ware 2025-05-19 11:00:27 +01:00
parent 26b532805f
commit ae2e16867f
24 changed files with 164 additions and 140 deletions

14
.gitattributes vendored
View File

@ -1,10 +1,10 @@
* text=auto eol=lf * text=auto eol=lf
# Ignore all JavaScript files in a directory # Ignore all JavaScript files in a directory
src/main/resources/static/pdfjs/* linguist-vendored stirling-pdf/src/main/resources/static/pdfjs/* linguist-vendored
src/main/resources/static/pdfjs/** linguist-vendored stirling-pdf/src/main/resources/static/pdfjs/** linguist-vendored
src/main/resources/static/pdfjs-legacy/* linguist-vendored stirling-pdf/src/main/resources/static/pdfjs-legacy/* linguist-vendored
src/main/resources/static/pdfjs-legacy/** linguist-vendored stirling-pdf/src/main/resources/static/pdfjs-legacy/** linguist-vendored
src/main/resources/static/css/bootstrap-icons.css linguist-vendored stirling-pdf/src/main/resources/static/css/bootstrap-icons.css linguist-vendored
src/main/resources/static/css/bootstrap.min.css linguist-vendored stirling-pdf/src/main/resources/static/css/bootstrap.min.css linguist-vendored
src/main/resources/static/css/fonts/* linguist-vendored stirling-pdf/src/main/resources/static/css/fonts/* linguist-vendored

View File

@ -29,22 +29,7 @@ Back End:
Security: Security:
- changed-files: - 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/**/*'
# - 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: 'scripts/download-security-jar.sh'
- any-glob-to-any-file: '.github/workflows/dependency-review.yml' - any-glob-to-any-file: '.github/workflows/dependency-review.yml'
- any-glob-to-any-file: '.github/workflows/scorecards.yml' - any-glob-to-any-file: '.github/workflows/scorecards.yml'

View File

@ -317,7 +317,7 @@ def check_for_differences(reference_file, file_list, branch, actor):
report.append("## ❌ Overall Check Status: **_Failed_**") report.append("## ❌ Overall Check Status: **_Failed_**")
report.append("") report.append("")
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: else:
report.append("## ✅ Overall Check Status: **_Success_**") report.append("## ✅ Overall Check Status: **_Success_**")

View File

@ -200,11 +200,11 @@ jobs:
run: | run: |
# Set security settings based on flags # Set security settings based on flags
if [ "${{ needs.check-comment.outputs.enable_security }}" == "true" ]; then if [ "${{ needs.check-comment.outputs.enable_security }}" == "true" ]; then
DOCKER_SECURITY="true" ADDITIONAL_FEATURES="true"
LOGIN_SECURITY="true" LOGIN_SECURITY="true"
SECURITY_STATUS="🔒 Security Enabled" SECURITY_STATUS="🔒 Security Enabled"
else else
DOCKER_SECURITY="false" ADDITIONAL_FEATURES="false"
LOGIN_SECURITY="false" LOGIN_SECURITY="false"
SECURITY_STATUS="Security Disabled" SECURITY_STATUS="Security Disabled"
fi 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 }}/config:/configs:rw
- /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/logs:/logs:rw - /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/logs:/logs:rw
environment: environment:
ADDITIONAL_FEATURES: "${DOCKER_SECURITY}" ADDITIONAL_FEATURES: "${ADDITIONAL_FEATURES}"
SECURITY_ENABLELOGIN: "${LOGIN_SECURITY}" SECURITY_ENABLELOGIN: "${LOGIN_SECURITY}"
SYSTEM_DEFAULTLOCALE: en-GB SYSTEM_DEFAULTLOCALE: en-GB
UI_APPNAME: "Stirling-PDF PR#${{ needs.check-comment.outputs.pr_number }}" UI_APPNAME: "Stirling-PDF PR#${{ needs.check-comment.outputs.pr_number }}"

View File

@ -4,7 +4,7 @@ on:
pull_request_target: pull_request_target:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
paths: paths:
- "src/main/resources/messages_*.properties" - "stirling-pdf/src/main/resources/messages_*.properties"
permissions: permissions:
contents: read # Allow read access to repository content contents: read # Allow read access to repository content
@ -58,7 +58,7 @@ jobs:
run: | run: |
echo "Fetching PR changed files..." echo "Fetching PR changed files..."
echo "Getting list of changed files from PR..." 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 - name: Determine reference file test
id: determine-file id: determine-file
@ -137,12 +137,12 @@ jobs:
// Determine reference file // Determine reference file
let referenceFilePath; 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."); console.log("Using PR branch reference file.");
const { data: fileContent } = await github.rest.repos.getContent({ const { data: fileContent } = await github.rest.repos.getContent({
owner: prRepoOwner, owner: prRepoOwner,
repo: prRepoName, repo: prRepoName,
path: "src/main/resources/messages_en_GB.properties", path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
ref: branch, ref: branch,
}); });
@ -154,7 +154,7 @@ jobs:
const { data: fileContent } = await github.rest.repos.getContent({ const { data: fileContent } = await github.rest.repos.getContent({
owner: repoOwner, owner: repoOwner,
repo: repoName, repo: repoName,
path: "src/main/resources/messages_en_GB.properties", path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
ref: "main", ref: "main",
}); });

View File

@ -54,7 +54,7 @@ jobs:
- name: Move and Rename License File - name: Move and Rename License File
run: | 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 - name: Set up git config
run: | run: |
@ -63,7 +63,7 @@ jobs:
- name: Run git add - name: Run git add
run: | 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 git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
- name: Create Pull Request - name: Create Pull Request

View File

@ -8,8 +8,8 @@ on:
paths: paths:
- "build.gradle" - "build.gradle"
- "README.md" - "README.md"
- "src/main/resources/messages_*.properties" - "stirling-pdf/src/main/resources/messages_*.properties"
- "src/main/resources/static/3rdPartyLicenses.json" - "stirling-pdf/src/main/resources/static/3rdPartyLicenses.json"
- "scripts/ignore_translation.toml" - "scripts/ignore_translation.toml"
permissions: permissions:
@ -78,7 +78,7 @@ jobs:
- name: Sync translation property files - name: Sync translation property files
run: | 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 - name: Set up git config
run: | run: |
@ -87,7 +87,7 @@ jobs:
- name: Run git add - name: Run git add
run: | 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" git diff --staged --quiet || git commit -m ":memo: Sync translation files" || echo "no changes"
- name: Install dependencies - name: Install dependencies
@ -142,4 +142,4 @@ jobs:
sign-commits: true sign-commits: true
add-paths: | add-paths: |
README.md README.md
src/main/resources/messages_*.properties stirling-pdf/src/main/resources/messages_*.properties

View File

@ -20,7 +20,7 @@ repos:
- --skip="./.*,*.csv,*.json,*.ambr" - --skip="./.*,*.csv,*.json,*.ambr"
- --quiet-level=2 - --quiet-level=2
files: \.(html|css|js|py|md)$ 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 - repo: https://github.com/gitleaks/gitleaks
rev: v8.24.3 rev: v8.24.3
hooks: hooks:

View File

@ -332,7 +332,7 @@ Thymeleaf is a server-side Java HTML template engine. It is used in Stirling-PDF
### Thymeleaf overview ### 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: 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) ### Adding a New Feature to the Backend (API)
1. **Create a New Controller:** 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. - 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")`. - 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) 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. - Implement the business logic for the new feature.
```java ```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) ### Adding a New Feature to the Frontend (UI)
1. **Create a New Thymeleaf Template:** 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 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. - 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:** 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. - Annotate the class with `@Controller` and `@RequestMapping` to define the UI endpoint.
```java ```java
@ -537,7 +537,7 @@ This would generate n entries of tr for each person in exampleData
3. **Update the Navigation Bar:** 3. **Update the Navigation Bar:**
- Add a link to the new feature page in 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 ```html
<li class="nav-item"> <li class="nav-item">
@ -551,7 +551,7 @@ When adding a new feature or modifying existing ones in Stirling-PDF, you'll nee
### 1. Locate Existing Language Files ### 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.properties` (default, usually English)
- `messages_en_GB.properties` - `messages_en_GB.properties`

View File

@ -4,7 +4,7 @@ FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff45
# Copy necessary files # Copy necessary files
COPY scripts /scripts COPY scripts /scripts
COPY pipeline /pipeline 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 src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/
COPY build/libs/*.jar app.jar COPY build/libs/*.jar app.jar

View File

@ -24,7 +24,7 @@ FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff45
# Copy necessary files # Copy necessary files
COPY scripts /scripts COPY scripts /scripts
COPY pipeline /pipeline 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 COPY --from=build /app/build/libs/*.jar app.jar
ARG VERSION_TAG ARG VERSION_TAG

View File

@ -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: 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: 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: 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`. 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`.

View File

@ -4,7 +4,7 @@ Copyright (c) 2024 Stirling Tools
Portions of this software are licensed as follows: 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. * 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 Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -57,7 +57,7 @@ sourceSets {
test { test {
java { java {
if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false') { if (System.getenv('ADDITIONAL_FEATURES') == 'false') {
exclude 'stirling/software/proprietary/security/**' exclude 'stirling/software/proprietary/security/**'
} }
@ -167,7 +167,7 @@ jpackage {
appVersion = project.version appVersion = project.version
vendor = "Stirling PDF Inc" vendor = "Stirling PDF Inc"
appDescription = "Stirling PDF - Your Local PDF Editor" 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 verbose = true
// mainClass = "org.springframework.boot.loader.launch.JarLauncher" // mainClass = "org.springframework.boot.loader.launch.JarLauncher"
@ -208,7 +208,7 @@ jpackage {
// MacOS-specific configuration // MacOS-specific configuration
mac { mac {
appVersion = getMacVersion(project.version.toString()) appVersion = getMacVersion(project.version.toString())
icon = "src/main/resources/static/favicon.icns" icon = "stirling-pdf/src/main/resources/static/favicon.icns"
type = "dmg" type = "dmg"
macPackageIdentifier = "Stirling PDF" macPackageIdentifier = "Stirling PDF"
macPackageName = "Stirling PDF" macPackageName = "Stirling PDF"
@ -230,7 +230,7 @@ jpackage {
// Linux-specific configuration // Linux-specific configuration
linux { linux {
appVersion = project.version 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 type = "deb" // Can also use "rpm" for Red Hat-based systems
// Debian package configuration // Debian package configuration
@ -307,7 +307,7 @@ tasks.register('jpackageMacX64') {
'--main-class', 'org.springframework.boot.loader.launch.JarLauncher', '--main-class', 'org.springframework.boot.loader.launch.JarLauncher',
'--runtime-image', file(jrePath + "/zulu-17.jre/Contents/Home"), '--runtime-image', file(jrePath + "/zulu-17.jre/Contents/Home"),
'--dest', 'build/jpackage/x86_64', '--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()), '--app-version', getMacVersion(project.version.toString()),
'--mac-package-name', 'Stirling PDF (x86_64)', '--mac-package-name', 'Stirling PDF (x86_64)',
'--mac-package-identifier', 'Stirling PDF (x86_64)', '--mac-package-identifier', 'Stirling PDF (x86_64)',
@ -392,7 +392,7 @@ tasks.register('cleanTempJre') {
} }
launch4j { launch4j {
icon = "${projectDir}/src/main/resources/static/favicon.ico" icon = "${projectDir}/stirling-pdf/src/main/resources/static/favicon.ico"
outfile="Stirling-PDF.exe" outfile="Stirling-PDF.exe"
@ -443,9 +443,9 @@ sonar {
property "sonar.projectKey", "Stirling-Tools_Stirling-PDF" property "sonar.projectKey", "Stirling-Tools_Stirling-PDF"
property "sonar.organization", "stirling-tools" 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.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.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.cpd.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
} }
} }

View File

@ -62,7 +62,7 @@ public class AppConfig {
@Bean @Bean
public boolean activeSecurity() { public boolean activeSecurity() {
return env.getProperty("DOCKER_SECURITY_ENABLED", Boolean.class, true); return env.getProperty("ADDITIONAL_FEATURES", Boolean.class, true);
} }
@Bean(name = "appName") @Bean(name = "appName")

View File

@ -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;
}
}

View File

@ -1,5 +1,7 @@
package stirling.software.common.model; package stirling.software.common.model;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -14,26 +16,63 @@ import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties; 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.Ordered;
import org.springframework.core.annotation.Order; 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.ClassPathResource;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.stereotype.Component; 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.model.exception.UnsupportedProviderException;
import stirling.software.common.util.ValidationUtil; import stirling.software.common.util.ValidationUtil;
import stirling.software.common.model.oauth2.provider.GitHubProvider; import stirling.software.common.model.oauth2.provider.GitHubProvider;
import stirling.software.common.model.oauth2.provider.GoogleProvider; import stirling.software.common.model.oauth2.provider.GoogleProvider;
import stirling.software.common.model.oauth2.provider.KeycloakProvider; import stirling.software.common.model.oauth2.provider.KeycloakProvider;
import stirling.software.common.model.oauth2.provider.Provider; 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 @Configuration
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
@ConfigurationProperties(prefix = "") @ConfigurationProperties(prefix = "")
@Data
@Order(Ordered.HIGHEST_PRECEDENCE)
@Slf4j
public class ApplicationProperties { 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 Legal legal = new Legal();
private Security security = new Security(); private Security security = new Security();
private System system = new System(); private System system = new System();
@ -208,11 +247,11 @@ public class ApplicationProperties {
} }
public boolean isSettingsValid() { public boolean isSettingsValid() {
return !ValidationUtil.isStringEmpty(this.getIssuer()) return !isStringEmpty(this.getIssuer())
&& !ValidationUtil.isStringEmpty(this.getClientId()) && !isStringEmpty(this.getClientId())
&& !ValidationUtil.isStringEmpty(this.getClientSecret()) && !isStringEmpty(this.getClientSecret())
&& !ValidationUtil.isCollectionEmpty(this.getScopes()) && !isCollectionEmpty(this.getScopes())
&& !ValidationUtil.isStringEmpty(this.getUseAsUsername()); && !isStringEmpty(this.getUseAsUsername());
} }
@Data @Data

View File

@ -29,7 +29,7 @@ sourceSets {
test { test {
java { java {
if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false') { if (System.getenv('ADDITIONAL_FEATURES') == 'false') {
exclude 'stirling/software/proprietary/security/**' exclude 'stirling/software/proprietary/security/**'
} }

View File

@ -1,6 +1,6 @@
echo "Running Stirling PDF with ADDITIONAL_FEATURES=${ADDITIONAL_FEATURES} and VERSION_TAG=${VERSION_TAG}" 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 # 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 if [ ! -f app-security.jar ]; then
echo "Trying to download from: https://files.stirlingpdf.com/v$VERSION_TAG/Stirling-PDF-with-login.jar" 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 curl -L -o app-security.jar https://files.stirlingpdf.com/v$VERSION_TAG/Stirling-PDF-with-login.jar

View File

@ -68,5 +68,48 @@ dependencies {
// runtimeOnly "com.twelvemonkeys.imageio:imageio-thumbsdb:$imageioVersion" // runtimeOnly "com.twelvemonkeys.imageio:imageio-thumbsdb:$imageioVersion"
// runtimeOnly "com.twelvemonkeys.imageio:imageio-xwd:$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'

View File

@ -17,6 +17,7 @@ server.error.include-message=always
#logging.level.org.springframework.web=DEBUG #logging.level.org.springframework.web=DEBUG
#logging.level.org.springframework=DEBUG #logging.level.org.springframework=DEBUG
#logging.level.org.springframework.security=DEBUG #logging.level.org.springframework.security=DEBUG
spring.servlet.multipart.max-file-size=2000MB spring.servlet.multipart.max-file-size=2000MB
spring.servlet.multipart.max-request-size=2000MB spring.servlet.multipart.max-request-size=2000MB
server.servlet.session.tracking-modes=cookie 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} spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
management.endpoints.web.exposure.include=beans 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.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.driver-class-name=org.h2.Driver
spring.datasource.username=sa spring.datasource.username=sa

View File

@ -40,10 +40,6 @@ import stirling.software.common.util.UrlUtils;
"stirling.software.common", "stirling.software.common",
"stirling.software.proprietary", "stirling.software.proprietary",
"stirling.software.proprietary.configuration" "stirling.software.proprietary.configuration"
},
exclude = {
DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class
}) })
public class SPDFApplication { public class SPDFApplication {

View File

@ -17,6 +17,7 @@ server.error.include-message=always
#logging.level.org.springframework.web=DEBUG #logging.level.org.springframework.web=DEBUG
#logging.level.org.springframework=DEBUG #logging.level.org.springframework=DEBUG
#logging.level.org.springframework.security=DEBUG #logging.level.org.springframework.security=DEBUG
spring.servlet.multipart.max-file-size=2000MB spring.servlet.multipart.max-file-size=2000MB
spring.servlet.multipart.max-request-size=2000MB spring.servlet.multipart.max-request-size=2000MB
server.servlet.session.tracking-modes=cookie 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} spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
management.endpoints.web.exposure.include=beans 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.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.driver-class-name=org.h2.Driver
spring.datasource.username=sa spring.datasource.username=sa