mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-29 13:48:46 +02:00
Merge branch 'main' into add_formating_test_20250731
This commit is contained in:
commit
d0acf3f704
@ -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 && \
|
||||||
|
@ -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 Nicht‑Root Benutzer
|
# Wechsel zum Nicht‑Root Benutzer
|
||||||
USER devuser
|
USER devuser
|
||||||
|
@ -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 && \
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -45,12 +45,13 @@ 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 =
|
||||||
|
new ByteArrayResource("data".getBytes()) {
|
||||||
@Override
|
@Override
|
||||||
public String getFilename() {
|
public String getFilename() {
|
||||||
return "test.pdf";
|
return "test.pdf";
|
||||||
@ -59,9 +60,11 @@ class PipelineProcessorTest {
|
|||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user