mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-22 07:25:04 +00:00
wip - fixing fe bug
This commit is contained in:
parent
9091281ae4
commit
3ced047760
36
build.gradle
36
build.gradle
@ -29,9 +29,6 @@ ext {
|
|||||||
tempJrePath = null
|
tempJrePath = null
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "stirling.software"
|
|
||||||
version = "0.46.1"
|
|
||||||
|
|
||||||
// todo: package jar with option for enterprise features to be included
|
// todo: package jar with option for enterprise features to be included
|
||||||
jar {
|
jar {
|
||||||
enabled = false
|
enabled = false
|
||||||
@ -46,6 +43,9 @@ bootJar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
group = "stirling.software"
|
||||||
|
version = "0.46.1"
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
if (project == rootProject) return
|
if (project == rootProject) return
|
||||||
tasks.register('wrapper', Wrapper) {
|
tasks.register('wrapper', Wrapper) {
|
||||||
@ -61,8 +61,7 @@ subprojects {
|
|||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
|
||||||
group = "stirling.software"
|
|
||||||
version = "0.46.1"
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
// 17 is lowest but we support and recommend 21
|
// 17 is lowest but we support and recommend 21
|
||||||
@ -148,10 +147,10 @@ sourceSets {
|
|||||||
test {
|
test {
|
||||||
java {
|
java {
|
||||||
if (System.getenv("DOCKER_ENABLE_SECURITY") == "false") {
|
if (System.getenv("DOCKER_ENABLE_SECURITY") == "false") {
|
||||||
exclude "stirling/software/SPDF/config/security/**"
|
exclude "stirling/software/spdf/config/security/**"
|
||||||
exclude "stirling/software/SPDF/model/ApiKeyAuthenticationTokenTest.java"
|
exclude "stirling/software/spdf/model/ApiKeyAuthenticationTokenTest.java"
|
||||||
exclude "stirling/software/SPDF/controller/api/EmailControllerTest.java"
|
exclude "stirling/software/spdf/controller/api/EmailControllerTest.java"
|
||||||
exclude "stirling/software/SPDF/repository/**"
|
exclude "stirling/software/spdf/repository/**"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getenv("STIRLING_PDF_DESKTOP_UI") == "false") {
|
if (System.getenv("STIRLING_PDF_DESKTOP_UI") == "false") {
|
||||||
@ -475,13 +474,26 @@ swaggerhubUpload {
|
|||||||
oas = "3.0.0" // The version of the OpenAPI Specification you"re using
|
oas = "3.0.0" // The version of the OpenAPI Specification you"re using
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named("test") {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register('writeVersion') {
|
tasks.register('writeVersion') {
|
||||||
def propsFile = file("$projectDir/stirling-pdf/src/main/resources/version.properties")
|
def propsFile = file("$projectDir/stirling-pdf/src/main/resources/version.properties")
|
||||||
def propsDir = propsFile.parentFile
|
def propsDir = propsFile.parentFile
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
if (!propsDir.exists()) {
|
if (propsDir.exists()) {
|
||||||
|
if (propsFile.exists()) {
|
||||||
|
println "File exists: $propsFile"
|
||||||
|
} else {
|
||||||
|
println "$propsFile does not exist. Creating file."
|
||||||
|
propsFile.createNewFile()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println "Creating directory: $propsDir"
|
||||||
propsDir.mkdirs()
|
propsDir.mkdirs()
|
||||||
|
propsFile.createNewFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
def props = new Properties()
|
def props = new Properties()
|
||||||
@ -492,10 +504,6 @@ tasks.register('writeVersion') {
|
|||||||
|
|
||||||
processResources.dependsOn(writeVersion)
|
processResources.dependsOn(writeVersion)
|
||||||
|
|
||||||
tasks.named("test") {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register('printVersion') {
|
tasks.register('printVersion') {
|
||||||
doLast {
|
doLast {
|
||||||
println project.version
|
println project.version
|
||||||
|
@ -11,6 +11,7 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20240325.1'
|
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20240325.1'
|
||||||
implementation 'com.fathzer:javaluator:3.0.6'
|
implementation 'com.fathzer:javaluator:3.0.6'
|
||||||
|
implementation 'com.posthog.java:posthog:1.2.0'
|
||||||
implementation 'io.github.pixee:java-security-toolkit:1.2.1'
|
implementation 'io.github.pixee:java-security-toolkit:1.2.1'
|
||||||
implementation 'org.apache.commons:commons-lang3:3.17.0'
|
implementation 'org.apache.commons:commons-lang3:3.17.0'
|
||||||
implementation 'com.drewnoakes:metadata-extractor:2.19.0' // Image metadata extractor
|
implementation 'com.drewnoakes:metadata-extractor:2.19.0' // Image metadata extractor
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.configuration;
|
package stirling.software.common.configuration;
|
||||||
|
|
||||||
|
import com.posthog.java.PostHog;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -32,9 +33,8 @@ import stirling.software.common.model.ApplicationProperties;
|
|||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
|
|
||||||
private final Environment env;
|
private final Environment env;
|
||||||
private final ApplicationProperties applicationProperties;
|
|
||||||
|
|
||||||
private final Environment env;
|
private final ApplicationProperties applicationProperties;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Value("${baseUrl:http://localhost}")
|
@Value("${baseUrl:http://localhost}")
|
||||||
@ -48,6 +48,12 @@ public class AppConfig {
|
|||||||
@Value("${server.port:8080}")
|
@Value("${server.port:8080}")
|
||||||
private String serverPort;
|
private String serverPort;
|
||||||
|
|
||||||
|
@Value("${posthog.apiKey")
|
||||||
|
private String posthogApiKey;
|
||||||
|
|
||||||
|
@Value("${posthog.host}")
|
||||||
|
private String posthogHost;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "system.customHTMLFiles", havingValue = "true")
|
@ConditionalOnProperty(name = "system.customHTMLFiles", havingValue = "true")
|
||||||
public SpringTemplateEngine templateEngine(ResourceLoader resourceLoader) {
|
public SpringTemplateEngine templateEngine(ResourceLoader resourceLoader) {
|
||||||
@ -271,4 +277,12 @@ public class AppConfig {
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PostHog postHog() {
|
||||||
|
return new PostHog.Builder(posthogApiKey)
|
||||||
|
.host(posthogHost)
|
||||||
|
.logger(new PostHogLoggerImpl())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,25 +48,22 @@ public class InstallationPathConfig {
|
|||||||
String os = System.getProperty("os.name").toLowerCase();
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
if (os.contains("win")) {
|
if (os.contains("win")) {
|
||||||
return Paths.get(
|
return Paths.get(
|
||||||
System.getenv("APPDATA"), // parent path
|
System.getenv("APPDATA"), // parent path
|
||||||
"Stirling-PDF")
|
"Stirling-PDF")
|
||||||
.toString()
|
+ File.separator;
|
||||||
+ File.separator;
|
|
||||||
} else if (os.contains("mac")) {
|
} else if (os.contains("mac")) {
|
||||||
return Paths.get(
|
return Paths.get(
|
||||||
System.getProperty("user.home"),
|
System.getProperty("user.home"),
|
||||||
"Library",
|
"Library",
|
||||||
"Application Support",
|
"Application Support",
|
||||||
"Stirling-PDF")
|
"Stirling-PDF")
|
||||||
.toString()
|
+ File.separator;
|
||||||
+ File.separator;
|
|
||||||
} else {
|
} else {
|
||||||
return Paths.get(
|
return Paths.get(
|
||||||
System.getProperty("user.home"), // parent path
|
System.getProperty("user.home"), // parent path
|
||||||
".config",
|
".config",
|
||||||
"Stirling-PDF")
|
"Stirling-PDF")
|
||||||
.toString()
|
+ File.separator;
|
||||||
+ File.separator;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "." + File.separator;
|
return "." + File.separator;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package stirling.software.spdf.config;
|
package stirling.software.common.configuration;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package stirling.software.spdf.service;
|
package stirling.software.common.service;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.management.GarbageCollectorMXBean;
|
import java.lang.management.GarbageCollectorMXBean;
|
||||||
@ -26,7 +26,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.posthog.java.PostHog;
|
import com.posthog.java.PostHog;
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.service.UserServiceInterface;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PostHogService {
|
public class PostHogService {
|
@ -59,7 +59,6 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-jetty'
|
implementation 'org.springframework.boot:spring-boot-starter-jetty'
|
||||||
implementation 'io.swagger.core.v3:swagger-core-jakarta:2.2.30'
|
implementation 'io.swagger.core.v3:swagger-core-jakarta:2.2.30'
|
||||||
implementation 'com.posthog.java:posthog:1.2.0'
|
|
||||||
|
|
||||||
implementation 'com.bucket4j:bucket4j_jdk17-core:8.14.0' // https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
implementation 'com.bucket4j:bucket4j_jdk17-core:8.14.0' // https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
||||||
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
|
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package stirling.software.spdf.EE.configuration;
|
package stirling.software.spdf.EE;
|
||||||
|
|
||||||
import static stirling.software.spdf.EE.configuration.KeygenLicenseVerifier.License;
|
import static stirling.software.spdf.EE.KeygenLicenseVerifier.License;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
@ -1,4 +1,4 @@
|
|||||||
package stirling.software.spdf.EE.configuration;
|
package stirling.software.spdf.EE;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.http.HttpClient;
|
import java.net.http.HttpClient;
|
@ -1,4 +1,4 @@
|
|||||||
package stirling.software.spdf.EE.configuration;
|
package stirling.software.spdf.EE;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import stirling.software.spdf.EE.configuration.KeygenLicenseVerifier.License;
|
import stirling.software.spdf.EE.KeygenLicenseVerifier.License;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.util.GeneralUtil;
|
import stirling.software.common.util.GeneralUtil;
|
||||||
|
|
@ -59,7 +59,7 @@ public class InitialSetup {
|
|||||||
|
|
||||||
public void initEnableCSRFSecurity() throws IOException {
|
public void initEnableCSRFSecurity() throws IOException {
|
||||||
if (GeneralUtil.isVersionHigher(
|
if (GeneralUtil.isVersionHigher(
|
||||||
"0.36.0", applicationProperties.getAutomaticallyGenerated().getAppVersion())) {
|
"0.46.0", applicationProperties.getAutomaticallyGenerated().getAppVersion())) {
|
||||||
Boolean csrf = applicationProperties.getSecurity().getCsrfDisabled();
|
Boolean csrf = applicationProperties.getSecurity().getCsrfDisabled();
|
||||||
if (!csrf) {
|
if (!csrf) {
|
||||||
GeneralUtil.saveKeyToSettings("security.csrfDisabled", false);
|
GeneralUtil.saveKeyToSettings("security.csrfDisabled", false);
|
||||||
|
@ -25,7 +25,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
// Handler for external static resources
|
// Handler for external static resources
|
||||||
registry.addResourceHandler("/**")
|
registry.addResourceHandler("/**")
|
||||||
.addResourceLocations(
|
.addResourceLocations(
|
||||||
"file:" + InstallationPathConfig.getStaticPath(), "classpath:/static/");
|
"classpath:/stirling-pdf/src/main/resources/static/",
|
||||||
|
"classpath:/stirling-pdf/static/",
|
||||||
|
"classpath:/static/",
|
||||||
|
"file:" + InstallationPathConfig.getStaticPath()
|
||||||
|
);
|
||||||
// .setCachePeriod(0); // Optional: disable caching
|
// .setCachePeriod(0); // Optional: disable caching
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import stirling.software.spdf.model.PipelineConfig;
|
|||||||
import stirling.software.spdf.model.PipelineOperation;
|
import stirling.software.spdf.model.PipelineOperation;
|
||||||
import stirling.software.spdf.model.PipelineResult;
|
import stirling.software.spdf.model.PipelineResult;
|
||||||
import stirling.software.spdf.model.api.HandleDataRequest;
|
import stirling.software.spdf.model.api.HandleDataRequest;
|
||||||
import stirling.software.spdf.service.PostHogService;
|
import stirling.software.common.service.PostHogService;
|
||||||
import stirling.software.common.util.WebResponseUtils;
|
import stirling.software.common.util.WebResponseUtils;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -36,7 +36,7 @@ import stirling.software.spdf.model.PipelineConfig;
|
|||||||
import stirling.software.spdf.model.PipelineOperation;
|
import stirling.software.spdf.model.PipelineOperation;
|
||||||
import stirling.software.spdf.model.PipelineResult;
|
import stirling.software.spdf.model.PipelineResult;
|
||||||
import stirling.software.spdf.service.ApiDocService;
|
import stirling.software.spdf.service.ApiDocService;
|
||||||
import stirling.software.spdf.service.PostHogService;
|
import stirling.software.common.service.PostHogService;
|
||||||
import stirling.software.common.configuration.RuntimePathConfig;
|
import stirling.software.common.configuration.RuntimePathConfig;
|
||||||
import stirling.software.common.util.FileMonitor;
|
import stirling.software.common.util.FileMonitor;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import io.micrometer.core.instrument.search.Search;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import stirling.software.common.service.PostHogService;
|
||||||
import stirling.software.spdf.config.EndpointInspector;
|
import stirling.software.spdf.config.EndpointInspector;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
45
stirling-pdf/src/main/resources/application.properties
Normal file
45
stirling-pdf/src/main/resources/application.properties
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
multipart.enabled=true
|
||||||
|
logging.level.org.springframework=WARN
|
||||||
|
logging.level.org.hibernate=WARN
|
||||||
|
logging.level.org.eclipse.jetty=WARN
|
||||||
|
#logging.level.org.springframework.security.saml2=TRACE
|
||||||
|
#logging.level.org.springframework.security=DEBUG
|
||||||
|
#logging.level.org.opensaml=DEBUG
|
||||||
|
#logging.level.stirling.software.SPDF.config.security: DEBUG
|
||||||
|
logging.level.com.zaxxer.hikari=WARN
|
||||||
|
spring.jpa.open-in-view=false
|
||||||
|
server.forward-headers-strategy=NATIVE
|
||||||
|
server.error.path=/error
|
||||||
|
server.error.whitelabel.enabled=false
|
||||||
|
server.error.include-stacktrace=always
|
||||||
|
server.error.include-exception=true
|
||||||
|
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
|
||||||
|
server.servlet.context-path=${SYSTEM_ROOTURIPATH:/}
|
||||||
|
spring.devtools.restart.enabled=true
|
||||||
|
spring.devtools.livereload.enabled=true
|
||||||
|
spring.devtools.restart.exclude=stirling.software.proprietary.security/**
|
||||||
|
spring.thymeleaf.encoding=UTF-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.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
|
||||||
|
spring.datasource.password=
|
||||||
|
spring.h2.console.enabled=true
|
||||||
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
|
server.servlet.session.timeout:30m
|
||||||
|
# Change the default URL path for OpenAPI JSON
|
||||||
|
springdoc.api-docs.path=/v1/api-docs
|
||||||
|
# Set the URL of the OpenAPI JSON for the Swagger UI
|
||||||
|
springdoc.swagger-ui.url=/v1/api-docs
|
||||||
|
springdoc.swagger-ui.path=/index.html
|
||||||
|
posthog.api.key=phc_fiR65u5j6qmXTYL56MNrLZSWqLaDW74OrZH0Insd2xq
|
||||||
|
posthog.host=https://eu.i.posthog.com
|
Loading…
x
Reference in New Issue
Block a user