jgraph / docker-drawio

Dockerized draw.io based on whichever is the most secure image at the time.
GNU General Public License v3.0
1.48k stars 359 forks source link

Exporting to PDF goes to https://convert.diagrams.net/node/export #139

Closed kabaga closed 7 months ago

kabaga commented 8 months ago

Is this a new behavior of the drawio container? When I export to PNG, JPEG, SVG, or VSDX, it does go to https://convert.diagrams.net/.

I am running the latest version v22.0.8 Below is my docker-compose.yml content

version: '3.5'
services:
  drawio:
    image: jgraph/drawio
    container_name: drawio
    restart: unless-stopped
    ports:
      - 8081:8080
      - 8443:8443
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://10.0.7.20:8081 || exit 1"]
      interval: 1m30s
      timeout: 10s
      retries: 5
      start_period: 10s
davidjgraph commented 8 months ago

That's not right. What's in your preconfig file? https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/PreConfig.js

kabaga commented 8 months ago

How do I check my preconfig file?

kabaga commented 8 months ago

That's not right. What's in your preconfig file? https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/PreConfig.js

I think I found it:

(function() {
  try {
        var s = document.createElement('meta');
        s.setAttribute('content', 'default-src \'self\'; script-src \'self\' https://storage.googleapis.com https://apis.google.com https://docs.google.com https://code.jquery.com \'unsafe-inline\'; connect-src \'self\' https://*.dropboxapi.com https://api.trello.com https://api.github.com https://raw.githubusercontent.com https://*.googleapis.com https://*.googleusercontent.com https://graph.microsoft.com https://*.1drv.com https://*.sharepoint.com https://gitlab.com https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; img-src * data:; media-src * data:; font-src * about:; style-src \'self\' \'unsafe-inline\' https://fonts.googleapis.com; frame-src \'self\' https://*.google.com;');
        s.setAttribute('http-equiv', 'Content-Security-Policy');
        var t = document.getElementsByTagName('meta')[0];
      t.parentNode.insertBefore(s, t);
  } catch (e) {} // ignore
})();
window.DRAWIO_BASE_URL = 'http://localhost:8080';
window.DRAWIO_SERVER_URL = window.DRAWIO_BASE_URL + '/';
window.DRAWIO_VIEWER_URL = '';
window.DRAWIO_LIGHTBOX_URL = '';
window.DRAW_MATH_URL = 'math/es5';
window.DRAWIO_CONFIG = null;
urlParams['sync'] = 'manual'; //Disable Real-Time
urlParams['db'] = '0'; //dropbox
urlParams['gh'] = '0'; //github
urlParams['tr'] = '0'; //trello
urlParams['gapi'] = '0'; //Google Drive
urlParams['od'] = '0'; //OneDrive
urlParams['gl'] = '0'; //Gitlab
davidjgraph commented 8 months ago

OK, add window.EXPORT_URL to point at your export server.

m-mohamedin commented 8 months ago

Please have a look at https://github.com/jgraph/docker-drawio/blob/dev/self-contained/docker-compose.yml which contains a local export server

kabaga commented 8 months ago

OK, add window.EXPORT_URL to point at your export server.

If the export server is the same as the drawio host, should this be 127.0.0.1:8000 or the container name with the port? I tried both but it is going to the base url "DRAWIO_BASE_URL=https://10.0.7.20:8085". Below is my new docker-compose file:

version: '3'
services:
  plantuml-server:
    image: plantuml/plantuml-server
    expose:
      - "8080"
    networks:
      - drawionet
    volumes:
      - fonts_volume:/usr/share/fonts/drawio
  image-export:
    image: jgraph/export-server
    expose:
      - "8001"
    networks:
      - drawionet
    volumes:
      - fonts_volume:/usr/share/fonts/drawio
    environment:
      - DRAWIO_BASE_URL=${DRAWIO_BASE_URL}
  drawio:
    image: jgraph/drawio
    ports:
      - "8084:8443"
      - "8085:8080"
    links:
      - plantuml-server:plantuml-server
      - image-export:image-export
    depends_on:
      - plantuml-server
      - image-export
    networks:
      - drawionet
    environment:
      - DRAWIO_SELF_CONTAINED=1
      - PLANTUML_URL=http://plantuml-server:8080/
      - EXPORT_URL=http://image-export:8001/
networks:
  drawionet:

volumes:
  fonts_volume:
m-mohamedin commented 8 months ago

It should be EXPORT_URL=http://image-export:8000/ and the image should expose 8000 The actual redirect will be to draw.io URL and it internally will contact the local export server

moehringn commented 4 months ago

I have this issue only when using PDF-Export, all other exports (PNG, JPEG, SVG and also VSDX) are working fine. I'm currently running the compose file https://github.com/jgraph/docker-drawio/blob/dev/self-contained/docker-compose.yml (currently latest version 24.2.2) and only used the following environment vars:

All servers in the compose file are running and have no errors.

When I try to Export as PDF.. or using "Advanced.." > PDF, a new tab is opened with the URL https://convert.diagrams.net/node/export regardless if I choose "Download", "Open in new Window" or "Device".

The diagram is just one rectangle for testing, so nothing big.

Any ideas what I can do about it? Thanks