Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM node:8
FROM node:17-slim AS base

WORKDIR /tmp
RUN wget http://downloadarchive.documentfoundation.org/libreoffice/old/6.3.3.1/deb/x86_64/LibreOffice_6.3.3.1_Linux_x86-64_deb.tar.gz -O libo.tar.gz
RUN apt update && apt install -y wget
RUN wget http://downloadarchive.documentfoundation.org/libreoffice/old/latest/deb/x86_64/LibreOffice_7.3.0.3_Linux_x86-64_deb.tar.gz -O libo.tar.gz
RUN apt update \
&& apt install -y libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6 unzip \
&& tar -zxvf libo.tar.gz
WORKDIR LibreOffice_6.3.3.1_Linux_x86-64_deb/DEBS
WORKDIR LibreOffice_7.3.0.3_Linux_x86-64_deb/DEBS
RUN dpkg -i *.deb

FROM base AS final
RUN mkdir /tmp-reports
COPY . /carbone-api
WORKDIR /carbone-api
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.post('/render', upload.single(`template`), async (req, res) => {
let formatters = {};
try {
options = JSON.parse(req.body.options);
} catch (e) {}
} catch (e) { }
options.convertTo = options.convertTo || originalFormat;
options.outputName = options.outputName || `${originalNameWOExt}.${options.convertTo}`;
if (typeof data !== `object` || data === null) {
Expand All @@ -43,7 +43,7 @@ app.post('/render', upload.single(`template`), async (req, res) => {
}
try {
formatters = telejson.parse(req.body.formatters);
} catch (e) {}
} catch (e) { }

// Removing previous custom formatters before adding new ones
carbone.formatters = _.filter(carbone.formatters, formatter => formatter.$isDefault === true);
Expand All @@ -63,7 +63,7 @@ app.post('/render', upload.single(`template`), async (req, res) => {

res.setHeader(`Content-Disposition`, `attachment; filename=${options.outputName}`);
res.setHeader(`Content-Transfer-Encoding`, `binary`);
res.setHeader(`Content-Type`, `application/octet-stream`);
res.setHeader(`Content-Type`, `application/octet-stream`);
res.setHeader(`Carbone-Report-Name`, options.outputName);

return res.send(report);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"dependencies": {
"body-parser": "^1.18.3",
"carbone": "^1.2.0",
"carbone": "^3.2.3",
"express": "^4.16.4",
"fs-extra": "^7.0.1",
"lodash": "^4.17.15",
Expand Down
2 changes: 2 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
let data = {};

try {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless empty line

data = JSON.parse(_data);
console.log(data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining log

} catch (e) {
console.error(`Cannot parse data : ${e}`);
}
Expand Down
75 changes: 42 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,17 @@ caller@~0.0.1:
dependencies:
tape "~2.3.2"

carbone@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/carbone/-/carbone-1.2.0.tgz#a7c556d35ad47aad59a81b74661d72d792ec7970"
integrity sha512-UPLQ/SMUsXyJWLcCVyq82j6o5dXG783N5eTY/c2MiYQ66PIpyB41OEXW0vIKNq7fv77EknaL2z3IcpmGWmAHtg==
carbone@3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/carbone/-/carbone-3.2.3.tgz#9317b9403de2a9e8137c94754e12ada56f4f54f7"
integrity sha512-UV7nOsxje6/ChjbGip4lBOepozwPtH06JaiO08YAAx45f4M7HVRR8y6YPzLy0g3XfbVewODCaIFIPqCFwO6O5Q==
dependencies:
debug "=2.6.9"
moment "=2.19.3"
moxie-zip "=0.0.3"
dayjs "=1.10.4"
debug "=4.1.1"
timsort "=0.3.0"
which "=1.3.1"
yauzl "=2.8.0"
which "=2.0.2"
yauzl "=2.10.0"
yazl "=2.5.1"

chokidar@^1.0.1:
version "1.7.0"
Expand Down Expand Up @@ -405,13 +405,25 @@ cycle@1.0.x:
resolved "https://registry.yarnpkg.com/cycle/-/cycle-1.0.3.tgz#21e80b2be8580f98b468f379430662b046c34ad2"
integrity sha1-IegLK+hYD5i0aPN5QwZisEbDStI=

debug@2.6.9, debug@=2.6.9, debug@^2.2.0, debug@^2.3.3:
dayjs@=1.10.4:
version "1.10.4"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==

debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
dependencies:
ms "2.0.0"

debug@=4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
dependencies:
ms "^2.1.1"

debug@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
Expand Down Expand Up @@ -659,10 +671,10 @@ eyes@0.1.x, eyes@~0.1.8:
resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0"
integrity sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=

fd-slicer@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65"
integrity sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=
fd-slicer@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e"
integrity sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=
dependencies:
pend "~1.2.0"

Expand Down Expand Up @@ -1404,16 +1416,6 @@ mkdirp@0.x.x, mkdirp@^0.5.0, mkdirp@^0.5.1:
dependencies:
minimist "0.0.8"

moment@=2.19.3:
version "2.19.3"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.3.tgz#bdb99d270d6d7fda78cc0fbace855e27fe7da69f"
integrity sha1-vbmdJw1tf9p4zA+6zoVeJ/59pp8=

moxie-zip@=0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/moxie-zip/-/moxie-zip-0.0.3.tgz#b28023e40c0328cb4329e61eabb5b55696779c07"
integrity sha1-soAj5AwDKMtDKeYeq7W1VpZ3nAc=

ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down Expand Up @@ -2311,10 +2313,10 @@ vary@~1.1.2:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=

which@=1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
which@=2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
dependencies:
isexe "^2.0.0"

Expand Down Expand Up @@ -2370,10 +2372,17 @@ yallist@^3.0.0, yallist@^3.0.3:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==

yauzl@=2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.8.0.tgz#79450aff22b2a9c5a41ef54e02db907ccfbf9ee2"
integrity sha1-eUUK/yKyqcWkHvVOAtuQfM+/nuI=
yauzl@=2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=
dependencies:
buffer-crc32 "~0.2.3"
fd-slicer "~1.1.0"

yazl@=2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35"
integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==
dependencies:
buffer-crc32 "~0.2.3"
fd-slicer "~1.0.1"