Commit Graph

3035 Commits

Author SHA1 Message Date
Teddy Warner e5bb5fbbc8 [BUG] atlas: open morph no longer snaps the card on a quick close (#5) 2026-06-11 17:39:00 -07:00
Karina Macancela 50e7012c64 Fix atlas modal close snap (#3) 2026-06-11 17:32:52 -07:00
Twarner491 9b262ffa34 [DOC] document the illustration regeneration pipeline 2026-06-08 12:00:36 -07:00
Twarner491 ee5fffd8fb [FEAT] scripts: adversarial species-ID and anatomy verifier 2026-06-08 12:00:36 -07:00
Twarner491 23fa8311f8 [FEAT] scripts: cream-ground generation and BiRefNet cutout pipeline 2026-06-08 12:00:36 -07:00
Twarner491 68b216745e [FEAT] collage: refreshed bird library, rare flight poses, responsive layout 2026-06-08 12:00:36 -07:00
Twarner491 8025dfa88d [FEAT] ui: auto-close menu on nav + click-to-advance segmented toggles 2026-06-05 16:37:10 -07:00
Twarner491 511e0bfb24 [FEAT] motion: staggered view entrances synced to the slide + card↔modal morph 2026-06-05 16:36:56 -07:00
Twarner491 85afadb058 [BUG] spectrograms: render live & modal strips in the active theme 2026-06-05 16:36:30 -07:00
Twarner491 a0f8d57708 [FEAT] atlas: spectrogram preview on card play + "lifer" badge 2026-06-05 16:35:54 -07:00
Twarner491 ddb7c557e9 [FEAT] stats: editorial detection timeline, a column per species 2026-06-05 16:34:46 -07:00
Twarner491 1897a5848b [FEAT] audio: exclusive playback — starting one clip stops the others 2026-06-05 16:34:21 -07:00
Twarner491 4fb21fe01d [FEAT] theme: light/charcoal dark mode with a persistent switcher 2026-06-05 16:34:08 -07:00
Twarner491 4e43b5ee69 [BUG] api: resolve recording/spectrogram dirs by normalized species name 2026-06-05 16:28:18 -07:00
Twarner491 b8b97893a1 [CHORE] gitignore local session data & large reference assets 2026-06-05 16:28:18 -07:00
Teddy Warner e369a7d052 [DOC] Raspberry Pi Zero 2 W only upstream guide 2026-05-31 09:02:13 -07:00
Twarner491 ca225e1482 [DOC] readme: passwordless sudo note 2026-05-31 08:45:47 -07:00
Twarner491 11b80c946f [BUG] caddy: detect php-fpm socket dynamically 2026-05-31 08:45:47 -07:00
Twarner491 038b17c6c1 [PROD] refined php int 2026-05-28 15:39:58 -07:00
Twarner491 ec167eac7b refined readme 2026-05-28 15:23:26 -07:00
Twarner491 87981a62fb [PROD] 2026-05-28 15:15:22 -07:00
Twarner491 37b7c9e6a7 fix(caddy): override php_fastcgi try_files to prefer index.html 2026-05-28 14:31:30 -07:00
Twarner491 4fea750146 Menu: fix broken 'logs' link + add 'detections' shortcut
The 'logs' menu item pointed at /views.php?view=Log+Out which doesn't
exist in BirdNET-Pi's view router - hitting that link returned a
blank page. Renamed to 'log' and pointed at the correct view='View+Log'.

Added a 'detections' item pointing at view='Todays+Detections' (the
most useful BirdNET-Pi page for a casual user, faster to reach than
clicking through /index.php).

Valid view= values pulled from homepage/views.php:142-161.

Also added .DS_Store to .gitignore.
2026-05-28 12:39:05 -07:00
Twarner491 35eed2a885 Atlas modal: pose toggle + wiki descriptions
avian/api/cutout.php: read ?pose=N parameter. pose=1 (default) serves
<slug>.png, pose=2 serves <slug>-2.png, etc. Pose >1 missing falls
back to pose-1 instead of skipping to the photo cutout so the flight
tab still shows something recognisable. Pose clamped to 1-99 to
block path-traversal payloads.

avian/api/wiki.php (new): Wikipedia REST summary proxy. Returns
{extract, thumbnail, title}. Thumbnail host pinned to wikimedia.org/
wikipedia.org to block SSRF. Cached for 24h.

avian/frontend/apt.js: fetch wiki descriptions from ./avian/api/wiki.php
(was hitting the worker's /api/wiki.json which 404'd in our overlay).
2026-05-28 12:16:08 -07:00
Twarner491 0105fb54f0 Menu: rename 'avianvisitors' link to 'github' + add built-by attribution
avian/api/menu.php: 4th drawer link label is now 'github' (shorter,
matches what the link actually points to).

avian/frontend/index.html: 'built by teddy' attribution sits below
the menu items (sibling of #dd-items inside #menu-dd) so it shows in
both local and forwarded modes. Drops the redundant 'built with
AvianVisitors' line that lived inside the lock screen - the github
menu item covers source-of-truth attribution.
2026-05-28 12:10:09 -07:00
Twarner491 b2027fed2c Serve collage at http://birdnet.local/ (replaces stock index)
install_services.sh now symlinks five frontend files (index.html,
styles.css, apt.js, masks.json, dims.json) from avian/frontend/ into
the Caddy site root. Caddy serves index.html before index.php, so /
shows the collage and BirdNET-Pi's stock UI moves to /index.php
(still linked from the menu drawer).

API shims stay under /avian/api/. apt.js fetches them with
./avian/api/birdnet-api.php?action=X now that the frontend lives at
root instead of /avian/frontend/.

avian/index.html redirect file removed (no longer needed - / serves
the collage directly).

README + menu drawer updated to reflect / as the entry point and
/index.php as the stock-UI link.

Verified in Docker:
  /                        200 text/html (collage, 4 tiles)
  /masks.json              200 (276 KB)
  /avian/api/...           200 (all PHP shims working)
  Caddy serves index.html as default index, index.php still reachable
2026-05-28 12:07:27 -07:00
Twarner491 65ac7efef4 Fix atlas-card click + wire live audio + verify pipeline
- Add hidden admin-screen stub to index.html. The live JS calls
  adminEl.setAttribute() on every hashchange (via openAdmin/closeAdmin);
  with the element missing those threw a null-ref that killed
  syncRouter mid-flight, so atlas card clicks set the hash but never
  opened the detail modal. Stub is empty - menu items navigate to
  BirdNET-Pi's stock pages instead of triggering in-app admin.

- Point the live-audio Audio() at /stream (BirdNET-Pi's existing
  icecast reverse-proxy from install_services.sh:189) instead of the
  worker's /birdnet/stream. The drawer's live-audio button now plays
  real BirdNET-Pi audio on local installs.

Verified end-to-end in Docker container:
- Landing collage: 4 tiles render from seeded DB
- Atlas click: detail modal opens with image + sci/common name
- Menu drawer: opens, shows 4 items (no password in local mode)
- Auto-refresh: INSERTed Bubo virginianus into birds.db, forced
  refresh via window picker re-click, tile count 4→5 with the new
  species appearing in the collage.
2026-05-28 12:03:18 -07:00
Twarner491 2dcb6d2fc3 Frontend: verbatim apt.ts lift + restored menu drawer
Pulls the live rendered HTML/CSS/JS from the working repo:
- styles.css: 1449 lines, full live palette + chrome rules
- index.html: live <body> structure with stats sidebar, atlas with
  svg sort icons, full detail-modal (pose toggle, recordings list,
  wiki/ebird chips), about modal
- apt.js: 2760 lines of live JS verbatim, URLs rewired:
  - /api/{recent,lifelist,firstseen,timeseries,stats,species}.json
    → ../api/birdnet-api.php?action=X
  - /api/img and /api/sketch → ../api/cutout.php
  - /api/recording and /api/spectrogram → ../api/{name}.php
  - /api/menu → ../api/menu.php (new)
  - /birdnet/stream → '' (live audio is admin-only, stripped)
  - admin endpoints (/api/auth, /api/config, /api/status, /api/regen,
    /api/wiki) left to 404 silently - the live .catch() handlers
    already absorb them

Menu drawer restored. Defaults to <body class='av-local'> which CSS
toggles to show items directly without the lock screen. Forwarded
deploys switch to av-forwarded + set AV_REQUIRE_AUTH=1 in php-fpm
env + Caddy basic_auth on /avian/api/ - see avian/forwarding/.

avian/api/menu.php: returns AvianVisitors drawer items (BirdNET-Pi UI,
logs, system, github link). 401s in forwarded mode when no
Authorization header arrives.
2026-05-28 11:55:36 -07:00
Twarner491 f8e599ccdc Frontend: lift CSS + HTML structure from live apt.ts verbatim
The previous styles.css was a from-memory reconstruction with wrong
palette (tan paper #f4ede0 vs the live near-white #fcfcfb, red accent
vs warm-grey). HTML class names also diverged (.collage vs .gcollage,
#atlasList vs #atlasGrid, .stats-tl vs .stats-timeline). Result: the
overlay looked nothing like the live site.

Now:
- styles.css copied verbatim from the apt.ts <style> block (1449 lines)
- index.html mirrors the live body structure: header.top + main.stage
  with view sections id=v0/v1/v2, nav.slider, about-modal
- apt.js updated for matching IDs/classes:
  - View switching via translateX on .views container (live uses
    flex: 0 0 100% per view, slides between them)
  - Hover state via alpha-mask hit-testing in mousemove (.gtile is
    pointer-events:none, bounding rects overlap)
  - Atlas builds .bird-card elements (the live CSS class)
  - atlasSort data-sort='alpha' (was 'first')
  - #atlasGrid (was #atlasList)

Verified against Docker container faithfully replicating BirdNET-Pi's
runtime (Caddy + PHP-FPM as caddy user + php-fpm-socket-helper):
side-by-side screenshots with bird.onethreenine.net show identical
palette, typography, pill chrome, tile rendering. Differences are
content-only (different seeded species).
2026-05-28 11:35:27 -07:00
Twarner491 9ea3249f9d PHP shims: derive paths from __DIR__ (PHP-FPM runs as caddy user)
BirdNET-Pi's installer runs PHP-FPM as the caddy user, so getenv('HOME')
resolves to /var/lib/caddy - not the install user's home. Every path
constructed from getenv('HOME') was broken on first install.

PHP resolves __DIR__ through the install_services.sh symlink to the
realpath ($HOME/BirdNET-Pi/avian/api), so dirname(__DIR__, 2) = the
BirdNET-Pi install root and dirname(__DIR__, 3) = the user's home.
Works under any username because nothing is hardcoded.

Also fixed birdnet-api.php's DB_PATH which walked one level too far
(used , 3) - the BirdNET-Pi root is , 2).
2026-05-28 11:16:38 -07:00
Twarner491 7999483b7a README: update lav price + SD card link 2026-05-28 11:12:26 -07:00
Twarner491 d3241f92cf 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.).
2026-05-28 11:11:20 -07:00
Twarner491 41a051bc55 README: tighten tagline + mention mic placement in Pi setup 2026-05-28 10:56:47 -07:00
Twarner491 2ec45b9138 AvianVisitors hardening pass — install via fork's newinstaller
Restructures the install so users run ONE command. The fork's
newinstaller.sh clones this repo (instead of upstream Nachtzuster) and
runs BirdNET-Pi's installer. install_services.sh symlinks the avian/
overlay into the Caddy site root, so http://birdnet.local/avian/ comes
up after reboot with no Caddy config needed.

Reviewer-flagged fixes:

Frontend (avian/frontend/apt.js)
- Switch all API paths from /api/*.json (which didn't route) to relative
  action-based URLs (./api/birdnet-api.php?action=recent etc.).
- Fetch ./masks.json + ./dims.json relatively (were /avian/*.json).
- Replace every innerHTML user-content sink with createElement +
  textContent + setAttribute — species labels are user-editable in
  BirdNET-Pi, so untrusted.
- Add esc() helper for the few remaining innerHTML attribute contexts.
- fetchJson throws on non-200 (was silently parsing 404 HTML as JSON).
- Defensive null-check in loadMask if MASKS hasn't loaded.

Backend (avian/api/*.php)
- birdnet-api.php now derives DB_PATH from dirname(__DIR__, 3) so any
  BirdNET-Pi install user works (no hardcoded /home/birdnet).
- recording/spectrogram/cutout use getenv('HOME') for the same reason.
- cutout.php reworked as the canonical image resolver: bundled
  illustration → bundled cutout → cached rembg → fresh
  Wikipedia+rembg, with the binomial regex guard and atomic rename
  on cache write. Wikipedia URL host pinned to wikimedia.org /
  wikipedia.org to block SSRF.
- Stale 'X-BirdNET-Proxy-Token' auth claims removed everywhere.

Pregen (avian/scripts/pregen.py)
- Gemini key moved from URL query to x-goog-api-key header.
- Model bumped to gemini-2.5-flash-image-preview.
- Bounded retry on 429 + 5xx with Retry-After honoured.
- Default --sleep raised from 1s to 4s (under free-tier RPM).
- Unified parser handles |/_/comma in all three input modes.
- responseModalities now [TEXT, IMAGE] (was IMAGE-only).
- --poses validated against POSES keys.
- ASCII [ok]/[fail] markers (was ✓/✗ — Windows console crash).
- Surfaces finishReason + blockReason on safety blocks.

Prompt template
- 'Two placeholders' typo → three.
- 'warm paper' / 'transparent background' contradiction resolved.

Forwarding
- mqtt-bridge.py: paho-mqtt 2.x CallbackAPIVersion compat shim.
- avian-mqtt.service: dropped broken %i, set User=birdnet + %h path.
- forwarding/README.md uses the actual action-based URLs.

README
- One-line install via curl … newinstaller.sh.
- No more 'install BirdNET-Pi separately' step (our fork does it).
- License section uses absolute github.com links.
- bird.onethreenine.net replaces the not-yet-existent project writeup.
- docs/thumb.png replaced with the 24-bird Twitter capture.

Removed
- avian/caddy/ and avian/scripts/install.sh — no longer needed; the
  overlay symlink in install_services.sh handles everything.
2026-05-28 10:49:41 -07:00
Twarner491 d0ad1454c4 AvianVisitors: BirdNET-Pi collage frontend overlay
Adds avian/ on top of upstream BirdNET-Pi:
- frontend/    static collage UI (mask-packed bird tiles, sized by detection count)
- assets/      ~450 bundled kachō-e illustrations + cutouts + binary masks
- api/         PHP shims for recent/lifelist/firstseen/timeseries JSON
- scripts/     installer + Gemini pregen + editable prompt template
- caddy/       snippet mounting /collage on existing Caddy
- forwarding/  optional HA / MQTT / Cloudflare configs

Default install: http://birdnet.local/collage/ with no auth.

Upstream BirdNET-Pi README preserved at README.upstream.md.
2026-05-28 10:14:25 -07:00
frederik 88985a3a6f fix: make bottom visible on smaller screens 2026-02-28 10:57:00 +01:00
frederik 13e44a72de fix: look for an actual json file 2026-02-28 10:50:26 +01:00
Canopy2523 c5877e6e89 change_thumbnail_size
Wikipedia errors out on thumbnails with obsolete resolutions with "Error: 429, Use thumbnail steps listed on https://w.wiki/GHai."
Indirectly fixes https://github.com/Nachtzuster/BirdNET-Pi/issues/568 and https://github.com/Nachtzuster/BirdNET-Pi/discussions/441
2026-02-28 09:54:41 +01:00
Tim 'mithro' Ansell 779325dd8c Add php-mbstring to installed dependencies
phpSysInfo (Tools -> System Info) requires the mbstring PHP extension.
Without it, the page shows:

  checkForExtensions phpSysInfo requires the mbstring extension to php
  in order to work properly.

Fixes #531

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 09:53:38 +01:00
frederik 3786dfd4c4 fix typo 2025-12-20 12:14:30 +01:00
Alexandre f6752e1e16 Fix ffmpeg command by removing unused option 2025-12-20 11:31:57 +01:00
Alexandre 5fe725f251 Remove xerror 2025-12-20 11:31:57 +01:00
Alexandre 0f287d597d Update ffmpeg command to include xerror option 2025-12-20 11:31:57 +01:00
Alexandre 8b637e5640 Increase ffmpeg thread queue size in recording script 2025-12-20 11:31:57 +01:00
Alexandre 524d366023 Remove under_base function from species_tools.php
Removed the under_base function to simplify path checks.
2025-12-20 11:31:38 +01:00
Alexandre 7a17fa2574 Remove under_base check before directory deletion
Removed the check for directory under base before deletion.
2025-12-20 11:31:38 +01:00
Alexandre 24461bb679 Remove htmlspecialchars
Removed htmlspecialchars encoding for common and scientific names, and adjusted last seen display.
2025-12-20 11:31:38 +01:00
Alexandre 3465305fd6 Remove useless under_base 2025-12-20 11:31:38 +01:00
Alexandre 26d028f187 Simplify file deletion process in species_tools.php
Refactor deletion logic to count deleted files instead of iterating through them.
2025-12-20 11:31:38 +01:00
Alexandre 082d0369a1 Fix typo 2025-12-20 11:31:38 +01:00