This commit is contained in:
Anthony Stirling 2024-10-05 15:27:57 +01:00
parent dedfabd630
commit 83e93688ee
13 changed files with 76 additions and 69 deletions

@ -123,7 +123,7 @@ Feature: API Validation
| odt | .odt | | odt | .odt |
| doc | .doc | | doc | .doc |
@ocr @ocr @pdfa1
Scenario: PDFA Scenario: PDFA
Given I use an example file at "exampleFiles/pdfa2.pdf" as parameter "fileInput" Given I use an example file at "exampleFiles/pdfa2.pdf" as parameter "fileInput"
And the request data includes And the request data includes
@ -134,7 +134,7 @@ Feature: API Validation
And the response file should have extension ".pdf" And the response file should have extension ".pdf"
And the response file should have size greater than 100 And the response file should have size greater than 100
@ocr @ocr @pdfa2
Scenario: PDFA1 Scenario: PDFA1
Given I use an example file at "exampleFiles/pdfa1.pdf" as parameter "fileInput" Given I use an example file at "exampleFiles/pdfa1.pdf" as parameter "fileInput"
And the request data includes And the request data includes

@ -175,7 +175,10 @@ public class KeygenLicenseVerifier {
log.info("Machine activated successfully"); log.info("Machine activated successfully");
return true; return true;
} else { } else {
log.error("Error activating machine. Status code: " + response.statusCode()); log.error(
"Error activating machine. Status code: {}, error: {}",
response.statusCode(),
response.body());
return false; return false;
} }

