Skip to content
Merged
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
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ RUN echo 'export GIT_SSH_COMMAND="ssh -i \$(pwd | sed s/_transform.*//)/.private
#RUN apt upgrade git --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN git config --global --add safe.directory /srv/wikigdrive/*

HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost:3000 || exit 1

CMD [ "sh", "-c", "wikigdrive --workdir /data server 3000" ]
2 changes: 1 addition & 1 deletion src/LinkTranslator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function convertToRelativeSvgPath(localPath: string, basePath: string) {
if (basePath === localPath) return '.';

const host = '//example.com/';
convertExtension(decodeURIComponent(relateUrl(host + basePath, host + localPath)), 'dirURLs');
return convertExtension(decodeURIComponent(relateUrl(host + basePath, host + localPath)), 'dirURLs');
}

export function convertToAbsolutePath(fullPath: string, relativePath: string) {
Expand Down
7 changes: 6 additions & 1 deletion src/containers/job/worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {parentPort} from 'node:worker_threads';
import fs from 'node:fs';
import {executeOdtToMarkdown} from '../../odt/executeOdtToMarkdown.ts';

parentPort.on('message', async (msg) => {
Expand All @@ -13,7 +14,11 @@ parentPort.on('message', async (msg) => {

parentPort.postMessage({ err: new Error('Unhandled worker message: ' + type) });
} catch (err) {
console.error(err);
console.error(err, msg.payload);
parentPort.postMessage({ err });
if (err.message.indexOf('Corrupted zip') > -1) {
console.info('Corrupted zip, removing file: ', msg.payload.odtPath);
fs.unlinkSync(msg.payload.odtPath);
}
}
});
6 changes: 1 addition & 5 deletions src/containers/transform/TaskLocalFileTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ export class TaskLocalFileTransform extends QueueTask {

const converter = new OdtToMarkdown(document, styles, fileNameMap, xmlMap);
converter.setRewriteRules(rewriteRules);
if (this.realFileName === '_index.md') {
converter.setPicturesDir('./' + this.realFileName.replace(/.md$/, '.assets/'), picturesDirAbsolute);
} else {
converter.setPicturesDir('../' + this.realFileName.replace(/.md$/, '.assets/'), picturesDirAbsolute);
}
converter.setPicturesDir('./' + this.realFileName.replace(/.md$/, '.assets/'), picturesDirAbsolute);
headersMap = converter.getHeadersMap();
invisibleBookmarks = converter.getInvisibleBookmarks();
markdown = await converter.convert();
Expand Down
6 changes: 1 addition & 5 deletions src/odt/executeOdtToMarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ export async function executeOdtToMarkdown(workerData) {

const converter = new OdtToMarkdown(document, styles, fileNameMap, xmlMap);
converter.setRewriteRules(workerData.rewriteRules);
if (workerData.realFileName === '_index.md') {
converter.setPicturesDir('./' + workerData.realFileName.replace(/.md$/, '.assets/'), workerData.picturesDirAbsolute);
} else {
converter.setPicturesDir('../' + workerData.realFileName.replace(/.md$/, '.assets/'), workerData.picturesDirAbsolute);
}
converter.setPicturesDir('./' + workerData.realFileName.replace(/.md$/, '.assets/'), workerData.picturesDirAbsolute);
const markdown = await converter.convert();
const links = Array.from(converter.links);

Expand Down
4 changes: 4 additions & 0 deletions website/public/assets/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ body,
height: 100vh;
}

body {
min-width: 300px !important;
}

#main {
display: flex;
flex-direction: column;
Expand Down
Loading