Skip to content

Add XSweet component

Jure requested to merge add_xsweet_component into master

Introduces a XSweet component that, once specified in the components config with '@pubsweet/job-xsweet' adds:

A /convertDocxToHTML endpoint

That takes a docx file formdata input, with e.g. something like a

curl -X POST \
  'http://localhost:3000/convertDocxToHTML?=' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F docx=@/Users/juretriglav/src/pdk-tesms/pubsweet/packages/components/job-xsweet/src/test.docx

This publishes a job that the job runner (a Docker container) picks up.

A Docker container

Run it with: docker run -e DATABASE_URL=yourdatabaseurl pubsweet/job-xsweet:latest

For example, if running locally:

docker run -e DATABASE_URL="postgres://juretriglav@host.docker.internal/starter" pubsweet/job-xsweet

The DATABASE_URL is needed so that the Docker container knows how to connect to your database.

After the Docker container starts up, jobs from the endpoint will start to be processed.

Responses will take a while, about 30 seconds for simple files. We're working on speeding that up.

This is an early version, please test and report any issues.

Merge request reports