@ -37,10 +37,8 @@ public class LicenseKeyChecker {
log.info(applicationProperties.toString()); log.info(applicationProperties.toString());
log.info(applicationProperties.getEnterpriseEdition().toString()); log.info(applicationProperties.getEnterpriseEdition().toString());
if (!applicationProperties.getEnterpriseEdition().isEnabled()) { if (!applicationProperties.getEnterpriseEdition().isEnabled()) {
System.out.println("gggggg");
enterpriseEnbaledResult = false; enterpriseEnbaledResult = false;
} else { } else {
System.out.println("ssssssssssss");
enterpriseEnbaledResult = enterpriseEnbaledResult =
licenseService.verifyLicense( licenseService.verifyLicense(
applicationProperties.getEnterpriseEdition().getKey()); applicationProperties.getEnterpriseEdition().getKey());

@ -1,22 +1,22 @@
//package stirling.software.SPDF.config.fingerprint; // package stirling.software.SPDF.config.fingerprint;
// //
//import java.io.IOException; // import java.io.IOException;
// //
//import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component; // import org.springframework.stereotype.Component;
//import org.springframework.web.filter.OncePerRequestFilter; // import org.springframework.web.filter.OncePerRequestFilter;
// //
//import jakarta.servlet.FilterChain; // import jakarta.servlet.FilterChain;
//import jakarta.servlet.ServletException; // import jakarta.servlet.ServletException;
//import jakarta.servlet.http.HttpServletRequest; // import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse; // import jakarta.servlet.http.HttpServletResponse;
//import jakarta.servlet.http.HttpSession; // import jakarta.servlet.http.HttpSession;
//import lombok.extern.slf4j.Slf4j; // import lombok.extern.slf4j.Slf4j;
//import stirling.software.SPDF.utils.RequestUriUtils; // import stirling.software.SPDF.utils.RequestUriUtils;
// //
////@Component //// @Component
//@Slf4j // @Slf4j
//public class FingerprintBasedSessionFilter extends OncePerRequestFilter { // public class FingerprintBasedSessionFilter extends OncePerRequestFilter {
// private final FingerprintGenerator fingerprintGenerator; // private final FingerprintGenerator fingerprintGenerator;
// private final FingerprintBasedSessionManager sessionManager; // private final FingerprintBasedSessionManager sessionManager;
// //
@ -65,4 +65,4 @@
// log.debug("Proceeding with request: {}", request.getRequestURI()); // log.debug("Proceeding with request: {}", request.getRequestURI());
// filterChain.doFilter(request, response); // filterChain.doFilter(request, response);
// } // }
//} // }

@ -1,24 +1,24 @@
//package stirling.software.SPDF.config.fingerprint; // package stirling.software.SPDF.config.fingerprint;
// //
//import java.util.Iterator; // import java.util.Iterator;
//import java.util.Map; // import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap; // import java.util.concurrent.ConcurrentHashMap;
//import java.util.concurrent.TimeUnit; // import java.util.concurrent.TimeUnit;
// //
//import org.springframework.scheduling.annotation.Scheduled; // import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component; // import org.springframework.stereotype.Component;
// //
//import jakarta.servlet.http.HttpSession; // import jakarta.servlet.http.HttpSession;
//import jakarta.servlet.http.HttpSessionAttributeListener; // import jakarta.servlet.http.HttpSessionAttributeListener;
//import jakarta.servlet.http.HttpSessionEvent; // import jakarta.servlet.http.HttpSessionEvent;
//import jakarta.servlet.http.HttpSessionListener; // import jakarta.servlet.http.HttpSessionListener;
//import lombok.AllArgsConstructor; // import lombok.AllArgsConstructor;
//import lombok.Data; // import lombok.Data;
//import lombok.extern.slf4j.Slf4j; // import lombok.extern.slf4j.Slf4j;
// //
//@Slf4j // @Slf4j
//@Component // @Component
//public class FingerprintBasedSessionManager // public class FingerprintBasedSessionManager
// implements HttpSessionListener, HttpSessionAttributeListener { // implements HttpSessionListener, HttpSessionAttributeListener {
// private static final ConcurrentHashMap<String, FingerprintInfo> activeFingerprints = // private static final ConcurrentHashMap<String, FingerprintInfo> activeFingerprints =
// new ConcurrentHashMap<>(); // new ConcurrentHashMap<>();
@ -131,4 +131,4 @@
// private String sessionId; // private String sessionId;
// private long lastAccessTime; // private long lastAccessTime;
// } // }
//} // }

@ -1,14 +1,14 @@
//package stirling.software.SPDF.config.fingerprint; // package stirling.software.SPDF.config.fingerprint;
// //
//import java.security.MessageDigest; // import java.security.MessageDigest;
//import java.security.NoSuchAlgorithmException; // import java.security.NoSuchAlgorithmException;
// //
//import org.springframework.stereotype.Component; // import org.springframework.stereotype.Component;
// //
//import jakarta.servlet.http.HttpServletRequest; // import jakarta.servlet.http.HttpServletRequest;
// //
//@Component // @Component
//public class FingerprintGenerator { // public class FingerprintGenerator {
// //
// public String generateFingerprint(HttpServletRequest request) { // public String generateFingerprint(HttpServletRequest request) {
// if (request == null) { // if (request == null) {
@ -74,4 +74,4 @@
// throw new RuntimeException("Failed to generate fingerprint hash", e); // throw new RuntimeException("Failed to generate fingerprint hash", e);
// } // }
// } // }
//} // }

@ -79,7 +79,7 @@ public class SecurityConfiguration {
http.authenticationManager(authenticationManager(http)); http.authenticationManager(authenticationManager(http));
if (loginEnabledValue) { if (loginEnabledValue) {
http.addFilterBefore( http.addFilterBefore(
userAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); userAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
http.csrf(csrf -> csrf.disable()); http.csrf(csrf -> csrf.disable());
http.addFilterBefore(rateLimitingFilter(), UsernamePasswordAuthenticationFilter.class); http.addFilterBefore(rateLimitingFilter(), UsernamePasswordAuthenticationFilter.class);

@ -61,7 +61,7 @@ public class ConvertPDFToPDFA {
command.add("-dPDFA=" + ("pdfa".equals(outputFormat) ? "2" : "1")); command.add("-dPDFA=" + ("pdfa".equals(outputFormat) ? "2" : "1"));
command.add("-dNOPAUSE"); command.add("-dNOPAUSE");
command.add("-dBATCH"); command.add("-dBATCH");
command.add("-sColorConversionStrategy=UseDeviceIndependentColor"); command.add("-sColorConversionStrategy=sRGB");
command.add("-sDEVICE=pdfwrite"); command.add("-sDEVICE=pdfwrite");
command.add("-dPDFACompatibilityPolicy=2"); command.add("-dPDFACompatibilityPolicy=2");
command.add("-o"); command.add("-o");

@ -39,9 +39,9 @@ public class PostHogService {
} }
private void captureSystemInfo() { private void captureSystemInfo() {
if(!Boolean.getBoolean(applicationProperties.getSystem().getEnableAnalytics())) { if (!Boolean.getBoolean(applicationProperties.getSystem().getEnableAnalytics())) {
return; return;
} }
try { try {
postHog.capture(uniqueId, "system_info_captured", captureServerMetrics()); postHog.capture(uniqueId, "system_info_captured", captureServerMetrics());
} catch (Exception e) { } catch (Exception e) {
@ -50,9 +50,9 @@ public class PostHogService {
} }
public void captureEvent(String eventName, Map<String, Object> properties) { public void captureEvent(String eventName, Map<String, Object> properties) {
if(!Boolean.getBoolean(applicationProperties.getSystem().getEnableAnalytics())) { if (!Boolean.getBoolean(applicationProperties.getSystem().getEnableAnalytics())) {
return; return;
} }
postHog.capture(uniqueId, eventName, properties); postHog.capture(uniqueId, eventName, properties);
} }

@ -6,11 +6,12 @@ import org.springframework.core.io.InputStreamResource;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile; import stirling.software.SPDF.model.api.PDFFile;
import stirling.software.SPDF.model.api.misc.ReplaceAndInvert; import stirling.software.SPDF.model.api.misc.ReplaceAndInvert;
@Data @Data
// @EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public abstract class ReplaceAndInvertColorStrategy extends PDFFile { public abstract class ReplaceAndInvertColorStrategy extends PDFFile {
protected ReplaceAndInvert replaceAndInvert; protected ReplaceAndInvert replaceAndInvert;

@ -508,9 +508,9 @@ home.splitPdfByChapters.desc=Split a PDF into multiple files based on its chapte
splitPdfByChapters.tags=split,chapters,bookmarks,organize splitPdfByChapters.tags=split,chapters,bookmarks,organize
#replace-invert-color #replace-invert-color
replace-color.title=Replace-Invert-Color replace-color.title=Advanced Colour options
replace-color.header=Replace-Invert Color PDF replace-color.header=Replace-Invert Color PDF
home.replaceColorPdf.title=Replace and Invert Color home.replaceColorPdf.title=Advanced Colour options
home.replaceColorPdf.desc=Replace color for text and background in PDF and invert full color of pdf to reduce file size home.replaceColorPdf.desc=Replace color for text and background in PDF and invert full color of pdf to reduce file size
replaceColorPdf.tags=Replace Color,Page operations,Back end,server side replaceColorPdf.tags=Replace Color,Page operations,Back end,server side
replace-color.selectText.1=Replace or Invert color Options replace-color.selectText.1=Replace or Invert color Options

@ -77,7 +77,7 @@ label {
flex-direction: column; flex-direction: column;
padding: 1rem; padding: 1rem;
border-radius: 25px; border-radius: 25px;
overflow-y: hidden; overflow-y: auto;
overflow-x: auto; overflow-x: auto;
min-height: 275px; min-height: 275px;
margin: 0 0 30px 0; margin: 0 0 30px 0;

@ -1,27 +1,32 @@
const scrollDivHorizontally = (id) => { const scrollDivHorizontally = (id) => {
var scrollDelta = 0; // variable to store the accumulated scroll delta var scrollDeltaX = 0; // variable to store the accumulated horizontal scroll delta
var scrollDeltaY = 0; // variable to store the accumulated vertical scroll delta
var isScrolling = false; // variable to track if scroll is already in progress var isScrolling = false; // variable to track if scroll is already in progress
const divToScrollHorizontally = document.getElementById(id); const divToScroll = document.getElementById(id);
function scrollLoop() { function scrollLoop() {
// Scroll the div horizontally by a fraction of the accumulated scroll delta // Scroll the div horizontally and vertically by a fraction of the accumulated scroll delta
divToScrollHorizontally.scrollLeft += scrollDelta * 0.1; divToScroll.scrollLeft += scrollDeltaX * 0.1;
divToScroll.scrollTop += scrollDeltaY * 0.1;
// Reduce the accumulated scroll delta by a fraction // Reduce the accumulated scroll delta by a fraction
scrollDelta *= 0.9; scrollDeltaX *= 0.9;
scrollDeltaY *= 0.9;
// If scroll delta is still significant, continue the scroll loop // If scroll delta is still significant, continue the scroll loop
if (Math.abs(scrollDelta) > 0.1) { if (Math.abs(scrollDeltaX) > 0.1 || Math.abs(scrollDeltaY) > 0.1) {
requestAnimationFrame(scrollLoop); requestAnimationFrame(scrollLoop);
} else { } else {
isScrolling = false; // Reset scroll in progress flag isScrolling = false; // Reset scroll in progress flag
} }
} }
divToScrollHorizontally.addEventListener("wheel", function (e) { divToScroll.addEventListener("wheel", function (e) {
e.preventDefault(); // prevent default mousewheel behavior e.preventDefault(); // prevent default mousewheel behavior
// Accumulate the horizontal scroll delta // Accumulate the horizontal and vertical scroll delta
scrollDelta -= e.deltaX || e.wheelDeltaX || -e.deltaY || -e.wheelDeltaY; scrollDeltaX -= e.deltaX || e.wheelDeltaX || -e.deltaY || -e.wheelDeltaY;
scrollDeltaY -= e.deltaY || e.wheelDeltaY || -e.deltaX || -e.wheelDeltaX;
// If scroll is not already in progress, start the scroll loop // If scroll is not already in progress, start the scroll loop
if (!isScrolling) { if (!isScrolling) {
@ -31,4 +36,4 @@ const scrollDivHorizontally = (id) => {
}); });
}; };
export default scrollDivHorizontally; export default scrollDivHorizontally;