This commit is contained in:
Ludy87 2025-07-29 22:21:01 +02:00
parent 0966b919cb
commit 7a9e6cbd2a
No known key found for this signature in database
GPG Key ID: 92696155E0220F94
8 changed files with 35 additions and 2 deletions

View File

@ -78,6 +78,7 @@ labels:
- 'app/core/src/main/resources/banner.txt' - 'app/core/src/main/resources/banner.txt'
- 'app/core/src/main/resources/static/python/png_to_webp.py' - 'app/core/src/main/resources/static/python/png_to_webp.py'
- 'app/core/src/main/resources/static/python/split_photos.py' - 'app/core/src/main/resources/static/python/split_photos.py'
- 'app/core/src/main/resources/static/pipeline/defaultWebUIConfigs/**'
- 'application.properties' - 'application.properties'
- label: 'Security' - label: 'Security'

View File

@ -15,6 +15,7 @@ public class InstallationPathConfig {
private static final String CUSTOM_FILES_PATH; private static final String CUSTOM_FILES_PATH;
private static final String CLIENT_WEBUI_PATH; private static final String CLIENT_WEBUI_PATH;
private static final String SCRIPTS_PATH; private static final String SCRIPTS_PATH;
private static final String PIPELINE_PATH;
// Config paths // Config paths
private static final String SETTINGS_PATH; private static final String SETTINGS_PATH;
@ -33,6 +34,7 @@ public class InstallationPathConfig {
CONFIG_PATH = BASE_PATH + "configs" + File.separator; CONFIG_PATH = BASE_PATH + "configs" + File.separator;
CUSTOM_FILES_PATH = BASE_PATH + "customFiles" + File.separator; CUSTOM_FILES_PATH = BASE_PATH + "customFiles" + File.separator;
CLIENT_WEBUI_PATH = BASE_PATH + "clientWebUI" + File.separator; CLIENT_WEBUI_PATH = BASE_PATH + "clientWebUI" + File.separator;
PIPELINE_PATH = BASE_PATH + "pipeline" + File.separator;
// Initialize config paths // Initialize config paths
SETTINGS_PATH = CONFIG_PATH + "settings.yml"; SETTINGS_PATH = CONFIG_PATH + "settings.yml";
@ -95,6 +97,10 @@ public class InstallationPathConfig {
return SCRIPTS_PATH; return SCRIPTS_PATH;
} }
public static String getPipelinePath() {
return PIPELINE_PATH;
}
public static String getSettingsPath() { public static String getSettingsPath() {
return SETTINGS_PATH; return SETTINGS_PATH;
} }

View File

@ -446,6 +446,32 @@ public class GeneralUtils {
} }
} }
public static void extractPipeline() throws IOException {
Path pipelinePath =
Paths.get(InstallationPathConfig.getPipelinePath(), "defaultWebUIConfigs");
Files.createDirectories(pipelinePath);
List<String> defaultFiles =
List.of(
"OCR images.json",
"Prepare-pdfs-for-email.json",
"split-rotate-auto-rename.json");
for (String fileName : defaultFiles) {
Path pipelineFile = pipelinePath.resolve(fileName);
if (!Files.exists(pipelineFile)) {
ClassPathResource resource =
new ClassPathResource("static/pipeline/defaultWebUIConfigs/" + fileName);
try (InputStream in = resource.getInputStream()) {
Files.copy(in, pipelineFile, StandardCopyOption.REPLACE_EXISTING);
log.error("Extracted pipeline file: {}", pipelineFile);
} catch (IOException e) {
log.error("Failed to extract pipeline file", e);
}
}
}
}
public static Path extractScript(String scriptName) throws IOException { public static Path extractScript(String scriptName) throws IOException {
// Validate input // Validate input
if (scriptName == null || scriptName.trim().isEmpty()) { if (scriptName == null || scriptName.trim().isEmpty()) {

3
app/core/.gitignore vendored
View File

@ -16,8 +16,7 @@ local.properties
version.properties version.properties
#### Stirling-PDF Files ### #### Stirling-PDF Files ###
pipeline/watchedFolders/ ./pipeline/
pipeline/finishedFolders/
customFiles/ customFiles/
configs/ configs/
watchedFolders/ watchedFolders/

View File

@ -35,6 +35,7 @@ public class InitialSetup {
initEnableCSRFSecurity(); initEnableCSRFSecurity();
initLegalUrls(); initLegalUrls();
initSetAppVersion(); initSetAppVersion();
GeneralUtils.extractPipeline();
} }
public void initUUIDKey() throws IOException { public void initUUIDKey() throws IOException {