111 Commits

Author SHA1 Message Date
C4illin
bba420386f chore: flake wip 2025-05-15 22:11:30 +02:00
C4illin
74df47531c chore: nix doesn't like dirty git trees 2025-05-15 21:09:04 +02:00
C4illin
1adac8c31c chore: start on flake 2025-05-15 21:08:20 +02:00
Emrik Östling
0579f1852b chore: add potrace to readme 2025-05-14 13:14:55 +02:00
Emrik Östling
52d4cc0d03 chore: remove calibre from README.md 2025-05-14 13:10:57 +02:00
Emrik Östling
2c68016ca6 chore: remove duplicates 2025-05-14 13:09:06 +02:00
Emrik Östling
7914194856 Merge pull request #255 from C4illin/release-please--branches--main--components--convertx-frontend 2025-05-14 13:07:23 +02:00
Emrik Östling
2dac7f1362 chore: downgrade bun to 1.2.2 2025-05-14 12:19:40 +02:00
Emrik Östling
a17e5fd614 chore(main): release 0.13.0 2025-05-14 08:55:39 +02:00
Emrik Östling
21994fb6a2 Merge pull request #282 from aidanjacobson/main
Added support for drag/drop of images
2025-05-14 08:54:10 +02:00
Emrik Östling
a5eaaa422a Merge pull request #284 from frederickjansen/hif
feat: Add support for .HIF files
2025-05-14 08:02:28 +02:00
aidanjacobson
ff2ef74135 feat: add support for drag/drop of images 2025-05-13 19:19:57 -07:00
Frederick Jansen
70705c1850 feat: Add support for .HIF files 2025-05-13 12:22:08 -04:00
C4illin
fd9c151e01 chore: update deps 2025-05-12 09:24:36 +02:00
Emrik Östling
4f0573963f Merge pull request #283 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.13
2025-05-10 18:11:06 +02:00
renovate[bot]
6bb6bce8a4 chore(deps): update oven/bun docker tag to v1.2.13 2025-05-10 14:45:25 +00:00
Emrik Östling
448557bece Merge pull request #278 from atfox98/main 2025-05-07 10:11:44 +02:00
A Fox
bdbd4a122c feat: add potrace converter 2025-05-06 12:46:05 -05:00
Emrik Östling
cb9d0ec680 Merge pull request #275 from C4illin/renovate/oven-bun-1.x 2025-05-04 23:04:38 +02:00
renovate[bot]
fb60ef66f5 chore(deps): update oven/bun docker tag to v1.2.12 2025-05-04 10:08:16 +00:00
Emrik Östling
c1ae43075f Merge pull request #274 from C4illin/renovate/npm-run-all2-8.x
chore(deps): update dependency npm-run-all2 to v8
2025-05-02 21:30:55 +02:00
renovate[bot]
377f69ae8d chore(deps): update dependency npm-run-all2 to v8 2025-05-02 18:38:15 +00:00
Emrik Östling
cb131cd0a0 Merge pull request #270 from C4illin/renovate/oven-bun-1.x 2025-04-29 10:46:38 +02:00
renovate[bot]
fcc83c5ea8 chore(deps): update oven/bun docker tag to v1.2.11 2025-04-29 08:11:10 +00:00
Emrik Östling
96d4717d13 chore: create FUNDING.yml 2025-04-24 18:17:24 +02:00
Emrik Östling
4d73bf9760 chore: add tutorial disclaimer 2025-04-24 18:06:57 +02:00
Emrik Östling
725a94bc95 chore: move http warning 2025-04-24 18:03:21 +02:00
Emrik Östling
0a366b447a chore: add dev image size 2025-04-24 18:01:47 +02:00
Emrik Östling
4a27a7bc03 Merge pull request #264 from C4illin/renovate/oven-bun-1.x 2025-04-17 13:45:47 +02:00
renovate[bot]
3ca5803bda chore(deps): update oven/bun docker tag to v1.2.10 2025-04-17 10:54:10 +00:00
Emrik Östling
239041294c Merge pull request #260 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.9
2025-04-16 12:46:11 +02:00
renovate[bot]
31fdd8f214 chore(deps): update oven/bun docker tag to v1.2.9 2025-04-16 10:08:31 +00:00
C4illin
c3319c09eb chore: remove calibre dependency 2025-04-16 11:23:44 +02:00
C4illin
d460e94d52 chore: disable calibre due to conflict with other packages 2025-04-16 11:21:40 +02:00
C4illin
4b5c732380 fix: add timezone support
issue #258
2025-04-12 10:24:08 +02:00
C4illin
f42665ca40 chore: update deps 2025-04-12 10:18:44 +02:00
Emrik Östling
bed52cef17 Merge pull request #254 from kek-Sec/feat/hide-history
feat: add HIDE_HISTORY option to control visibility of history page
2025-04-02 14:26:35 +02:00
g.petrakis
9d1c93155c feat: add HIDE_HISTORY option to control visibility of history page 2025-04-02 15:02:56 +03:00
C4illin
794cc7c474 chore: update deps 2025-04-01 18:09:56 +02:00
C4illin
d7d584e497 chore: format 2025-04-01 14:50:15 +02:00
Emrik Östling
f5320df86e Merge pull request #241 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.8
2025-04-01 14:19:48 +02:00
C4illin
056fd4ba93 change to bun 1.2.2 2025-04-01 14:19:00 +02:00
Emrik Östling
5b6e70eb3a Merge pull request #246 from C4illin/release-please--branches--main--components--convertx-frontend
chore(main): release 0.12.1
2025-04-01 14:15:28 +02:00
renovate[bot]
f437a8e7e2 chore(deps): update oven/bun docker tag to v1.2.8 2025-03-31 19:37:32 +00:00
Emrik Östling
cdae798fcf chore: rollback to 1.2.2
issue: #235
2025-03-20 11:05:24 +01:00
Emrik Östling
bcc827a81b chore(main): release 0.12.1 2025-03-20 09:40:15 +01:00
Emrik Östling
84274b9c55 chore: revert to bun 1.2.3
issue: #235
2025-03-20 09:39:36 +01:00
Emrik Östling
20c6f8249e Merge pull request #245 from C4illin/fix/#235/change-to-canary-bun
fix: change to canary bun
2025-03-19 21:19:45 +01:00
C4illin
8f0ea2a592 fix: change to canary bun
issue: #235
2025-03-19 20:30:50 +01:00
Emrik Östling
a29e4a930a Merge pull request #242 from C4illin/downgrade-bun-to-1.2.2
chore: downgrade bun to 1.2.2
2025-03-10 13:12:31 +01:00
Emrik Östling
4549c96ae3 chore: remove old labels 2025-03-10 12:38:17 +01:00
Emrik Östling
bc64094c04 chore: downgrade bun to 1.2.2
issue: #235
2025-03-10 12:34:47 +01:00
Emrik Östling
fa58827ad5 Merge pull request #240 from C4illin/donwgrade-bun-to-1.2.3
chore: downgrade bun to 1.2.3
2025-03-09 22:43:02 +01:00
C4illin
8f27be0e3d chore: downgrade bun 2025-03-09 21:10:59 +01:00
C4illin
df43df1178 Merge branch 'main' of https://github.com/C4illin/ConvertX 2025-03-09 21:09:58 +01:00
C4illin
c2beb4a227 chore: add default full opacity 2025-03-09 21:09:53 +01:00
Emrik Östling
9277c27a50 chore: change security url 2025-03-09 21:07:04 +01:00
Emrik Östling
171ecd6884 chore: Create SECURITY.md 2025-03-09 21:04:18 +01:00
Emrik Östling
dca29f7e5a Merge pull request #239 from C4illin/remove-slim
build: remove slim for tailwind
2025-03-09 16:40:20 +01:00
C4illin
318acc20bd build: remove slim for tailwind 2025-03-08 01:08:00 +01:00
C4illin
f433493d57 chore: remove @elysiajs/cookie 2025-03-08 00:28:27 +01:00
C4illin
19970fc132 chore: fix lint 2025-03-06 21:09:02 +01:00
Emrik Östling
24394ca3c5 Merge pull request #226 from C4illin/release-please--branches--main--components--convertx-frontend
chore(main): release 0.12.0
2025-03-06 18:47:25 +01:00
Emrik Östling
10ff0b464a chore(main): release 0.12.0 2025-03-06 18:17:28 +01:00
C4illin
9263d17609 feat: replace exec with execFile 2025-03-06 18:16:51 +01:00
Emrik Östling
c1b75a13fd chore: sanitize filename 2025-03-04 09:23:06 +01:00
Emrik Östling
a8ed60d48f Merge pull request #233 from Lacni135/feature-progress
Added progress bar for file upload
2025-02-28 09:57:39 +01:00
lacni
dc82a438d4 fix: refactored uploadFile to only accept a single file instead of multiple 2025-02-27 21:11:52 -05:00
lacni
cc54bdcbe7 feat: made every upload file independent 2025-02-27 19:18:13 -05:00
lacni
ae4bbc8baa fix: added onerror log 2025-02-27 19:15:58 -05:00
C4illin
ad98499da0 chore: move libheif below vips 2025-02-27 22:17:02 +01:00
lacni
db60f355b2 feat: added progress bar for file upload 2025-02-26 23:31:31 -05:00
Emrik Östling
eb91d8b298 Merge pull request #232 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.4
2025-02-26 16:07:27 +01:00
renovate[bot]
b8312be4b7 chore(deps): update oven/bun docker tag to v1.2.4 2025-02-26 14:32:53 +00:00
Emrik Östling
326a8e3404 Merge pull request #230 from C4illin/renovate/oven-bun-1.x 2025-02-23 12:45:09 +01:00
renovate[bot]
f017e13ac1 chore(deps): update oven/bun docker tag to v1.2.3 2025-02-23 01:15:18 +00:00
Emrik Östling
67a5fe353e Merge pull request #229 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.3
2025-02-22 11:47:50 +01:00
renovate[bot]
51d49d7ff3 chore(deps): update oven/bun docker tag to v1.2.3 2025-02-22 10:05:09 +00:00
Emrik Östling
d42b820b36 Merge pull request #227 from C4illin/renovate/eslint__js-9.x
chore(deps): update dependency @types/eslint__js to v9
2025-02-22 11:04:42 +01:00
renovate[bot]
07d32776d3 chore(deps): update dependency @types/eslint__js to v9 2025-02-21 23:05:04 +00:00
Emrik Östling
ef027e81b5 Merge pull request #228 from C4illin/renovate/globals-16.x
chore(deps): update dependency globals to v16
2025-02-22 00:04:37 +01:00
renovate[bot]
a75e4b495d chore(deps): update dependency globals to v16 2025-02-21 20:05:07 +00:00
C4illin
fba5e212e8 fix: update libheif to 1.19.5
issue: #202
2025-02-18 21:24:54 +01:00
C4illin
62f44fb052 chore: print libheif version 2025-02-18 20:05:46 +01:00
Emrik Östling
6b9254047c Merge pull request #225 from C4illin/fix/#202/add-libheif
fix: add libheif
2025-02-16 23:04:35 +01:00
C4illin
decfea5dc9 fix: add libheif
issue #202
2025-02-16 21:18:33 +01:00
Emrik Östling
eacded6848 Merge pull request #224 from C4illin/release-please--branches--main--components--convertx-frontend
chore(main): release 0.11.1
2025-02-07 22:52:29 +01:00
Emrik Östling
279ca72c64 chore(main): release 0.11.1 2025-02-07 16:15:21 +01:00
C4illin
b8fc9383ca chore: update deps 2025-02-07 16:14:46 +01:00
C4illin
bec58ac59f fix: mobile view overflow 2025-02-06 19:57:07 +01:00
Emrik Östling
83d7126820 Merge pull request #216 from C4illin/release-please--branches--main--components--convertx-frontend
chore(main): release 0.11.0
2025-02-05 15:23:43 +01:00
Emrik Östling
f0e9c6d794 chore(main): release 0.11.0 2025-02-05 14:18:31 +01:00
Emrik Östling
0e61051fc6 fix: install numpy for inkscape 2025-02-05 14:17:55 +01:00
C4illin
480ba77ebe chore: fix eslint config 2025-02-01 21:46:15 +01:00
C4illin
16f27c13bb fix: don't crash if file is not found 2025-02-01 21:09:48 +01:00
C4illin
afe5c50d66 chore: fix tailwind v4 docker 2025-02-01 21:09:12 +01:00
C4illin
72ea859ebb chore: switch to new lockfile format 2025-02-01 21:08:38 +01:00
C4illin
8edf3834c4 chore: print correct version 2025-02-01 21:08:04 +01:00
C4illin
e595014fcd refactor: update Tailwind to v4 2025-02-01 20:15:50 +01:00
Emrik Östling
8bebf7e569 Merge pull request #220 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.2
2025-02-01 10:05:04 +01:00
renovate[bot]
c825ec06e2 chore(deps): update oven/bun docker tag to v1.2.2 2025-02-01 08:31:38 +00:00
Emrik Östling
8c75f273fb Merge pull request #217 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.1
2025-01-28 07:13:26 +01:00
renovate[bot]
0ba776c129 chore(deps): update oven/bun docker tag to v1.2.1 2025-01-28 01:48:23 +00:00
C4illin
2bbbd03554 feat: add deps for vaapi
issue #192
2025-01-23 22:00:19 +01:00
C4illin
0a5d0487b1 chore: update deps 2025-01-23 21:59:24 +01:00
Emrik Östling
583cd2dd3b Merge pull request #214 from C4illin/renovate/oven-bun-1.x
chore(deps): update oven/bun docker tag to v1.2.0
2025-01-22 23:11:45 +01:00
renovate[bot]
e1f7fc1ecb chore(deps): update oven/bun docker tag to v1.2.0 2025-01-22 18:46:19 +00:00
Emrik Östling
961a55cbe5 Merge pull request #213 from C4illin/release-please--branches--main--components--convertx-frontend 2025-01-21 23:28:20 +01:00
Emrik Östling
cdf9bad903 chore(main): release 0.10.1 2025-01-21 23:25:50 +01:00
C4illin
6769fa2f83 chore: update deps 2025-01-21 23:25:11 +01:00
C4illin
3b7ea88b73 fix: ffmpeg works without ffmpeg_args
issue #212
2025-01-21 23:24:53 +01:00
36 changed files with 3088 additions and 1398 deletions

