Commit Graph

3057 Commits

Author SHA1 Message Date
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
Alexandre dba949b83d Show deletion text using common name 2025-12-20 11:31:38 +01:00
Alexandre 5ee50c089b Delete using sudo rm aligned code with play.php
Updated file and directory deletion methods to use 'exec' for sudo commands and handle errors appropriately.
2025-12-20 11:31:38 +01:00
Alexandre 2348b1e25e Revert diskcount to comname, as files are stored by comname 2025-12-20 11:31:38 +01:00
Alexandre 40bb623348 Use sci names for diskcount ajax 2025-12-20 11:31:38 +01:00
Alexandre 6ef96d1c9e FILTER_SANITIZE_STRING is deprecated in PHP 8.1+ 2025-12-20 11:31:38 +01:00
Alexandre f16114736b Load threshold with sci names 2025-12-20 11:31:38 +01:00
Alexandre 60313a5c7d Add check.svg 2025-12-20 11:31:38 +01:00
Alexandre b0ccfbb50c Add symlink for confirmed_species_list.txt 2025-12-20 11:31:38 +01:00
Alexandre 7a06695c80 Add confirmed species list to backup script 2025-12-20 11:31:38 +01:00
Alexandre ed92d165bd Link confirmed species list in clear_all_data.sh
Add symbolic link for confirmed species list.
2025-12-20 11:31:38 +01:00
Alexandre c9fa9ee81d Still use sci name_com name in text files 2025-12-20 11:31:38 +01:00
Alexandre 99a7f652ee Compare with sci_names and not com_names in lists 2025-12-20 11:31:38 +01:00
Alexandre efd62fcadf External generateMiniGraph function
Removed the generateMiniGraph function and its associated logic.
2025-12-20 11:31:38 +01:00
Alexandre 6f125ce303 External generateMiniGraph
Removed the generateMiniGraph function and its associated AJAX call for fetching detections. This change may affect how mini graphs are displayed on the page.
2025-12-20 11:31:38 +01:00
Alexandre ccd3e1a741 Use common generateMiniGraph 2025-12-20 11:31:38 +01:00
Alexandre be425a21e6 Add generateMiniGraph function for dynamic charts 2025-12-20 11:31:38 +01:00
Alexandre 8a851923ad Change queries to use Sci_Name instead of Com_Name 2025-12-20 11:31:38 +01:00
Alexandre aa6d1016f6 Fix apostrophes 2025-12-20 11:31:38 +01:00
Alexandre 1ce9f4caa9 Remove db modif 2025-12-20 11:31:38 +01:00
Alexandre 89c49d5d2f Add link to info pages 2025-12-20 11:31:38 +01:00
Alexandre 47b39aa098 Rename 'Identifications' header to 'Count' 2025-12-20 11:31:38 +01:00
Alexandre 013bcf1c24 Add options for 720 and 1080 days in selector 2025-12-20 11:31:38 +01:00
Alexandre d6b853b4eb Add improved mini charts 2025-12-20 11:31:38 +01:00
Alexandre 4a0ff5a095 Lazy load local files and threshold 2025-12-20 11:31:38 +01:00
Alexandre 5ce5547ffc Clarify what is deleted 2025-12-20 11:31:38 +01:00
Alexandre b8562c6904 Add search, max confidence 2025-12-20 11:31:38 +01:00
Alexandre fb59d34873 Open db in write only if needed 2025-12-20 11:31:38 +01:00
Alexandre 97fa0c5e11 Enhance species management with confirmed list 2025-12-20 11:31:38 +01:00