Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ body:
attributes:
label: ALPR Community version
description: Find this under Settings → Release. Include the source revision there when reporting an installation or update problem.
placeholder: v0.1.61
placeholder: v0.1.62
validations:
required: true

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.1.62 — 2026-11-04

- Add **Delete input** to Axis and Blue Iris camera input settings, including automatically discovered Blue Iris cameras, with a named confirmation dialog.
- Stop imports, revoke the deleted input's HTTP credential, retire its live MQTT subscription, and cancel queued detections and unfinished passages. Preserve saved plate reads, direction observations, images, shared brokers, and other camera inputs.
- Keep deleted inputs out of the settings list after refresh. Re-adding the same camera creates a fresh input identity and credential; stale deletion requests cannot remove its replacement.
- Add a tracked database migration and real PostgreSQL, MQTT and browser coverage for deletion, in-flight processing and history preservation. Update User Guide 3.30 and current install/update guidance; existing installations use the normal updater without manual SQL.

## 0.1.61 — 2026-11-02

- Return HTTP 404 for Home Assistant display image IDs outside the supported PostgreSQL integer range. Reject these IDs before querying images, avoiding the previous HTTP 503 response.
Expand Down
19 changes: 19 additions & 0 deletions app/api/camera-inputs/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getPool } from "@/lib/db";
import { denyUnlessRoutePermission } from "@/lib/route-permission.mjs";
import { CameraInputRepository } from "@/lib/camera-inputs/repository.mjs";
import { InputError, readAxisRequest } from "@/lib/camera-inputs/axis.mjs";
import { refreshCameraInputs } from "@/lib/camera-inputs/runtime.mjs";

export async function GET() {
const denied = await denyUnlessRoutePermission("system.manage_settings");
Expand Down Expand Up @@ -59,3 +60,21 @@ export async function POST(request) {
);
}
}

