mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-04 22:13:32 +00:00
Compare commits
1 Commits
v0.8.1
...
feature-po
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8f2cd4e9e |
55
.eslintrc.cjs
Normal file
55
.eslintrc.cjs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/** @type {import("eslint").Linter.Config} */
|
||||||
|
const config = {
|
||||||
|
root: true,
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
plugins: ["isaacscript", "import"],
|
||||||
|
extends: [
|
||||||
|
"plugin:@typescript-eslint/recommended-type-checked",
|
||||||
|
"plugin:@typescript-eslint/stylistic-type-checked",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: [
|
||||||
|
"./tsconfig.json",
|
||||||
|
"./cli/tsconfig.eslint.json", // separate eslint config for the CLI since we want to lint and typecheck differently due to template files
|
||||||
|
"./upgrade/tsconfig.json",
|
||||||
|
"./www/tsconfig.json",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
// Template files don't have reliable type information
|
||||||
|
{
|
||||||
|
files: ["./cli/template/**/*.{ts,tsx}"],
|
||||||
|
extends: ["plugin:@typescript-eslint/disable-type-checked"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// These off/not-configured-the-way-we-want lint rules we like & opt into
|
||||||
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
|
||||||
|
],
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
"error",
|
||||||
|
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
|
||||||
|
],
|
||||||
|
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
|
||||||
|
|
||||||
|
// For educational purposes we format our comments/jsdoc nicely
|
||||||
|
"isaacscript/complete-sentences-jsdoc": "warn",
|
||||||
|
"isaacscript/format-jsdoc-comments": "warn",
|
||||||
|
|
||||||
|
// These lint rules don't make sense for us but are enabled in the preset configs
|
||||||
|
"@typescript-eslint/no-confusing-void-expression": "off",
|
||||||
|
"@typescript-eslint/restrict-template-expressions": "off",
|
||||||
|
|
||||||
|
// This rule doesn't seem to be working properly
|
||||||
|
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
23
.github/dependabot.yml
vendored
Normal file
23
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
# Maintain dependencies for npm
|
||||||
|
- package-ecosystem: "npm" # See documentation for possible values
|
||||||
|
versioning-strategy: increase
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
# Maintain dependencies for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
28
.github/workflows/bun-dependabot.yml
vendored
Normal file
28
.github/workflows/bun-dependabot.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: 'Dependabot: Update bun.lockb'
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "package.json"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-bun-lockb:
|
||||||
|
name: "Update bun.lockb"
|
||||||
|
if: github.actor == 'dependabot[bot]'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: oven-sh/setup-bun@v1
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.ref }}
|
||||||
|
- run: |
|
||||||
|
bun install
|
||||||
|
git add bun.lockb
|
||||||
|
git config --global user.name 'dependabot[bot]'
|
||||||
|
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
|
||||||
|
git commit --amend --no-edit
|
||||||
|
git push --force
|
||||||
3
.github/workflows/docker-publish.yml
vendored
3
.github/workflows/docker-publish.yml
vendored
@@ -58,10 +58,9 @@ jobs:
|
|||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
25
.github/workflows/release-please.yml
vendored
25
.github/workflows/release-please.yml
vendored
@@ -1,25 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
name: release-please
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-please:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: googleapis/release-please-action@v4
|
|
||||||
with:
|
|
||||||
# this assumes that you have created a personal access token
|
|
||||||
# (PAT) and configured it as a GitHub action secret named
|
|
||||||
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
|
|
||||||
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
|
|
||||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# this is a built-in strategy in release-please, see "Action Inputs"
|
|
||||||
# for more options
|
|
||||||
release-type: node
|
|
||||||
21
.github/workflows/remove-docker-tag.yml
vendored
21
.github/workflows/remove-docker-tag.yml
vendored
@@ -1,21 +0,0 @@
|
|||||||
name: Remove Docker Tag
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
remove-docker-tag:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
|
||||||
# (required)
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Remove Docker Tag
|
|
||||||
uses: ArchieAtkinson/remove-dockertag-action@v0.0
|
|
||||||
with:
|
|
||||||
tag_name: master
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -47,5 +47,3 @@ package-lock.json
|
|||||||
/db
|
/db
|
||||||
/data
|
/data
|
||||||
/Bruno
|
/Bruno
|
||||||
/tsconfig.tsbuildinfo
|
|
||||||
/src/public/generated.css
|
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
||||||
}
|
|
||||||
148
CHANGELOG.md
148
CHANGELOG.md
@@ -1,148 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [0.8.1](https://github.com/C4illin/ConvertX/compare/v0.8.0...v0.8.1) (2024-10-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* disable convert button when input is empty ([78844d7](https://github.com/C4illin/ConvertX/commit/78844d7bd55990789ed07c81e49043e688cbe656)), closes [#151](https://github.com/C4illin/ConvertX/issues/151)
|
|
||||||
* resize to fit for ico ([b4e53db](https://github.com/C4illin/ConvertX/commit/b4e53dbb8e70b3a95b44e5b756759d16117a87e1)), closes [#157](https://github.com/C4illin/ConvertX/issues/157)
|
|
||||||
* treat jfif as jpeg ([339b79f](https://github.com/C4illin/ConvertX/commit/339b79f786131deb93f0d5683e03178fdcab1ef5)), closes [#163](https://github.com/C4illin/ConvertX/issues/163)
|
|
||||||
|
|
||||||
## [0.8.0](https://github.com/C4illin/ConvertX/compare/v0.7.0...v0.8.0) (2024-09-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add light theme, fixes [#156](https://github.com/C4illin/ConvertX/issues/156) ([72636c5](https://github.com/C4illin/ConvertX/commit/72636c5059ebf09c8fece2e268293650b2f8ccf6))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add support for usd for assimp, [#144](https://github.com/C4illin/ConvertX/issues/144) ([2057167](https://github.com/C4illin/ConvertX/commit/20571675766209ad1251f07e687d29a6791afc8b))
|
|
||||||
* cleanup formats and add opus, fixes [#159](https://github.com/C4illin/ConvertX/issues/159) ([ae1dfaf](https://github.com/C4illin/ConvertX/commit/ae1dfafc9d9116a57b08c2f7fc326990e00824b0))
|
|
||||||
* support .awb and clean up, fixes [#153](https://github.com/C4illin/ConvertX/issues/153), [#92](https://github.com/C4illin/ConvertX/issues/92) ([1c9e67f](https://github.com/C4illin/ConvertX/commit/1c9e67fc3201e0e5dee91e8981adf34daaabf33a))
|
|
||||||
|
|
||||||
## [0.7.0](https://github.com/C4illin/ConvertX/compare/v0.6.0...v0.7.0) (2024-09-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Add support for 3d assets through assimp converter ([63a4328](https://github.com/C4illin/ConvertX/commit/63a4328d4a1e01df3e0ec4a877bad8c8ffe71129))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* wrong layout on search with few options ([8817389](https://github.com/C4illin/ConvertX/commit/88173891ba2d69da46eda46f3f598a9b54f26f96))
|
|
||||||
|
|
||||||
## [0.6.0](https://github.com/C4illin/ConvertX/compare/v0.5.0...v0.6.0) (2024-09-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* ui remake with tailwind ([22f823c](https://github.com/C4illin/ConvertX/commit/22f823c535b20382981f86a13616b830a1f3392f))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* rename css file to force update cache, fixes [#141](https://github.com/C4illin/ConvertX/issues/141) ([47139a5](https://github.com/C4illin/ConvertX/commit/47139a550bd3d847da288c61bf8f88953b79c673))
|
|
||||||
|
|
||||||
## [0.5.0](https://github.com/C4illin/ConvertX/compare/v0.4.1...v0.5.0) (2024-09-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add option to customize how often files are automatically deleted ([317c932](https://github.com/C4illin/ConvertX/commit/317c932c2a26280bf37ed3d3bf9b879413590f5a))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* improve file name replacement logic ([60ba7c9](https://github.com/C4illin/ConvertX/commit/60ba7c93fbdc961f3569882fade7cc13dee7a7a5))
|
|
||||||
|
|
||||||
## [0.4.1](https://github.com/C4illin/ConvertX/compare/v0.4.0...v0.4.1) (2024-09-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* allow non lowercase true and false values, fixes [#122](https://github.com/C4illin/ConvertX/issues/122) ([bef1710](https://github.com/C4illin/ConvertX/commit/bef1710e3376baa7e25c107ded20a40d18b8c6b0))
|
|
||||||
|
|
||||||
## [0.4.0](https://github.com/C4illin/ConvertX/compare/v0.3.3...v0.4.0) (2024-08-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add option for unauthenticated file conversions [#114](https://github.com/C4illin/ConvertX/issues/114) ([f0d0e43](https://github.com/C4illin/ConvertX/commit/f0d0e4392983c3e4c530304ea88e023fda9bcac0))
|
|
||||||
* add resvg converter ([d5eeef9](https://github.com/C4illin/ConvertX/commit/d5eeef9f6884b2bb878508bed97ea9ceaa662995))
|
|
||||||
* add robots.txt ([6597c1d](https://github.com/C4illin/ConvertX/commit/6597c1d7caeb4dfb6bc47b442e4dfc9840ad12b7))
|
|
||||||
* Add search bar for formats ([53fff59](https://github.com/C4illin/ConvertX/commit/53fff594fc4d69306abcb2a5cad890fcd0953a58))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* keep unauthenticated user logged in if allowed [#114](https://github.com/C4illin/ConvertX/issues/114) ([bc4ad49](https://github.com/C4illin/ConvertX/commit/bc4ad492852fad8cb832a0c03485cccdd7f7b117))
|
|
||||||
* pdf support in vips ([8ca4f15](https://github.com/C4illin/ConvertX/commit/8ca4f1587df7f358893941c656d78d75f04dac93))
|
|
||||||
* Slow click on conversion popup does not work ([4d9c4d6](https://github.com/C4illin/ConvertX/commit/4d9c4d64aa0266f3928935ada68d91ac81f638aa))
|
|
||||||
|
|
||||||
## [0.3.3](https://github.com/C4illin/ConvertX/compare/v0.3.2...v0.3.3) (2024-07-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* downgrade @elysiajs/html dependency to version 1.0.2 ([c714ade](https://github.com/C4illin/ConvertX/commit/c714ade3e23865ba6cfaf76c9e7259df1cda222c))
|
|
||||||
|
|
||||||
## [0.3.2](https://github.com/C4illin/ConvertX/compare/v0.3.1...v0.3.2) (2024-07-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* increase max request body to support large uploads ([3ae2db5](https://github.com/C4illin/ConvertX/commit/3ae2db5d9b36fe3dcd4372ddcd32aa573ea59aa6)), closes [#64](https://github.com/C4illin/ConvertX/issues/64)
|
|
||||||
|
|
||||||
## [0.3.1](https://github.com/C4illin/ConvertX/compare/v0.3.0...v0.3.1) (2024-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* release releases ([4d4c13a](https://github.com/C4illin/ConvertX/commit/4d4c13a8d85ec7c9209ad41cdbea7d4380b0edbf))
|
|
||||||
|
|
||||||
## [0.3.0](https://github.com/C4illin/ConvertX/compare/v0.2.0...v0.3.0) (2024-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add version number to log ([4dcb796](https://github.com/C4illin/ConvertX/commit/4dcb796e1bd27badc078d0638076cd9f1e81c4a4)), closes [#44](https://github.com/C4illin/ConvertX/issues/44)
|
|
||||||
* change to xelatex ([fae2ba9](https://github.com/C4illin/ConvertX/commit/fae2ba9c54461dccdccd1bfb5e76398540d11d0b))
|
|
||||||
* print version of installed converters to log ([801cf28](https://github.com/C4illin/ConvertX/commit/801cf28d1e5edac9353b0b16be75a4fb48470b8a))
|
|
||||||
|
|
||||||
## [0.2.0](https://github.com/C4illin/ConvertX/compare/v0.1.2...v0.2.0) (2024-06-20)
|
|
||||||
|
|
||||||
|
|
||||||
### 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)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* fix incorrect redirect ([25df58b](https://github.com/C4illin/ConvertX/commit/25df58ba82321aaa6617811a6995cb96c2a00a40)), closes [#23](https://github.com/C4illin/ConvertX/issues/23)
|
|
||||||
|
|
||||||
## [0.1.1](https://github.com/C4illin/ConvertX/compare/v0.1.0...v0.1.1) (2024-05-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* :bug: make sure all redirects are 302 ([9970fd3](https://github.com/C4illin/ConvertX/commit/9970fd3f89190af96f8762edc3817d1e03082b3a)), closes [#12](https://github.com/C4illin/ConvertX/issues/12)
|
|
||||||
|
|
||||||
## 0.1.0 (2024-05-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* remove file from file list in index.html ([787ff97](https://github.com/C4illin/ConvertX/commit/787ff9741ecbbf4fb4c02b43bd22a214a173fd7b))
|
|
||||||
|
|
||||||
|
|
||||||
### Miscellaneous Chores
|
|
||||||
|
|
||||||
* release 0.1.0 ([54d9aec](https://github.com/C4illin/ConvertX/commit/54d9aecbf949689b12aa7e5e8e9be7b9032f4431))
|
|
||||||
40
Dockerfile
40
Dockerfile
@@ -1,5 +1,4 @@
|
|||||||
FROM oven/bun:1.1.29-alpine AS base
|
FROM oven/bun:1-debian as base
|
||||||
LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# install dependencies into temp directory
|
# install dependencies into temp directory
|
||||||
@@ -14,22 +13,16 @@ RUN mkdir -p /temp/prod
|
|||||||
COPY package.json bun.lockb /temp/prod/
|
COPY package.json bun.lockb /temp/prod/
|
||||||
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
||||||
|
|
||||||
FROM base AS builder
|
|
||||||
RUN apk --no-cache add curl gcc
|
|
||||||
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
|
# copy node_modules from temp directory
|
||||||
# then copy all (non-ignored) project files into the image
|
# then copy all (non-ignored) project files into the image
|
||||||
FROM base AS prerelease
|
# FROM base AS prerelease
|
||||||
COPY --from=install /temp/dev/node_modules node_modules
|
# COPY --from=install /temp/dev/node_modules node_modules
|
||||||
COPY . .
|
# COPY . .
|
||||||
|
|
||||||
# # [optional] tests & build
|
# # [optional] tests & build
|
||||||
ENV NODE_ENV=production
|
# ENV NODE_ENV=production
|
||||||
# RUN bun test
|
# RUN bun test
|
||||||
RUN bun run build
|
# RUN bun run build
|
||||||
|
|
||||||
# copy production dependencies and source code into final image
|
# copy production dependencies and source code into final image
|
||||||
FROM base AS release
|
FROM base AS release
|
||||||
@@ -38,30 +31,21 @@ LABEL description="ConvertX: self-hosted online file converter supporting 700+ f
|
|||||||
LABEL repo="https://github.com/C4illin/ConvertX"
|
LABEL repo="https://github.com/C4illin/ConvertX"
|
||||||
|
|
||||||
# install additional dependencies
|
# install additional dependencies
|
||||||
RUN apk --no-cache add \
|
RUN rm -rf /var/lib/apt/lists/partial && apt-get update -o Acquire::CompressionTypes::Order::=gz \
|
||||||
|
&& apt-get install -y \
|
||||||
pandoc \
|
pandoc \
|
||||||
texlive \
|
texlive-latex-recommended \
|
||||||
texlive-xetex \
|
texlive-fonts-recommended \
|
||||||
texmf-dist-latexextra \
|
texlive-latex-extra \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
graphicsmagick \
|
graphicsmagick \
|
||||||
ghostscript \
|
ghostscript \
|
||||||
vips-tools \
|
libvips-tools
|
||||||
vips-poppler \
|
|
||||||
vips-jxl \
|
|
||||||
libjxl-tools \
|
|
||||||
assimp
|
|
||||||
|
|
||||||
# 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=install /temp/prod/node_modules node_modules
|
||||||
COPY --from=builder /root/.cargo/bin/resvg /usr/local/bin/resvg
|
|
||||||
COPY --from=prerelease /app/src/public/generated.css /app/src/public/
|
|
||||||
# COPY --from=prerelease /app/src/index.tsx /app/src/
|
# COPY --from=prerelease /app/src/index.tsx /app/src/
|
||||||
# COPY --from=prerelease /app/package.json .
|
# COPY --from=prerelease /app/package.json .
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 3000/tcp
|
EXPOSE 3000/tcp
|
||||||
ENV NODE_ENV=production
|
|
||||||
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]
|
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]
|
||||||
61
README.md
61
README.md
@@ -1,64 +1,49 @@
|
|||||||

|

|
||||||
# ConvertX
|
# ConvertX
|
||||||
[](https://github.com/C4illin/ConvertX/actions/workflows/docker-publish.yml)
|
[](https://github.com/C4illin/ConvertX/actions/workflows/docker-publish.yml)
|
||||||
[](https://github.com/C4illin/ConvertX/pkgs/container/convertx)
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
A self-hosted online file converter. Supports over a thousand different formats. Written with TypeScript, Bun and Elysia.
|
A self-hosted online file converter. Supports 831 different formats. Written with Typescript, Bun and Elysia.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Convert files to different formats
|
- Convert files to different formats
|
||||||
- Process multiple files at once
|
|
||||||
- Password protection
|
- Password protection
|
||||||
- Multiple accounts
|
- Multiple accounts
|
||||||
|
|
||||||
## Converters supported
|
## Converters supported
|
||||||
|
|
||||||
| Converter | Use case | Converts from | Converts to |
|
| Converter | Use case | Converts from | Converts to |
|
||||||
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
|----------------|---------------|---------------|-------------|
|
||||||
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
| Vips | Images (fast) | 45 | 23 |
|
||||||
| [resvg](https://github.com/RazrFalcon/resvg) | SVG | 1 | 1 |
|
| PDFLaTeX | Documents | 1 | 1 |
|
||||||
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
| Pandoc | Documents | 43 | 65 |
|
||||||
| [Assimp](https://github.com/assimp/assimp) | 3D Assets | 70 | 24 |
|
| GraphicsMagick | Images | 166 | 133 |
|
||||||
| [XeLaTeX](https://tug.org/xetex/) | LaTeX | 1 | 1 |
|
| FFmpeg | Video | ~473 | ~280 |
|
||||||
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
|
|
||||||
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |
|
|
||||||
| [FFmpeg](https://ffmpeg.org/) | Video | ~473 | ~280 |
|
|
||||||
|
|
||||||
<!-- many ffmpeg fileformats are duplicates -->
|
<!-- many ffmpeg fileformats are duplicates -->
|
||||||
|
|
||||||
Any missing converter? Open an issue or pull request!
|
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
services:
|
services:
|
||||||
convertx:
|
convertx:
|
||||||
image: ghcr.io/c4illin/convertx
|
image: ghcr.io/c4illin/convertx:main
|
||||||
container_name: convertx
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment: # Defaults are listed below. All are optional.
|
environment: # Defaults are listed below. All are optional.
|
||||||
- ACCOUNT_REGISTRATION=false # true or false, doesn't matter for the first account (e.g. keep this to false if you only want one account)
|
- ACCOUNT_REGISTRATION=false # true or false, doesn't matter for the first account (e.g. keep this to false if you only want one account)
|
||||||
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234 # will use randomUUID() by default
|
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234 # will use randomUUID() by default
|
||||||
- HTTP_ALLOWED=false # setting this to true is unsafe, only set this to true locally
|
- HTTP_ALLOWED=false # setting this to true is unsafe, only set this to true locally
|
||||||
- ALLOW_UNAUTHENTICATED=false # allows anyone to use the service without logging in, only set this to true locally
|
|
||||||
- AUTO_DELETE_EVERY_N_HOURS=24 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
|
|
||||||
volumes:
|
volumes:
|
||||||
- convertx:/app/data
|
- convertx:/app/data
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
<!-- or
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -p 3000:3000 -v ./data:/app/data ghcr.io/c4illin/convertx
|
docker run ghcr.io/c4illin/convertx:master -p 3000:3000 -e ACCOUNT_REGISTRATION=false -v /path/you/want:/app/data
|
||||||
```
|
``` -->
|
||||||
|
|
||||||
Then visit `http://localhost:3000` in your browser and create your account. Don't leave it unconfigured and open, as anyone can register the first account.
|
Then visit `http://localhost:3000` in your browser and create your account. Don't leave it unconfigured and open, as anyone can register the first account.
|
||||||
|
|
||||||
@@ -68,31 +53,13 @@ If you get unable to open database file run `chown -R $USER:$USER path` on the p
|
|||||||
|
|
||||||
Tutorial in french: https://belginux.com/installer-convertx-avec-docker/
|
Tutorial in french: https://belginux.com/installer-convertx-avec-docker/
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
0. Install [Bun](https://bun.sh/) and Git
|
|
||||||
1. Clone the repository
|
|
||||||
2. `bun install`
|
|
||||||
3. `bun run dev`
|
|
||||||
|
|
||||||
Pull requests are welcome! See below and open issues for the list of todos.
|
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
- [x] Add messages for errors in converters
|
- [x] Add messages for errors in converters
|
||||||
- [x] Add searchable list of formats
|
|
||||||
- [ ] Add options for converters
|
- [ ] Add options for converters
|
||||||
|
- [ ] Add more converters
|
||||||
- [ ] Divide index.tsx into smaller components
|
- [ ] Divide index.tsx into smaller components
|
||||||
- [ ] Add tests
|
- [ ] Add tests
|
||||||
- [ ] Make the upload button nicer and more easy to drop files on. Support copy paste as well if possible.
|
- [ ] Add searchable list of formats
|
||||||
- [ ] Make errors logs visible from the web ui
|
|
||||||
- [ ] Add more converters:
|
|
||||||
- [ ] [deark](https://github.com/jsummers/deark)
|
|
||||||
- [ ] LibreOffice
|
|
||||||
- [ ] [dvisvgm](https://github.com/mgieseki/dvisvgm)
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
|||||||
21
biome.json
21
biome.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"formatWithErrors": true,
|
"formatWithErrors": true,
|
||||||
@@ -9,15 +9,7 @@
|
|||||||
"lineWidth": 80,
|
"lineWidth": 80,
|
||||||
"attributePosition": "auto"
|
"attributePosition": "auto"
|
||||||
},
|
},
|
||||||
"files": {
|
"organizeImports": { "enabled": true },
|
||||||
"ignore": [
|
|
||||||
"**/node_modules/**",
|
|
||||||
"**/pico.lime.min.css"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"organizeImports": {
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
@@ -30,11 +22,7 @@
|
|||||||
"useLiteralKeys": "error",
|
"useLiteralKeys": "error",
|
||||||
"useOptionalChain": "error"
|
"useOptionalChain": "error"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": { "noPrecisionLoss": "error", "noUnusedVariables": "off" },
|
||||||
"noPrecisionLoss": "error",
|
|
||||||
"noUnusedVariables": "off",
|
|
||||||
"useJsxKeyInIterable": "off"
|
|
||||||
},
|
|
||||||
"style": {
|
"style": {
|
||||||
"noInferrableTypes": "error",
|
"noInferrableTypes": "error",
|
||||||
"noNamespace": "error",
|
"noNamespace": "error",
|
||||||
@@ -54,9 +42,6 @@
|
|||||||
"noUnsafeDeclarationMerging": "error",
|
"noUnsafeDeclarationMerging": "error",
|
||||||
"useAwait": "error",
|
"useAwait": "error",
|
||||||
"useNamespaceKeyword": "error"
|
"useNamespaceKeyword": "error"
|
||||||
},
|
|
||||||
"nursery": {
|
|
||||||
"useSortedClasses": "error"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
10
compose.yaml
10
compose.yaml
@@ -2,14 +2,10 @@ services:
|
|||||||
convertx:
|
convertx:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
# dockerfile: Debian.Dockerfile
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
environment: # Defaults are listed below. All are optional.
|
environment:
|
||||||
- ACCOUNT_REGISTRATION=true # true or false, doesn't matter for the first account (e.g. keep this to false if you only want one account)
|
- ACCOUNT_REGISTRATION=true
|
||||||
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234 # will use randomUUID() by default
|
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234
|
||||||
- HTTP_ALLOWED=true # setting this to true is unsafe, only set this to true locally
|
|
||||||
- ALLOW_UNAUTHENTICATED=true # allows anyone to use the service without logging in, only set this to true locally
|
|
||||||
- AUTO_DELETE_EVERY_N_HOURS=1 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
|
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
|
|||||||
@@ -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",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
67
package.json
67
package.json
@@ -1,61 +1,40 @@
|
|||||||
{
|
{
|
||||||
"name": "convertx-frontend",
|
"name": "convertx-frontend",
|
||||||
"version": "0.8.1",
|
"version": "1.0.50",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --watch src/index.tsx",
|
"dev": "bun run --watch src/index.tsx",
|
||||||
"hot": "bun run --hot src/index.tsx",
|
"hot": "bun run --hot src/index.tsx",
|
||||||
"format": "eslint --fix .",
|
"format": "biome format --write ./src",
|
||||||
"build": "postcss ./src/main.css -o ./src/public/generated.css",
|
"css": "cpy 'node_modules/@picocss/pico/css/pico.lime.min.css' 'src/public/' --flat"
|
||||||
"lint": "run-p 'lint:*'",
|
|
||||||
"lint:tsc": "tsc --noEmit",
|
|
||||||
"lint:knip": "knip",
|
|
||||||
"lint:eslint": "eslint ."
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@elysiajs/cookie": "^0.8.0",
|
"@elysiajs/cookie": "^0.8.0",
|
||||||
"@elysiajs/html": "1.0.2",
|
"@elysiajs/html": "^1.0.2",
|
||||||
"@elysiajs/jwt": "^1.1.1",
|
"@elysiajs/jwt": "^1.0.2",
|
||||||
"@elysiajs/static": "1.0.3",
|
"@elysiajs/static": "^1.0.3",
|
||||||
"elysia": "^1.1.17"
|
"elysia": "^1.0.22",
|
||||||
|
"node-poppler": "^7.2.0"
|
||||||
},
|
},
|
||||||
"module": "src/index.tsx",
|
"module": "src/index.tsx",
|
||||||
"type": "module",
|
|
||||||
"bun-create": {
|
"bun-create": {
|
||||||
"start": "bun run src/index.tsx"
|
"start": "bun run src/index.tsx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^1.1.1",
|
"@biomejs/biome": "1.7.3",
|
||||||
"@eslint/js": "^9.12.0",
|
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
"@kitajs/ts-html-plugin": "^4.0.1",
|
||||||
"@kitajs/ts-html-plugin": "^4.1.0",
|
"@picocss/pico": "^2.0.6",
|
||||||
"@total-typescript/ts-reset": "^0.6.1",
|
"@total-typescript/ts-reset": "^0.5.1",
|
||||||
"@types/bun": "^1.1.10",
|
"@types/bun": "^1.1.3",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^8.56.10",
|
||||||
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
"@types/node": "^20.12.13",
|
||||||
"@types/eslint__js": "^8.42.3",
|
"@types/ws": "^8.5.10",
|
||||||
"@types/node": "^22.7.4",
|
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
"@typescript-eslint/parser": "^7.11.0",
|
||||||
"@typescript-eslint/parser": "^8.7.0",
|
"cpy-cli": "^5.0.0",
|
||||||
"autoprefixer": "^10.4.20",
|
|
||||||
"cssnano": "^7.0.6",
|
|
||||||
"eslint": "^9.12.0",
|
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-deprecation": "^3.0.0",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"eslint-plugin-isaacscript": "^4.0.0",
|
"prettier": "^3.2.5",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"typescript": "^5.4.5"
|
||||||
"eslint-plugin-readable-tailwind": "^1.8.1",
|
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
||||||
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
||||||
"globals": "^15.9.0",
|
|
||||||
"knip": "^5.30.6",
|
|
||||||
"npm-run-all2": "^6.2.3",
|
|
||||||
"postcss": "^8.4.47",
|
|
||||||
"postcss-cli": "^11.0.0",
|
|
||||||
"postcss-lightningcss": "^1.0.1",
|
|
||||||
"prettier": "^3.3.3",
|
|
||||||
"tailwind-scrollbar": "^3.1.0",
|
|
||||||
"tailwindcss": "^3.4.13",
|
|
||||||
"typescript": "^5.6.2",
|
|
||||||
"typescript-eslint": "^8.8.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
module.exports = {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
|
|
||||||
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"config:recommended",
|
|
||||||
":disableDependencyDashboard"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
export const BaseHtml = ({
|
export const BaseHtml = ({ children, title = "ConvertX" }) => (
|
||||||
children,
|
|
||||||
title = "ConvertX",
|
|
||||||
}: { children: JSX.Element; title?: string }) => (
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title safe>{title}</title>
|
<title safe>{title}</title>
|
||||||
<link rel="stylesheet" href="/generated.css" />
|
<link rel="stylesheet" href="/pico.lime.min.css" />
|
||||||
|
<link rel="stylesheet" href="/style.css" />
|
||||||
<link
|
<link
|
||||||
rel="apple-touch-icon"
|
rel="apple-touch-icon"
|
||||||
sizes="180x180"
|
sizes="180x180"
|
||||||
@@ -27,6 +25,6 @@ export const BaseHtml = ({
|
|||||||
/>
|
/>
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
</head>
|
</head>
|
||||||
<body class="w-full bg-neutral-900 text-neutral-200">{children}</body>
|
<body>{children}</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,65 +5,44 @@ export const Header = ({
|
|||||||
let rightNav: JSX.Element;
|
let rightNav: JSX.Element;
|
||||||
if (loggedIn) {
|
if (loggedIn) {
|
||||||
rightNav = (
|
rightNav = (
|
||||||
<ul class="flex gap-4">
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="/history">History</a>
|
||||||
class={`
|
|
||||||
text-accent-600 transition-all
|
|
||||||
hover:text-accent-500 hover:underline
|
|
||||||
`}
|
|
||||||
href="/history">
|
|
||||||
History
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="/logoff">Logout</a>
|
||||||
class={`
|
|
||||||
text-accent-600 transition-all
|
|
||||||
hover:text-accent-500 hover:underline
|
|
||||||
`}
|
|
||||||
href="/logoff">
|
|
||||||
Logout
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
rightNav = (
|
rightNav = (
|
||||||
<ul class="flex gap-4">
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="/login">Login</a>
|
||||||
class={`
|
|
||||||
text-accent-600 transition-all
|
|
||||||
hover:text-accent-500 hover:underline
|
|
||||||
`}
|
|
||||||
href="/login">
|
|
||||||
Login
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{accountRegistration ? (
|
{accountRegistration && (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="/register">Register</a>
|
||||||
class={`
|
|
||||||
text-accent-600 transition-all
|
|
||||||
hover:text-accent-500 hover:underline
|
|
||||||
`}
|
|
||||||
href="/register">
|
|
||||||
Register
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header class="w-full p-4">
|
<header className="container">
|
||||||
<nav class="mx-auto flex max-w-4xl justify-between rounded bg-neutral-900 p-4">
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<strong>
|
<strong>
|
||||||
<a href="/">ConvertX</a>
|
<a
|
||||||
|
href="/"
|
||||||
|
style={{
|
||||||
|
textDecoration: "none",
|
||||||
|
color: "inherit",
|
||||||
|
}}>
|
||||||
|
ConvertX
|
||||||
|
</a>
|
||||||
</strong>
|
</strong>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
import { exec } from "node:child_process";
|
|
||||||
|
|
||||||
// This could be done dynamically by running `ffmpeg -formats` and parsing the output
|
|
||||||
export const properties = {
|
|
||||||
from: {
|
|
||||||
muxer: [
|
|
||||||
"3d",
|
|
||||||
"3ds",
|
|
||||||
"3mf",
|
|
||||||
"ac",
|
|
||||||
"ac3d",
|
|
||||||
"acc",
|
|
||||||
"amf",
|
|
||||||
"ase",
|
|
||||||
"ask",
|
|
||||||
"assbin",
|
|
||||||
"b3d",
|
|
||||||
"blend",
|
|
||||||
"bsp",
|
|
||||||
"bvh",
|
|
||||||
"cob",
|
|
||||||
"csm",
|
|
||||||
"dae",
|
|
||||||
"dxf",
|
|
||||||
"enff",
|
|
||||||
"fbx",
|
|
||||||
"glb",
|
|
||||||
"gltf",
|
|
||||||
"hmp",
|
|
||||||
"ifc",
|
|
||||||
"ifczip",
|
|
||||||
"iqm",
|
|
||||||
"irr",
|
|
||||||
"irrmesh",
|
|
||||||
"lwo",
|
|
||||||
"lws",
|
|
||||||
"lxo",
|
|
||||||
"md2",
|
|
||||||
"md3",
|
|
||||||
"md5anim",
|
|
||||||
"md5camera",
|
|
||||||
"md5mesh",
|
|
||||||
"mdc",
|
|
||||||
"mdl",
|
|
||||||
"mesh.xml",
|
|
||||||
"mesh",
|
|
||||||
"mot",
|
|
||||||
"ms3d",
|
|
||||||
"ndo",
|
|
||||||
"nff",
|
|
||||||
"obj",
|
|
||||||
"off",
|
|
||||||
"ogex",
|
|
||||||
"pk3",
|
|
||||||
"ply",
|
|
||||||
"pmx",
|
|
||||||
"prj",
|
|
||||||
"q3o",
|
|
||||||
"q3s",
|
|
||||||
"raw",
|
|
||||||
"scn",
|
|
||||||
"sib",
|
|
||||||
"smd",
|
|
||||||
"step",
|
|
||||||
"stl",
|
|
||||||
"stp",
|
|
||||||
"ter",
|
|
||||||
"uc",
|
|
||||||
"usd",
|
|
||||||
"usda",
|
|
||||||
"usdc",
|
|
||||||
"usdz",
|
|
||||||
"vta",
|
|
||||||
"x",
|
|
||||||
"x3d",
|
|
||||||
"x3db",
|
|
||||||
"xgl",
|
|
||||||
"xml",
|
|
||||||
"zae",
|
|
||||||
"zgl",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
to: {
|
|
||||||
muxer: [
|
|
||||||
"3ds",
|
|
||||||
"3mf",
|
|
||||||
"assbin",
|
|
||||||
"assjson",
|
|
||||||
"assxml",
|
|
||||||
"collada",
|
|
||||||
"dae",
|
|
||||||
"fbx",
|
|
||||||
"fbxa",
|
|
||||||
"glb",
|
|
||||||
"glb2",
|
|
||||||
"gltf",
|
|
||||||
"gltf2",
|
|
||||||
"m3d",
|
|
||||||
"m3da",
|
|
||||||
"obj",
|
|
||||||
"objnomtl",
|
|
||||||
"pbrt",
|
|
||||||
"ply",
|
|
||||||
"plyb",
|
|
||||||
"stl",
|
|
||||||
"stlb",
|
|
||||||
"stp",
|
|
||||||
"x",
|
|
||||||
"x3d",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function convert(
|
|
||||||
filePath: string,
|
|
||||||
fileType: string,
|
|
||||||
convertTo: string,
|
|
||||||
targetPath: string,
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
options?: unknown,
|
|
||||||
): Promise<string> {
|
|
||||||
// let command = "ffmpeg";
|
|
||||||
|
|
||||||
const command = `assimp export "${filePath}" "${targetPath}"`;
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
exec(command, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
reject(`error: ${error}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stderr) {
|
|
||||||
console.error(`stderr: ${stderr}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve("Done");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ export const properties = {
|
|||||||
muxer: [
|
muxer: [
|
||||||
"264",
|
"264",
|
||||||
"265",
|
"265",
|
||||||
"266",
|
|
||||||
"302",
|
"302",
|
||||||
"3dostr",
|
"3dostr",
|
||||||
"3g2",
|
"3g2",
|
||||||
@@ -19,7 +18,6 @@ export const properties = {
|
|||||||
"aac",
|
"aac",
|
||||||
"aax",
|
"aax",
|
||||||
"ac3",
|
"ac3",
|
||||||
"ac4",
|
|
||||||
"ace",
|
"ace",
|
||||||
"acm",
|
"acm",
|
||||||
"act",
|
"act",
|
||||||
@@ -50,6 +48,7 @@ export const properties = {
|
|||||||
"apng",
|
"apng",
|
||||||
"aptx",
|
"aptx",
|
||||||
"aptxhd",
|
"aptxhd",
|
||||||
|
"aptx_hd",
|
||||||
"aqt",
|
"aqt",
|
||||||
"aqtitle",
|
"aqtitle",
|
||||||
"argo_asf",
|
"argo_asf",
|
||||||
@@ -64,12 +63,10 @@ export const properties = {
|
|||||||
"av1",
|
"av1",
|
||||||
"avc",
|
"avc",
|
||||||
"avi",
|
"avi",
|
||||||
"avif",
|
|
||||||
"avr",
|
"avr",
|
||||||
"avs",
|
"avs",
|
||||||
"avs2",
|
"avs2",
|
||||||
"avs3",
|
"avs3",
|
||||||
"awb",
|
|
||||||
"bcstm",
|
"bcstm",
|
||||||
"bethsoftvid",
|
"bethsoftvid",
|
||||||
"bfi",
|
"bfi",
|
||||||
@@ -78,10 +75,8 @@ export const properties = {
|
|||||||
"bink",
|
"bink",
|
||||||
"binka",
|
"binka",
|
||||||
"bit",
|
"bit",
|
||||||
"bitpacked",
|
"bmp_pipe",
|
||||||
"bmv",
|
"bmv",
|
||||||
"bmp",
|
|
||||||
"bonk",
|
|
||||||
"boa",
|
"boa",
|
||||||
"brender_pix",
|
"brender_pix",
|
||||||
"brstm",
|
"brstm",
|
||||||
@@ -98,7 +93,7 @@ export const properties = {
|
|||||||
"codec2",
|
"codec2",
|
||||||
"codec2raw",
|
"codec2raw",
|
||||||
"concat",
|
"concat",
|
||||||
"cri",
|
"cri_pipe",
|
||||||
"dash",
|
"dash",
|
||||||
"dat",
|
"dat",
|
||||||
"data",
|
"data",
|
||||||
@@ -106,9 +101,8 @@ export const properties = {
|
|||||||
"dav",
|
"dav",
|
||||||
"dbm",
|
"dbm",
|
||||||
"dcstr",
|
"dcstr",
|
||||||
"dds",
|
"dds_pipe",
|
||||||
"derf",
|
"derf",
|
||||||
"dfpwm",
|
|
||||||
"dfa",
|
"dfa",
|
||||||
"dhav",
|
"dhav",
|
||||||
"dif",
|
"dif",
|
||||||
@@ -137,8 +131,6 @@ export const properties = {
|
|||||||
"exr_pipe",
|
"exr_pipe",
|
||||||
"f32be",
|
"f32be",
|
||||||
"f32le",
|
"f32le",
|
||||||
"ec3",
|
|
||||||
"evc",
|
|
||||||
"f4v",
|
"f4v",
|
||||||
"f64be",
|
"f64be",
|
||||||
"f64le",
|
"f64le",
|
||||||
@@ -165,13 +157,13 @@ export const properties = {
|
|||||||
"gdv",
|
"gdv",
|
||||||
"genh",
|
"genh",
|
||||||
"gif",
|
"gif",
|
||||||
|
"gif_pipe",
|
||||||
"gsm",
|
"gsm",
|
||||||
"gxf",
|
"gxf",
|
||||||
"h261",
|
"h261",
|
||||||
"h263",
|
"h263",
|
||||||
"h264",
|
"h264",
|
||||||
"h265",
|
"h265",
|
||||||
"h266",
|
|
||||||
"h26l",
|
"h26l",
|
||||||
"hca",
|
"hca",
|
||||||
"hcom",
|
"hcom",
|
||||||
@@ -188,6 +180,7 @@ export const properties = {
|
|||||||
"ifv",
|
"ifv",
|
||||||
"ilbc",
|
"ilbc",
|
||||||
"image2",
|
"image2",
|
||||||
|
"image2pipe",
|
||||||
"imf",
|
"imf",
|
||||||
"imx",
|
"imx",
|
||||||
"ingenient",
|
"ingenient",
|
||||||
@@ -204,17 +197,21 @@ export const properties = {
|
|||||||
"ivr",
|
"ivr",
|
||||||
"j2b",
|
"j2b",
|
||||||
"j2k",
|
"j2k",
|
||||||
|
"j2k_pipe",
|
||||||
"jack",
|
"jack",
|
||||||
"jacosub",
|
"jacosub",
|
||||||
|
"jpegls_pipe",
|
||||||
|
"jpeg_pipe",
|
||||||
"jv",
|
"jv",
|
||||||
"jpegls",
|
|
||||||
"jpeg",
|
|
||||||
"jxl",
|
|
||||||
"kmsgrab",
|
"kmsgrab",
|
||||||
"kux",
|
"kux",
|
||||||
"kvag",
|
"kvag",
|
||||||
"lavfi",
|
"lavfi",
|
||||||
"laf",
|
"libcdio",
|
||||||
|
"libdc1394",
|
||||||
|
"libgme",
|
||||||
|
"libopenmpt",
|
||||||
|
"live_flv",
|
||||||
"lmlm4",
|
"lmlm4",
|
||||||
"loas",
|
"loas",
|
||||||
"lrc",
|
"lrc",
|
||||||
@@ -227,13 +224,16 @@ export const properties = {
|
|||||||
"m4b",
|
"m4b",
|
||||||
"m4v",
|
"m4v",
|
||||||
"mac",
|
"mac",
|
||||||
|
"matroska",
|
||||||
"mca",
|
"mca",
|
||||||
"mcc",
|
"mcc",
|
||||||
"mdl",
|
"mdl",
|
||||||
"med",
|
"med",
|
||||||
|
"mgsts",
|
||||||
"microdvd",
|
"microdvd",
|
||||||
"mj2",
|
"mj2",
|
||||||
"mjpeg",
|
"mjpeg",
|
||||||
|
"mjpeg_2000",
|
||||||
"mjpg",
|
"mjpg",
|
||||||
"mk3d",
|
"mk3d",
|
||||||
"mka",
|
"mka",
|
||||||
@@ -257,7 +257,9 @@ export const properties = {
|
|||||||
"mpc",
|
"mpc",
|
||||||
"mpc8",
|
"mpc8",
|
||||||
"mpeg",
|
"mpeg",
|
||||||
"mpg",
|
"mpegts",
|
||||||
|
"mpegtsraw",
|
||||||
|
"mpegvideo",
|
||||||
"mpjpeg",
|
"mpjpeg",
|
||||||
"mpl2",
|
"mpl2",
|
||||||
"mpo",
|
"mpo",
|
||||||
@@ -291,27 +293,25 @@ export const properties = {
|
|||||||
"okt",
|
"okt",
|
||||||
"oma",
|
"oma",
|
||||||
"omg",
|
"omg",
|
||||||
"opus",
|
|
||||||
"openal",
|
"openal",
|
||||||
"oss",
|
"oss",
|
||||||
"osq",
|
|
||||||
"paf",
|
"paf",
|
||||||
"pdv",
|
"pam_pipe",
|
||||||
"pam",
|
"pbm_pipe",
|
||||||
"pbm",
|
"pcx_pipe",
|
||||||
"pcx",
|
"pgmyuv_pipe",
|
||||||
"pgmyuv",
|
"pgm_pipe",
|
||||||
"pgm",
|
"pgx_pipe",
|
||||||
"pgx",
|
"photocd_pipe",
|
||||||
"photocd",
|
"pictor_pipe",
|
||||||
"pictor",
|
|
||||||
"pjs",
|
"pjs",
|
||||||
"plm",
|
"plm",
|
||||||
"pmp",
|
"pmp",
|
||||||
"png",
|
"png_pipe",
|
||||||
"ppm",
|
"ppm",
|
||||||
"pp",
|
"ppm_pipe",
|
||||||
"psd",
|
"pp_bnk",
|
||||||
|
"psd_pipe",
|
||||||
"psm",
|
"psm",
|
||||||
"psp",
|
"psp",
|
||||||
"psxstr",
|
"psxstr",
|
||||||
@@ -322,7 +322,7 @@ export const properties = {
|
|||||||
"pvf",
|
"pvf",
|
||||||
"qcif",
|
"qcif",
|
||||||
"qcp",
|
"qcp",
|
||||||
"qdraw",
|
"qdraw_pipe",
|
||||||
"r3d",
|
"r3d",
|
||||||
"rawvideo",
|
"rawvideo",
|
||||||
"rco",
|
"rco",
|
||||||
@@ -334,7 +334,6 @@ export const properties = {
|
|||||||
"rm",
|
"rm",
|
||||||
"roq",
|
"roq",
|
||||||
"rpl",
|
"rpl",
|
||||||
"rka",
|
|
||||||
"rsd",
|
"rsd",
|
||||||
"rso",
|
"rso",
|
||||||
"rt",
|
"rt",
|
||||||
@@ -355,7 +354,6 @@ export const properties = {
|
|||||||
"sbc",
|
"sbc",
|
||||||
"sbg",
|
"sbg",
|
||||||
"scc",
|
"scc",
|
||||||
"sdns",
|
|
||||||
"sdp",
|
"sdp",
|
||||||
"sdr2",
|
"sdr2",
|
||||||
"sds",
|
"sds",
|
||||||
@@ -365,9 +363,10 @@ export const properties = {
|
|||||||
"sfx",
|
"sfx",
|
||||||
"sfx2",
|
"sfx2",
|
||||||
"sga",
|
"sga",
|
||||||
"sgi",
|
"sgi_pipe",
|
||||||
"shn",
|
"shn",
|
||||||
"siff",
|
"siff",
|
||||||
|
"simbiosis_imx",
|
||||||
"sln",
|
"sln",
|
||||||
"smi",
|
"smi",
|
||||||
"smjpeg",
|
"smjpeg",
|
||||||
@@ -389,9 +388,12 @@ export const properties = {
|
|||||||
"stp",
|
"stp",
|
||||||
"str",
|
"str",
|
||||||
"sub",
|
"sub",
|
||||||
|
"subviewer",
|
||||||
|
"subviewer1",
|
||||||
|
"sunrast_pipe",
|
||||||
"sup",
|
"sup",
|
||||||
"svag",
|
"svag",
|
||||||
"svg",
|
"svg_pipe",
|
||||||
"svs",
|
"svs",
|
||||||
"sw",
|
"sw",
|
||||||
"swf",
|
"swf",
|
||||||
@@ -401,8 +403,7 @@ export const properties = {
|
|||||||
"thd",
|
"thd",
|
||||||
"thp",
|
"thp",
|
||||||
"tiertexseq",
|
"tiertexseq",
|
||||||
"tif",
|
"tiff_pipe",
|
||||||
"tiff",
|
|
||||||
"tmv",
|
"tmv",
|
||||||
"truehd",
|
"truehd",
|
||||||
"tta",
|
"tta",
|
||||||
@@ -422,7 +423,6 @@ export const properties = {
|
|||||||
"ul",
|
"ul",
|
||||||
"ult",
|
"ult",
|
||||||
"umx",
|
"umx",
|
||||||
"usm",
|
|
||||||
"uw",
|
"uw",
|
||||||
"v",
|
"v",
|
||||||
"v210",
|
"v210",
|
||||||
@@ -446,14 +446,12 @@ export const properties = {
|
|||||||
"vql",
|
"vql",
|
||||||
"vt",
|
"vt",
|
||||||
"vtt",
|
"vtt",
|
||||||
"vvc",
|
|
||||||
"w64",
|
"w64",
|
||||||
"wa",
|
|
||||||
"wav",
|
"wav",
|
||||||
"way",
|
|
||||||
"wc3movie",
|
"wc3movie",
|
||||||
"webm",
|
"webm",
|
||||||
"webp",
|
"webm_dash_manifest",
|
||||||
|
"webp_pipe",
|
||||||
"webvtt",
|
"webvtt",
|
||||||
"wow",
|
"wow",
|
||||||
"wsaud",
|
"wsaud",
|
||||||
@@ -465,31 +463,32 @@ export const properties = {
|
|||||||
"x11grab",
|
"x11grab",
|
||||||
"xa",
|
"xa",
|
||||||
"xbin",
|
"xbin",
|
||||||
|
"xbm_pipe",
|
||||||
"xl",
|
"xl",
|
||||||
"xm",
|
"xm",
|
||||||
"xmd",
|
|
||||||
"xmv",
|
"xmv",
|
||||||
"xpk",
|
"xpk",
|
||||||
|
"xpm_pipe",
|
||||||
"xvag",
|
"xvag",
|
||||||
|
"xwd_pipe",
|
||||||
"xwma",
|
"xwma",
|
||||||
"y4m",
|
"y4m",
|
||||||
"yop",
|
"yop",
|
||||||
"yuv",
|
"yuv",
|
||||||
"yuv10",
|
"yuv10",
|
||||||
|
"yuv4mpegpipe",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
muxer: [
|
muxer: [
|
||||||
"264",
|
"264",
|
||||||
"265",
|
"265",
|
||||||
"266",
|
|
||||||
"302",
|
"302",
|
||||||
"3g2",
|
"3g2",
|
||||||
"3gp",
|
"3gp",
|
||||||
"a64",
|
"a64",
|
||||||
"aac",
|
"aac",
|
||||||
"ac3",
|
"ac3",
|
||||||
"ac4",
|
|
||||||
"adts",
|
"adts",
|
||||||
"adx",
|
"adx",
|
||||||
"afc",
|
"afc",
|
||||||
@@ -497,32 +496,43 @@ export const properties = {
|
|||||||
"aifc",
|
"aifc",
|
||||||
"aiff",
|
"aiff",
|
||||||
"al",
|
"al",
|
||||||
|
"alaw",
|
||||||
|
"alp",
|
||||||
|
"alsa",
|
||||||
"amr",
|
"amr",
|
||||||
"amv",
|
"amv",
|
||||||
"apm",
|
"apm",
|
||||||
"apng",
|
"apng",
|
||||||
"aptx",
|
"aptx",
|
||||||
"aptxhd",
|
"aptxhd",
|
||||||
|
"aptx_hd",
|
||||||
|
"argo_asf",
|
||||||
"asf",
|
"asf",
|
||||||
|
"asf_stream",
|
||||||
"ass",
|
"ass",
|
||||||
"ast",
|
"ast",
|
||||||
"au",
|
"au",
|
||||||
"aud",
|
|
||||||
"av1",
|
|
||||||
"avi",
|
"avi",
|
||||||
"avif",
|
"avm2",
|
||||||
"avs",
|
"avs",
|
||||||
"avs2",
|
"avs2",
|
||||||
"avs3",
|
|
||||||
"bit",
|
"bit",
|
||||||
"bmp",
|
"bmp",
|
||||||
"c2",
|
"c2",
|
||||||
|
"caca",
|
||||||
"caf",
|
"caf",
|
||||||
"cavs",
|
"cavs",
|
||||||
|
"cavsvideo",
|
||||||
"chk",
|
"chk",
|
||||||
|
"chromaprint",
|
||||||
|
"codec2",
|
||||||
|
"codec2raw",
|
||||||
"cpk",
|
"cpk",
|
||||||
"cvg",
|
"crc",
|
||||||
"dfpwm",
|
"dash",
|
||||||
|
"data",
|
||||||
|
"daud",
|
||||||
|
"dirac",
|
||||||
"dnxhd",
|
"dnxhd",
|
||||||
"dnxhr",
|
"dnxhr",
|
||||||
"dpx",
|
"dpx",
|
||||||
@@ -531,16 +541,30 @@ export const properties = {
|
|||||||
"dv",
|
"dv",
|
||||||
"dvd",
|
"dvd",
|
||||||
"eac3",
|
"eac3",
|
||||||
"ec3",
|
|
||||||
"evc",
|
|
||||||
"exr",
|
"exr",
|
||||||
|
"f32be",
|
||||||
|
"f32le",
|
||||||
"f4v",
|
"f4v",
|
||||||
|
"f64be",
|
||||||
|
"f64le",
|
||||||
|
"fbdev",
|
||||||
"ffmeta",
|
"ffmeta",
|
||||||
|
"ffmetadata",
|
||||||
|
"fifo",
|
||||||
|
"fifo_test",
|
||||||
|
"filmstrip",
|
||||||
|
"film_cpk",
|
||||||
"fits",
|
"fits",
|
||||||
"flac",
|
"flac",
|
||||||
"flm",
|
"flm",
|
||||||
"flv",
|
"flv",
|
||||||
|
"framecrc",
|
||||||
|
"framehash",
|
||||||
|
"framemd5",
|
||||||
"g722",
|
"g722",
|
||||||
|
"g723_1",
|
||||||
|
"g726",
|
||||||
|
"g726le",
|
||||||
"gif",
|
"gif",
|
||||||
"gsm",
|
"gsm",
|
||||||
"gxf",
|
"gxf",
|
||||||
@@ -548,26 +572,32 @@ export const properties = {
|
|||||||
"h263",
|
"h263",
|
||||||
"h264",
|
"h264",
|
||||||
"h265",
|
"h265",
|
||||||
"h266",
|
"hash",
|
||||||
"hdr",
|
"hds",
|
||||||
"hevc",
|
"hevc",
|
||||||
|
"hls",
|
||||||
"ico",
|
"ico",
|
||||||
|
"ilbc",
|
||||||
"im1",
|
"im1",
|
||||||
"im24",
|
"im24",
|
||||||
"im8",
|
"im8",
|
||||||
|
"image2",
|
||||||
|
"image2pipe",
|
||||||
|
"ipod",
|
||||||
"ircam",
|
"ircam",
|
||||||
"isma",
|
"isma",
|
||||||
"ismv",
|
"ismv",
|
||||||
"ivf",
|
"ivf",
|
||||||
"j2c",
|
"j2c",
|
||||||
"j2k",
|
"j2k",
|
||||||
|
"jacosub",
|
||||||
"jls",
|
"jls",
|
||||||
"jp2",
|
"jp2",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
"jpg",
|
"jpg",
|
||||||
"js",
|
"js",
|
||||||
"jss",
|
"jss",
|
||||||
"jxl",
|
"kvag",
|
||||||
"latm",
|
"latm",
|
||||||
"lbc",
|
"lbc",
|
||||||
"ljpg",
|
"ljpg",
|
||||||
@@ -582,9 +612,13 @@ export const properties = {
|
|||||||
"m4a",
|
"m4a",
|
||||||
"m4b",
|
"m4b",
|
||||||
"m4v",
|
"m4v",
|
||||||
|
"matroska",
|
||||||
|
"md5",
|
||||||
|
"microdvd",
|
||||||
"mjpeg",
|
"mjpeg",
|
||||||
"mjpg",
|
"mjpg",
|
||||||
"mkv",
|
"mkv",
|
||||||
|
"mkvtimestamp_v2",
|
||||||
"mlp",
|
"mlp",
|
||||||
"mmf",
|
"mmf",
|
||||||
"mov",
|
"mov",
|
||||||
@@ -594,17 +628,26 @@ export const properties = {
|
|||||||
"mpa",
|
"mpa",
|
||||||
"mpd",
|
"mpd",
|
||||||
"mpeg",
|
"mpeg",
|
||||||
|
"mpeg1video",
|
||||||
|
"mpeg2video",
|
||||||
|
"mpegts",
|
||||||
"mpg",
|
"mpg",
|
||||||
|
"mpjpeg",
|
||||||
"msbc",
|
"msbc",
|
||||||
"mts",
|
"mts",
|
||||||
|
"mulaw",
|
||||||
"mxf",
|
"mxf",
|
||||||
|
"mxf_d10",
|
||||||
|
"mxf_opatom",
|
||||||
|
"null",
|
||||||
"nut",
|
"nut",
|
||||||
"obu",
|
|
||||||
"oga",
|
"oga",
|
||||||
"ogg",
|
"ogg",
|
||||||
"ogv",
|
"ogv",
|
||||||
"oma",
|
"oma",
|
||||||
|
"opengl",
|
||||||
"opus",
|
"opus",
|
||||||
|
"oss",
|
||||||
"pam",
|
"pam",
|
||||||
"pbm",
|
"pbm",
|
||||||
"pcm",
|
"pcm",
|
||||||
@@ -612,14 +655,14 @@ export const properties = {
|
|||||||
"pfm",
|
"pfm",
|
||||||
"pgm",
|
"pgm",
|
||||||
"pgmyuv",
|
"pgmyuv",
|
||||||
"phm",
|
|
||||||
"pix",
|
"pix",
|
||||||
"png",
|
"png",
|
||||||
"ppm",
|
"ppm",
|
||||||
"psp",
|
"psp",
|
||||||
"qoi",
|
"pulse",
|
||||||
"ra",
|
"ra",
|
||||||
"ras",
|
"ras",
|
||||||
|
"rawvideo",
|
||||||
"rco",
|
"rco",
|
||||||
"rcv",
|
"rcv",
|
||||||
"rgb",
|
"rgb",
|
||||||
@@ -627,47 +670,84 @@ export const properties = {
|
|||||||
"roq",
|
"roq",
|
||||||
"rs",
|
"rs",
|
||||||
"rso",
|
"rso",
|
||||||
|
"rtp",
|
||||||
|
"rtp_mpegts",
|
||||||
|
"rtsp",
|
||||||
|
"s16be",
|
||||||
|
"s16le",
|
||||||
|
"s24be",
|
||||||
|
"s24le",
|
||||||
|
"s32be",
|
||||||
|
"s32le",
|
||||||
|
"s8",
|
||||||
|
"sap",
|
||||||
"sb",
|
"sb",
|
||||||
"sbc",
|
"sbc",
|
||||||
"scc",
|
"scc",
|
||||||
|
"sdl",
|
||||||
|
"sdl2",
|
||||||
|
"segment",
|
||||||
"sf",
|
"sf",
|
||||||
"sgi",
|
"sgi",
|
||||||
|
"singlejpeg",
|
||||||
|
"smjpeg",
|
||||||
|
"smoothstreaming",
|
||||||
|
"sndio",
|
||||||
"sox",
|
"sox",
|
||||||
"spdif",
|
"spdif",
|
||||||
"spx",
|
"spx",
|
||||||
"srt",
|
"srt",
|
||||||
"ssa",
|
"ssa",
|
||||||
|
"ssegment",
|
||||||
|
"streamhash",
|
||||||
|
"stream_segment",
|
||||||
"sub",
|
"sub",
|
||||||
"sun",
|
"sun",
|
||||||
"sunras",
|
"sunras",
|
||||||
"sup",
|
"sup",
|
||||||
|
"svcd",
|
||||||
"sw",
|
"sw",
|
||||||
"swf",
|
"swf",
|
||||||
"tco",
|
"tco",
|
||||||
|
"tee",
|
||||||
"tga",
|
"tga",
|
||||||
"thd",
|
"thd",
|
||||||
"tif",
|
"tif",
|
||||||
"tiff",
|
"tiff",
|
||||||
|
"truehd",
|
||||||
"ts",
|
"ts",
|
||||||
"tta",
|
"tta",
|
||||||
"ttml",
|
"ttml",
|
||||||
"tun",
|
"tun",
|
||||||
|
"u16be",
|
||||||
|
"u16le",
|
||||||
|
"u24be",
|
||||||
|
"u24le",
|
||||||
|
"u32be",
|
||||||
|
"u32le",
|
||||||
|
"u8",
|
||||||
"ub",
|
"ub",
|
||||||
"ul",
|
"ul",
|
||||||
|
"uncodedframecrc",
|
||||||
"uw",
|
"uw",
|
||||||
|
"v4l2",
|
||||||
"vag",
|
"vag",
|
||||||
"vbn",
|
|
||||||
"vc1",
|
"vc1",
|
||||||
|
"vc1test",
|
||||||
"vc2",
|
"vc2",
|
||||||
|
"vcd",
|
||||||
|
"vidc",
|
||||||
|
"video4linux2",
|
||||||
"vob",
|
"vob",
|
||||||
"voc",
|
"voc",
|
||||||
"vtt",
|
"vtt",
|
||||||
"vvc",
|
|
||||||
"w64",
|
"w64",
|
||||||
"wav",
|
"wav",
|
||||||
"wbmp",
|
|
||||||
"webm",
|
"webm",
|
||||||
|
"webm_chunk",
|
||||||
|
"webm_dash_manifest",
|
||||||
"webp",
|
"webp",
|
||||||
|
"webvtt",
|
||||||
"wma",
|
"wma",
|
||||||
"wmv",
|
"wmv",
|
||||||
"wtv",
|
"wtv",
|
||||||
@@ -675,10 +755,12 @@ export const properties = {
|
|||||||
"xbm",
|
"xbm",
|
||||||
"xface",
|
"xface",
|
||||||
"xml",
|
"xml",
|
||||||
|
"xv",
|
||||||
"xwd",
|
"xwd",
|
||||||
"y",
|
"y",
|
||||||
"y4m",
|
"y4m",
|
||||||
"yuv",
|
"yuv",
|
||||||
|
"yuv4mpegpipe",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -688,19 +770,42 @@ export async function convert(
|
|||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let extra = "";
|
// let command = "ffmpeg";
|
||||||
let message = "Done";
|
|
||||||
|
|
||||||
if (convertTo === "ico") {
|
// these are containers that can contain multiple formats
|
||||||
// make sure image is 256x256 or smaller
|
// const autoDetect = [
|
||||||
extra = `-filter:v "scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease"`;
|
// "mp4",
|
||||||
message = "Done: resized to 256x256";
|
// "mkv",
|
||||||
}
|
// "avi",
|
||||||
|
// "mov",
|
||||||
|
// "m4a",
|
||||||
|
// "3gp",
|
||||||
|
// "3g2",
|
||||||
|
// "mj2",
|
||||||
|
// "psp",
|
||||||
|
// "m4b",
|
||||||
|
// "ism",
|
||||||
|
// "ismv",
|
||||||
|
// "isma",
|
||||||
|
// "f4v",
|
||||||
|
// ];
|
||||||
|
|
||||||
const command = `ffmpeg -i "${filePath}" ${extra} "${targetPath}"`;
|
// if (!(fileType in autoDetect)) {
|
||||||
|
// command += ` -f "${fileType}"`;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// command += ` -i "${filePath}"`;
|
||||||
|
|
||||||
|
// if (!(convertTo in autoDetect)) {
|
||||||
|
// command += ` -f "${convertTo}"`;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// command += ` "${targetPath}"`;
|
||||||
|
|
||||||
|
const command = `ffmpeg -i "${filePath}" "${targetPath}"`;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(command, (error, stdout, stderr) => {
|
exec(command, (error, stdout, stderr) => {
|
||||||
@@ -716,7 +821,7 @@ export async function convert(
|
|||||||
console.error(`stderr: ${stderr}`);
|
console.error(`stderr: ${stderr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(message);
|
resolve("success");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ export const properties = {
|
|||||||
"svgz",
|
"svgz",
|
||||||
"text",
|
"text",
|
||||||
"tga",
|
"tga",
|
||||||
"tif",
|
|
||||||
"tiff",
|
"tiff",
|
||||||
"tile",
|
"tile",
|
||||||
"tim",
|
"tim",
|
||||||
@@ -228,6 +227,7 @@ export const properties = {
|
|||||||
"jbig",
|
"jbig",
|
||||||
"jng",
|
"jng",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
|
"jpg",
|
||||||
"k",
|
"k",
|
||||||
"m",
|
"m",
|
||||||
"m2v",
|
"m2v",
|
||||||
@@ -313,8 +313,8 @@ export function convert(
|
|||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(
|
exec(
|
||||||
@@ -332,7 +332,7 @@ export function convert(
|
|||||||
console.error(`stderr: ${stderr}`);
|
console.error(`stderr: ${stderr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve("Done");
|
resolve("success");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
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");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,59 +1,68 @@
|
|||||||
import { normalizeFiletype } from "../helpers/normalizeFiletype";
|
|
||||||
import { convert as convertassimp, properties as propertiesassimp } from "./assimp";
|
|
||||||
import { convert as convertFFmpeg, properties as propertiesFFmpeg } from "./ffmpeg";
|
|
||||||
import { convert as convertGraphicsmagick, properties as propertiesGraphicsmagick } from "./graphicsmagick";
|
|
||||||
import { convert as convertLibjxl, properties as propertiesLibjxl } from "./libjxl";
|
|
||||||
import { convert as convertPandoc, properties as propertiesPandoc } from "./pandoc";
|
|
||||||
import { convert as convertresvg, properties as propertiesresvg } from "./resvg";
|
|
||||||
import { convert as convertImage, properties as propertiesImage } from "./vips";
|
import { convert as convertImage, properties as propertiesImage } from "./vips";
|
||||||
import { convert as convertxelatex, properties as propertiesxelatex } from "./xelatex";
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
convert as convertPandoc,
|
||||||
|
properties as propertiesPandoc,
|
||||||
|
} from "./pandoc";
|
||||||
|
|
||||||
|
import {
|
||||||
|
convert as convertFFmpeg,
|
||||||
|
properties as propertiesFFmpeg,
|
||||||
|
} from "./ffmpeg";
|
||||||
|
|
||||||
|
import {
|
||||||
|
convert as convertGraphicsmagick,
|
||||||
|
properties as propertiesGraphicsmagick,
|
||||||
|
} from "./graphicsmagick";
|
||||||
|
|
||||||
|
import {
|
||||||
|
convert as convertPdflatex,
|
||||||
|
properties as propertiesPdflatex,
|
||||||
|
} from "./pdflatex";
|
||||||
|
|
||||||
|
import { convert as convertPoppler, properties as propertiesPoppler } from "./poppler";
|
||||||
|
|
||||||
|
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
|
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
|
||||||
|
|
||||||
const properties: Record<
|
const properties: {
|
||||||
string,
|
[key: string]: {
|
||||||
{
|
|
||||||
properties: {
|
properties: {
|
||||||
from: Record<string, string[]>;
|
from: { [key: string]: string[] };
|
||||||
to: Record<string, string[]>;
|
to: { [key: string]: string[] };
|
||||||
options?: Record<
|
options?: {
|
||||||
string,
|
[key: string]: {
|
||||||
Record<
|
[key: string]: {
|
||||||
string,
|
|
||||||
{
|
|
||||||
description: string;
|
description: string;
|
||||||
type: string;
|
type: string;
|
||||||
default: number;
|
default: number;
|
||||||
}
|
};
|
||||||
>
|
};
|
||||||
>;
|
};
|
||||||
};
|
};
|
||||||
converter: (
|
converter: (
|
||||||
filePath: string,
|
filePath: string,
|
||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
) => unknown;
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
}
|
) => any;
|
||||||
> = {
|
};
|
||||||
libjxl: {
|
} = {
|
||||||
properties: propertiesLibjxl,
|
|
||||||
converter: convertLibjxl,
|
|
||||||
},
|
|
||||||
resvg: {
|
|
||||||
properties: propertiesresvg,
|
|
||||||
converter: convertresvg,
|
|
||||||
},
|
|
||||||
vips: {
|
vips: {
|
||||||
properties: propertiesImage,
|
properties: propertiesImage,
|
||||||
converter: convertImage,
|
converter: convertImage,
|
||||||
},
|
},
|
||||||
xelatex: {
|
pdflatex: {
|
||||||
properties: propertiesxelatex,
|
properties: propertiesPdflatex,
|
||||||
converter: convertxelatex,
|
converter: convertPdflatex,
|
||||||
|
},
|
||||||
|
poppler: {
|
||||||
|
properties: propertiesPoppler,
|
||||||
|
converter: convertPoppler,
|
||||||
},
|
},
|
||||||
pandoc: {
|
pandoc: {
|
||||||
properties: propertiesPandoc,
|
properties: propertiesPandoc,
|
||||||
@@ -63,10 +72,6 @@ const properties: Record<
|
|||||||
properties: propertiesGraphicsmagick,
|
properties: propertiesGraphicsmagick,
|
||||||
converter: convertGraphicsmagick,
|
converter: convertGraphicsmagick,
|
||||||
},
|
},
|
||||||
assimp: {
|
|
||||||
properties: propertiesassimp,
|
|
||||||
converter: convertassimp,
|
|
||||||
},
|
|
||||||
ffmpeg: {
|
ffmpeg: {
|
||||||
properties: propertiesFFmpeg,
|
properties: propertiesFFmpeg,
|
||||||
converter: convertFFmpeg,
|
converter: convertFFmpeg,
|
||||||
@@ -76,19 +81,24 @@ const properties: Record<
|
|||||||
export async function mainConverter(
|
export async function mainConverter(
|
||||||
inputFilePath: string,
|
inputFilePath: string,
|
||||||
fileTypeOriginal: string,
|
fileTypeOriginal: string,
|
||||||
convertTo: string,
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
|
convertTo: any,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
options?: unknown,
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
|
options?: any,
|
||||||
converterName?: string,
|
converterName?: string,
|
||||||
) {
|
) {
|
||||||
const fileType = normalizeFiletype(fileTypeOriginal);
|
const fileType = normalizeFiletype(fileTypeOriginal);
|
||||||
|
|
||||||
let converterFunc: typeof properties["libjxl"]["converter"] | undefined;
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
|
let converterFunc: any;
|
||||||
|
// let converterName = converterName;
|
||||||
|
|
||||||
if (converterName) {
|
if (converterName) {
|
||||||
converterFunc = properties[converterName]?.converter;
|
converterFunc = properties[converterName]?.converter;
|
||||||
} else {
|
} else {
|
||||||
// Iterate over each converter in properties
|
// Iterate over each converter in properties
|
||||||
|
// biome-ignore lint/style/noParameterAssign: <explanation>
|
||||||
for (converterName in properties) {
|
for (converterName in properties) {
|
||||||
const converterObj = properties[converterName];
|
const converterObj = properties[converterName];
|
||||||
|
|
||||||
@@ -98,8 +108,9 @@ export async function mainConverter(
|
|||||||
|
|
||||||
for (const key in converterObj.properties.from) {
|
for (const key in converterObj.properties.from) {
|
||||||
if (
|
if (
|
||||||
converterObj?.properties?.from[key]?.includes(fileType) &&
|
// HOW??
|
||||||
converterObj?.properties?.to[key]?.includes(convertTo)
|
converterObj.properties.from[key].includes(fileType) &&
|
||||||
|
converterObj.properties.to[key].includes(convertTo)
|
||||||
) {
|
) {
|
||||||
converterFunc = converterObj.converter;
|
converterFunc = converterObj.converter;
|
||||||
break;
|
break;
|
||||||
@@ -116,7 +127,7 @@ export async function mainConverter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await converterFunc(
|
await converterFunc(
|
||||||
inputFilePath,
|
inputFilePath,
|
||||||
fileType,
|
fileType,
|
||||||
convertTo,
|
convertTo,
|
||||||
@@ -126,13 +137,7 @@ export async function mainConverter(
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Converted ${inputFilePath} from ${fileType} to ${convertTo} successfully using ${converterName}.`,
|
`Converted ${inputFilePath} from ${fileType} to ${convertTo} successfully using ${converterName}.`,
|
||||||
result,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeof result === "string") {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "Done";
|
return "Done";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -143,7 +148,7 @@ export async function mainConverter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const possibleTargets: Record<string, Record<string, string[]>> = {};
|
const possibleTargets: { [key: string]: { [key: string]: string[] } } = {};
|
||||||
|
|
||||||
for (const converterName in properties) {
|
for (const converterName in properties) {
|
||||||
const converterProperties = properties[converterName]?.properties;
|
const converterProperties = properties[converterName]?.properties;
|
||||||
@@ -168,7 +173,9 @@ for (const converterName in properties) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPossibleTargets = (from: string): Record<string, string[]> => {
|
export const getPossibleTargets = (
|
||||||
|
from: string,
|
||||||
|
): { [key: string]: string[] } => {
|
||||||
const fromClean = normalizeFiletype(from);
|
const fromClean = normalizeFiletype(from);
|
||||||
|
|
||||||
return possibleTargets[fromClean] || {};
|
return possibleTargets[fromClean] || {};
|
||||||
@@ -192,12 +199,11 @@ for (const converterName in properties) {
|
|||||||
}
|
}
|
||||||
possibleInputs.sort();
|
possibleInputs.sort();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
export const getPossibleInputs = () => {
|
||||||
const getPossibleInputs = () => {
|
|
||||||
return possibleInputs;
|
return possibleInputs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const allTargets: Record<string, string[]> = {};
|
const allTargets: { [key: string]: string[] } = {};
|
||||||
|
|
||||||
for (const converterName in properties) {
|
for (const converterName in properties) {
|
||||||
const converterProperties = properties[converterName]?.properties;
|
const converterProperties = properties[converterName]?.properties;
|
||||||
@@ -208,9 +214,9 @@ for (const converterName in properties) {
|
|||||||
|
|
||||||
for (const key in converterProperties.to) {
|
for (const key in converterProperties.to) {
|
||||||
if (allTargets[converterName]) {
|
if (allTargets[converterName]) {
|
||||||
allTargets[converterName].push(...(converterProperties.to[key] || []));
|
allTargets[converterName].push(...converterProperties.to[key]);
|
||||||
} else {
|
} else {
|
||||||
allTargets[converterName] = converterProperties.to[key] || [];
|
allTargets[converterName] = converterProperties.to[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +225,7 @@ export const getAllTargets = () => {
|
|||||||
return allTargets;
|
return allTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
const allInputs: Record<string, string[]> = {};
|
const allInputs: { [key: string]: string[] } = {};
|
||||||
for (const converterName in properties) {
|
for (const converterName in properties) {
|
||||||
const converterProperties = properties[converterName]?.properties;
|
const converterProperties = properties[converterName]?.properties;
|
||||||
|
|
||||||
@@ -229,9 +235,9 @@ for (const converterName in properties) {
|
|||||||
|
|
||||||
for (const key in converterProperties.from) {
|
for (const key in converterProperties.from) {
|
||||||
if (allInputs[converterName]) {
|
if (allInputs[converterName]) {
|
||||||
allInputs[converterName].push(...(converterProperties.from[key] || []));
|
allInputs[converterName].push(...converterProperties.from[key]);
|
||||||
} else {
|
} else {
|
||||||
allInputs[converterName] = converterProperties.from[key] || [];
|
allInputs[converterName] = converterProperties.from[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
119
src/converters/old.sharp.ts
Normal file
119
src/converters/old.sharp.ts
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import sharp from "sharp";
|
||||||
|
import type { FormatEnum } from "sharp";
|
||||||
|
|
||||||
|
// 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 async function convert(
|
||||||
|
filePath: string,
|
||||||
|
fileType: string,
|
||||||
|
convertTo: keyof FormatEnum,
|
||||||
|
targetPath: string,
|
||||||
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
|
options?: any,
|
||||||
|
) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await sharp(filePath).toFormat(convertTo).toFile(targetPath);
|
||||||
|
}
|
||||||
@@ -124,18 +124,12 @@ export function convert(
|
|||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
// set xelatex here
|
|
||||||
const xelatex = ["pdf", "latex"];
|
|
||||||
let option = "";
|
|
||||||
if (xelatex.includes(convertTo)) {
|
|
||||||
option = "--pdf-engine=xelatex";
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(
|
exec(
|
||||||
`pandoc ${option} "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
`pandoc "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
@@ -149,7 +143,7 @@ export function convert(
|
|||||||
console.error(`stderr: ${stderr}`);
|
console.error(`stderr: ${stderr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve("Done");
|
resolve("success");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,18 +14,14 @@ export function convert(
|
|||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// const fileName: string = (targetPath.split("/").pop() as string).replace(".pdf", "")
|
// const fileName: string = (targetPath.split("/").pop() as string).replace(".pdf", "")
|
||||||
const outputPath = targetPath
|
const outputPath = targetPath.split("/").slice(0, -1).join("/").replace("./", "")
|
||||||
.split("/")
|
|
||||||
.slice(0, -1)
|
|
||||||
.join("/")
|
|
||||||
.replace("./", "");
|
|
||||||
exec(
|
exec(
|
||||||
`latexmk -xelatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
`pdflatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
@@ -39,7 +35,7 @@ export function convert(
|
|||||||
console.error(`stderr: ${stderr}`);
|
console.error(`stderr: ${stderr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve("Done");
|
resolve("success");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
115
src/converters/poppler.ts
Normal file
115
src/converters/poppler.ts
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
const { Poppler } = require("node-poppler");
|
||||||
|
const poppler = new Poppler();
|
||||||
|
|
||||||
|
export const properties = {
|
||||||
|
from: {
|
||||||
|
text: ["pdf"],
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
text: [
|
||||||
|
"jpeg",
|
||||||
|
"png",
|
||||||
|
"tiff",
|
||||||
|
"eps",
|
||||||
|
"icc",
|
||||||
|
"pdf",
|
||||||
|
"svg",
|
||||||
|
"ps",
|
||||||
|
"html",
|
||||||
|
"text",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export function convert(
|
||||||
|
filePath: string,
|
||||||
|
fileType: string,
|
||||||
|
convertTo: string,
|
||||||
|
targetPath: string,
|
||||||
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
|
options?: any,
|
||||||
|
): Promise<string> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const cairoFiles = [
|
||||||
|
"jpeg",
|
||||||
|
"png",
|
||||||
|
"tiff",
|
||||||
|
"eps",
|
||||||
|
"icc",
|
||||||
|
"pdf",
|
||||||
|
"svg",
|
||||||
|
"ps",
|
||||||
|
];
|
||||||
|
|
||||||
|
if (cairoFiles.includes(convertTo)) {
|
||||||
|
const popplerOptions: {
|
||||||
|
jpegFile?: boolean;
|
||||||
|
pngFile?: boolean;
|
||||||
|
tiffFile?: boolean;
|
||||||
|
epsFile?: boolean;
|
||||||
|
iccFile?: boolean;
|
||||||
|
pdfFile?: boolean;
|
||||||
|
svgFile?: boolean;
|
||||||
|
psFile?: boolean;
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
switch (convertTo) {
|
||||||
|
case "jpeg":
|
||||||
|
popplerOptions.jpegFile = true;
|
||||||
|
break;
|
||||||
|
case "png":
|
||||||
|
popplerOptions.pngFile = true;
|
||||||
|
break;
|
||||||
|
case "tiff":
|
||||||
|
popplerOptions.tiffFile = true;
|
||||||
|
break;
|
||||||
|
case "eps":
|
||||||
|
popplerOptions.epsFile = true;
|
||||||
|
break;
|
||||||
|
case "icc":
|
||||||
|
popplerOptions.iccFile = true;
|
||||||
|
break;
|
||||||
|
case "pdf":
|
||||||
|
popplerOptions.pdfFile = true;
|
||||||
|
break;
|
||||||
|
case "svg":
|
||||||
|
popplerOptions.svgFile = true;
|
||||||
|
break;
|
||||||
|
case "ps":
|
||||||
|
popplerOptions.psFile = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reject(`Invalid convertTo option: ${convertTo}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
poppler
|
||||||
|
.pdfToCairo(filePath, targetPath, popplerOptions)
|
||||||
|
.then(() => {
|
||||||
|
resolve("success");
|
||||||
|
})
|
||||||
|
.catch((err: Error) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
} else if (convertTo === "html") {
|
||||||
|
poppler
|
||||||
|
.pdfToHtml(filePath, targetPath)
|
||||||
|
.then(() => {
|
||||||
|
resolve("success");
|
||||||
|
})
|
||||||
|
.catch((err: Error) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
} else if (convertTo === "text") {
|
||||||
|
poppler
|
||||||
|
.pdfToText(filePath, targetPath)
|
||||||
|
.then(() => {
|
||||||
|
resolve("success");
|
||||||
|
})
|
||||||
|
.catch((err: Error) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
reject(`Invalid convertTo option: ${convertTo}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { exec } from "node:child_process";
|
import { exec } from "node:child_process";
|
||||||
|
|
||||||
|
|
||||||
// declare possible conversions
|
// declare possible conversions
|
||||||
export const properties = {
|
export const properties = {
|
||||||
from: {
|
from: {
|
||||||
@@ -95,8 +94,8 @@ export function convert(
|
|||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: unknown,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
// if (fileType === "svg") {
|
// if (fileType === "svg") {
|
||||||
// const scale = options.scale || 1;
|
// const scale = options.scale || 1;
|
||||||
@@ -114,29 +113,22 @@ export function convert(
|
|||||||
// .toFormat(convertTo)
|
// .toFormat(convertTo)
|
||||||
// .toFile(targetPath);
|
// .toFile(targetPath);
|
||||||
// }
|
// }
|
||||||
let action = "copy";
|
|
||||||
if (fileType === "pdf") {
|
|
||||||
action = "pdfload";
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(
|
exec(`vips copy "${filePath}" "${targetPath}"`, (error, stdout, stderr) => {
|
||||||
`vips ${action} "${filePath}" "${targetPath}"`,
|
if (error) {
|
||||||
(error, stdout, stderr) => {
|
reject(`error: ${error}`);
|
||||||
if (error) {
|
}
|
||||||
reject(`error: ${error}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
if (stdout) {
|
||||||
console.log(`stdout: ${stdout}`);
|
console.log(`stdout: ${stdout}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
console.error(`stderr: ${stderr}`);
|
console.error(`stderr: ${stderr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve("Done");
|
resolve("success");
|
||||||
},
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ export const normalizeFiletype = (filetype: string): string => {
|
|||||||
const lowercaseFiletype = filetype.toLowerCase();
|
const lowercaseFiletype = filetype.toLowerCase();
|
||||||
|
|
||||||
switch (lowercaseFiletype) {
|
switch (lowercaseFiletype) {
|
||||||
case "jfif":
|
|
||||||
case "jpg":
|
case "jpg":
|
||||||
return "jpeg";
|
return "jpeg";
|
||||||
case "htm":
|
case "htm":
|
||||||
@@ -24,11 +23,10 @@ export const normalizeOutputFiletype = (filetype: string): string => {
|
|||||||
return "jpg";
|
return "jpg";
|
||||||
case "latex":
|
case "latex":
|
||||||
return "tex";
|
return "tex";
|
||||||
case "markdown_phpextra":
|
|
||||||
case "markdown_strict":
|
|
||||||
case "markdown_mmd":
|
|
||||||
case "markdown":
|
case "markdown":
|
||||||
return "md";
|
return "md";
|
||||||
|
case "text":
|
||||||
|
return "txt";
|
||||||
default:
|
default:
|
||||||
return lowercaseFiletype;
|
return lowercaseFiletype;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
import { exec } from "node:child_process";
|
|
||||||
import { version } from "../../package.json";
|
|
||||||
console.log(`ConvertX v${version}`);
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
|
||||||
exec("cat /etc/os-release", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("Not running on docker, this is not supported.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split('PRETTY_NAME="')[1]?.split('"')[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("pandoc -v", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("Pandoc is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("ffmpeg -version", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("FFmpeg is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("vips -v", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("Vips is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("gm version", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("GraphicsMagick is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("djxl --version", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("libjxl-tools is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("xelatex -version", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("Tex Live with XeTeX is not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(stdout.split("\n")[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("resvg -V", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("resvg is not installed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(`resvg v${stdout.split("\n")[0]}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("assimp version", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("assimp is not installed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(`assimp v${stdout.split("\n")[5]}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exec("bun -v", (error, stdout) => {
|
|
||||||
if (error) {
|
|
||||||
console.error("Bun is not installed. wait what");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
|
||||||
console.log(`Bun v${stdout.split("\n")[0]}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import tw from "tailwindcss";
|
|
||||||
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, {
|
|
||||||
from: "./src/main.css",
|
|
||||||
to: "./public/generated.css",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
1165
src/index.tsx
1165
src/index.tsx
File diff suppressed because it is too large
Load Diff
45
src/main.css
45
src/main.css
@@ -1,45 +0,0 @@
|
|||||||
@tailwind base;
|
|
||||||
@tailwind components;
|
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
: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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--contrast: 0, 0, 0;
|
|
||||||
--neutral-900: 17, 24, 39;
|
|
||||||
--neutral-800: 31, 41, 55;
|
|
||||||
--neutral-700: 55, 65, 81;
|
|
||||||
--neutral-600: 75, 85, 99;
|
|
||||||
--neutral-500: 107, 114, 128;
|
|
||||||
--neutral-300: 209, 213, 219;
|
|
||||||
--neutral-400: 156, 163, 175;
|
|
||||||
--neutral-200: 229, 231, 235;
|
|
||||||
--accent-600: 101, 163, 13;
|
|
||||||
--accent-500: 132, 204, 22;
|
|
||||||
--accent-400: 163, 230, 53;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4
src/public/pico.lime.min.css
vendored
Normal file
4
src/public/pico.lime.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
|||||||
User-agent: *
|
|
||||||
Disallow: /
|
|
||||||
@@ -1,98 +1,9 @@
|
|||||||
// Select the file input element
|
// Select the file input element
|
||||||
const fileInput = document.querySelector('input[type="file"]');
|
const fileInput = document.querySelector('input[type="file"]');
|
||||||
const dropZone = document.getElementById("dropzone");
|
|
||||||
const fileNames = [];
|
const fileNames = [];
|
||||||
let fileType;
|
let fileType;
|
||||||
|
|
||||||
dropZone.addEventListener("dragover", () => {
|
const selectContainer = document.querySelector("form > article");
|
||||||
dropZone.classList.add("dragover");
|
|
||||||
});
|
|
||||||
|
|
||||||
dropZone.addEventListener("dragleave", () => {
|
|
||||||
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 convertButton = document.querySelector("input[type='submit']");
|
|
||||||
|
|
||||||
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}`;
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
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");
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// const convertFromSelect = document.querySelector("select[name='convert_from']");
|
// const convertFromSelect = document.querySelector("select[name='convert_from']");
|
||||||
|
|
||||||
@@ -117,7 +28,6 @@ fileInput.addEventListener("change", (e) => {
|
|||||||
|
|
||||||
if (!fileType) {
|
if (!fileType) {
|
||||||
fileType = file.name.split(".").pop();
|
fileType = file.name.split(".").pop();
|
||||||
console.log("fileType", fileType);
|
|
||||||
fileInput.setAttribute("accept", `.${fileType}`);
|
fileInput.setAttribute("accept", `.${fileType}`);
|
||||||
setTitle();
|
setTitle();
|
||||||
|
|
||||||
@@ -139,7 +49,6 @@ fileInput.addEventListener("change", (e) => {
|
|||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
selectContainer.innerHTML = html;
|
selectContainer.innerHTML = html;
|
||||||
updateSearchBar();
|
|
||||||
})
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
}
|
}
|
||||||
@@ -160,7 +69,6 @@ const setTitle = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Add a onclick for the delete button
|
// Add a onclick for the delete button
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const deleteRow = (target) => {
|
const deleteRow = (target) => {
|
||||||
const filename = target.parentElement.parentElement.children[0].textContent;
|
const filename = target.parentElement.parentElement.children[0].textContent;
|
||||||
const row = target.parentElement.parentElement;
|
const row = target.parentElement.parentElement;
|
||||||
@@ -211,9 +119,7 @@ const uploadFiles = (files) => {
|
|||||||
|
|
||||||
const formConvert = document.querySelector("form[action='/convert']");
|
const formConvert = document.querySelector("form[action='/convert']");
|
||||||
|
|
||||||
formConvert.addEventListener("submit", () => {
|
formConvert.addEventListener("submit", (e) => {
|
||||||
const hiddenInput = document.querySelector("input[name='file_names']");
|
const hiddenInput = document.querySelector("input[name='file_names']");
|
||||||
hiddenInput.value = JSON.stringify(fileNames);
|
hiddenInput.value = JSON.stringify(fileNames);
|
||||||
});
|
});
|
||||||
|
|
||||||
updateSearchBar();
|
|
||||||
|
|||||||
21
src/public/style.css
Normal file
21
src/public/style.css
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
article {
|
||||||
|
/* height: 300px; */
|
||||||
|
/* width: 300px; */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
div.icon {
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[type="submit"] {
|
||||||
|
width: 50%
|
||||||
|
}
|
||||||
|
|
||||||
|
div.center {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
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: [require("tailwind-scrollbar")],
|
|
||||||
};
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["ESNext"],
|
"lib": ["ESNext"],
|
||||||
"module": "ESNext",
|
"module": "esnext",
|
||||||
"target": "ES2021",
|
"target": "esnext",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
"types": [
|
||||||
|
"bun-types" // add Bun global
|
||||||
|
],
|
||||||
// non bun init
|
// non bun init
|
||||||
"plugins": [{ "name": "@kitajs/ts-html-plugin" }],
|
"plugins": [{ "name": "@kitajs/ts-html-plugin" }],
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user