diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java index b0deb586..39ca6937 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java @@ -56,9 +56,8 @@ public class ApiDocService { JsonNode pathNode = entry.getValue(); if (pathNode.has("post")) { JsonNode postNode = pathNode.get("post"); - String operation = path.substring(1); // Assuming operation name is the path without leading '/' - ApiEndpoint endpoint = new ApiEndpoint(operation, postNode); - apiDocumentation.put(operation, endpoint); + ApiEndpoint endpoint = new ApiEndpoint(path, postNode); + apiDocumentation.put(path, endpoint); } }); } catch (Exception e) { @@ -68,7 +67,6 @@ public class ApiDocService { } public boolean isValidOperation(String operationName, Map parameters) { - System.out.println(apiDocumentation); if (!apiDocumentation.containsKey(operationName)) { return false; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineController.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineController.java index 1c1c8d80..6d12789e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineController.java @@ -72,8 +72,14 @@ public class PipelineController { @Autowired private ApiDocService apiDocService; + + + @Scheduled(fixedRate = 60000) public void scanFolders() { + if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) { + return; + } Path watchedFolderPath = Paths.get(watchedFoldersDir); if (!Files.exists(watchedFolderPath)) { try { @@ -453,6 +459,10 @@ public class PipelineController { @PostMapping("/handleData") public ResponseEntity handleData(@ModelAttribute HandleDataRequest request) { + if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + MultipartFile[] files = request.getFileInput(); String jsonString = request.getJson(); if(files == null) { diff --git a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java index dc068779..735edc6f 100644 --- a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java +++ b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java @@ -175,6 +175,19 @@ public class ApplicationProperties { private String rootURIPath; private String customStaticFilePath; private Integer maxFileSize; + + private Boolean enableAlphaFunctionality; + + + + + public Boolean getEnableAlphaFunctionality() { + return enableAlphaFunctionality; + } + + public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) { + this.enableAlphaFunctionality = enableAlphaFunctionality; + } public String getDefaultLocale() { return defaultLocale; @@ -218,12 +231,13 @@ public class ApplicationProperties { @Override public String toString() { - return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility + ", rootURIPath=" - + rootURIPath + ", customStaticFilePath=" + customStaticFilePath + ", maxFileSize=" + maxFileSize - + "]"; + return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility + + ", rootURIPath=" + rootURIPath + ", customStaticFilePath=" + customStaticFilePath + + ", maxFileSize=" + maxFileSize + ", enableAlphaFunctionality=" + enableAlphaFunctionality + "]"; } + } public static class Ui { diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index 0f229ba4..cafea794 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -9,6 +9,7 @@ security: system: defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc) googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow + enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) #ui: # appName: exampleAppName # Application's visible name diff --git a/src/main/resources/static/js/pipeline.js b/src/main/resources/static/js/pipeline.js index 4f104a2a..21c05cb8 100644 --- a/src/main/resources/static/js/pipeline.js +++ b/src/main/resources/static/js/pipeline.js @@ -343,7 +343,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function() parameterInput = document.createElement('input'); parameterInput.type = 'text'; parameterInput.className = "form-control"; - parameterInput.value = "automatedFileInput"; + parameterInput.value = "FileInputPathToBeInputtedManuallyOffline"; } else { parameterInput = document.createElement('input'); parameterInput.type = 'text'; @@ -480,14 +480,16 @@ document.getElementById('addOperationBtn').addEventListener('click', function() "outputDir": "{outputFolder}/{folderName}", "outputFileName": "{filename}-{pipelineName}-{date}-{time}" }, - "outputDir": "httpWebRequest", + "outputDir": "{outputFolder}", "outputFileName": "{filename}" }; for (let i = 0; i < pipelineList.length; i++) { let operationName = pipelineList[i].querySelector('.operationName').textContent; let parameters = operationSettings[operationName] || {}; - + + parameters['fileInput'] = 'automated'; + pipelineConfig.pipeline.push({ "operation": operationName, "parameters": parameters