mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(lint): clear remaining biome errors (unused code, optional chains, non-null assertions, effect deps)
This commit is contained in:
@@ -326,7 +326,7 @@ export async function authRoutes(app: FastifyInstance): Promise<void> {
|
||||
|
||||
const audit = auditFromRequest(request);
|
||||
|
||||
if (!user || !user.passwordHash) {
|
||||
if (!user?.passwordHash) {
|
||||
authAttempts.inc({ method: "password", result: "failure" });
|
||||
await audit("LOGIN_FAILED", {
|
||||
username: sanitizeAuditInput(body.username),
|
||||
|
||||
@@ -108,7 +108,7 @@ export async function registerSaml(app: FastifyInstance): Promise<void> {
|
||||
return redirectToLogin(reply, "saml_auth_failed");
|
||||
}
|
||||
|
||||
if (!profile || !profile.nameID) {
|
||||
if (!profile?.nameID) {
|
||||
request.log.warn("SAML callback: no profile or nameID in assertion");
|
||||
authAttempts.inc({ method: "saml", result: "failure" });
|
||||
await audit("SAML_LOGIN_FAILED", { reason: "missing_profile" });
|
||||
|
||||
@@ -456,7 +456,8 @@ export async function registerBatchRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Append results from object storage in original upload order
|
||||
try {
|
||||
for (const entry of successEntries) {
|
||||
const stream = await getObjectStream(entry.outputRef!);
|
||||
if (!entry.outputRef) continue;
|
||||
const stream = await getObjectStream(entry.outputRef);
|
||||
archive.append(stream, { name: entry.filename });
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { z } from "zod";
|
||||
import { env } from "../../config.js";
|
||||
import { db, schema } from "../../db/index.js";
|
||||
import { auditFromRequest } from "../../lib/audit.js";
|
||||
import { encrypt, isEncrypted } from "../../lib/encryption.js";
|
||||
import { encrypt } from "../../lib/encryption.js";
|
||||
import { requirePermission } from "../../permissions.js";
|
||||
|
||||
const configSchema = z.object({
|
||||
|
||||
@@ -1161,7 +1161,8 @@ export async function registerPipelineRoutes(app: FastifyInstance): Promise<void
|
||||
// Append results from object storage in original upload order
|
||||
try {
|
||||
for (const entry of successEntries) {
|
||||
const stream = await getObjectStream(entry.outputRef!);
|
||||
if (!entry.outputRef) continue;
|
||||
const stream = await getObjectStream(entry.outputRef);
|
||||
archive.append(stream, { name: entry.filename });
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ export async function registerProgressRoutes(app: FastifyInstance): Promise<void
|
||||
if (!sseListeners.has(jobId)) {
|
||||
sseListeners.set(jobId, new Set());
|
||||
}
|
||||
sseListeners.get(jobId)!.add(callback);
|
||||
sseListeners.get(jobId)?.add(callback);
|
||||
|
||||
// Clean up on client disconnect
|
||||
request.raw.on("close", () => {
|
||||
|
||||
@@ -88,9 +88,10 @@ export function registerHtmlToImage(app: FastifyInstance) {
|
||||
isMobile: preset.isMobile,
|
||||
};
|
||||
|
||||
// Zod refine guarantees either url or html is present
|
||||
const buffer = settings.html
|
||||
? await captureHtml(settings.html, captureOpts)
|
||||
: await capturePage(settings.url!, captureOpts);
|
||||
: await capturePage(settings.url ?? "", captureOpts);
|
||||
|
||||
const jobId = randomUUID();
|
||||
const ext = settings.format;
|
||||
|
||||
Reference in New Issue
Block a user