Merge branch 'main' into main

This commit is contained in:
Kosztyk 2025-12-26 23:43:51 +01:00 committed by GitHub
commit 09e0e840b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 492 additions and 106 deletions

View file

@ -456,6 +456,7 @@ export const properties = {
"webm",
"webp",
"webvtt",
"wma",
"wow",
"wsaud",
"wsd",
@ -699,7 +700,7 @@ export async function convert(
let message = "Done";
if (convertTo === "ico") {
// make sure image is 256x256 or smaller
// Make sure image is 256x256 or smaller
extraArgs = [
"-filter:v",
"scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease",
@ -708,7 +709,7 @@ export async function convert(
}
if (convertTo.split(".").length > 1) {
// support av1.mkv and av1.mp4 and h265.mp4 etc.
// Support av1.mkv and av1.mp4 and h265.mp4 etc.
const split = convertTo.split(".");
const codec_short = split[0];
@ -730,11 +731,14 @@ export async function convert(
// Parse FFMPEG_ARGS environment variable into array
const ffmpegArgs = process.env.FFMPEG_ARGS ? process.env.FFMPEG_ARGS.split(/\s+/) : [];
const ffmpegOutputArgs = process.env.FFMPEG_OUTPUT_ARGS
? process.env.FFMPEG_OUTPUT_ARGS.split(/\s+/)
: [];
return new Promise((resolve, reject) => {
execFile(
"ffmpeg",
[...ffmpegArgs, "-i", filePath, ...extraArgs, targetPath],
[...ffmpegArgs, "-i", filePath, ...ffmpegOutputArgs, ...extraArgs, targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);

View file

@ -28,21 +28,4 @@ export const MAX_CONVERT_PROCESS =
export const UNAUTHENTICATED_USER_SHARING =
process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false;
// ─────────────────────────────────────────────────────────────
// ClamAV / Antivirus integration
// ─────────────────────────────────────────────────────────────
// REST endpoint of benzino77/clamav-rest-api, e.g.
// CLAMAV_URL=http://192.168.68.134:3000/api/v1/scan
export const CLAMAV_URL = process.env.CLAMAV_URL ?? "";
// True only if CLAMAV_URL is non-empty
export const CLAMAV_CONFIGURED = CLAMAV_URL.length > 0;
// Default AV toggle value:
// - If ANTIVIRUS_ENABLED_DEFAULT=false → force disabled
// - Otherwise: enabled only when CLAMAV is configured
export const ANTIVIRUS_ENABLED_DEFAULT =
process.env.ANTIVIRUS_ENABLED_DEFAULT?.toLowerCase() === "false"
? false
: CLAMAV_CONFIGURED;
export const TIMEZONE = process.env.TZ || undefined;

View file

@ -1,10 +1,11 @@
import { exec } from "node:child_process";
import { readFile } from "node:fs";
import { version } from "../../package.json";
console.log(`ConvertX v${version}`);
if (process.env.NODE_ENV === "production") {
exec("cat /etc/os-release", (error, stdout) => {
readFile("/etc/os-release", "utf8", (error, stdout) => {
if (error) {
console.error("Not running on docker, this is not supported.");
}

View file

@ -3,7 +3,7 @@ import { BaseHtml } from "../components/base";
import { Header } from "../components/header";
import db from "../db/db";
import { Filename, Jobs } from "../db/types";
import { ALLOW_UNAUTHENTICATED, HIDE_HISTORY, LANGUAGE, WEBROOT } from "../helpers/env";
import { ALLOW_UNAUTHENTICATED, HIDE_HISTORY, LANGUAGE, TIMEZONE, WEBROOT } from "../helpers/env";
import { userService } from "./user";
import { EyeIcon } from "../icons/eye";
import { DeleteIcon } from "../icons/delete";
@ -129,7 +129,11 @@ export const history = new Elysia().use(userService).get(
/>
</svg>
</td>
<td safe>{new Date(job.date_created).toLocaleTimeString(LANGUAGE)}</td>
<td safe>
{new Date(job.date_created).toLocaleTimeString(LANGUAGE, {
timeZone: TIMEZONE,
})}
</td>
<td>{job.num_files}</td>
<td class="max-sm:hidden">{job.finished_files}</td>
<td safe>{job.status}</td>