cameras/next.config.ts
Michael Mainguy f4d40dbea6 Add image and stream editing with audit log, manual exposure controls
- Per-section Edit/Save for image settings and streams (Server Actions),
  validated against the camera's own ranges; stream saves ask to confirm
  the restart. Results report applied or adjusted values.
- Every write is appended to a local audit log (.data/audit.jsonl).
- In Manual exposure, edit exposure time (with approximate shutter speed)
  and gain; the read-only page shows them, and a hint explains that
  Brightness mainly works in Auto.
- Pin onvif to the mikemainguy fork for complete imaging/encoder setters;
  set turbopack.root automatically when onvif is a linked checkout.
- Export vrek log.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-19 14:44:00 -05:00

35 lines
1.2 KiB
TypeScript

import { realpathSync } from "node:fs";
import path from "node:path";
import type { NextConfig } from "next";
/**
* While onvif is linked to a local checkout outside this project (e.g. the fork, installed
* with `npm install ../onvif --no-save`), Turbopack only resolves files inside its root, so
* the root must contain both (Next docs, 03-api-reference/08-turbopack.md "Root directory").
* Returns undefined for a normal install, leaving the auto-detected root alone.
*/
function linkedPackagesRoot(project: string, packages: string[]): string | undefined {
let root = project;
for (const name of packages) {
let target: string;
try {
target = realpathSync(path.join(project, "node_modules", name));
} catch {
continue;
}
while (path.relative(root, target).startsWith("..")) root = path.dirname(root);
}
return root === project ? undefined : root;
}
const project = process.cwd();
const turbopackRoot = linkedPackagesRoot(project, ["onvif"]);
const nextConfig: NextConfig = {
// onvif uses Node's dgram/os modules; load it with native require instead of bundling.
serverExternalPackages: ["onvif"],
...(turbopackRoot && { turbopack: { root: turbopackRoot } }),
};
export default nextConfig;