View File

@@ -1,20 +1,19 @@
.dockerignore
.editorconfig
.env
.git
.gitignore
.idea
.vscode
CHANGELOG.md
coverage*
data
docker-compose*
Dockerfile*
eslint.config.js
helm-charts
LICENSE
Makefile
node_modules
prettier.config.js
README.md
.dockerignore
.editorconfig
.env
.git
.idea
.vscode
CHANGELOG.md
coverage*
data
docker-compose*
Dockerfile*
eslint.config.js
helm-charts
LICENSE
Makefile
node_modules
prettier.config.js
README.md
renovate.json

15
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# These are supported funding model platforms
github: [C4illin] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -1,5 +1,72 @@
# Changelog
## [0.13.0](https://github.com/C4illin/ConvertX/compare/v0.12.1...v0.13.0) (2025-05-14)
### Features
* add HIDE_HISTORY option to control visibility of history page ([9d1c931](https://github.com/C4illin/ConvertX/commit/9d1c93155cc33ed6c83f9e5122afff8f28d0e4bf))
* add potrace converter ([bdbd4a1](https://github.com/C4illin/ConvertX/commit/bdbd4a122c09559b089b985ea12c5f3e085107da))
* Add support for .HIF files ([70705c1](https://github.com/C4illin/ConvertX/commit/70705c1850d470296df85958c02a01fb5bc3a25f))
* add support for drag/drop of images ([ff2ef74](https://github.com/C4illin/ConvertX/commit/ff2ef7413542cf10ba7a6e246763bcecd6829ec1))
### Bug Fixes
* add timezone support ([4b5c732](https://github.com/C4illin/ConvertX/commit/4b5c732380bc844dccf340ea1eb4f8bfe3bb44a5)), closes [#258](https://github.com/C4illin/ConvertX/issues/258)
## [0.12.1](https://github.com/C4illin/ConvertX/compare/v0.12.0...v0.12.1) (2025-03-20)
### Bug Fixes
* rollback to bun 1.2.2 ([cdae798](https://github.com/C4illin/ConvertX/commit/cdae798fcf5879e4adea87386a38748b9a1e1ddc))
## [0.12.0](https://github.com/C4illin/ConvertX/compare/v0.11.1...v0.12.0) (2025-03-06)
### Features
* added progress bar for file upload ([db60f35](https://github.com/C4illin/ConvertX/commit/db60f355b2973f43f8e5990e6fe4e351b959b659))
* made every upload file independent ([cc54bdc](https://github.com/C4illin/ConvertX/commit/cc54bdcbe764c41cc3273485d072fd3178ad2dca))
* replace exec with execFile ([9263d17](https://github.com/C4illin/ConvertX/commit/9263d17609dc4b2b367eb7fee67b3182e283b3a3))
### Bug Fixes
* add libheif ([6b92540](https://github.com/C4illin/ConvertX/commit/6b9254047c0598963aee1d99e20ba1650a0368bf))
* add libheif ([decfea5](https://github.com/C4illin/ConvertX/commit/decfea5dc9627b216bb276a9e1578c32cfa1deb6)), closes [#202](https://github.com/C4illin/ConvertX/issues/202)
* added onerror log ([ae4bbc8](https://github.com/C4illin/ConvertX/commit/ae4bbc8baacbaf67763c62ea44140bb21cc17230))
* refactored uploadFile to only accept a single file instead of multiple ([dc82a43](https://github.com/C4illin/ConvertX/commit/dc82a438d4104b79ff423d502a6779a43928968a))
* update libheif to 1.19.5 ([fba5e21](https://github.com/C4illin/ConvertX/commit/fba5e212e8d0eaba8971e239e35aeb521f3cd813)), closes [#202](https://github.com/C4illin/ConvertX/issues/202)
## [0.11.1](https://github.com/C4illin/ConvertX/compare/v0.11.0...v0.11.1) (2025-02-07)
### Bug Fixes
* mobile view overflow ([bec58ac](https://github.com/C4illin/ConvertX/commit/bec58ac59f9600e35385b9e21d174f3ab1b42b1d))
## [0.11.0](https://github.com/C4illin/ConvertX/compare/v0.10.1...v0.11.0) (2025-02-05)
### Features
* add deps for vaapi ([2bbbd03](https://github.com/C4illin/ConvertX/commit/2bbbd03554d384a4488143f29e5fc863cfdf333b)), closes [#192](https://github.com/C4illin/ConvertX/issues/192)
### Bug Fixes
* don't crash if file is not found ([16f27c1](https://github.com/C4illin/ConvertX/commit/16f27c13bbc1c0e5fa2316f3db11d0918524053b))
* install numpy for inkscape ([0e61051](https://github.com/C4illin/ConvertX/commit/0e61051fc6be188164c3865b4fb579c140859fdc))
## [0.10.1](https://github.com/C4illin/ConvertX/compare/v0.10.0...v0.10.1) (2025-01-21)
### Bug Fixes
* ffmpeg works without ffmpeg_args ([3b7ea88](https://github.com/C4illin/ConvertX/commit/3b7ea88b7382f7c21b120bdc9bda5bb10547f55d)), closes [#212](https://github.com/C4illin/ConvertX/issues/212)
## [0.10.0](https://github.com/C4illin/ConvertX/compare/v0.9.0...v0.10.0) (2025-01-18)

View File

@@ -1,4 +1,4 @@
FROM oven/bun:1.1.45-alpine AS base
FROM oven/bun:1.2.2-alpine AS base
LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
WORKDIR /app
@@ -6,12 +6,12 @@ WORKDIR /app
# 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/
COPY package.json bun.lock /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/
COPY package.json bun.lock /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
FROM base AS builder
@@ -20,22 +20,18 @@ ENV PATH=/root/.cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN cargo install resvg
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
WORKDIR /app
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# # [optional] tests & build
ENV NODE_ENV=production
# RUN bun test
# ENV NODE_ENV=production
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"
RUN apk --no-cache add libheif-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
# install additional dependencies
RUN apk --no-cache add \
@@ -49,14 +45,18 @@ RUN apk --no-cache add \
vips-tools \
vips-poppler \
vips-jxl \
vips-heif \
vips-magick \
libjxl-tools \
assimp \
inkscape \
poppler-utils
poppler-utils \
gcompat \
libva-utils \
py3-numpy \
potrace
RUN apk --no-cache add qt6-qtbase-private-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
RUN apk --no-cache add calibre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
# RUN apk --no-cache add calibre@testing --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main/
# this might be needed for some latex use cases, will add it if needed.
# texmf-dist-fontsextra \
@@ -64,8 +64,6 @@ RUN apk --no-cache add calibre --repository=http://dl-cdn.alpinelinux.org/alpine
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=builder /root/.cargo/bin/resvg /usr/local/bin/resvg
COPY --from=prerelease /app/public/generated.css /app/public/
# COPY --from=prerelease /app/src/index.tsx /app/src/
# COPY --from=prerelease /app/package.json .
COPY . .
EXPOSE 3000/tcp

View File

@@ -27,13 +27,16 @@ A self-hosted online file converter. Supports over a thousand different formats.
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
| [resvg](https://github.com/RazrFalcon/resvg) | SVG | 1 | 1 |
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
| [libheif](https://github.com/strukturag/libheif) | HEIF | 2 | 4 |
| [XeLaTeX](https://tug.org/xetex/) | LaTeX | 1 | 1 |
| [Calibre](https://calibre-ebook.com/) | E-books | 26 | 19 |
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 167 | 130 |
| [Inkscape](https://inkscape.org/) | Vector images | 7 | 17 |
| [Assimp](https://github.com/assimp/assimp) | 3D Assets | 77 | 23 |
| [FFmpeg](https://ffmpeg.org/) | Video | ~472 | ~199 |
| [Potrace](https://potrace.sourceforge.net/) | Raster to vector | 4 | 11 |
<!-- | [Calibre](https://calibre-ebook.com/) | E-books | 26 | 19 | -->
<!-- many ffmpeg fileformats are duplicates -->
@@ -41,6 +44,9 @@ Any missing converter? Open an issue or pull request!
## Deployment
> [!WARNING]
> If you can't login, make sure you are accessing the service over localhost or https otherwise set HTTP_ALLOWED=true
```yml
# docker-compose.yml
services:
@@ -79,9 +85,7 @@ All are optional, JWT_SECRET is recommended to be set.
| AUTO_DELETE_EVERY_N_HOURS | 24 | Checks every n hours for files older then n hours and deletes them, set to 0 to disable |
| WEBROOT | | The address to the root path setting this to "/convert" will serve the website on "example.com/convert/" |
| FFMPEG_ARGS | | Arguments to pass to ffmpeg, e.g. `-preset veryfast` |
> [!WARNING]
> If you can't login, make sure you are accessing the service over https or set HTTP_ALLOWED=true
| HIDE_HISTORY | false | Hide the history page |
### Docker images
@@ -96,10 +100,15 @@ The image is available on [GitHub Container Registry](https://github.com/C4illin
| `image: c4illin/convertx` | The latest release on docker hub |
| `image: c4illin/convertx:main` | The latest commit on docker hub |
![Release image size](https://ghcr-badge.egpl.dev/c4illin/convertx/size?color=%230375b6&tag=latest&label=release+image&trim=)
![Dev image size](https://ghcr-badge.egpl.dev/c4illin/convertx/size?color=%230375b6&tag=main&label=dev+image&trim=)
<!-- Dockerhub was introduced in 0.9.0 and older releases -->
### Tutorial
> [!NOTE]
> These are written by other people, and may be outdated, incorrect or wrong.
Tutorial in french: <https://belginux.com/installer-convertx-avec-docker/>
Tutorial in chinese: <https://xzllll.com/24092901/>

9
SECURITY.md Normal file
View File

@@ -0,0 +1,9 @@
# Security Policy
## Supported Versions
Only the latest release is supported
## Reporting a Vulnerability
To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/C4illin/ConvertX/security/advisories/new) tab.

1164
bun.lock Normal file

File diff suppressed because it is too large Load Diff

BIN
bun.lockb

Binary file not shown.

View File

@@ -13,5 +13,6 @@ services:
- AUTO_DELETE_EVERY_N_HOURS=1 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
# - FFMPEG_ARGS=-hwaccel vulkan # additional arguments to pass to ffmpeg
# - WEBROOT=/convertx # the root path of the web interface, leave empty to disable
# - HIDE_HISTORY=true # hides the history tab in the web interface, defaults to false
ports:
- 3000:3000

View File

@@ -1,59 +0,0 @@
import { fixupPluginRules } from "@eslint/compat";
import eslint from "@eslint/js";
import deprecationPlugin from "eslint-plugin-deprecation";
import eslintPluginReadableTailwind from "eslint-plugin-readable-tailwind";
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
import tailwind from "eslint-plugin-tailwindcss";
import globals from "globals";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tailwind.configs["flat/recommended"],
{
plugins: {
deprecation: fixupPluginRules(deprecationPlugin),
"simple-import-sort": simpleImportSortPlugin,
"readable-tailwind": eslintPluginReadableTailwind,
},
ignores: ["**/node_modules/**"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json"],
},
globals: {
...globals.node,
...globals.browser,
},
},
files: ["**/*.{js,mjs,cjs,tsx,ts}"],
rules: {
...eslintPluginReadableTailwind.configs.warning.rules,
"tailwindcss/classnames-order": "off",
"readable-tailwind/multiline": [
"warn",
{
group: "newLine",
printWidth: 100,
},
],
"tailwindcss/no-custom-classname": [
"warn",
{
whitelist: [
"select_container",
"convert_to_popup",
"convert_to_group",
"target",
"convert_to_target",
],
},
],
},
},
);

57
eslint.config.ts Normal file
View File

@@ -0,0 +1,57 @@
import js from "@eslint/js";
import eslintParserTypeScript from "@typescript-eslint/parser";
import type { Linter } from "eslint";
import eslintPluginReadableTailwind from "eslint-plugin-readable-tailwind";
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
import globals from "globals";
import tseslint from "typescript-eslint";
export default [
js.configs.recommended,
...tseslint.configs.recommended,
// ...tailwind.configs["flat/recommended"],
{
plugins: {
"simple-import-sort": simpleImportSortPlugin,
"readable-tailwind": eslintPluginReadableTailwind,
},
ignores: ["**/node_modules/**"],
languageOptions: {
parser: eslintParserTypeScript,
parserOptions: {
project: true,
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.node,
...globals.browser,
},
},
files: ["**/*.{js,mjs,cjs,jsx,tsx,ts}"],
rules: {
...eslintPluginReadableTailwind.configs.warning.rules,
// "tailwindcss/classnames-order": "off",
"readable-tailwind/multiline": [
"warn",
{
group: "newLine",
printWidth: 100,
},
],
// "tailwindcss/no-custom-classname": [
// "warn",
// {
// whitelist: [
// "select_container",
// "convert_to_popup",
// "convert_to_group",
// "target",
// "convert_to_target",
// ],
// },
// ],
},
},
] as Linter.Config[];

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1747179050,
"narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

60
flake.nix Normal file
View File

@@ -0,0 +1,60 @@
{
description = "ConvertX";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
appSrc = ./.;
app = pkgs.dockerTools.buildLayeredImage {
name = "convertx";
tag = "latest";
contents = [
pkgs.bun
pkgs.resvg
pkgs.ffmpeg
pkgs.graphicsmagick
pkgs.ghostscript
pkgs.vips
pkgs.pandoc
pkgs.texlive.combined.scheme-full
pkgs.calibre
pkgs.inkscape
pkgs.poppler_utils
pkgs.assimp
pkgs.jxrlib
pkgs.libheif
pkgs.libjxl
pkgs.python3Packages.numpy
];
config = {
Env = [
"NODE_ENV=production"
"PATH=/bin:/usr/bin"
];
WorkingDir = "/app";
Cmd = [ "bun" "run" "./src/index.tsx" ];
ExposedPorts = {
"3000/tcp" = {};
};
};
extraCommands = ''
export PATH=${pkgs.bun}/bin:$PATH
mkdir -p /app
cp -r ${./dist}/* /app/
'';
};
in {
packages.default = app;
}
);
}

View File

@@ -1,23 +1,24 @@
{
"name": "convertx-frontend",
"version": "0.10.0",
"version": "0.13.0",
"scripts": {
"dev": "bun run --watch src/index.tsx",
"hot": "bun run --hot src/index.tsx",
"start": "bun run src/index.tsx",
"format": "eslint --fix .",
"build": "postcss ./src/main.css -o ./public/generated.css",
"build": "bunx @tailwindcss/cli -i ./src/main.css -o ./public/generated.css",
"lint": "run-p 'lint:*'",
"lint:tsc": "tsc --noEmit",
"lint:knip": "knip",
"lint:eslint": "eslint ."
},
"dependencies": {
"@elysiajs/cookie": "^0.8.0",
"@elysiajs/html": "^1.2.0",
"@elysiajs/jwt": "^1.2.0",
"@elysiajs/static": "^1.2.0",
"@kitajs/html": "^4.2.7",
"elysia": "^1.2.10"
"@elysiajs/html": "^1.3.0",
"@elysiajs/jwt": "^1.3.0",
"@elysiajs/static": "^1.3.0",
"@kitajs/html": "^4.2.9",
"elysia": "^1.3.1",
"sanitize-filename": "^1.6.3"
},
"module": "src/index.tsx",
"type": "module",
@@ -25,31 +26,30 @@
"start": "bun run src/index.tsx"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@eslint/js": "^9.26.0",
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
"@kitajs/ts-html-plugin": "^4.1.1",
"@tailwindcss/cli": "^4.1.6",
"@tailwindcss/postcss": "^4.1.6",
"@total-typescript/ts-reset": "^0.6.1",
"@types/bun": "^1.1.16",
"@types/bun": "^1.2.13",
"@types/eslint-plugin-tailwindcss": "^3.17.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.10.7",
"autoprefixer": "^10.4.20",
"cssnano": "^7.0.6",
"eslint": "^9.18.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-readable-tailwind": "^1.8.2",
"@types/node": "^22.15.17",
"autoprefixer": "^10.4.21",
"cssnano": "^7.0.7",
"eslint": "^9.26.0",
"eslint-plugin-readable-tailwind": "^2.1.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-tailwindcss": "^3.17.5",
"globals": "^15.14.0",
"knip": "^5.42.1",
"npm-run-all2": "^7.0.2",
"postcss": "^8.5.1",
"postcss-cli": "^11.0.0",
"prettier": "^3.4.2",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript-eslint": "^8.20.0"
"eslint-plugin-tailwindcss": "4.0.0-alpha.0",
"globals": "^16.1.0",
"knip": "^5.55.1",
"npm-run-all2": "^8.0.1",
"postcss": "^8.5.3",
"postcss-cli": "^11.0.1",
"prettier": "^3.5.3",
"tailwind-scrollbar": "^4.0.2",
"tailwindcss": "^4.1.6",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.0"
}
}
}

View File

@@ -1,8 +1,5 @@
import autoprefixer from "autoprefixer";
import cssnano from "cssnano";
import tailwind from "tailwindcss";
import tailwindConfig from "./tailwind.config.js";
export default {
plugins: [autoprefixer, tailwind(tailwindConfig), cssnano],
};
plugins: {
"@tailwindcss/postcss": {},
},
};

View File

@@ -1,236 +1,254 @@
const webroot = document.querySelector("meta[name='webroot']").content;
const fileInput = document.querySelector('input[type="file"]');
const dropZone = document.getElementById("dropzone");
const convertButton = document.querySelector("input[type='submit']");
const fileNames = [];
let fileType;
let pendingFiles = 0;
let formatSelected = false;
dropZone.addEventListener("dragover", () => {
dropZone.classList.add("dragover");
});
dropZone.addEventListener("dragleave", () => {
dropZone.classList.remove("dragover");
});
dropZone.addEventListener("drop", () => {
dropZone.classList.remove("dragover");
});
const selectContainer = document.querySelector("form .select_container");
const updateSearchBar = () => {
const convertToInput = document.querySelector(
"input[name='convert_to_search']",
);
const convertToPopup = document.querySelector(".convert_to_popup");
const convertToGroupElements = document.querySelectorAll(".convert_to_group");
const convertToGroups = {};
const convertToElement = document.querySelector("select[name='convert_to']");
const showMatching = (search) => {
for (const [targets, groupElement] of Object.values(convertToGroups)) {
let matchingTargetsFound = 0;
for (const target of targets) {
if (target.dataset.target.includes(search)) {
matchingTargetsFound++;
target.classList.remove("hidden");
target.classList.add("flex");
} else {
target.classList.add("hidden");
target.classList.remove("flex");
}
}
if (matchingTargetsFound === 0) {
groupElement.classList.add("hidden");
groupElement.classList.remove("flex");
} else {
groupElement.classList.remove("hidden");
groupElement.classList.add("flex");
}
}
};
for (const groupElement of convertToGroupElements) {
const groupName = groupElement.dataset.converter;
const targetElements = groupElement.querySelectorAll(".target");
const targets = Array.from(targetElements);
for (const target of targets) {
target.onmousedown = () => {
convertToElement.value = target.dataset.value;
convertToInput.value = `${target.dataset.target} using ${target.dataset.converter}`;
formatSelected = true;
if (pendingFiles === 0 && fileNames.length > 0) {
convertButton.disabled = false;
}
showMatching("");
};
}
convertToGroups[groupName] = [targets, groupElement];
}
convertToInput.addEventListener("input", (e) => {
showMatching(e.target.value.toLowerCase());
});
convertToInput.addEventListener("search", () => {
// when the user clears the search bar using the 'x' button
convertButton.disabled = true;
formatSelected = false;
});
convertToInput.addEventListener("blur", (e) => {
// Keep the popup open even when clicking on a target button
// for a split second to allow the click to go through
if (e?.relatedTarget?.classList?.contains("target")) {
convertToPopup.classList.add("hidden");
convertToPopup.classList.remove("flex");
return;
}
convertToPopup.classList.add("hidden");
convertToPopup.classList.remove("flex");
});
convertToInput.addEventListener("focus", () => {
convertToPopup.classList.remove("hidden");
convertToPopup.classList.add("flex");
});
};
// Add a 'change' event listener to the file input element
fileInput.addEventListener("change", (e) => {
// Get the selected files from the event target
const files = e.target.files;
// Select the file-list table
const fileList = document.querySelector("#file-list");
// Loop through the selected files
for (const file of files) {
// Create a new table row for each file
const row = document.createElement("tr");
row.innerHTML = `
<td>${file.name}</td>
<td>${(file.size / 1024).toFixed(2)} kB</td>
<td><a onclick="deleteRow(this)">Remove</a></td>
`;
if (!fileType) {
fileType = file.name.split(".").pop();
fileInput.setAttribute("accept", `.${fileType}`);
setTitle();
// choose the option that matches the file type
// for (const option of convertFromSelect.children) {
// console.log(option.value);
// if (option.value === fileType) {
// option.selected = true;
// }
// }
fetch(`${webroot}/conversions`, {
method: "POST",
body: JSON.stringify({ fileType: fileType }),
headers: {
"Content-Type": "application/json",
},
})
.then((res) => res.text())
.then((html) => {
selectContainer.innerHTML = html;
updateSearchBar();
})
.catch((err) => console.log(err));
}
// Append the row to the file-list table
fileList.appendChild(row);
// Append the file to the hidden input
fileNames.push(file.name);
}
uploadFiles(files);
});
const setTitle = () => {
const title = document.querySelector("h1");
title.textContent = `Convert ${fileType ? `.${fileType}` : ""}`;
};
// Add a onclick for the delete button
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const deleteRow = (target) => {
const filename = target.parentElement.parentElement.children[0].textContent;
const row = target.parentElement.parentElement;
row.remove();
// remove from fileNames
const index = fileNames.indexOf(filename);
fileNames.splice(index, 1);
// reset fileInput
fileInput.value = "";
// if fileNames is empty, reset fileType
if (fileNames.length === 0) {
fileType = null;
fileInput.removeAttribute("accept");
convertButton.disabled = true;
setTitle();
}
fetch(`${webroot}/delete`, {
method: "POST",
body: JSON.stringify({ filename: filename }),
headers: {
"Content-Type": "application/json",
},
})
.catch((err) => console.log(err));
};
const uploadFiles = (files) => {
convertButton.disabled = true;
convertButton.textContent = "Uploading...";
pendingFiles += 1;
const formData = new FormData();
for (const file of files) {
formData.append("file", file, file.name);
}
fetch(`${webroot}/upload`, {
method: "POST",
body: formData,
})
.then((res) => res.json())
.then((data) => {
pendingFiles -= 1;
if (pendingFiles === 0) {
if (formatSelected) {
convertButton.disabled = false;
}
convertButton.textContent = "Convert";
}
console.log(data);
})
.catch((err) => console.log(err));
};
const formConvert = document.querySelector(`form[action='${webroot}/convert']`);
formConvert.addEventListener("submit", () => {
const hiddenInput = document.querySelector("input[name='file_names']");
hiddenInput.value = JSON.stringify(fileNames);
});
updateSearchBar();
const webroot = document.querySelector("meta[name='webroot']").content;
const fileInput = document.querySelector('input[type="file"]');
const dropZone = document.getElementById("dropzone");
const convertButton = document.querySelector("input[type='submit']");
const fileNames = [];
let fileType;
let pendingFiles = 0;
let formatSelected = false;
dropZone.addEventListener("dragover", (e) => {
e.preventDefault();
dropZone.classList.add("dragover");
});
dropZone.addEventListener("dragleave", () => {
dropZone.classList.remove("dragover");
});
dropZone.addEventListener("drop", (e) => {
e.preventDefault();
dropZone.classList.remove("dragover");
const files = e.dataTransfer.files;
if (files.length === 0) {
console.warn("No files dropped — likely a URL or unsupported source.");
return;
}
for (const file of files) {
console.log("Handling dropped file:", file.name);
handleFile(file);
}
});
// Extracted handleFile function for reusability in drag-and-drop and file input
function handleFile(file) {
const fileList = document.querySelector("#file-list");
const row = document.createElement("tr");
row.innerHTML = `
<td>${file.name}</td>
<td><progress max="100"></progress></td>
<td>${(file.size / 1024).toFixed(2)} kB</td>
<td><a onclick="deleteRow(this)">Remove</a></td>
`;
if (!fileType) {
fileType = file.name.split(".").pop();
fileInput.setAttribute("accept", `.${fileType}`);
setTitle();
fetch(`${webroot}/conversions`, {
method: "POST",
body: JSON.stringify({ fileType }),
headers: { "Content-Type": "application/json" },
})
.then((res) => res.text())
.then((html) => {
selectContainer.innerHTML = html;
updateSearchBar();
})
.catch(console.error);
}
fileList.appendChild(row);
file.htmlRow = row;
fileNames.push(file.name);
uploadFile(file);
}
const selectContainer = document.querySelector("form .select_container");
const updateSearchBar = () => {
const convertToInput = document.querySelector(
"input[name='convert_to_search']",
);
const convertToPopup = document.querySelector(".convert_to_popup");
const convertToGroupElements = document.querySelectorAll(".convert_to_group");
const convertToGroups = {};
const convertToElement = document.querySelector("select[name='convert_to']");
const showMatching = (search) => {
for (const [targets, groupElement] of Object.values(convertToGroups)) {
let matchingTargetsFound = 0;
for (const target of targets) {
if (target.dataset.target.includes(search)) {
matchingTargetsFound++;
target.classList.remove("hidden");
target.classList.add("flex");
} else {
target.classList.add("hidden");
target.classList.remove("flex");
}
}
if (matchingTargetsFound === 0) {
groupElement.classList.add("hidden");
groupElement.classList.remove("flex");
} else {
groupElement.classList.remove("hidden");
groupElement.classList.add("flex");
}
}
};
for (const groupElement of convertToGroupElements) {
const groupName = groupElement.dataset.converter;
const targetElements = groupElement.querySelectorAll(".target");
const targets = Array.from(targetElements);
for (const target of targets) {
target.onmousedown = () => {
convertToElement.value = target.dataset.value;
convertToInput.value = `${target.dataset.target} using ${target.dataset.converter}`;
formatSelected = true;
if (pendingFiles === 0 && fileNames.length > 0) {
convertButton.disabled = false;
}
showMatching("");
};
}
convertToGroups[groupName] = [targets, groupElement];
}
convertToInput.addEventListener("input", (e) => {
showMatching(e.target.value.toLowerCase());
});
convertToInput.addEventListener("search", () => {
// when the user clears the search bar using the 'x' button
convertButton.disabled = true;
formatSelected = false;
});
convertToInput.addEventListener("blur", (e) => {
// Keep the popup open even when clicking on a target button
// for a split second to allow the click to go through
if (e?.relatedTarget?.classList?.contains("target")) {
convertToPopup.classList.add("hidden");
convertToPopup.classList.remove("flex");
return;
}
convertToPopup.classList.add("hidden");
convertToPopup.classList.remove("flex");
});
convertToInput.addEventListener("focus", () => {
convertToPopup.classList.remove("hidden");
convertToPopup.classList.add("flex");
});
};
// Add a 'change' event listener to the file input element
fileInput.addEventListener("change", (e) => {
const files = e.target.files;
for (const file of files) {
handleFile(file);
}
});
const setTitle = () => {
const title = document.querySelector("h1");
title.textContent = `Convert ${fileType ? `.${fileType}` : ""}`;
};
// Add a onclick for the delete button
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const deleteRow = (target) => {
const filename = target.parentElement.parentElement.children[0].textContent;
const row = target.parentElement.parentElement;
row.remove();
// remove from fileNames
const index = fileNames.indexOf(filename);
fileNames.splice(index, 1);
// reset fileInput
fileInput.value = "";
// if fileNames is empty, reset fileType
if (fileNames.length === 0) {
fileType = null;
fileInput.removeAttribute("accept");
convertButton.disabled = true;
setTitle();
}
fetch(`${webroot}/delete`, {
method: "POST",
body: JSON.stringify({ filename: filename }),
headers: {
"Content-Type": "application/json",
},
})
.catch((err) => console.log(err));
};
const uploadFile = (file) => {
convertButton.disabled = true;
convertButton.textContent = "Uploading...";
pendingFiles += 1;
const formData = new FormData();
formData.append("file", file, file.name);
let xhr = new XMLHttpRequest();
xhr.open("POST", `${webroot}/upload`, true);
xhr.onload = () => {
let data = JSON.parse(xhr.responseText);
pendingFiles -= 1;
if (pendingFiles === 0) {
if (formatSelected) {
convertButton.disabled = false;
}
convertButton.textContent = "Convert";
}
//Remove the progress bar when upload is done
let progressbar = file.htmlRow.getElementsByTagName("progress");
progressbar[0].parentElement.remove();
console.log(data);
};
xhr.upload.onprogress = (e) => {
let sent = e.loaded;
let total = e.total;
console.log(`upload progress (${file.name}):`, (100 * sent) / total);
let progressbar = file.htmlRow.getElementsByTagName("progress");
progressbar[0].value = ((100 * sent) / total);
};
xhr.onerror = (e) => {
console.log(e);
};
xhr.send(formData);
};
const formConvert = document.querySelector(`form[action='${webroot}/convert']`);
formConvert.addEventListener("submit", () => {
const hiddenInput = document.querySelector("input[name='file_names']");
hiddenInput.value = JSON.stringify(fileNames);
});
updateSearchBar();

View File

@@ -1,40 +1,40 @@
import { Html } from "@elysiajs/html";
export const BaseHtml = ({
children,
title = "ConvertX",
webroot = "",
}: {
children: JSX.Element;
title?: string;
webroot?: string;
}) => (
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="webroot" content={webroot} />
<title safe>{title}</title>
<link rel="stylesheet" href={`${webroot}/generated.css`} />
<link
rel="apple-touch-icon"
sizes="180x180"
href={`${webroot}/apple-touch-icon.png`}
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href={`${webroot}/favicon-32x32.png`}
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href={`${webroot}/favicon-16x16.png`}
/>
<link rel="manifest" href={`${webroot}/site.webmanifest`} />
</head>
<body class="w-full bg-neutral-900 text-neutral-200">{children}</body>
</html>
);
import { Html } from "@elysiajs/html";
export const BaseHtml = ({
children,
title = "ConvertX",
webroot = "",
}: {
children: JSX.Element;
title?: string;
webroot?: string;
}) => (
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="webroot" content={webroot} />
<title safe>{title}</title>
<link rel="stylesheet" href={`${webroot}/generated.css`} />
<link
rel="apple-touch-icon"
sizes="180x180"
href={`${webroot}/apple-touch-icon.png`}
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href={`${webroot}/favicon-32x32.png`}
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href={`${webroot}/favicon-16x16.png`}
/>
<link rel="manifest" href={`${webroot}/site.webmanifest`} />
</head>
<body class="w-full bg-neutral-900 text-neutral-200">{children}</body>
</html>
);

View File

@@ -4,28 +4,32 @@ export const Header = ({
loggedIn,
accountRegistration,
allowUnauthenticated,
hideHistory,
webroot = "",
}: {
loggedIn?: boolean;
accountRegistration?: boolean;
allowUnauthenticated?: boolean;
hideHistory?: boolean;
webroot?: string;
}) => {
let rightNav: JSX.Element;
if (loggedIn) {
rightNav = (
<ul class="flex gap-4">
<li>
<a
class={`
text-accent-600 transition-all
hover:text-accent-500 hover:underline
`}
href={`${webroot}/history`}
>
History
</a>
</li>
{!hideHistory && (
<li>
<a
class={`
text-accent-600 transition-all
hover:text-accent-500 hover:underline
`}
href={`${webroot}/history`}
>
History
</a>
</li>
)}
{!allowUnauthenticated ? (
<li>
<a
@@ -74,7 +78,7 @@ export const Header = ({
return (
<header class="w-full p-4">
<nav class="mx-auto flex max-w-4xl justify-between rounded bg-neutral-900 p-4">
<nav class="mx-auto flex max-w-4xl justify-between rounded-sm bg-neutral-900 p-4">
<ul>
<li>
<strong>

View File

@@ -1,4 +1,4 @@
import { exec } from "node:child_process";
import { execFile } from "node:child_process";
export const properties = {
from: {
@@ -119,10 +119,8 @@ export async function convert(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
const command = `assimp export "${filePath}" "${targetPath}"`;
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
execFile("assimp", ["export", filePath, targetPath], (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}

View File

@@ -1,4 +1,4 @@
import { exec } from "node:child_process";
import { execFile } from "node:child_process";
export const properties = {
from: {
@@ -64,10 +64,8 @@ export async function convert(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
const command = `ebook-convert "${filePath}" "${targetPath}"`;
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
execFile("ebook-convert", [filePath, targetPath], (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}

View File

@@ -1,4 +1,4 @@
import { exec } from "node:child_process";
import { execFile } from "node:child_process";
// This could be done dynamically by running `ffmpeg -formats` and parsing the output
export const properties = {
@@ -691,19 +691,28 @@ export async function convert(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
let extra = "";
let extraArgs: string[] = [];
let message = "Done";
if (convertTo === "ico") {
// make sure image is 256x256 or smaller
extra = `-filter:v "scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease"`;
extraArgs = ['-filter:v', "scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease"];
message = "Done: resized to 256x256";
}
const command = `ffmpeg ${process.env.FFMPEG_ARGS} -i "${filePath}" ${extra} "${targetPath}"`;
// Parse FFMPEG_ARGS environment variable into array
const ffmpegArgs = process.env.FFMPEG_ARGS ? process.env.FFMPEG_ARGS.split(/\s+/) : [];
// Build arguments array
const args = [
...ffmpegArgs,
"-i", filePath,
...extraArgs,
targetPath
];
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
execFile("ffmpeg", args, (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}

View File

@@ -1,339 +1,340 @@
import { exec } from "node:child_process";
export const properties = {
from: {
image: [
"3fr",
"8bim",
"8bimtext",
"8bimwtext",
"app1",
"app1jpeg",
"art",
"arw",
"avs",
"b",
"bie",
"bigtiff",
"bmp",
"c",
"cals",
"caption",
"cin",
"cmyk",
"cmyka",
"cr2",
"crw",
"cur",
"cut",
"dcm",
"dcr",
"dcx",
"dng",
"dpx",
"epdf",
"epi",
"eps",
"epsf",
"epsi",
"ept",
"ept2",
"ept3",
"erf",
"exif",
"fax",
"file",
"fits",
"fractal",
"ftp",
"g",
"gif",
"gif87",
"gradient",
"gray",
"graya",
"heic",
"heif",
"hrz",
"http",
"icb",
"icc",
"icm",
"ico",
"icon",
"identity",
"image",
"iptc",
"iptctext",
"iptcwtext",
"jbg",
"jbig",
"jng",
"jnx",
"jpeg",
"jpg",
"k",
"k25",
"kdc",
"label",
"m",
"mac",
"map",
"mat",
"mef",
"miff",
"mng",
"mono",
"mpc",
"mrw",
"msl",
"mtv",
"mvg",
"nef",
"null",
"o",
"orf",
"otb",
"p7",
"pal",
"palm",
"pam",
"pbm",
"pcd",
"pcds",
"pct",
"pcx",
"pdb",
"pdf",
"pef",
"pfa",
"pfb",
"pgm",
"picon",
"pict",
"pix",
"plasma",
"png",
"png00",
"png24",
"png32",
"png48",
"png64",
"png8",
"pnm",
"ppm",
"ps",
"ptif",
"pwp",
"r",
"raf",
"ras",
"rgb",
"rgba",
"rla",
"rle",
"sct",
"sfw",
"sgi",
"sr2",
"srf",
"stegano",
"sun",
"svg",
"svgz",
"text",
"tga",
"tif",
"tiff",
"tile",
"tim",
"topol",
"ttf",
"txt",
"uyvy",
"vda",
"vicar",
"vid",
"viff",
"vst",
"wbmp",
"webp",
"wmf",
"wpg",
"x3f",
"xbm",
"xc",
"xcf",
"xmp",
"xpm",
"xv",
"xwd",
"y",
"yuv",
],
},
to: {
image: [
"8bim",
"8bimtext",
"8bimwtext",
"app1",
"app1jpeg",
"art",
"avs",
"b",
"bie",
"bigtiff",
"bmp",
"bmp2",
"bmp3",
"brf",
"c",
"cals",
"cin",
"cmyk",
"cmyka",
"dcx",
"dpx",
"epdf",
"epi",
"eps",
"eps2",
"eps3",
"epsf",
"epsi",
"ept",
"ept2",
"ept3",
"exif",
"fax",
"fits",
"g",
"gif",
"gif87",
"gray",
"graya",
"histogram",
"html",
"icb",
"icc",
"icm",
"info",
"iptc",
"iptctext",
"iptcwtext",
"isobrl",
"isobrl6",
"jbg",
"jbig",
"jng",
"jpeg",
"k",
"m",
"m2v",
"map",
"mat",
"matte",
"miff",
"mng",
"mono",
"mpc",
"mpeg",
"mpg",
"msl",
"mtv",
"mvg",
"null",
"o",
"otb",
"p7",
"pal",
"pam",
"pbm",
"pcd",
"pcds",
"pcl",
"pct",
"pcx",
"pdb",
"pdf",
"pgm",
"picon",
"pict",
"png",
"png00",
"png24",
"png32",
"png48",
"png64",
"png8",
"pnm",
"ppm",
"preview",
"ps",
"ps2",
"ps3",
"ptif",
"r",
"ras",
"rgb",
"rgba",
"sgi",
"shtml",
"sun",
"text",
"tga",
"tiff",
"txt",
"ubrl",
"ubrl6",
"uil",
"uyvy",
"vda",
"vicar",
"vid",
"viff",
"vst",
"wbmp",
"webp",
"x",
"xbm",
"xmp",
"xpm",
"xv",
"xwd",
"y",
"yuv",
],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
exec(
`gm convert "${filePath}" "${targetPath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}
import { execFile } from "node:child_process";
export const properties = {
from: {
image: [
"3fr",
"8bim",
"8bimtext",
"8bimwtext",
"app1",
"app1jpeg",
"art",
"arw",
"avs",
"b",
"bie",
"bigtiff",
"bmp",
"c",
"cals",
"caption",
"cin",
"cmyk",
"cmyka",
"cr2",
"crw",
"cur",
"cut",
"dcm",
"dcr",
"dcx",
"dng",
"dpx",
"epdf",
"epi",
"eps",
"epsf",
"epsi",
"ept",
"ept2",
"ept3",
"erf",
"exif",
"fax",
"file",
"fits",
"fractal",
"ftp",
"g",
"gif",
"gif87",
"gradient",
"gray",
"graya",
"heic",
"heif",
"hrz",
"http",
"icb",
"icc",
"icm",
"ico",
"icon",
"identity",
"image",
"iptc",
"iptctext",
"iptcwtext",
"jbg",
"jbig",
"jng",
"jnx",
"jpeg",
"jpg",
"k",
"k25",
"kdc",
"label",
"m",
"mac",
"map",
"mat",
"mef",
"miff",
"mng",
"mono",
"mpc",
"mrw",
"msl",
"mtv",
"mvg",
"nef",
"null",
"o",
"orf",
"otb",
"p7",
"pal",
"palm",
"pam",
"pbm",
"pcd",
"pcds",
"pct",
"pcx",
"pdb",
"pdf",
"pef",
"pfa",
"pfb",
"pgm",
"picon",
"pict",
"pix",
"plasma",
"png",
"png00",
"png24",
"png32",
"png48",
"png64",
"png8",
"pnm",
"ppm",
"ps",
"ptif",
"pwp",
"r",
"raf",
"ras",
"rgb",
"rgba",
"rla",
"rle",
"sct",
"sfw",
"sgi",
"sr2",
"srf",
"stegano",
"sun",
"svg",
"svgz",
"text",
"tga",
"tif",
"tiff",
"tile",
"tim",
"topol",
"ttf",
"txt",
"uyvy",
"vda",
"vicar",
"vid",
"viff",
"vst",
"wbmp",
"webp",
"wmf",
"wpg",
"x3f",
"xbm",
"xc",
"xcf",
"xmp",
"xpm",
"xv",
"xwd",
"y",
"yuv",
],
},
to: {
image: [
"8bim",
"8bimtext",
"8bimwtext",
"app1",
"app1jpeg",
"art",
"avs",
"b",
"bie",
"bigtiff",
"bmp",
"bmp2",
"bmp3",
"brf",
"c",
"cals",
"cin",
"cmyk",
"cmyka",
"dcx",
"dpx",
"epdf",
"epi",
"eps",
"eps2",
"eps3",
"epsf",
"epsi",
"ept",
"ept2",
"ept3",
"exif",
"fax",
"fits",
"g",
"gif",
"gif87",
"gray",
"graya",
"histogram",
"html",
"icb",
"icc",
"icm",
"info",
"iptc",
"iptctext",
"iptcwtext",
"isobrl",
"isobrl6",
"jbg",
"jbig",
"jng",
"jpeg",
"k",
"m",
"m2v",
"map",
"mat",
"matte",
"miff",
"mng",
"mono",
"mpc",
"mpeg",
"mpg",
"msl",
"mtv",
"mvg",
"null",
"o",
"otb",
"p7",
"pal",
"pam",
"pbm",
"pcd",
"pcds",
"pcl",
"pct",
"pcx",
"pdb",
"pdf",
"pgm",
"picon",
"pict",
"png",
"png00",
"png24",
"png32",
"png48",
"png64",
"png8",
"pnm",
"ppm",
"preview",
"ps",
"ps2",
"ps3",
"ptif",
"r",
"ras",
"rgb",
"rgba",
"sgi",
"shtml",
"sun",
"text",
"tga",
"tiff",
"txt",
"ubrl",
"ubrl6",
"uil",
"uyvy",
"vda",
"vicar",
"vid",
"viff",
"vst",
"wbmp",
"webp",
"x",
"xbm",
"xmp",
"xpm",
"xv",
"xwd",
"y",
"yuv",
],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
execFile(
"gm",
["convert", filePath, targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}

View File

@@ -1,64 +1,59 @@
import { exec } from "node:child_process";
import { execFile } from "node:child_process";
export const properties = {
from: {
images: [
"svg",
"pdf",
"eps",
"ps",
"wmf",
"emf",
"png"
]
},
to: {
images: [
"dxf",
"emf",
"eps",
"fxg",
"gpl",
"hpgl",
"html",
"odg",
"pdf",
"png",
"pov",
"ps",
"sif",
"svg",
"svgz",
"tex",
"wmf",
]
},
};
from: {
images: ["svg", "pdf", "eps", "ps", "wmf", "emf", "png"],
},
to: {
images: [
"dxf",
"emf",
"eps",
"fxg",
"gpl",
"hpgl",
"html",
"odg",
"pdf",
"png",
"pov",
"ps",
"sif",
"svg",
"svgz",
"tex",
"wmf",
],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
exec(`inkscape "${filePath}" -o "${targetPath}"`, (error, stdout, stderr) => {
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
execFile(
"inkscape",
[filePath, "-o", targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}
},
);
});
}

53
src/converters/libheif.ts Normal file
View File

@@ -0,0 +1,53 @@
import { execFile } from "child_process";
export const properties = {
from: {
images: [
"avci",
"avcs",
"avif",
"h264",
"heic",
"heics",
"heif",
"heifs",
"hif",
"mkv",
"mp4",
],
},
to: {
images: ["jpeg", "png", "y4m"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
execFile(
"heif-convert",
[filePath, targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}

View File

@@ -1,71 +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,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): 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("Done");
});
});
}
import { execFile } 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,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
let tool = "";
if (fileType === "jxl") {
tool = "djxl";
}
if (convertTo === "jxl") {
tool = "cjxl";
}
return new Promise((resolve, reject) => {
execFile(tool, [filePath, targetPath], (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}

View File

@@ -8,7 +8,9 @@ import { convert as convertPandoc, properties as propertiesPandoc } from "./pand
import { convert as convertresvg, properties as propertiesresvg } from "./resvg";
import { convert as convertImage, properties as propertiesImage } from "./vips";
import { convert as convertxelatex, properties as propertiesxelatex } from "./xelatex";
import { convert as convertCalibre, properties as propertiesCalibre } from "./calibre";
// import { convert as convertCalibre, properties as propertiesCalibre } from "./calibre";
import { convert as convertLibheif, properties as propertiesLibheif } from "./libheif";
import { convert as convertpotrace, properties as propertiespotrace } from "./potrace";
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
@@ -53,14 +55,18 @@ const properties: Record<
properties: propertiesImage,
converter: convertImage,
},
libheif: {
properties: propertiesLibheif,
converter: convertLibheif,
},
xelatex: {
properties: propertiesxelatex,
converter: convertxelatex,
},
calibre: {
properties: propertiesCalibre,
converter: convertCalibre,
},
// calibre: {
// properties: propertiesCalibre,
// converter: convertCalibre,
// },
pandoc: {
properties: propertiesPandoc,
converter: convertPandoc,
@@ -81,6 +87,10 @@ const properties: Record<
properties: propertiesFFmpeg,
converter: convertFFmpeg,
},
potrace: {
properties: propertiespotrace,
converter: convertpotrace,
},
};
export async function mainConverter(

View File

@@ -1,156 +1,162 @@
import { exec } from "node:child_process";
export const properties = {
from: {
text: [
"textile",
"tikiwiki",
"tsv",
"twiki",
"typst",
"vimwiki",
"biblatex",
"bibtex",
"bits",
"commonmark",
"commonmark_x",
"creole",
"csljson",
"csv",
"djot",
"docbook",
"docx",
"dokuwiki",
"endnotexml",
"epub",
"fb2",
"gfm",
"haddock",
"html",
"ipynb",
"jats",
"jira",
"json",
"latex",
"man",
"markdown",
"markdown_mmd",
"markdown_phpextra",
"markdown_strict",
"mediawiki",
"muse",
"pandoc native",
"opml",
"org",
"ris",
"rst",
"rtf",
"t2t",
],
},
to: {
text: [
"tei",
"texinfo",
"textile",
"typst",
"xwiki",
"zimwiki",
"asciidoc",
"asciidoc_legacy",
"asciidoctor",
"beamer",
"biblatex",
"bibtex",
"chunkedhtml",
"commonmark",
"commonmark_x",
"context",
"csljson",
"djot",
"docbook",
"docbook4",
"docbook5",
"docx",
"dokuwiki",
"dzslides",
"epub",
"epub2",
"epub3",
"fb2",
"gfm",
"haddock",
"html",
"html4",
"html5",
"icml",
"ipynb",
"jats",
"jats_archiving",
"jats_articleauthoring",
"jats_publishing",
"jira",
"json",
"latex",
"man",
"markdown",
"markdown_mmd",
"markdown_phpextra",
"markdown_strict",
"markua",
"mediawiki",
"ms",
"muse",
"pandoc native",
"odt",
"opendocument",
"opml",
"org",
"pdf",
"plain",
"pptx",
"revealjs",
"rst",
"rtf",
"s5",
"slideous",
"slidy",
],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): 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 ${option} "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}
import { execFile } from "node:child_process";
export const properties = {
from: {
text: [
"textile",
"tikiwiki",
"tsv",
"twiki",
"typst",
"vimwiki",
"biblatex",
"bibtex",
"bits",
"commonmark",
"commonmark_x",
"creole",
"csljson",
"csv",
"djot",
"docbook",
"docx",
"dokuwiki",
"endnotexml",
"epub",
"fb2",
"gfm",
"haddock",
"html",
"ipynb",
"jats",
"jira",
"json",
"latex",
"man",
"markdown",
"markdown_mmd",
"markdown_phpextra",
"markdown_strict",
"mediawiki",
"muse",
"pandoc native",
"opml",
"org",
"ris",
"rst",
"rtf",
"t2t",
],
},
to: {
text: [
"tei",
"texinfo",
"textile",
"typst",
"xwiki",
"zimwiki",
"asciidoc",
"asciidoc_legacy",
"asciidoctor",
"beamer",
"biblatex",
"bibtex",
"chunkedhtml",
"commonmark",
"commonmark_x",
"context",
"csljson",
"djot",
"docbook",
"docbook4",
"docbook5",
"docx",
"dokuwiki",
"dzslides",
"epub",
"epub2",
"epub3",
"fb2",
"gfm",
"haddock",
"html",
"html4",
"html5",
"icml",
"ipynb",
"jats",
"jats_archiving",
"jats_articleauthoring",
"jats_publishing",
"jira",
"json",
"latex",
"man",
"markdown",
"markdown_mmd",
"markdown_phpextra",
"markdown_strict",
"markua",
"mediawiki",
"ms",
"muse",
"pandoc native",
"odt",
"opendocument",
"opml",
"org",
"pdf",
"plain",
"pptx",
"revealjs",
"rst",
"rtf",
"s5",
"slideous",
"slidy",
],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
// set xelatex here
const xelatex = ["pdf", "latex"];
// Build arguments array
const args: string[] = [];
if (xelatex.includes(convertTo)) {
args.push("--pdf-engine=xelatex");
}
args.push(filePath);
args.push("-f", fileType);
args.push("-t", convertTo);
args.push("-o", targetPath);
return new Promise((resolve, reject) => {
execFile("pandoc", args, (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}

37
src/converters/potrace.ts Normal file
View File

@@ -0,0 +1,37 @@
import { execFile } from "node:child_process";
export const properties = {
from: {
images: ["pnm", "pbm", "pgm", "bmp"],
},
to: {
images: ["svg", "pdf", "pdfpage", "eps", "postscript", "ps", "dxf", "geojson", "pgm", "gimppath", "xfig"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
execFile("potrace", [filePath, "-o", targetPath, "-b", convertTo], (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}

View File

@@ -1,37 +1,37 @@
import { exec } from "node:child_process";
export const properties = {
from: {
images: ["svg"],
},
to: {
images: ["png"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
exec(`resvg "${filePath}" "${targetPath}"`, (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}
import { execFile } from "node:child_process";
export const properties = {
from: {
images: ["svg"],
},
to: {
images: ["png"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
execFile("resvg", [filePath, targetPath], (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
});
}

View File

@@ -1,142 +1,142 @@
import { exec } from "node:child_process";
// declare possible conversions
export const properties = {
from: {
images: [
"avif",
"bif",
"csv",
"exr",
"fits",
"gif",
"hdr.gz",
"hdr",
"heic",
"heif",
"img.gz",
"img",
"j2c",
"j2k",
"jp2",
"jpeg",
"jpx",
"jxl",
"mat",
"mrxs",
"ndpi",
"nia.gz",
"nia",
"nii.gz",
"nii",
"pdf",
"pfm",
"pgm",
"pic",
"png",
"ppm",
"raw",
"scn",
"svg",
"svs",
"svslide",
"szi",
"tif",
"tiff",
"v",
"vips",
"vms",
"vmu",
"webp",
"zip",
],
},
to: {
images: [
"avif",
"dzi",
"fits",
"gif",
"hdr.gz",
"heic",
"heif",
"img.gz",
"j2c",
"j2k",
"jp2",
"jpeg",
"jpx",
"jxl",
"mat",
"nia.gz",
"nia",
"nii.gz",
"nii",
"png",
"tiff",
"vips",
"webp",
],
},
options: {
svg: {
scale: {
description: "Scale the image up or down",
type: "number",
default: 1,
},
},
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
// if (fileType === "svg") {
// const scale = options.scale || 1;
// const metadata = await sharp(filePath).metadata();
// if (!metadata || !metadata.width || !metadata.height) {
// throw new Error("Could not get metadata from image");
// }
// const newWidth = Math.round(metadata.width * scale);
// const newHeight = Math.round(metadata.height * scale);
// return await sharp(filePath)
// .resize(newWidth, newHeight)
// .toFormat(convertTo)
// .toFile(targetPath);
// }
let action = "copy";
if (fileType === "pdf") {
action = "pdfload";
}
return new Promise((resolve, reject) => {
exec(
`vips ${action} "${filePath}" "${targetPath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}
import { execFile } from "node:child_process";
// declare possible conversions
export const properties = {
from: {
images: [
"avif",
"bif",
"csv",
"exr",
"fits",
"gif",
"hdr.gz",
"hdr",
"heic",
"heif",
"img.gz",
"img",
"j2c",
"j2k",
"jp2",
"jpeg",
"jpx",
"jxl",
"mat",
"mrxs",
"ndpi",
"nia.gz",
"nia",
"nii.gz",
"nii",
"pdf",
"pfm",
"pgm",
"pic",
"png",
"ppm",
"raw",
"scn",
"svg",
"svs",
"svslide",
"szi",
"tif",
"tiff",
"v",
"vips",
"vms",
"vmu",
"webp",
"zip",
],
},
to: {
images: [
"avif",
"dzi",
"fits",
"gif",
"hdr.gz",
"heic",
"heif",
"img.gz",
"j2c",
"j2k",
"jp2",
"jpeg",
"jpx",
"jxl",
"mat",
"nia.gz",
"nia",
"nii.gz",
"nii",
"png",
"tiff",
"vips",
"webp",
],
},
options: {
svg: {
scale: {
description: "Scale the image up or down",
type: "number",
default: 1,
},
},
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
// if (fileType === "svg") {
// const scale = options.scale || 1;
// const metadata = await sharp(filePath).metadata();
// if (!metadata || !metadata.width || !metadata.height) {
// throw new Error("Could not get metadata from image");
// }
// const newWidth = Math.round(metadata.width * scale);
// const newHeight = Math.round(metadata.height * scale);
// return await sharp(filePath)
// .resize(newWidth, newHeight)
// .toFormat(convertTo)
// .toFile(targetPath);
// }
let action = "copy";
if (fileType === "pdf") {
action = "pdfload";
}
return new Promise((resolve, reject) => {
execFile(
"vips",
[action, filePath, targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}

View File

@@ -1,46 +1,53 @@
import { exec } from "node:child_process";
export const properties = {
from: {
text: ["tex", "latex"],
},
to: {
text: ["pdf"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): 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("./", "");
exec(
`latexmk -xelatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}
import { execFile } from "node:child_process";
export const properties = {
from: {
text: ["tex", "latex"],
},
to: {
text: ["pdf"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): 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("./", "");
execFile(
"latexmk",
[
"-xelatex",
"-interaction=nonstopmode",
`-output-directory=${outputPath}`,
filePath,
],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
},
);
});
}

View File

@@ -1,5 +1,6 @@
import { exec } from "node:child_process";
import { version } from "../../package.json";
console.log(`ConvertX v${version}`);
if (process.env.NODE_ENV === "production") {
@@ -99,7 +100,7 @@ if (process.env.NODE_ENV === "production") {
}
if (stdout) {
console.log(`assimp v${stdout.split("\n")[5]}`);
console.log(`assimp ${stdout.split("\n")[5]}`);
}
});
@@ -113,6 +114,26 @@ if (process.env.NODE_ENV === "production") {
}
});
exec("heif-info -v", (error, stdout) => {
if (error) {
console.error("libheif is not installed");
}
if (stdout) {
console.log(`libheif v${stdout.split("\n")[0]}`);
}
});
exec("potrace -v", (error, stdout) => {
if (error) {
console.error("potrace is not installed");
}
if (stdout) {
console.log(stdout.split("\n")[0]);
}
});
exec("bun -v", (error, stdout) => {
if (error) {
console.error("Bun is not installed. wait what");

View File

@@ -1,13 +1,11 @@
import tw from "tailwindcss";
import tailwind from "@tailwindcss/postcss";
import postcss from "postcss";
export const generateTailwind = async () => {
const result = await Bun.file("./src/main.css")
.text()
.then((sourceText) => {
const config = "./tailwind.config.js";
return postcss([tw(config)]).process(sourceText, {
return postcss([tailwind]).process(sourceText, {
from: "./src/main.css",
to: "./public/generated.css",
});

View File

@@ -1,12 +1,12 @@
import { randomInt, randomUUID } from "node:crypto";
import { rmSync } from "node:fs";
import { mkdir, unlink } from "node:fs/promises";
import cookie from "@elysiajs/cookie";
import { html, Html } from "@elysiajs/html";
import { jwt, type JWTPayloadSpec } from "@elysiajs/jwt";
import { staticPlugin } from "@elysiajs/static";
import { Database } from "bun:sqlite";
import { Elysia, t } from "elysia";
import sanitize from "sanitize-filename";
import { BaseHtml } from "./components/base";
import { Header } from "./components/header";
import {
@@ -36,6 +36,8 @@ const ALLOW_UNAUTHENTICATED =
const AUTO_DELETE_EVERY_N_HOURS = process.env.AUTO_DELETE_EVERY_N_HOURS
? Number(process.env.AUTO_DELETE_EVERY_N_HOURS)
: 24;
const HIDE_HISTORY =
process.env.HIDE_HISTORY?.toLowerCase() === "true" || false;
const WEBROOT = process.env.WEBROOT ?? "";
@@ -116,7 +118,6 @@ const app = new Elysia({
},
prefix: WEBROOT,
})
.use(cookie())
.use(html())
.use(
jwt({
@@ -153,7 +154,12 @@ const app = new Elysia({
return (
<BaseHtml title="ConvertX | Setup" webroot={WEBROOT}>
<main class="mx-auto w-full max-w-4xl px-4">
<main
class={`
mx-auto w-full max-w-4xl px-2
sm:px-4
`}
>
<h1 class="my-8 text-3xl">Welcome to ConvertX!</h1>
<article class="article p-0">
<header class="w-full bg-neutral-800 p-4">
@@ -166,7 +172,7 @@ const app = new Elysia({
<input
type="email"
name="email"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Email"
autocomplete="email"
required
@@ -177,7 +183,7 @@ const app = new Elysia({
<input
type="password"
name="password"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Password"
autocomplete="current-password"
required
@@ -217,7 +223,12 @@ const app = new Elysia({
accountRegistration={ACCOUNT_REGISTRATION}
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<form method="post" class="flex flex-col gap-4">
<fieldset class="mb-4 flex flex-col gap-4">
@@ -226,7 +237,7 @@ const app = new Elysia({
<input
type="email"
name="email"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Email"
autocomplete="email"
required
@@ -237,7 +248,7 @@ const app = new Elysia({
<input
type="password"
name="password"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Password"
autocomplete="current-password"
required
@@ -342,8 +353,14 @@ const app = new Elysia({
webroot={WEBROOT}
accountRegistration={ACCOUNT_REGISTRATION}
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
hideHistory={HIDE_HISTORY}
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<form method="post" class="flex flex-col gap-4">
<fieldset class="mb-4 flex flex-col gap-4">
@@ -352,7 +369,7 @@ const app = new Elysia({
<input
type="email"
name="email"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Email"
autocomplete="email"
required
@@ -363,7 +380,7 @@ const app = new Elysia({
<input
type="password"
name="password"
class="rounded bg-neutral-800 p-3"
class="rounded-sm bg-neutral-800 p-3"
placeholder="Password"
autocomplete="current-password"
required
@@ -556,16 +573,21 @@ const app = new Elysia({
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
loggedIn
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<h1 class="mb-4 text-xl">Convert</h1>
<div class="mb-4 max-h-[50vh] overflow-y-auto scrollbar-thin">
<div class="scrollbar-thin mb-4 max-h-[50vh] overflow-y-auto">
<table
id="file-list"
class={`
w-full table-auto rounded bg-neutral-900
[&_td]:p-4
[&_tr]:rounded [&_tr]:border-b [&_tr]:border-neutral-800
[&_td]:p-4 [&_td]:first:max-w-[30vw] [&_td]:first:truncate
[&_tr]:rounded-sm [&_tr]:border-b [&_tr]:border-neutral-800
`}
/>
</div>
@@ -574,8 +596,8 @@ const app = new Elysia({
class={`
relative flex h-48 w-full items-center justify-center rounded border border-dashed
border-neutral-700 transition-all
[&.dragover]:border-4 [&.dragover]:border-neutral-500
hover:border-neutral-600
[&.dragover]:border-4 [&.dragover]:border-neutral-500
`}
>
<span>
@@ -601,13 +623,13 @@ const app = new Elysia({
name="convert_to_search"
placeholder="Search for conversions"
autocomplete="off"
class="w-full rounded bg-neutral-800 p-4"
class="w-full rounded-sm bg-neutral-800 p-4"
/>
<div class="select_container relative">
<article
class={`
convert_to_popup absolute z-[2] m-0 hidden h-[30vh] max-h-[50vh] w-full
flex-col overflow-y-auto overflow-x-hidden rounded bg-neutral-800
convert_to_popup absolute z-2 m-0 hidden h-[30vh] max-h-[50vh] w-full flex-col
overflow-x-hidden overflow-y-auto rounded bg-neutral-800
sm:h-[30vh]
`}
>
@@ -672,7 +694,7 @@ const app = new Elysia({
</article>
<input
class={`
btn-primary w-full
btn-primary w-full opacity-100
disabled:cursor-not-allowed disabled:opacity-50
`}
type="submit"
@@ -693,8 +715,8 @@ const app = new Elysia({
<>
<article
class={`
convert_to_popup absolute z-[2] m-0 hidden h-[50vh] max-h-[50vh] w-full flex-col
overflow-y-auto overflow-x-hidden rounded bg-neutral-800
convert_to_popup absolute z-2 m-0 hidden h-[50vh] max-h-[50vh] w-full flex-col
overflow-x-hidden overflow-y-auto rounded bg-neutral-800
sm:h-[30vh]
`}
>
@@ -866,6 +888,10 @@ const app = new Elysia({
const converterName = body.convert_to.split(",")[1];
const fileNames = JSON.parse(body.file_names) as string[];
for (let i = 0; i < fileNames.length; i++) {
fileNames[i] = sanitize(fileNames[i] || "");
}
if (!Array.isArray(fileNames) || fileNames.length === 0) {
return redirect(`${WEBROOT}/`, 302);
}
@@ -930,6 +956,10 @@ const app = new Elysia({
},
)
.get("/history", async ({ jwt, redirect, cookie: { auth } }) => {
if (HIDE_HISTORY) {
return redirect(`${WEBROOT}/`, 302);
}
if (!auth?.value) {
return redirect(`${WEBROOT}/login`, 302);
}
@@ -942,7 +972,8 @@ const app = new Elysia({
let userJobs = db
.query("SELECT * FROM jobs WHERE user_id = ?")
.as(Jobs)
.all(user.id);
.all(user.id)
.reverse();
for (const job of userJobs) {
const files = db
@@ -962,33 +993,77 @@ const app = new Elysia({
<Header
webroot={WEBROOT}
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
hideHistory={HIDE_HISTORY}
loggedIn
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<h1 class="mb-4 text-xl">Results</h1>
<table
class={`
w-full table-auto rounded bg-neutral-900 text-left
w-full table-auto overflow-y-auto rounded bg-neutral-900 text-left
[&_td]:p-4
[&_tr]:rounded [&_tr]:border-b [&_tr]:border-neutral-800
[&_tr]:rounded-sm [&_tr]:border-b [&_tr]:border-neutral-800
`}
>
<thead>
<tr>
<th class="px-4 py-2">Time</th>
<th class="px-4 py-2">Files</th>
<th class="px-4 py-2">Files Done</th>
<th class="px-4 py-2">Status</th>
<th class="px-4 py-2">View</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Time
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Files
</th>
<th
class={`
px-2 py-2
max-sm:hidden
sm:px-4
`}
>
Files Done
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Status
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
View
</th>
</tr>
</thead>
<tbody>
{userJobs.map((job) => (
<tr>
<td safe>{job.date_created}</td>
<td safe>
{new Date(job.date_created).toLocaleTimeString()}
</td>
<td>{job.num_files}</td>
<td>{job.finished_files}</td>
<td class="max-sm:hidden">{job.finished_files}</td>
<td safe>{job.status}</td>
<td>
<a
@@ -1055,7 +1130,12 @@ const app = new Elysia({
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
loggedIn
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<div class="mb-4 flex items-center justify-between">
<h1 class="text-xl">Results</h1>
@@ -1078,33 +1158,63 @@ const app = new Elysia({
max={job.num_files}
value={files.length}
class={`
mb-4 inline-block h-2 w-full appearance-none overflow-hidden rounded-full
border-0 bg-neutral-700 bg-none text-accent-500 accent-accent-500
[&::-moz-progress-bar]:bg-neutral-700 [&::-webkit-progress-value]:rounded-full
[&::-webkit-progress-value]:[background:none]
text-accent-500 accent-accent-500 mb-4 inline-block h-2 w-full appearance-none
overflow-hidden rounded-full border-0 bg-neutral-700 bg-none
[&[value]::-webkit-progress-value]:bg-accent-500
[&[value]::-webkit-progress-value]:transition-[inline-size]
[&::-moz-progress-bar]:bg-neutral-700 [&::-webkit-progress-value]:rounded-full
[&::-webkit-progress-value]:[background:none]
`}
/>
<table
class={`
w-full table-auto rounded bg-neutral-900 text-left
[&_td]:p-4
[&_tr]:rounded [&_tr]:border-b [&_tr]:border-neutral-800
[&_tr]:rounded-sm [&_tr]:border-b [&_tr]:border-neutral-800
`}
>
<thead>
<tr>
<th class="px-4 py-2">Converted File Name</th>
<th class="px-4 py-2">Status</th>
<th class="px-4 py-2">View</th>
<th class="px-4 py-2">Download</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Converted File Name
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Status
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
View
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Download
</th>
</tr>
</thead>
<tbody>
{files.map((file) => (
<tr>
<td safe>{file.output_file_name}</td>
<td safe class="max-w-[20vw] truncate">
{file.output_file_name}
</td>
<td safe>{file.status}</td>
<td>
<a
@@ -1200,33 +1310,63 @@ const app = new Elysia({
max={job.num_files}
value={files.length}
class={`
mb-4 inline-block h-2 w-full appearance-none overflow-hidden rounded-full border-0
bg-neutral-700 bg-none text-accent-500 accent-accent-500
[&::-moz-progress-bar]:bg-neutral-700 [&::-webkit-progress-value]:rounded-full
[&::-webkit-progress-value]:[background:none]
text-accent-500 accent-accent-500 mb-4 inline-block h-2 w-full appearance-none
overflow-hidden rounded-full border-0 bg-neutral-700 bg-none
[&[value]::-webkit-progress-value]:bg-accent-500
[&[value]::-webkit-progress-value]:transition-[inline-size]
[&::-moz-progress-bar]:bg-neutral-700 [&::-webkit-progress-value]:rounded-full
[&::-webkit-progress-value]:[background:none]
`}
/>
<table
class={`
w-full table-auto rounded bg-neutral-900 text-left
[&_td]:p-4
[&_tr]:rounded [&_tr]:border-b [&_tr]:border-neutral-800
[&_tr]:rounded-sm [&_tr]:border-b [&_tr]:border-neutral-800
`}
>
<thead>
<tr>
<th class="px-4 py-2">Converted File Name</th>
<th class="px-4 py-2">Status</th>
<th class="px-4 py-2">View</th>
<th class="px-4 py-2">Download</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Converted File Name
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Status
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
View
</th>
<th
class={`
px-2 py-2
sm:px-4
`}
>
Download
</th>
</tr>
</thead>
<tbody>
{files.map((file) => (
<tr>
<td safe>{file.output_file_name}</td>
<td safe class="max-w-[20vw] truncate">
{file.output_file_name}
</td>
<td safe>{file.status}</td>
<td>
<a
@@ -1281,7 +1421,7 @@ const app = new Elysia({
// parse from url encoded string
const userId = decodeURIComponent(params.userId);
const jobId = decodeURIComponent(params.jobId);
const fileName = decodeURIComponent(params.fileName);
const fileName = sanitize(decodeURIComponent(params.fileName));
const filePath = `${outputDir}${userId}/${jobId}/${fileName}`;
return Bun.file(filePath);
@@ -1305,14 +1445,19 @@ const app = new Elysia({
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
loggedIn
/>
<main class="w-full px-4">
<main
class={`
w-full px-2
sm:px-4
`}
>
<article class="article">
<h1 class="mb-4 text-xl">Converters</h1>
<table
class={`
w-full table-auto rounded bg-neutral-900 text-left
[&_td]:p-4
[&_tr]:rounded [&_tr]:border-b [&_tr]:border-neutral-800
[&_tr]:rounded-sm [&_tr]:border-b [&_tr]:border-neutral-800
[&_ul]:list-inside [&_ul]:list-disc
`}
>
@@ -1420,8 +1565,14 @@ const clearJobs = () => {
for (const job of jobs) {
// delete the directories
rmSync(`${outputDir}${job.user_id}/${job.id}`, { recursive: true });
rmSync(`${uploadsDir}${job.user_id}/${job.id}`, { recursive: true });
rmSync(`${outputDir}${job.user_id}/${job.id}`, {
recursive: true,
force: true,
});
rmSync(`${uploadsDir}${job.user_id}/${job.id}`, {
recursive: true,
force: true,
});
// delete the job
db.query("DELETE FROM jobs WHERE id = ?").run(job.id);

View File

@@ -1,31 +1,64 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";
@layer components {
.article {
@apply p-4 mb-4 bg-neutral-800/40 w-full mx-auto max-w-4xl rounded;
}
.btn-primary {
@apply bg-accent-500 text-contrast rounded p-4 hover:bg-accent-400 cursor-pointer transition-colors;
@plugin 'tailwind-scrollbar';
@theme {
--color-contrast: rgba(var(--contrast));
--color-neutral-900: rgba(var(--neutral-900));
--color-neutral-800: rgba(var(--neutral-800));
--color-neutral-700: rgba(var(--neutral-700));
--color-neutral-600: rgba(var(--neutral-600));
--color-neutral-500: rgba(var(--neutral-500));
--color-neutral-400: rgba(var(--neutral-400));
--color-neutral-300: rgba(var(--neutral-300));
--color-neutral-200: rgba(var(--neutral-200));
--color-neutral-100: rgba(var(--neutral-100));
--color-accent-600: rgba(var(--accent-600));
--color-accent-500: rgba(var(--accent-500));
--color-accent-400: rgba(var(--accent-400));
}
/*
The default border color has changed to `currentColor` in Tailwind CSS v4,
so we've added these compatibility styles to make sure everything still
looks the same as it did with Tailwind CSS v3.
If we ever want to remove these styles, we need to add an explicit border
color utility to any element that depends on these defaults.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-gray-200, currentColor);
}
}
@utility article {
@apply px-2 sm:px-4 py-4 mb-4 bg-neutral-800/40 w-full mx-auto max-w-4xl rounded-sm;
}
@utility btn-primary {
@apply bg-accent-500 text-contrast rounded-sm p-2 sm:p-4 hover:bg-accent-400 cursor-pointer transition-colors;
}
:root {
--contrast: 255, 255, 255;
--neutral-900: 243, 244, 246;
--neutral-800: 229, 231, 235;
--neutral-700: 209, 213, 219;
--neutral-600: 156, 163, 175;
--neutral-500: 180, 180, 180;
--neutral-400: 75, 85, 99;
--neutral-300: 55, 65, 81;
--neutral-200: 31, 41, 55;
--neutral-100: 17, 24, 39;
--accent-400: 132, 204, 22;
--accent-500: 101, 163, 13;
--accent-600: 77, 124, 15;
}
--contrast: 255, 255, 255;
--neutral-900: 243, 244, 246;
--neutral-800: 229, 231, 235;
--neutral-700: 209, 213, 219;
--neutral-600: 156, 163, 175;
--neutral-500: 180, 180, 180;
--neutral-400: 75, 85, 99;
--neutral-300: 55, 65, 81;
--neutral-200: 31, 41, 55;
--neutral-100: 17, 24, 39;
--accent-400: 132, 204, 22;
--accent-500: 101, 163, 13;
--accent-600: 77, 124, 15;
}
@media (prefers-color-scheme: dark) {
:root {

View File

@@ -1,27 +0,0 @@
/** @type {import('tailwindcss').Config} */
import tailwindScrollbar from "tailwind-scrollbar";
export default {
content: ["./src/**/*.{html,js,tsx,jsx,cjs,mjs}"],
theme: {
extend: {
colors: {
contrast: "rgba(var(--contrast))",
"neutral-900": "rgba(var(--neutral-900))",
"neutral-800": "rgba(var(--neutral-800))",
"neutral-700": "rgba(var(--neutral-700))",
"neutral-600": "rgba(var(--neutral-600))",
"neutral-500": "rgba(var(--neutral-500))",
"neutral-400": "rgba(var(--neutral-400))",
"neutral-300": "rgba(var(--neutral-300))",
"neutral-200": "rgba(var(--neutral-200))",
"neutral-100": "rgba(var(--neutral-100))",
"accent-600": "rgba(var(--accent-600))",
"accent-500": "rgba(var(--accent-500))",
"accent-400": "rgba(var(--accent-400))",
},
},
},
plugins: [tailwindScrollbar],
};