export async function DELETE(request) {
const denied = await denyUnlessRoutePermission("system.manage_settings");
if (denied) return denied;
try {
const data = await readAxisRequest(request, 64 * 1024);
if (!data || Array.isArray(data) || typeof data !== "object")
throw new InputError("Expected a camera input to delete");
const result = await new CameraInputRepository(await getPool()).remove(data);
refreshCameraInputs();
return Response.json(result, { headers: { "Cache-Control": "no-store" } });
} catch (error) {
return Response.json(
{ error: error instanceof InputError ? error.message : "Unable to delete camera input" },
{ status: error instanceof InputError ? error.status : 503 },
);
}
}
86 changes: 81 additions & 5 deletions components/settings/CameraInputs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import Link from "next/link";
import Image from "next/image";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import {
AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription,
AlertDialogFooter, AlertDialogHeader, AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import {
Card,
CardContent,
Expand All @@ -30,13 +34,13 @@ const blank = {
};
const selectClass =
"h-10 w-full rounded-md border border-input bg-background px-3 text-sm";
async function api(url, data) {
async function api(url, data, method = "POST") {
const response = await fetch(
url,
data === undefined
? { cache: "no-store" }
: {
method: "POST",
method,
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
},
Expand Down Expand Up @@ -69,6 +73,10 @@ export function CameraInputs() {
const [brokerDraft, setBrokerDraft] = useState(null);
const [origin, setOrigin] = useState("");
const [loaded, setLoaded] = useState(false);
const [deleteTarget, setDeleteTarget] = useState(null);
const [deleteError, setDeleteError] = useState("");
const deleteTrigger = useRef(null);
const addCameraButton = useRef(null);
const load = useCallback(async () => {
const result = await api("/api/camera-inputs");
setInputs(result.inputs);
Expand Down Expand Up @@ -169,6 +177,35 @@ export function CameraInputs() {
setBusy(false);
}
}
async function remove() {
const target = deleteTarget;
if (!target || busy) return;
setBusy(true);
setDeleteError("");
try {
await api("/api/camera-inputs", { id: target.id, camera_name: target.camera_name }, "DELETE");
setInputs((current) => current.filter((input) => input.camera_name !== target.camera_name));
if (draft?.camera_name === target.camera_name) {
setDraft(null);
setBrokerDraft(null);
}
setCredential((current) => current?.id === target.id ? null : current);
setListening(null);
setEvents([]);
setDeleteTarget(null);
setMessage("Camera input deleted. Saved plate history and images are kept.");
await load().catch(() => setMessage("Camera input deleted. Refresh the page to reload the list."));
} catch (error) {
setDeleteError(error.message);
} finally {
setBusy(false);
}
}
const confirmDelete = (input) => {
deleteTrigger.current = document.activeElement;
setDeleteError("");
setDeleteTarget(input);
};
return (
<div className="space-y-6">
<Card>
Expand All @@ -181,7 +218,7 @@ export function CameraInputs() {
Existing Blue Iris cameras work automatically.
</CardDescription>
</div>
<Button onClick={() => edit(blank)}>Add camera input</Button>
<Button ref={addCameraButton} onClick={() => edit(blank)}>Add camera input</Button>
</div>
</CardHeader>
<CardContent>
Expand Down Expand Up @@ -259,6 +296,15 @@ export function CameraInputs() {
) : null}
</>
) : null}
<Button
variant="destructive"
size="sm"
disabled={busy}
aria-label={`Delete input ${input.camera_name}`}
onClick={() => confirmDelete(input)}
>
Delete input
</Button>
</div>
</td>
</tr>
Expand All @@ -270,6 +316,7 @@ export function CameraInputs() {
<p className="py-6 text-muted-foreground">
Connect your first camera using Add camera input. Existing Blue
Iris feeds also appear automatically after their first read.
To reconnect a deleted camera, use Add camera input.
</p>
) : null}
</CardContent>
Expand Down Expand Up @@ -633,10 +680,15 @@ export function CameraInputs() {
/>
Enable this input
</label>
<div className="flex gap-3">
<div className="flex flex-wrap gap-3">
<Button disabled={busy || !draft.source} type="submit">
{busy ? "Saving…" : "Save camera input"}
</Button>
{draft.id || draft.legacy ? (
<Button type="button" variant="destructive" disabled={busy} onClick={() => confirmDelete(draft)}>
Delete input
</Button>
) : null}
<Button
type="button"
variant="outline"
Expand Down Expand Up @@ -738,6 +790,30 @@ export function CameraInputs() {
Configure Blue Iris
</Link>
</p>
<AlertDialog open={Boolean(deleteTarget)} onOpenChange={(open) => {
if (!open && !busy) { setDeleteTarget(null); setDeleteError(""); }
}}>
<AlertDialogContent onCloseAutoFocus={(event) => {
event.preventDefault();
const target = deleteTrigger.current?.isConnected ? deleteTrigger.current : addCameraButton.current;
target?.focus();
}}>
<AlertDialogHeader>
<AlertDialogTitle>Delete camera input?</AlertDialogTitle>
<AlertDialogDescription>
ALPR will stop importing from <strong>{deleteTarget?.camera_name}</strong> and cancel its queued detections
and unfinished passages. Saved plate history and images are kept.
</AlertDialogDescription>
</AlertDialogHeader>
{deleteError ? <p role="alert" className="text-sm text-destructive">{deleteError}</p> : null}
<AlertDialogFooter>
<AlertDialogCancel disabled={busy}>Cancel</AlertDialogCancel>
<Button variant="destructive" disabled={busy} onClick={() => void remove()}>
{busy ? "Deleting…" : "Delete input"}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
}
15 changes: 15 additions & 0 deletions docs/CAMERA_INPUTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ Open **Settings > Integrations > Camera Inputs**. Select a recognition source fo

Recognition and recording are independent. An Axis camera may supply recognition directly while Blue Iris continues recording it. This integration does not manufacture Blue Iris alert/clip pointers for Axis events; playback pointers require an actual Blue Iris alert association. The existing Blue Iris recording setup remains available independently.

## Delete a camera input

Select **Delete input** in the camera's Actions column or configuration form,
then confirm the named camera. Deletion stops new imports, revokes the input's
HTTP credential and disconnects its MQTT subscription. Queued detections and
unfinished passages are cancelled. Saved plate reads, direction observations,
and saved plate/scene images are preserved, so the camera can still appear in
historical data filters.

Deleted inputs stay out of this settings list, including Blue Iris cameras
discovered from history. Blue Iris recognition for a deleted camera name is
ignored until you explicitly add that name again. **Add camera input** can
reuse the name and device identity with a fresh input ID and HTTP credential.
The camera's own publishing setup and a shared MQTT broker are managed separately.

## Blue Iris

Use the exact camera name sent in the Blue Iris alert JSON. Send the existing alert body to `/api/plate-reads`, authenticated with the existing integration API key in `x-api-key` or `Authorization: Bearer`. Existing unregistered camera names continue to be accepted automatically.
Expand Down
7 changes: 6 additions & 1 deletion docs/COMMUNITY_PRODUCT_ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Community product roadmap

Last reviewed: November 2, 2026
Last reviewed: November 4, 2026

## Reliable upgrades and integration setup

Expand All @@ -24,6 +24,11 @@ while preserving original observations and human review. Recognition remains
independent of recording. Real Axis camera/firmware validation remains outstanding;
see [Camera inputs](CAMERA_INPUTS.md) for supported formats and setup.

Community v0.1.62 adds camera input deletion for Axis and Blue Iris, including
automatically discovered Blue Iris cameras. Deletion stops imports and cancels
unfinished work while preserving saved plate history and images. Deleted inputs
stay hidden; explicitly adding the camera again creates a fresh input identity.

## Adjustable table columns

Community v0.1.58 adds draggable header dividers to Recognition Feed and Plate
Expand Down
2 changes: 1 addition & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Clone the canonical repository and detach at the exact stable release tag:
```bash
git clone https://github.com/prsmith777/ALPR-Database-Community.git
cd ALPR-Database-Community
git checkout --detach v0.1.61
git checkout --detach v0.1.62
./alpr-community install
```

Expand Down
19 changes: 16 additions & 3 deletions docs/UPDATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ shown on the GitHub Releases page, rather than deploying moving `main`:
```bash
git clone https://github.com/prsmith777/ALPR-Database-Community.git
cd ALPR-Database-Community
git checkout --detach v0.1.61
git checkout --detach v0.1.62
./alpr-community install
```

Expand Down Expand Up @@ -88,7 +88,7 @@ alpr_native_update() (
set -Eeuo pipefail
download_dir="$(mktemp -d /tmp/alpr-maintenance-download.XXXXXX)"
trap 'rm -rf -- "$download_dir"' EXIT
asset_base="https://github.com/prsmith777/ALPR-Database-Community/releases/download/v0.1.61"
asset_base="https://github.com/prsmith777/ALPR-Database-Community/releases/download/v0.1.62"
curl -fLsS --retry 3 "$asset_base/community-maintenance.sh" -o "$download_dir/community-maintenance.sh"
curl -fLsS --retry 3 "$asset_base/community-maintenance.sh.sha256" -o "$download_dir/community-maintenance.sh.sha256"
(cd "$download_dir" && sha256sum --check --strict community-maintenance.sh.sha256)
Expand All @@ -99,7 +99,7 @@ unset -f alpr_native_update
```

The launcher verifies the canonical repository and exact released tag, loads the
fixed tools outside your checkout, and asks for **INSTALL v0.1.61**. It uses the
fixed tools outside your checkout, and asks for **INSTALL v0.1.62**. It uses the
same guarded backup/install workflow and does not reset or reinstall your system.
It temporarily stops only this installation's matching per-user systemd update
agent, then restarts it with the installed code. Keep the terminal open and do
Expand Down Expand Up @@ -372,6 +372,19 @@ ALPR_UPDATE_CLEANUP=ALPR_UPDATE_CLEANUP
These acknowledgements prevent an unattended typo from installing, accepting,
rolling back, or deleting rollback assets. They are not passwords.

## v0.1.62: camera input deletion

Use the normal Windows or Linux update workflow. The updater applies the new
tracked migration without manual SQL. Existing camera inputs remain enabled
and keep their saved configuration unless you explicitly delete them.

Open **Settings > Integrations > Camera Inputs**, select **Delete input**, and
confirm the named camera. Imports stop, queued detections and unfinished passages
are cancelled, and saved plate history and images are kept. Deleted Blue Iris
camera names are ignored until explicitly added again. To reconnect any deleted
camera, use **Add camera input** and configure its new HTTP endpoint/credential
or MQTT subscription as appropriate. See [Camera inputs](CAMERA_INPUTS.md).

## v0.1.61: Home Assistant image validation

Use the normal update workflow. Oversized display image IDs now return HTTP 404
Expand Down
7 changes: 6 additions & 1 deletion lib/camera-inputs/processor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class AxisEventProcessor {
const client = await this.pool.connect();
let lockKey;
let locked = false;
let inputLocked = false;
let transaction = false;
let committed = false;
const files = [];
Expand All @@ -72,12 +73,14 @@ export class AxisEventProcessor {
)
).rows[0].locked;
if (!locked) return false;
await client.query("SELECT pg_advisory_lock_shared(hashtextextended($1,2))", [receipt.input_id]);
inputLocked = true;
const input = (
await client.query("SELECT * FROM public.camera_inputs WHERE id=$1", [
receipt.input_id,
])
).rows[0];
if (!input?.enabled || input.source !== "axis") return false;
if (!input?.enabled || input.deleted_at || input.source !== "axis") return false;
const current = (
await client.query(
"SELECT * FROM public.camera_input_events WHERE id=$1",
Expand Down Expand Up @@ -351,6 +354,8 @@ export class AxisEventProcessor {
);
throw error;
} finally {
if (inputLocked)
await client.query("SELECT pg_advisory_unlock_shared(hashtextextended($1,2))", [receipt.input_id]).catch(() => {});
if (locked)
await client
.query("SELECT pg_advisory_unlock(hashtextextended($1,0))", [lockKey])
Expand Down
Loading
Loading