Skip to content

Commit

Permalink
feat: support drawio app > 16
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse authored Oct 20, 2022
1 parent 08b6a0b commit 1dc26bc
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 70 deletions.
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM debian:buster
FROM debian:bullseye

WORKDIR "/opt/drawio-desktop"

ENV DRAWIO_VERSION "16.0.0"
ENV DRAWIO_VERSION "20.3.0"
RUN set -e; \
apt-get update && apt-get install -y \
xvfb \
wget \
libappindicator3-1 \
libgbm1 \
libasound2; \
wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb \
Expand All @@ -21,11 +20,10 @@ ENV ELECTRON_DISABLE_SECURITY_WARNINGS "true"
ENV DRAWIO_DISABLE_UPDATE "true"
ENV DRAWIO_DESKTOP_COMMAND_TIMEOUT "10s"
ENV DRAWIO_DESKTOP_EXECUTABLE_PATH "/opt/drawio/drawio"
# Currently, no security warning in this version of drawio desktop
# ENV DRAWIO_DESKTOP_RUNNER_COMMAND_LINE "/opt/drawio-desktop/runner.sh"
ENV DRAWIO_DESKTOP_RUNNER_COMMAND_LINE "/opt/drawio-desktop/runner-no-security-warnings.sh"
ENV DRAWIO_DESKTOP_RUNNER_COMMAND_LINE "/opt/drawio-desktop/runner.sh"
ENV XVFB_DISPLAY ":42"
ENV XVFB_OPTIONS ""
ENV ELECTRON_ENABLE_LOGGING "false"

ENTRYPOINT [ "/opt/drawio-desktop/entrypoint.sh" ]
CMD [ "--help" ]
15 changes: 8 additions & 7 deletions scripts/runner.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -e

filter_electron_security_warnings() {
while read -r line; do
echo "$line" | grep -v "is deprecated and will be changing"
done
}

if [ "${ELECTRON_DISABLE_SECURITY_WARNINGS}" == "true" ]; then
"$DRAWIO_DESKTOP_EXECUTABLE_PATH" "$@" --no-sandbox 2> >(filter_electron_security_warnings)
"$DRAWIO_DESKTOP_EXECUTABLE_PATH" "$@" --no-sandbox 3>&1 >&2 2>&3 3>&- |
grep -v "Failed to connect to socket" |
grep -v "Could not parse server address" |
grep -v "Floss manager not present" |
grep -v "Exiting GPU process" |
grep -v "called with multiple threads" |
grep -v "extension not supported" |
grep -v "Failed to send GpuControl.CreateCommandBuffer"
else
"$DRAWIO_DESKTOP_EXECUTABLE_PATH" "$@" --no-sandbox 2>&1
fi
3 changes: 2 additions & 1 deletion tests/data/issue-20/frame-bug-good.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/expected/export-issue-20.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
issue-20/frame-bug.drawio -> issue-20/frame-bug.svg
1 change: 0 additions & 1 deletion tests/expected/output-electron-security-warning.log

This file was deleted.

41 changes: 0 additions & 41 deletions tests/expected/print_help.log

This file was deleted.

11 changes: 0 additions & 11 deletions tests/help.bats

This file was deleted.

6 changes: 3 additions & 3 deletions tests/output.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
docker_test "" 1 "output-unknown-file" "tests/data" -x unknown.drawio
}

@test "Output electron security warning" {
docker_test "-e ELECTRON_DISABLE_SECURITY_WARNINGS=false" 0 "output-electron-security-warning" "tests/data" -x file1.drawio
}
#@test "Output electron security warning" {
# docker_test "-e ELECTRON_DISABLE_SECURITY_WARNINGS=false" 0 "output-electron-security-warning" "tests/data" -x file1.drawio
#}

0 comments on commit 1dc26bc

Please sign in to comment.