Compare commits

31 Commits

Author SHA1 Message Date
Emrik Östling
277a35b5df Merge pull request #32 from C4illin/release-please--branches--main--components--convertx-frontend 2024-06-20 20:27:26 +02:00
github-actions[bot]
42124e08b2 chore(main): release 0.2.0 2024-06-20 18:24:09 +00:00
C4illin
13169574f0 feat: change from debian to alpine
issue #34
2024-06-20 20:23:34 +02:00
C4illin
6fb07f0d13 build(deps-dev): update typescroipt 2024-06-20 20:10:02 +02:00
Emrik Östling
8121114ccb Merge pull request #40 from C4illin/dependabot/npm_and_yarn/types/node-tw-20.14.6
build(deps-dev): update @types/node requirement from ^20.14.5 to ^20.14.6
2024-06-20 11:20:37 +02:00
dependabot[bot]
81881af1c1 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-20 08:58:16 +00:00
Emrik Östling
bbb4117e9d Merge pull request #41 from C4illin/dependabot/npm_and_yarn/types/bun-tw-1.1.5
build(deps-dev): update @types/bun requirement from ^1.1.4 to ^1.1.5
2024-06-20 10:56:48 +02:00
dependabot[bot]
d7ec8179d8 build(deps-dev): update @types/bun requirement from ^1.1.4 to ^1.1.5
---
updated-dependencies:
- dependency-name: "@types/bun"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-20 08:51:56 +00:00
Emrik Östling
cef60afee3 Merge pull request #37 from C4illin/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-tw-7.13.1
build(deps-dev): update @typescript-eslint/eslint-plugin requirement from ^7.13.0 to ^7.13.1
2024-06-19 00:40:57 +02:00
dependabot[bot]
ccf116acde 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.13.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-18 09:44:48 +00:00
Emrik Östling
f609984c90 Merge pull request #38 from C4illin/dependabot/npm_and_yarn/types/node-tw-20.14.5
build(deps-dev): update @types/node requirement from ^20.14.2 to ^20.14.5
2024-06-18 11:44:10 +02:00
dependabot[bot]
663e654c80 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-18 09:43:46 +00:00
Emrik Östling
31050dbf66 Merge pull request #36 from C4illin/dependabot/npm_and_yarn/typescript-eslint/parser-tw-7.13.1
build(deps-dev): update @typescript-eslint/parser requirement from ^7.13.0 to ^7.13.1
2024-06-18 11:42:16 +02:00
dependabot[bot]
8918c418f4 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.13.1/packages/parser)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 08:30:14 +00:00
Emrik Östling
56266e0da8 Merge pull request #35 from C4illin/dependabot/npm_and_yarn/elysia-tw-1.0.24
build(deps): update elysia requirement from ^1.0.23 to ^1.0.24
2024-06-18 10:28:46 +02:00
dependabot[bot]
a3f5b5153a build(deps): update elysia requirement from ^1.0.23 to ^1.0.24
---
updated-dependencies:
- dependency-name: elysia
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 08:16:34 +00:00
Emrik Östling
6b4c7a16e0 Merge pull request #33 from C4illin/dependabot/npm_and_yarn/types/bun-tw-1.1.4
build(deps-dev): update @types/bun requirement from ^1.1.3 to ^1.1.4
2024-06-13 12:43:00 +02:00
dependabot[bot]
7c7756713b build(deps-dev): update @types/bun requirement from ^1.1.3 to ^1.1.4
---
updated-dependencies:
- dependency-name: "@types/bun"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-13 08:22:51 +00:00
Emrik Östling
15d4233a82 Merge pull request #31 from C4illin/feature-libjxl 2024-06-11 19:36:52 +02:00
C4illin
a1411a7559 chore: update readme with libjxl 2024-06-11 19:36:19 +02:00
C4illin
853a4c4f32 chore: format 2024-06-11 19:32:23 +02:00
C4illin
b05b0a14b0 build(deps-dev): update trustedDependencies in package.json 2024-06-11 19:31:40 +02:00
C4illin
ff680cb295 feat: add libjxl for jpegxl conversion 2024-06-11 19:30:06 +02:00
Emrik Östling
31e1a3124c Merge pull request #30 from C4illin/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-tw-7.13.0
build(deps-dev): update @typescript-eslint/eslint-plugin requirement from ^7.12.0 to ^7.13.0
2024-06-11 15:52:39 +02:00
dependabot[bot]
70278ef0b6 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.13.0/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-11 10:28:16 +00:00
Emrik Östling
0a33fb32e7 Merge pull request #29 from C4illin/dependabot/npm_and_yarn/typescript-eslint/parser-tw-7.13.0
build(deps-dev): update @typescript-eslint/parser requirement from ^7.12.0 to ^7.13.0
2024-06-11 12:26:48 +02:00
dependabot[bot]
26f52a5122 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.13.0/packages/parser)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 10:24:09 +00:00
Emrik Östling
8f8de4295a Merge pull request #28 from C4illin/dependabot/npm_and_yarn/biomejs/biome-1.8.1
build(deps-dev): bump @biomejs/biome from 1.8.0 to 1.8.1
2024-06-11 12:22:41 +02:00
dependabot[bot]
660b342f2e build(deps-dev): bump @biomejs/biome from 1.8.0 to 1.8.1
Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 1.8.0 to 1.8.1.
- [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.1/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-11 10:08:39 +00:00
Emrik Östling
6306a99740 Merge pull request #27 from C4illin/dependabot/npm_and_yarn/prettier-tw-3.3.2
build(deps-dev): update prettier requirement from ^3.3.1 to ^3.3.2
2024-06-11 12:07:08 +02:00
dependabot[bot]
5ca6f45809 build(deps-dev): update prettier requirement from ^3.3.1 to ^3.3.2
Updates the requirements on [prettier](https://github.com/prettier/prettier) to permit the latest version.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.1...3.3.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 09:03:10 +00:00
11 changed files with 182 additions and 20 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## [0.2.0](https://github.com/C4illin/ConvertX/compare/v0.1.2...v0.2.0) (2024-06-20)
### Features
* add libjxl for jpegxl conversion ([ff680cb](https://github.com/C4illin/ConvertX/commit/ff680cb29534a25c3148a90fd064bb86c71fb482))
* change from debian to alpine ([1316957](https://github.com/C4illin/ConvertX/commit/13169574f0134ae236f8d41287bb73930b575e82)), closes [#34](https://github.com/C4illin/ConvertX/issues/34)
## [0.1.2](https://github.com/C4illin/ConvertX/compare/v0.1.1...v0.1.2) (2024-06-10)

63
Debian.Dockerfile Normal file
View File

@@ -0,0 +1,63 @@
FROM oven/bun:1-debian as base
WORKDIR /app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# FROM base AS install-libjxl-tools
# download
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
# FROM base AS prerelease
# COPY --from=install /temp/dev/node_modules node_modules
# COPY . .
# # [optional] tests & build
# ENV NODE_ENV=production
# RUN bun test
# RUN bun run build
# copy production dependencies and source code into final image
FROM base AS release
LABEL maintainer="Emrik Östling (C4illin)"
LABEL description="ConvertX: self-hosted online file converter supporting 700+ file formats."
LABEL repo="https://github.com/C4illin/ConvertX"
# install additional dependencies
RUN rm -rf /var/lib/apt/lists/partial && apt-get update -o Acquire::CompressionTypes::Order::=gz \
&& apt-get install -y \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-latex-extra \
ffmpeg \
graphicsmagick \
ghostscript \
libvips-tools
# # libjxl is not available in the official debian repositories
# RUN wget https://github.com/libjxl/libjxl/releases/download/v0.10.2/jxl-debs-amd64-debian-bullseye-v0.10.2.tar.gz -O /tmp/jxl-debs-amd64-debian-bullseye-v0.10.2.tar.gz \
# && mkdir -p /tmp/libjxl \
# && tar -xvf /tmp/jxl-debs-amd64-debian-bullseye-v0.10.2.tar.gz -C /tmp/libjxl \
# && dpkg -i /tmp/libjxl/libjxl_0.10.2_amd64.deb /tmp/libjxl/jxl_0.10.2_amd64.deb \
# && rm -rf /tmp/jxl-debs-amd64-debian-bullseye-v0.10.2.tar.gz /tmp/libjxl
COPY --from=install /temp/prod/node_modules node_modules
# COPY --from=prerelease /app/src/index.tsx /app/src/
# COPY --from=prerelease /app/package.json .
COPY . .
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]

View File

@@ -1,4 +1,4 @@
FROM oven/bun:1-debian as base
FROM oven/bun:1-alpine as base
WORKDIR /app
# install dependencies into temp directory
@@ -31,16 +31,18 @@ LABEL description="ConvertX: self-hosted online file converter supporting 700+ f
LABEL repo="https://github.com/C4illin/ConvertX"
# install additional dependencies
RUN rm -rf /var/lib/apt/lists/partial && apt-get update -o Acquire::CompressionTypes::Order::=gz \
&& apt-get install -y \
RUN apk --no-cache add \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-latex-extra \
texlive \
texmf-dist-latexextra \
ffmpeg \
graphicsmagick \
ghostscript \
libvips-tools
vips-tools \
libjxl-tools
# this might be needed for some latex use cases, will add it if needed.
# texmf-dist-fontsextra \
COPY --from=install /temp/prod/node_modules node_modules
# COPY --from=prerelease /app/src/index.tsx /app/src/

View File

@@ -19,7 +19,8 @@ A self-hosted online file converter. Supports 831 different formats. Written wit
| Converter | Use case | Converts from | Converts to |
|------------------------------------------------------------------------------|---------------|---------------|-------------|
| [Vips](https://github.com/libvips/libvips) | Images (fast) | 45 | 23 |
| [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 |
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |

BIN
bun.lockb

Binary file not shown.

View File

@@ -2,6 +2,7 @@ services:
convertx:
build:
context: .
# dockerfile: Debian.Dockerfile
volumes:
- ./data:/app/data
environment:

View File

@@ -1,6 +1,6 @@
{
"name": "convertx-frontend",
"version": "0.1.2",
"version": "0.2.0",
"scripts": {
"dev": "bun run --watch src/index.tsx",
"hot": "bun run --hot src/index.tsx",
@@ -12,28 +12,31 @@
"@elysiajs/html": "^1.0.2",
"@elysiajs/jwt": "^1.0.2",
"@elysiajs/static": "^1.0.3",
"elysia": "^1.0.23"
"elysia": "^1.0.24"
},
"module": "src/index.tsx",
"bun-create": {
"start": "bun run src/index.tsx"
},
"devDependencies": {
"@biomejs/biome": "1.8.0",
"@biomejs/biome": "1.8.1",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@kitajs/ts-html-plugin": "^4.0.1",
"@picocss/pico": "^2.0.6",
"@total-typescript/ts-reset": "^0.5.1",
"@types/bun": "^1.1.3",
"@types/bun": "^1.1.5",
"@types/eslint": "^8.56.10",
"@types/node": "^20.14.2",
"@types/node": "^20.14.6",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"cpy-cli": "^5.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.3.1",
"typescript": "^5.4.5"
}
"prettier": "^3.3.2",
"typescript": "^5.5.2"
},
"trustedDependencies": [
"@biomejs/biome"
]
}

View File

@@ -50,4 +50,4 @@ export const Header = ({
</nav>
</header>
);
};
};

71
src/converters/libjxl.ts Normal file
View File

@@ -0,0 +1,71 @@
import { exec } from "node:child_process";
// declare possible conversions
export const properties = {
from: {
jxl: ["jxl"],
images: [
"apng",
"exr",
"gif",
"jpeg",
"pam",
"pfm",
"pgm",
"pgx",
"png",
"ppm",
],
},
to: {
jxl: [
"apng",
"exr",
"gif",
"jpeg",
"pam",
"pfm",
"pgm",
"pgx",
"png",
"ppm",
],
images: ["jxl"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
options?: any,
): Promise<string> {
let tool = "";
if (fileType === "jxl") {
tool = "djxl";
}
if (convertTo === "jxl") {
tool = "cjxl";
}
return new Promise((resolve, reject) => {
exec(`${tool} "${filePath}" "${targetPath}"`, (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("success");
});
});
}

View File

@@ -20,6 +20,11 @@ import {
properties as propertiesPdflatex,
} from "./pdflatex";
import {
convert as convertLibjxl,
properties as propertiesLibjxl,
} from "./libjxl";
import { normalizeFiletype } from "../helpers/normalizeFiletype";
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
@@ -50,6 +55,10 @@ const properties: {
) => any;
};
} = {
libjxl: {
properties: propertiesLibjxl,
converter: convertLibjxl,
},
vips: {
properties: propertiesImage,
converter: convertImage,

View File

@@ -19,7 +19,11 @@ export function convert(
): Promise<string> {
return new Promise((resolve, reject) => {
// const fileName: string = (targetPath.split("/").pop() as string).replace(".pdf", "")
const outputPath = targetPath.split("/").slice(0, -1).join("/").replace("./", "")
const outputPath = targetPath
.split("/")
.slice(0, -1)
.join("/")
.replace("./", "");
exec(
`pdflatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
(error, stdout, stderr) => {