Pre-share fixes from final review pass

Blockers
- http://birdnet.local/avian/ now serves the collage (added avian/index.html
  redirect to frontend/; previously the symlink target had no top-level
  index, so users saw a directory listing of api/ assets/ forwarding/
  frontend/ scripts/).
- Gemini model bumped from gemini-2.5-flash-image-preview (deprecated
  2026-01-15) to the stable gemini-2.5-flash-image. Pregen was non-
  functional out of the box.
- avian-mqtt.service: dropped %h (which expands to /root for system-mode
  units regardless of User=). Use WorkingDirectory=~ which DOES respect
  User=, plus a relative ExecStart.
- birdnet-api.php case 'lifelist' now aliases COUNT(*) AS n (was 'total'),
  matching what apt.js reads for atlas card counts. Atlas previously
  always displayed 0.

Bugs
- Retry-After parsing handles HTTP-date format without crashing.
- apt.js no longer fetches firstseen/timeseries (declared in state but
  never consumed). Two wasted round-trips per page load removed.
- update_birdnet.sh defaults branch=avian-visitors so the (opt-in)
  Sunday auto-update cron doesn't reset HEAD to upstream main and
  delete the avian/ overlay.
- recording.php: removed dead $BIRDS_JSON_CANDIDATES.

Polish
- Pregen --sleep default raised 4→6s (more headroom under free-tier RPM).
- en-dash in README BOM (~$35–80) replaced with hyphen for style match.
- Slop sweep across user-facing docs: no em-dashes, no en-dashes, no
  AI-slop word hits (robust/comprehensive/seamless/etc.).
This commit is contained in:
Twarner491
2026-05-28 11:11:20 -07:00
parent 41a051bc55
commit d3241f92cf
17 changed files with 114 additions and 145 deletions
+3 -8
View File
@@ -1,5 +1,5 @@
<?php
// AvianVisitors serves the most-recent detection mp3 for a given
// AvianVisitors - serves the most-recent detection mp3 for a given
// scientific name. Called by the collage detail modal at
// /avian/api/recording.php?sci=<name>.
//
@@ -24,7 +24,7 @@ if ($sci === '' && $file === '') {
// Reject any sci-name that isn't a clean Genus species[ subspecies[ tri]]
// pattern. resolve_common() below falls back to str_replace(' ', '_', $sci)
// when there's no birds.json match without this guard, `?sci=../etc` would
// when there's no birds.json match - without this guard, `?sci=../etc` would
// flow through unmodified into a filesystem path.
if ($sci !== '' && !preg_match('/^[A-Za-z]{2,40}(?:[ ][a-z]{2,40}){1,3}$/', $sci)) {
http_response_code(400);
@@ -93,14 +93,9 @@ if ($file !== '') {
readfile($path);
exit;
}
$BIRDS_JSON_CANDIDATES = [
getenv('HOME') . '/BirdNET-Pi/scripts/birds.json',
getenv('HOME') . '/BirdNET-Pi/model/labels.txt',
];
// ---- Resolve scientific name → common name (with underscores) ----
function resolve_common(string $sci): ?string {
// Try birds.json first (preferred has clean sci/com pairs).
// Try birds.json first (preferred - has clean sci/com pairs).
foreach ([getenv('HOME') . '/BirdNET-Pi/scripts/birds.json'] as $f) {
if (is_readable($f)) {
$list = json_decode((string)file_get_contents($f), true);