2ec45b9138
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.
57 lines
1.3 KiB
Bash
Executable File
57 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ "$EUID" == 0 ]
|
|
then echo "Please run as a non-root user."
|
|
exit
|
|
fi
|
|
|
|
if [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "x86_64" ];then
|
|
echo "BirdNET-Pi requires a 64-bit OS.
|
|
It looks like your operating system is using $(uname -m),
|
|
but would need to be aarch64."
|
|
exit 1
|
|
fi
|
|
|
|
PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info[0]}{sys.version_info[1]}')")
|
|
if [ "${PY_VERSION}" == "39" ] ;then
|
|
echo "### BirdNET-Pi requires a newer OS. Bullseye is deprecated, please use Bookworm. ###"
|
|
[ -z "${FORCE_BULLSEYE}" ] && exit
|
|
fi
|
|
|
|
# we require passwordless sudo
|
|
sudo -K
|
|
if ! sudo -n true; then
|
|
echo "Passwordless sudo is not working. Aborting"
|
|
exit
|
|
fi
|
|
|
|
# Simple new installer
|
|
HOME=$HOME
|
|
USER=$USER
|
|
|
|
export HOME=$HOME
|
|
export USER=$USER
|
|
|
|
PACKAGES_MISSING=
|
|
for cmd in git jq ; do
|
|
if ! which $cmd &> /dev/null;then
|
|
PACKAGES_MISSING="${PACKAGES_MISSING} $cmd"
|
|
fi
|
|
done
|
|
if [[ ! -z $PACKAGES_MISSING ]] ; then
|
|
sudo apt update
|
|
sudo apt -y install $PACKAGES_MISSING
|
|
fi
|
|
|
|
branch=avian-visitors
|
|
git clone -b $branch --depth=1 https://github.com/Twarner491/AvianVisitors.git ${HOME}/BirdNET-Pi &&
|
|
|
|
$HOME/BirdNET-Pi/scripts/install_birdnet.sh
|
|
if [ ${PIPESTATUS[0]} -eq 0 ];then
|
|
echo "Installation completed successfully"
|
|
sudo reboot
|
|
else
|
|
echo "The installation exited unsuccessfully."
|
|
exit 1
|
|
fi
|