diff --git a/src/components/header.tsx b/src/components/header.tsx
index 4e94176..15ae929 100644
--- a/src/components/header.tsx
+++ b/src/components/header.tsx
@@ -4,7 +4,7 @@ export const Header = ({ loggedIn }: { loggedIn?: boolean }) => {
rightNav = (
-
- History
+ History
-
Logout
diff --git a/src/converters/ffmpeg.ts b/src/converters/ffmpeg.ts
index e03c3cc..6ac40a3 100644
--- a/src/converters/ffmpeg.ts
+++ b/src/converters/ffmpeg.ts
@@ -659,6 +659,7 @@ export async function convert(
// biome-ignore lint/suspicious/noExplicitAny:
options?: any,
) {
+
return exec(
`ffmpeg -f "${fileType}" -i "${filePath}" -f "${convertTo}" "${targetPath}"`,
(error, stdout, stderr) => {
diff --git a/src/converters/main.ts b/src/converters/main.ts
index 5720c1e..345649e 100644
--- a/src/converters/main.ts
+++ b/src/converters/main.ts
@@ -16,8 +16,8 @@ import {
const properties: {
[key: string]: {
properties: {
- from: string[] | { [key: string]: string[] };
- to: string[] | { [key: string]: string[] };
+ from: { [key: string]: string[] };
+ to: { [key: string]: string[] };
options?: {
[key: string]: {
[key: string]: {
@@ -36,7 +36,7 @@ const properties: {
targetPath: string,
// biome-ignore lint/suspicious/noExplicitAny:
options?: any,
- // biome-ignore lint/suspicious/noExplicitAny:
+ // biome-ignore lint/suspicious/noExplicitAny:
) => any;
};
} = {
@@ -70,12 +70,13 @@ export async function mainConverter(
// biome-ignore lint/suspicious/noExplicitAny:
let converterFunc: any;
+ let converterName = converter;
if (converter) {
converterFunc = properties[converter];
} else {
// Iterate over each converter in properties
- for (const converterName in properties) {
+ for (converterName in properties) {
const converterObj = properties[converterName];
if (!converterObj) {
@@ -84,24 +85,15 @@ export async function mainConverter(
// if converter properties.from is an object loop thorugh the keys otherwise use the array
// for example ffmpeg is an object eg from: {video: ["mp4", "webm"], audio: ["mp3"]}
- if (Array.isArray(converterObj.properties.from) && Array.isArray(converterObj.properties.to)) {
+
+ for (const key in converterObj.properties.from) {
if (
- converterObj.properties.from.includes(fileType) &&
- converterObj.properties.to.includes(convertTo)
+ converterObj.properties.from[key].includes(fileType) &&
+ converterObj.properties.to[key].includes(convertTo)
) {
converterFunc = converterObj.converter;
break;
}
- } else {
- for (const key in converterObj.properties.from) {
- if (
- converterObj.properties.from[key].includes(fileType) &&
- converterObj.properties.to[key].includes(convertTo)
- ) {
- converterFunc = converterObj.converter;
- break;
- }
- }
}
}
}
@@ -141,19 +133,13 @@ for (const converterName in properties) {
continue;
}
- if (Array.isArray(converterProperties.from)) {
- for (const extension of converterProperties.from) {
- possibleConversions[extension] = converterProperties.to;
+ for (const key in converterProperties.from) {
+ if (!converterProperties.from[key] || !converterProperties.to[key]) {
+ continue;
}
- } else {
- for (const key in converterProperties.from) {
- if (!converterProperties.from[key] || !converterProperties.to[key]) {
- continue;
- }
- for (const extension of converterProperties.from[key]) {
- possibleConversions[extension] = converterProperties.to[key];
- }
+ for (const extension of converterProperties.from[key]) {
+ possibleConversions[extension] = converterProperties.to[key];
}
}
}
@@ -178,12 +164,8 @@ let allTargets: string[] = [];
for (const converterName in properties) {
const converterProperties = properties[converterName].properties;
- if (Array.isArray(converterProperties.from)) {
- allTargets = allTargets.concat(converterProperties.to);
- } else {
- for (const key in converterProperties.to) {
- allTargets = allTargets.concat(converterProperties.to[key]);
- }
+ for (const key in converterProperties.to) {
+ allTargets = allTargets.concat(converterProperties.to[key]);
}
}
diff --git a/src/converters/pandoc.ts b/src/converters/pandoc.ts
index aa648f6..0f1c56e 100644
--- a/src/converters/pandoc.ts
+++ b/src/converters/pandoc.ts
@@ -1,118 +1,122 @@
import { exec } from "node:child_process";
export const properties = {
- from: [
- "textile",
- "tikiwiki",
- "tsv",
- "twiki",
- "typst",
- "vimwiki",
- "biblatex",
- "bibtex",
- "bits",
- "commonmark",
- "commonmark_x",
- "creole",
- "csljson",
- "csv",
- "djot",
- "docbook",
- "docx",
- "dokuwiki",
- "endnotexml",
- "epub",
- "fb2",
- "gfm",
- "haddock",
- "html",
- "ipynb",
- "jats",
- "jira",
- "json",
- "latex",
- "man",
- "markdown",
- "markdown_mmd",
- "markdown_phpextra",
- "markdown_strict",
- "mediawiki",
- "muse",
- "pandoc native",
- "opml",
- "org",
- "ris",
- "rst",
- "rtf",
- "t2t",
- ],
- to: [
- "tei",
- "texinfo",
- "textile",
- "typst",
- "xwiki",
- "zimwiki",
- "asciidoc",
- "asciidoc_legacy",
- "asciidoctor",
- "beamer",
- "biblatex",
- "bibtex",
- "chunkedhtml",
- "commonmark",
- "commonmark_x",
- "context",
- "csljson",
- "djot",
- "docbook",
- "docbook4",
- "docbook5",
- "docx",
- "dokuwiki",
- "dzslides",
- "epub",
- "epub2",
- "epub3",
- "fb2",
- "gfm",
- "haddock",
- "html",
- "html4",
- "html5",
- "icml",
- "ipynb",
- "jats",
- "jats_archiving",
- "jats_articleauthoring",
- "jats_publishing",
- "jira",
- "json",
- "latex",
- "man",
- "markdown",
- "markdown_mmd",
- "markdown_phpextra",
- "markdown_strict",
- "markua",
- "mediawiki",
- "ms",
- "muse",
- "pandoc native",
- "odt",
- "opendocument",
- "opml",
- "org",
- "pdf",
- "plain",
- "pptx",
- "revealjs",
- "rst",
- "rtf",
- "s5",
- "slideous",
- "slidy",
- ],
+ from: {
+ text: [
+ "textile",
+ "tikiwiki",
+ "tsv",
+ "twiki",
+ "typst",
+ "vimwiki",
+ "biblatex",
+ "bibtex",
+ "bits",
+ "commonmark",
+ "commonmark_x",
+ "creole",
+ "csljson",
+ "csv",
+ "djot",
+ "docbook",
+ "docx",
+ "dokuwiki",
+ "endnotexml",
+ "epub",
+ "fb2",
+ "gfm",
+ "haddock",
+ "html",
+ "ipynb",
+ "jats",
+ "jira",
+ "json",
+ "latex",
+ "man",
+ "markdown",
+ "markdown_mmd",
+ "markdown_phpextra",
+ "markdown_strict",
+ "mediawiki",
+ "muse",
+ "pandoc native",
+ "opml",
+ "org",
+ "ris",
+ "rst",
+ "rtf",
+ "t2t",
+ ],
+ },
+ to: {
+ text: [
+ "tei",
+ "texinfo",
+ "textile",
+ "typst",
+ "xwiki",
+ "zimwiki",
+ "asciidoc",
+ "asciidoc_legacy",
+ "asciidoctor",
+ "beamer",
+ "biblatex",
+ "bibtex",
+ "chunkedhtml",
+ "commonmark",
+ "commonmark_x",
+ "context",
+ "csljson",
+ "djot",
+ "docbook",
+ "docbook4",
+ "docbook5",
+ "docx",
+ "dokuwiki",
+ "dzslides",
+ "epub",
+ "epub2",
+ "epub3",
+ "fb2",
+ "gfm",
+ "haddock",
+ "html",
+ "html4",
+ "html5",
+ "icml",
+ "ipynb",
+ "jats",
+ "jats_archiving",
+ "jats_articleauthoring",
+ "jats_publishing",
+ "jira",
+ "json",
+ "latex",
+ "man",
+ "markdown",
+ "markdown_mmd",
+ "markdown_phpextra",
+ "markdown_strict",
+ "markua",
+ "mediawiki",
+ "ms",
+ "muse",
+ "pandoc native",
+ "odt",
+ "opendocument",
+ "opml",
+ "org",
+ "pdf",
+ "plain",
+ "pptx",
+ "revealjs",
+ "rst",
+ "rtf",
+ "s5",
+ "slideous",
+ "slidy",
+ ],
+ },
};
export function convert(
diff --git a/src/converters/sharp.ts b/src/converters/sharp.ts
index b6276f2..6c00a39 100644
--- a/src/converters/sharp.ts
+++ b/src/converters/sharp.ts
@@ -3,8 +3,8 @@ import type { FormatEnum } from "sharp";
// declare possible conversions
export const properties = {
- from: ["jpeg", "png", "webp", "gif", "avif", "tiff", "svg"],
- to: ["jpeg", "png", "webp", "gif", "avif", "tiff"],
+ from: { images: ["jpeg", "png", "webp", "gif", "avif", "tiff", "svg"] },
+ to: { images: ["jpeg", "png", "webp", "gif", "avif", "tiff"] },
options: {
svg: {
scale: {
diff --git a/src/index.tsx b/src/index.tsx
index cc1f293..baa3343 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -511,7 +511,7 @@ const app = new Elysia()
}
db.run(
- "UPDATE jobs SET num_files = ? WHERE id = ?",
+ "UPDATE jobs SET num_files = ?, status = 'pending' WHERE id = ?",
fileNames.length,
jobId.value,
);
@@ -540,7 +540,7 @@ const app = new Elysia()
}),
},
)
- .get("/hist", async ({ body, jwt, redirect, cookie: { auth } }) => {
+ .get("/test", async ({ jwt, redirect, cookie: { auth } }) => {
console.log("results page");
if (!auth?.value) {