25 Commits

Author SHA1 Message Date
Emrik Östling
f8f90ebd69 Merge pull request #55 from C4illin/release-please--branches--main--components--convertx-frontend 2024-06-28 00:23:46 +02:00
github-actions[bot]
648d5070e2 chore(main): release 0.3.0 2024-06-27 22:05:48 +00:00
C4illin
801cf28d1e feat: print version of installed converters to log 2024-06-28 00:05:21 +02:00
C4illin
fae2ba9c54 feat: change to xelatex 2024-06-27 23:26:46 +02:00
Emrik Östling
10d20a8786 Merge pull request #56 from C4illin/dependabot/npm_and_yarn/types/bun-tw-1.1.6
build(deps-dev): update @types/bun requirement from ^1.1.5 to ^1.1.6
2024-06-27 11:00:55 +02:00
dependabot[bot]
c9bc1e237e build(deps-dev): update @types/bun requirement from ^1.1.5 to ^1.1.6
---
updated-dependencies:
- dependency-name: "@types/bun"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-27 08:14:49 +00:00
C4illin
48a76a46b3 refactor: fix typescript 2024-06-27 01:05:36 +02:00
C4illin
4dcb796e1b feat: add version number to log
issue #44
2024-06-27 00:59:06 +02:00
C4illin
5952103bcd build(deps-dev): update @ianvs/prettier-plugin-sort-imports requirement 2024-06-27 00:58:07 +02:00
Emrik Östling
fd05ee5cd5 Merge pull request #54 from C4illin/dependabot/npm_and_yarn/types/node-tw-20.14.9
build(deps-dev): update @types/node requirement from ^20.14.8 to ^20.14.9
2024-06-26 16:27:25 +02:00
dependabot[bot]
7e7d238c7a build(deps-dev): update @types/node requirement
---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-26 08:52:48 +00:00
Emrik Östling
755a4170f2 Merge pull request #52 from C4illin/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-tw-7.14.1
build(deps-dev): update @typescript-eslint/eslint-plugin requirement from ^7.13.1 to ^7.14.1
2024-06-25 11:34:25 +02:00
dependabot[bot]
263ba415f5 build(deps-dev): update @typescript-eslint/eslint-plugin requirement
Updates the requirements on [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) to permit the latest version.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.14.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-25 09:16:20 +00:00
Emrik Östling
317260098a Merge pull request #51 from C4illin/dependabot/npm_and_yarn/typescript-eslint/parser-tw-7.14.1
build(deps-dev): update @typescript-eslint/parser requirement from ^7.13.1 to ^7.14.1
2024-06-25 11:14:48 +02:00
dependabot[bot]
5304e94b4e build(deps-dev): update @typescript-eslint/parser requirement
Updates the requirements on [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) to permit the latest version.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.14.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-25 08:28:04 +00:00
Emrik Östling
aab2b311cf Merge pull request #48 from C4illin/dependabot/github_actions/docker/build-push-action-6
build(deps): bump docker/build-push-action from 5 to 6
2024-06-24 11:44:13 +02:00
Emrik Östling
baa7ea40e6 Merge pull request #49 from C4illin/dependabot/github_actions/oven-sh/setup-bun-2
build(deps): bump oven-sh/setup-bun from 1 to 2
2024-06-24 11:44:01 +02:00
Emrik Östling
481a11b610 Merge pull request #50 from C4illin/dependabot/npm_and_yarn/elysia-tw-1.0.25
build(deps): update elysia requirement from ^1.0.24 to ^1.0.25
2024-06-24 11:43:51 +02:00
dependabot[bot]
c09fe296b1 build(deps): update elysia requirement from ^1.0.24 to ^1.0.25
---
updated-dependencies:
- dependency-name: elysia
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 08:48:40 +00:00
dependabot[bot]
f023aae753 build(deps): bump oven-sh/setup-bun from 1 to 2
Bumps [oven-sh/setup-bun](https://github.com/oven-sh/setup-bun) from 1 to 2.
- [Release notes](https://github.com/oven-sh/setup-bun/releases)
- [Commits](https://github.com/oven-sh/setup-bun/compare/v1...v2)

---
updated-dependencies:
- dependency-name: oven-sh/setup-bun
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 08:38:19 +00:00
dependabot[bot]
5cd9544b55 build(deps): bump docker/build-push-action from 5 to 6
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 08:38:17 +00:00
Emrik Östling
97c23ba65c Merge pull request #47 from C4illin/dependabot/npm_and_yarn/types/node-tw-20.14.8
build(deps-dev): update @types/node requirement from ^20.14.6 to ^20.14.8
2024-06-22 15:49:14 +02:00
dependabot[bot]
0ffda40ac8 build(deps-dev): update @types/node requirement
---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-22 12:55:07 +00:00
Emrik Östling
cb639907ee Merge pull request #43 from C4illin/dependabot/npm_and_yarn/biomejs/biome-1.8.2
build(deps-dev): bump @biomejs/biome from 1.8.1 to 1.8.2
2024-06-22 14:53:36 +02:00
dependabot[bot]
0166842b78 build(deps-dev): bump @biomejs/biome from 1.8.1 to 1.8.2
Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/cli/v1.8.2/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 08:47:40 +00:00
12 changed files with 121 additions and 26 deletions

View File

@@ -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

View File

@@ -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' }}

View File

@@ -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)

View File

@@ -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" ]

View File

@@ -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 |

BIN
bun.lockb

Binary file not shown.

View File

@@ -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",

View File

@@ -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] || [];
}
}
}

View File

@@ -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}`);

View File

@@ -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}`);

View 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]);
}
});
}

View File

@@ -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/";