Skip to content

Fix: auto-detect web root for different installations#5

Merged
Svardsten53 merged 1 commit into
Svardsten53:mainfrom
RonnyCHL:main
Feb 4, 2026
Merged

Fix: auto-detect web root for different installations#5
Svardsten53 merged 1 commit into
Svardsten53:mainfrom
RonnyCHL:main

Conversation

@RonnyCHL
Copy link
Copy Markdown
Contributor

@RonnyCHL RonnyCHL commented Feb 4, 2026

Problem

The install script failed on systems where BirdNET-Pi is installed in /BirdNET-Pi/ instead of ~/BirdNET-Pi/. The browser showed:

config.js:1 Uncaught SyntaxError: Unexpected token '<'
i18n.js:1 Uncaught SyntaxError: Unexpected token '<'

This happened because the i18n files weren't accessible via the web.

Solution

Updated install.sh and update.sh to:

  1. Search multiple BirdNET-Pi locations:

    • ~/BirdNET-Pi
    • /home/pi/BirdNET-Pi
    • /BirdNET-Pi
    • /opt/BirdNET-Pi
  2. Auto-detect web root from:

    • Caddy config (/etc/caddy/Caddyfile)
    • nginx config (/etc/nginx/sites-enabled/)
    • Apache config (/etc/apache2/sites-enabled/)
  3. Install to correct location:

    • If webroot is separate → install to $WEBROOT/i18n/
    • Otherwise → install to $BIRDNET_HOME/homepage/i18n/
  4. Use sudo for copying to system directories

Testing

Please re-run the installer:

cd ~/Translate
git pull
./scripts/install.sh sv

🤖 Generated with Claude Code

- Search multiple BirdNET-Pi locations (/BirdNET-Pi, ~/BirdNET-Pi, etc.)
- Auto-detect web root from Caddy, nginx, or Apache config
- Install i18n to correct location (webroot or homepage folder)
- Use sudo for copying to system directories
- Update script also syncs latest i18n.js and language files

Fixes installation on systems where BirdNET-Pi is not in ~/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Svardsten53 Svardsten53 merged commit 5ef1206 into Svardsten53:main Feb 4, 2026
@Svardsten53
Copy link
Copy Markdown
Owner

Now it works!

I have made a new draft of the Swedish translation file sv.json, copied it in and reinstalled, but it is still the old translation. Is this saved somewhere else?

I hope to be able to continue working on this tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants