mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-04 22:13:32 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8f90ebd69 | ||
|
|
648d5070e2 | ||
|
|
801cf28d1e | ||
|
|
fae2ba9c54 | ||
|
|
10d20a8786 | ||
|
|
c9bc1e237e | ||
|
|
48a76a46b3 | ||
|
|
4dcb796e1b | ||
|
|
5952103bcd | ||
|
|
fd05ee5cd5 | ||
|
|
7e7d238c7a | ||
|
|
755a4170f2 | ||
|
|
263ba415f5 | ||
|
|
317260098a | ||
|
|
5304e94b4e | ||
|
|
aab2b311cf | ||
|
|
baa7ea40e6 | ||
|
|
481a11b610 | ||
|
|
c09fe296b1 | ||
|
|
f023aae753 | ||
|
|
5cd9544b55 | ||
|
|
97c23ba65c | ||
|
|
0ffda40ac8 | ||
|
|
cb639907ee | ||
|
|
0166842b78 |
2
.github/workflows/bun-dependabot.yml
vendored
2
.github/workflows/bun-dependabot.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
2
.github/workflows/docker-publish.yml
vendored
2
.github/workflows/docker-publish.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## [0.3.0](https://github.com/C4illin/ConvertX/compare/v0.2.0...v0.3.0) (2024-06-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add version number to log ([4dcb796](https://github.com/C4illin/ConvertX/commit/4dcb796e1bd27badc078d0638076cd9f1e81c4a4)), closes [#44](https://github.com/C4illin/ConvertX/issues/44)
|
||||
* change to xelatex ([fae2ba9](https://github.com/C4illin/ConvertX/commit/fae2ba9c54461dccdccd1bfb5e76398540d11d0b))
|
||||
* print version of installed converters to log ([801cf28](https://github.com/C4illin/ConvertX/commit/801cf28d1e5edac9353b0b16be75a4fb48470b8a))
|
||||
|
||||
## [0.2.0](https://github.com/C4illin/ConvertX/compare/v0.1.2...v0.2.0) (2024-06-20)
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ LABEL repo="https://github.com/C4illin/ConvertX"
|
||||
RUN apk --no-cache add \
|
||||
pandoc \
|
||||
texlive \
|
||||
texlive-xetex \
|
||||
texmf-dist-latexextra \
|
||||
ffmpeg \
|
||||
graphicsmagick \
|
||||
@@ -50,4 +51,5 @@ COPY --from=install /temp/prod/node_modules node_modules
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
ENV NODE_ENV=production
|
||||
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]
|
||||
@@ -21,7 +21,7 @@ A self-hosted online file converter. Supports 831 different formats. Written wit
|
||||
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
||||
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
||||
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
||||
| [PDFLaTeX](https://www.math.rug.nl/~trentelman/jacob/pdflatex/pdflatex.html) | Documents | 1 | 1 |
|
||||
| [XeLaTeX](https://tug.org/xetex/) | Documents | 1 | 1 |
|
||||
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
|
||||
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |
|
||||
| [FFmpeg](https://ffmpeg.org/) | Video | ~473 | ~280 |
|
||||
|
||||
16
package.json
16
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "convertx-frontend",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"scripts": {
|
||||
"dev": "bun run --watch src/index.tsx",
|
||||
"hot": "bun run --hot src/index.tsx",
|
||||
@@ -12,24 +12,24 @@
|
||||
"@elysiajs/html": "^1.0.2",
|
||||
"@elysiajs/jwt": "^1.0.2",
|
||||
"@elysiajs/static": "^1.0.3",
|
||||
"elysia": "^1.0.24"
|
||||
"elysia": "^1.0.25"
|
||||
},
|
||||
"module": "src/index.tsx",
|
||||
"bun-create": {
|
||||
"start": "bun run src/index.tsx"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.8.1",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
||||
"@biomejs/biome": "1.8.2",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@kitajs/ts-html-plugin": "^4.0.1",
|
||||
"@picocss/pico": "^2.0.6",
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"@types/bun": "^1.1.5",
|
||||
"@types/bun": "^1.1.6",
|
||||
"@types/eslint": "^8.56.10",
|
||||
"@types/node": "^20.14.6",
|
||||
"@types/node": "^20.14.9",
|
||||
"@types/ws": "^8.5.10",
|
||||
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
||||
"@typescript-eslint/parser": "^7.13.1",
|
||||
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
||||
"@typescript-eslint/parser": "^7.14.1",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
|
||||
@@ -16,9 +16,9 @@ import {
|
||||
} from "./graphicsmagick";
|
||||
|
||||
import {
|
||||
convert as convertPdflatex,
|
||||
properties as propertiesPdflatex,
|
||||
} from "./pdflatex";
|
||||
convert as convertxelatex,
|
||||
properties as propertiesxelatex,
|
||||
} from "./xelatex";
|
||||
|
||||
import {
|
||||
convert as convertLibjxl,
|
||||
@@ -63,9 +63,9 @@ const properties: {
|
||||
properties: propertiesImage,
|
||||
converter: convertImage,
|
||||
},
|
||||
pdflatex: {
|
||||
properties: propertiesPdflatex,
|
||||
converter: convertPdflatex,
|
||||
xelatex: {
|
||||
properties: propertiesxelatex,
|
||||
converter: convertxelatex,
|
||||
},
|
||||
pandoc: {
|
||||
properties: propertiesPandoc,
|
||||
@@ -111,9 +111,8 @@ export async function mainConverter(
|
||||
|
||||
for (const key in converterObj.properties.from) {
|
||||
if (
|
||||
// HOW??
|
||||
converterObj.properties.from[key].includes(fileType) &&
|
||||
converterObj.properties.to[key].includes(convertTo)
|
||||
converterObj?.properties?.from[key]?.includes(fileType) &&
|
||||
converterObj?.properties?.to[key]?.includes(convertTo)
|
||||
) {
|
||||
converterFunc = converterObj.converter;
|
||||
break;
|
||||
@@ -217,9 +216,9 @@ for (const converterName in properties) {
|
||||
|
||||
for (const key in converterProperties.to) {
|
||||
if (allTargets[converterName]) {
|
||||
allTargets[converterName].push(...converterProperties.to[key]);
|
||||
allTargets[converterName].push(...(converterProperties.to[key] || []));
|
||||
} else {
|
||||
allTargets[converterName] = converterProperties.to[key];
|
||||
allTargets[converterName] = converterProperties.to[key] || [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,9 +237,9 @@ for (const converterName in properties) {
|
||||
|
||||
for (const key in converterProperties.from) {
|
||||
if (allInputs[converterName]) {
|
||||
allInputs[converterName].push(...converterProperties.from[key]);
|
||||
allInputs[converterName].push(...(converterProperties.from[key] || []));
|
||||
} else {
|
||||
allInputs[converterName] = converterProperties.from[key];
|
||||
allInputs[converterName] = converterProperties.from[key] || [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,9 +127,15 @@ export function convert(
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
options?: any,
|
||||
): Promise<string> {
|
||||
// set xelatex here
|
||||
const xelatex = ["pdf", "latex"];
|
||||
let option = "";
|
||||
if (xelatex.includes(convertTo)) {
|
||||
option = "--pdf-engine=xelatex";
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(
|
||||
`pandoc "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
||||
`pandoc ${option} "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`error: ${error}`);
|
||||
|
||||
@@ -25,7 +25,7 @@ export function convert(
|
||||
.join("/")
|
||||
.replace("./", "");
|
||||
exec(
|
||||
`pdflatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
||||
`latexmk -xelatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`error: ${error}`);
|
||||
75
src/helpers/printVersions.ts
Normal file
75
src/helpers/printVersions.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { exec } from "node:child_process";
|
||||
import { version } from "../../package.json";
|
||||
console.log(`ConvertX v${version}`);
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
exec("cat /etc/os-release", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("Not running on docker, this is not supported.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split('PRETTY_NAME="')[1]?.split('"')[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("pandoc -v", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("Pandoc is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("ffmpeg -version", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("FFmpeg is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("vips -v", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("Vips is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("gm version", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("GraphicsMagick is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("djxl --version", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("libjxl-tools is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
exec("xelatex -version", (error, stdout) => {
|
||||
if (error) {
|
||||
console.error("Tex Live with XeTeX is not installed.");
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(stdout.split("\n")[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -19,6 +19,10 @@ import {
|
||||
normalizeFiletype,
|
||||
normalizeOutputFiletype,
|
||||
} from "./helpers/normalizeFiletype";
|
||||
import "./helpers/printVersions";
|
||||
|
||||
|
||||
|
||||
|
||||
const db = new Database("./data/mydb.sqlite", { create: true });
|
||||
const uploadsDir = "./data/uploads/";
|
||||
|
||||
Reference in New Issue
Block a user