Skip to content

Commit 81f109f

Browse files
committed
chore: format files
1 parent 858ee28 commit 81f109f

File tree

15 files changed

+77
-63
lines changed

15 files changed

+77
-63
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
1818
4. See error
1919

2020
**Checklist:**
21+
2122
- [ ] I am accessing ConvertX over HTTPS or have `HTTP_ALLOWED=true`

.github/ISSUE_TEMPLATE/converter_request.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ name: Converter request
33
about: Suggest an converter for this project
44
title: "[Converter Request]"
55
labels: "converter request"
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**What file formats is missing?**
10+
1111
<!-- Provide an example of what you would like to convert -->
1212

1313
**What converter should be added**
14+
1415
<!-- It has to be free and preferably open source -->
1516

1617
**Are you willing to add it?**
18+
1719
<!-- Adding a converter is very easy just copy one of the existing and modify it -->
20+
1821
- [ ] Yes
1922
- [ ] No
2023

2124
**Additional context**
22-
<!-- Add any other context or screenshots about the feature request here. -->
25+
26+
<!-- Add any other context or screenshots about the feature request here. -->

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Feature request
33
about: Suggest an idea for this project
44
title: "[Feature Request]"
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the solution you'd like**

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
## [0.14.1](https://github.com/C4illin/ConvertX/compare/v0.14.0...v0.14.1) (2025-06-04)
44

5-
65
### Bug Fixes
76

8-
* change to baseline build ([6ea3058](https://github.com/C4illin/ConvertX/commit/6ea3058e66262f7a14633bddcecd5573948f524a)), closes [#311](https://github.com/C4illin/ConvertX/issues/311)
7+
- change to baseline build ([6ea3058](https://github.com/C4illin/ConvertX/commit/6ea3058e66262f7a14633bddcecd5573948f524a)), closes [#311](https://github.com/C4illin/ConvertX/issues/311)
98

109
## [0.14.0](https://github.com/C4illin/ConvertX/compare/v0.13.0...v0.14.0) (2025-06-03)
1110

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ All are optional, JWT_SECRET is recommended to be set.
9494
| LANGUAGE | en | Language to format date strings in, specified as a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) |
9595
| UNAUTHENTICATED_USER_SHARING | false | Shares conversion history between all unauthenticated users |
9696

97-
9897
### Docker images
9998

10099
There is a `:latest` tag that is updated with every release and a `:main` tag that is updated with every push to the main branch. `:latest` is recommended for normal use.

renovate.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
"enabled": true,
66
"automerge": true
77
},
8-
"ignoreDeps": [
9-
"bun-types",
10-
"@types/bun"
11-
]
8+
"ignoreDeps": ["bun-types", "@types/bun"]
129
}

src/converters/calibre.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,20 @@ export async function convert(
6666
options?: unknown,
6767
): Promise<string> {
6868
return new Promise((resolve, reject) => {
69-
execFile(
70-
"ebook-convert",
71-
[filePath, targetPath],
72-
(error, stdout, stderr) => {
73-
if (error) {
74-
reject(`error: ${error}`);
75-
}
69+
execFile("ebook-convert", [filePath, targetPath], (error, stdout, stderr) => {
70+
if (error) {
71+
reject(`error: ${error}`);
72+
}
7673

77-
if (stdout) {
78-
console.log(`stdout: ${stdout}`);
79-
}
74+
if (stdout) {
75+
console.log(`stdout: ${stdout}`);
76+
}
8077

81-
if (stderr) {
82-
console.error(`stderr: ${stderr}`);
83-
}
78+
if (stderr) {
79+
console.error(`stderr: ${stderr}`);
80+
}
8481

85-
resolve("Done");
86-
},
87-
);
82+
resolve("Done");
83+
});
8884
});
8985
}

src/converters/main.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Cookie } from "elysia";
12
import db from "../db/db";
23
import { MAX_CONVERT_PROCESS } from "../helpers/env";
34
import { normalizeFiletype, normalizeOutputFiletype } from "../helpers/normalizeFiletype";
@@ -119,11 +120,11 @@ const properties: Record<
119120
};
120121

