Merge branch 'main' into text-removal-auto-redact

This commit is contained in:
Anthony Stirling 2025-08-01 14:27:13 +01:00 committed by GitHub
commit 87414042c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 32 additions and 31 deletions

View File

@ -87,7 +87,7 @@ jobs:
- name: AI PR Title Analysis - name: AI PR Title Analysis
if: steps.actor.outputs.is_repo_dev == 'true' if: steps.actor.outputs.is_repo_dev == 'true'
id: ai-title-analysis id: ai-title-analysis
uses: actions/ai-inference@d645f067d89ee1d5d736a5990e327e504d1c5a4a # v1.1.0 uses: actions/ai-inference@9693b137b6566bb66055a713613bf4f0493701eb # v1.2.3
with: with:
model: openai/gpt-4o model: openai/gpt-4o
system-prompt-file: ".github/config/system-prompt.txt" system-prompt-file: ".github/config/system-prompt.txt"

View File

@ -74,6 +74,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@d6bbdef45e766d081b84a2def353b0055f728d3e # v3.29.3 uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@ -78,7 +78,7 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
# URW Base 35 fonts for better PDF rendering # URW Base 35 fonts for better PDF rendering
font-urw-base35 && \ font-urw-base35 && \
python3 -m venv /opt/venv && \ python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --upgrade pip setuptools && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip setuptools && \
/opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \ /opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \
ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \
@ -89,7 +89,6 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
ln -s /usr/share/fontconfig/conf.avail/69-urw-*.conf /etc/fonts/conf.d/ && \ ln -s /usr/share/fontconfig/conf.avail/69-urw-*.conf /etc/fonts/conf.d/ && \
fc-cache -f -v && \ fc-cache -f -v && \
chmod +x /scripts/* && \ chmod +x /scripts/* && \
chmod +x /scripts/init.sh && \
# User permissions # User permissions
addgroup -S stirlingpdfgroup && adduser -S stirlingpdfuser -G stirlingpdfgroup && \ addgroup -S stirlingpdfgroup && adduser -S stirlingpdfuser -G stirlingpdfgroup && \
chown -R stirlingpdfuser:stirlingpdfgroup $HOME /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf && \ chown -R stirlingpdfuser:stirlingpdfgroup $HOME /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf && \

View File

@ -36,7 +36,7 @@ ENV SETUPTOOLS_USE_DISTUTILS=local \
# Installation der benötigten Python-Pakete # Installation der benötigten Python-Pakete
RUN python3 -m venv --system-site-packages /opt/venv \ RUN python3 -m venv --system-site-packages /opt/venv \
&& . /opt/venv/bin/activate \ && . /opt/venv/bin/activate \
&& pip install --upgrade pip setuptools \ && pip install --no-cache-dir --upgrade pip setuptools \
&& pip install --no-cache-dir WeasyPrint pdf2image pillow unoserver opencv-python-headless pre-commit && pip install --no-cache-dir WeasyPrint pdf2image pillow unoserver opencv-python-headless pre-commit
# Füge den venv-Pfad zur globalen PATH-Variable hinzu, damit die Tools verfügbar sind # Füge den venv-Pfad zur globalen PATH-Variable hinzu, damit die Tools verfügbar sind
@ -54,8 +54,7 @@ RUN echo "devuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/devuser \
# Setze das Arbeitsverzeichnis (wird später per Bind-Mount überschrieben) # Setze das Arbeitsverzeichnis (wird später per Bind-Mount überschrieben)
WORKDIR /workspace WORKDIR /workspace
RUN chmod +x /workspace/.devcontainer/git-init.sh RUN chmod +x /workspace/.devcontainer/git-init.sh /workspace/.devcontainer/init-setup.sh
RUN sudo chmod +x /workspace/.devcontainer/init-setup.sh
# Wechsel zum NichtRoot Benutzer # Wechsel zum NichtRoot Benutzer
USER devuser USER devuser

View File

@ -91,7 +91,7 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
py3-pillow@testing \ py3-pillow@testing \
py3-pdf2image@testing && \ py3-pdf2image@testing && \
python3 -m venv /opt/venv && \ python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --upgrade pip setuptools && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip setuptools && \
/opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \ /opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \
ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \
@ -102,7 +102,6 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
ln -s /usr/share/fontconfig/conf.avail/69-urw-*.conf /etc/fonts/conf.d/ && \ ln -s /usr/share/fontconfig/conf.avail/69-urw-*.conf /etc/fonts/conf.d/ && \
fc-cache -f -v && \ fc-cache -f -v && \
chmod +x /scripts/* && \ chmod +x /scripts/* && \
chmod +x /scripts/init.sh && \
# User permissions # User permissions
addgroup -S stirlingpdfgroup && adduser -S stirlingpdfuser -G stirlingpdfgroup && \ addgroup -S stirlingpdfgroup && adduser -S stirlingpdfuser -G stirlingpdfgroup && \
chown -R stirlingpdfuser:stirlingpdfgroup $HOME /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf && \ chown -R stirlingpdfuser:stirlingpdfgroup $HOME /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf && \

View File

@ -152,7 +152,7 @@ Stirling-PDF currently supports 40 languages!
| Swedish (Svenska) (sv_SE) | ![67%](https://geps.dev/progress/67) | | Swedish (Svenska) (sv_SE) | ![67%](https://geps.dev/progress/67) |
| Thai (ไทย) (th_TH) | ![60%](https://geps.dev/progress/60) | | Thai (ไทย) (th_TH) | ![60%](https://geps.dev/progress/60) |
| Tibetan (བོད་ཡིག་) (bo_CN) | ![66%](https://geps.dev/progress/66) | | Tibetan (བོད་ཡིག་) (bo_CN) | ![66%](https://geps.dev/progress/66) |
| Traditional Chinese (繁體中文) (zh_TW) | ![77%](https://geps.dev/progress/77) | | Traditional Chinese (繁體中文) (zh_TW) | ![99%](https://geps.dev/progress/99) |
| Turkish (Türkçe) (tr_TR) | ![82%](https://geps.dev/progress/82) | | Turkish (Türkçe) (tr_TR) | ![82%](https://geps.dev/progress/82) |
| Ukrainian (Українська) (uk_UA) | ![72%](https://geps.dev/progress/72) | | Ukrainian (Українська) (uk_UA) | ![72%](https://geps.dev/progress/72) |
| Vietnamese (Tiếng Việt) (vi_VN) | ![58%](https://geps.dev/progress/58) | | Vietnamese (Tiếng Việt) (vi_VN) | ![58%](https://geps.dev/progress/58) |

View File

@ -62,7 +62,7 @@ dependencies {
exclude group: 'com.google.code.gson', module: 'gson' exclude group: 'com.google.code.gson', module: 'gson'
} }
implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4' implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4'
implementation 'com.opencsv:opencsv:5.11.2' // https://mvnrepository.com/artifact/com.opencsv/opencsv implementation 'com.opencsv:opencsv:5.12.0' // https://mvnrepository.com/artifact/com.opencsv/opencsv
// Batik // Batik
implementation 'org.apache.xmlgraphics:batik-all:1.19' implementation 'org.apache.xmlgraphics:batik-all:1.19'

View File

@ -108,9 +108,13 @@ public class PipelineProcessor {
if (inputFileTypes == null) { if (inputFileTypes == null) {
inputFileTypes = new ArrayList<String>(Arrays.asList("ALL")); inputFileTypes = new ArrayList<String>(Arrays.asList("ALL"));
} }
if (!operation.matches("^[a-zA-Z0-9_-]+$")) {
throw new IllegalArgumentException("Invalid operation value received."); if (!apiDocService.isValidOperation(operation, parameters)) {
log.error("Invalid operation or parameters: o:{} p:{}", operation, parameters);
throw new IllegalArgumentException(
"Invalid operation: " + operation + " with parameters: " + parameters);
} }
String url = getBaseUrl() + operation; String url = getBaseUrl() + operation;
List<Resource> newOutputFiles = new ArrayList<>(); List<Resource> newOutputFiles = new ArrayList<>();
if (!isMultiInputOperation) { if (!isMultiInputOperation) {
@ -136,7 +140,7 @@ public class PipelineProcessor {
// skip // skip
// this // this
// file // file
if (operation.startsWith("filter-") if (operation.startsWith("/api/v1/filter/filter-")
&& (response.getBody() == null && (response.getBody() == null
|| response.getBody().length == 0)) { || response.getBody().length == 0)) {
filtersApplied = true; filtersApplied = true;

View File

@ -1,6 +1,6 @@
/* Main bookmark container styles */ /* Main bookmark container styles */
.bookmark-editor { .bookmark-editor {
margin-top: 20px; margin-bottom: 20px;
padding: 20px; padding: 20px;
border: 1px solid var(--border-color, #ced4da); border: 1px solid var(--border-color, #ced4da);
border-radius: 0.25rem; border-radius: 0.25rem;

View File

@ -45,23 +45,26 @@ class PipelineProcessorTest {
@Test @Test
void runPipelineWithFilterSetsFlag() throws Exception { void runPipelineWithFilterSetsFlag() throws Exception {
PipelineOperation op = new PipelineOperation(); PipelineOperation op = new PipelineOperation();
op.setOperation("filter-page-count"); op.setOperation("/api/v1/filter/filter-page-count");
op.setParameters(Map.of()); op.setParameters(Map.of());
PipelineConfig config = new PipelineConfig(); PipelineConfig config = new PipelineConfig();
config.setOperations(List.of(op)); config.setOperations(List.of(op));
Resource file = new ByteArrayResource("data".getBytes()) { Resource file =
@Override new ByteArrayResource("data".getBytes()) {
public String getFilename() { @Override
return "test.pdf"; public String getFilename() {
} return "test.pdf";
}; }
};
List<Resource> files = List.of(file); List<Resource> files = List.of(file);
when(apiDocService.isMultiInput("filter-page-count")).thenReturn(false); when(apiDocService.isMultiInput("/api/v1/filter/filter-page-count")).thenReturn(false);
when(apiDocService.getExtensionTypes(false, "filter-page-count")) when(apiDocService.getExtensionTypes(false, "/api/v1/filter/filter-page-count"))
.thenReturn(List.of("pdf")); .thenReturn(List.of("pdf"));
when(apiDocService.isValidOperation(eq("/api/v1/filter/filter-page-count"), anyMap()))
.thenReturn(true);
doReturn(new ResponseEntity<>(new byte[0], HttpStatus.OK)) doReturn(new ResponseEntity<>(new byte[0], HttpStatus.OK))
.when(pipelineProcessor) .when(pipelineProcessor)

View File

@ -2,10 +2,10 @@ plugins {
id "java" id "java"
id "jacoco" id "jacoco"
id "io.spring.dependency-management" version "1.1.7" id "io.spring.dependency-management" version "1.1.7"
id "org.springframework.boot" version "3.5.3" id "org.springframework.boot" version "3.5.4"
id "org.springdoc.openapi-gradle-plugin" version "1.9.0" id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
id "io.swagger.swaggerhub" version "1.3.2" id "io.swagger.swaggerhub" version "1.3.2"
id "edu.sc.seis.launch4j" version "3.0.6" id "edu.sc.seis.launch4j" version "3.0.7"
id "com.diffplug.spotless" version "7.2.1" id "com.diffplug.spotless" version "7.2.1"
id "com.github.jk1.dependency-license-report" version "2.9" id "com.github.jk1.dependency-license-report" version "2.9"
//id "nebula.lint" version "19.0.3" //id "nebula.lint" version "19.0.3"
@ -21,7 +21,7 @@ import java.nio.file.Files
import java.time.Year import java.time.Year
ext { ext {
springBootVersion = "3.5.3" springBootVersion = "3.5.4"
pdfboxVersion = "3.0.5" pdfboxVersion = "3.0.5"
imageioVersion = "3.12.0" imageioVersion = "3.12.0"
lombokVersion = "1.18.38" lombokVersion = "1.18.38"

View File

@ -1026,8 +1026,5 @@ ignore = [
[zh_TW] [zh_TW]
ignore = [ ignore = [
'lang.dzo',
'lang.iku',
'lang.que',
'language.direction', 'language.direction',
] ]