feat(scan): support iX1600 duplex scanning on Linux

This commit is contained in:
2026-09-17 18:22:43 +02:00
parent cfef07b96d
commit dd37622bb6
24 changed files with 1411 additions and 215 deletions

View File

@@ -1,7 +1,8 @@
import { FastifyInstance, FastifyRequest } from "fastify"
import multipart from "@fastify/multipart"
import { createHash } from "node:crypto"
import { and, asc, eq, sql } from "drizzle-orm"
import { basename } from "node:path"
import { and, asc, eq, inArray, sql } from "drizzle-orm"
import { instanceAgentScanJobs, instanceAgents } from "../../db/schema"
import { saveFile } from "../utils/files"
@@ -178,11 +179,12 @@ export default async function instanceAgentGatewayRoutes(server: FastifyInstance
})
.where(and(
eq(instanceAgentScanJobs.id, req.params.id),
eq(instanceAgentScanJobs.agentId, agent.id)
eq(instanceAgentScanJobs.agentId, agent.id),
inArray(instanceAgentScanJobs.status, ["pending", "running"])
))
.returning()
if (!job) return reply.code(404).send({ error: "Scan job not found" })
if (!job) return reply.code(409).send({ error: "Scan job is no longer active or does not exist" })
return { job }
})
@@ -209,7 +211,8 @@ export default async function instanceAgentGatewayRoutes(server: FastifyInstance
if (!data?.file) return reply.code(400).send({ error: "No file uploaded" })
const fileBuffer = await data.toBuffer()
const filename = job.requestedFilename || data.filename || `${job.id}.pdf`
// The agent normalizes the extension to the actual output format.
const filename = basename(data.filename || job.requestedFilename || `${job.id}.pdf`)
const createdFile = await saveFile(
server,