121122
function chunks<T>(arr: T[], size: number): T[][] {
122-
if(size <= 0){
123-
return [arr]
123+
if (size <= 0) {
124+
return [arr];
124125
}
125126
return Array.from({ length: Math.ceil(arr.length / size) }, (_: T, i: number) =>
126-
arr.slice(i * size, i * size + size)
127+
arr.slice(i * size, i * size + size),
127128
);
128129
}
129130

@@ -133,17 +134,15 @@ export async function handleConvert(
133134
userOutputDir: string,
134135
convertTo: string,
135136
converterName: string,
136-
jobId: any
137+
jobId: Cookie<string | undefined>,
137138
) {
138-
139139
const query = db.query(
140140
"INSERT INTO file_names (job_id, file_name, output_file_name, status) VALUES (?1, ?2, ?3, ?4)",
141141
);
142142

143-
144143
for (const chunk of chunks(fileNames, MAX_CONVERT_PROCESS)) {
145144
const toProcess: Promise<string>[] = [];
146-
for(const fileName of chunk) {
145+
for (const fileName of chunk) {
147146
const filePath = `${userUploadsDir}${fileName}`;
148147
const fileTypeOrig = fileName.split(".").pop() ?? "";
149148
const fileType = normalizeFiletype(fileTypeOrig);
@@ -154,21 +153,16 @@ export async function handleConvert(
154153
);
155154
const targetPath = `${userOutputDir}${newFileName}`;
156155
toProcess.push(
157-
new Promise((resolve, reject) => {
158-
mainConverter(
159-
filePath,
160-
fileType,
161-
convertTo,
162-
targetPath,
163-
{},
164-
converterName,
165-
).then(r => {
156+
new Promise((resolve, reject) => {
157+
mainConverter(filePath, fileType, convertTo, targetPath, {}, converterName)
158+
.then((r) => {
166159
if (jobId.value) {
167160
query.run(jobId.value, fileName, newFileName, r);
168161
}
169162
resolve(r);
170-
}).catch(c => reject(c));
171-
})
163+
})
164+
.catch((c) => reject(c));
165+
}),
172166
);
173167
}
174168
await Promise.all(toProcess);

src/converters/msgconvert.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function convert(
2323
// msgconvert will output to the same directory as the input file with .eml extension
2424
// We need to use --outfile to specify the target path
2525
const args = ["--outfile", targetPath, filePath];
26-
26+
2727
execFile("msgconvert", args, (error, stdout, stderr) => {
2828
if (error) {
2929
reject(new Error(`msgconvert failed: ${error.message}`));
@@ -33,13 +33,19 @@ export function convert(
3333
if (stderr) {
3434
// Log sanitized stderr to avoid exposing sensitive paths
3535
const sanitizedStderr = stderr.replace(/(\/[^\s]+)/g, "[REDACTED_PATH]");
36-
console.warn(`msgconvert stderr: ${sanitizedStderr.length > 200 ? sanitizedStderr.slice(0, 200) + '...' : sanitizedStderr}`);
36+
console.warn(
37+
`msgconvert stderr: ${sanitizedStderr.length > 200 ? sanitizedStderr.slice(0, 200) + "..." : sanitizedStderr}`,
38+
);
3739
}
3840

3941
resolve(targetPath);
4042
});
4143
} else {
42-
reject(new Error(`Unsupported conversion from ${fileType} to ${convertTo}. Only MSG to EML conversion is currently supported.`));
44+
reject(
45+
new Error(
46+
`Unsupported conversion from ${fileType} to ${convertTo}. Only MSG to EML conversion is currently supported.`,
47+
),
48+
);
4349
}
4450
});
4551
}

src/helpers/env.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export const WEBROOT = process.env.WEBROOT ?? "";
1616

1717
export const LANGUAGE = process.env.LANGUAGE?.toLowerCase() || "en";
1818

19-
export const MAX_CONVERT_PROCESS = process.env.MAX_CONVERT_PROCESS && Number(process.env.MAX_CONVERT_PROCESS) > 0 ? Number(process.env.MAX_CONVERT_PROCESS) : 0
19+
export const MAX_CONVERT_PROCESS =
20+
process.env.MAX_CONVERT_PROCESS && Number(process.env.MAX_CONVERT_PROCESS) > 0
21+
? Number(process.env.MAX_CONVERT_PROCESS)
22+
: 0;
2023

2124
export const UNAUTHENTICATED_USER_SHARING =
22-
process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false;
25+
process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false;

0 commit comments

Comments
 (0)