Security Hardening, Insights Hub, Image Provider Overhaul, Analytics Dashboard & UI Redesign#575
Open
zach7036 wants to merge 239 commits intoNachtzuster:mainfrom
Open
Security Hardening, Insights Hub, Image Provider Overhaul, Analytics Dashboard & UI Redesign#575zach7036 wants to merge 239 commits intoNachtzuster:mainfrom
zach7036 wants to merge 239 commits intoNachtzuster:mainfrom
Conversation
…rouped nav, responsive design
…oaded as alternative, not supplement
…av layouts, tools grouping)
… BirdNET detection window
…3-second BirdNET detection window" This reverts commit 9015b52.
…r, and species header
…nt for iframe navigation
…itialized players
…ust custom players
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security Hardening, Insights Hub, Image Provider Overhaul, Analytics Dashboard & UI Redesign
Summary
This PR introduces comprehensive security fixes, a new multi-view Insights page, a redesigned image provider system with fallback support, new analytics and species pages, five new API endpoints, a collapsible sidebar navigation, a rewritten weekly report, and several bug fixes.
Security
bindValuewith:paramplaceholders) and Python (?placeholders with param lists). Affected:fetch_species_array,fetch_best_detection,fetch_all_detections,get_todays_count_for,get_this_weeks_count_for,get_species_by, the filename lookup inplay.php, and all 7+ queries inweekly_report.php.escapeshellarg()forrm,timedatectl set-timezone,echo | tee, andsudo date -scalls inplay.php,species_tools.php, andconfig.php.FILTER_SANITIZE_STRINGwithFILTER_SANITIZE_FULL_SPECIAL_CHARSinviews.phpandplay.php.Insights Page (NEW — 1,327 lines)
A comprehensive Insights hub at
scripts/insights.phpwith 7 subviews, each loading only its own data for efficient queries:weathertable; gracefully shows empty state without it.A standalone
insights_logic.php(77 lines) provides the same Dashboard KPIs as a reusable module.Weekly Report Redesign (rewritten, 204 → 425 lines)
?asciioutput preserved.Image Provider System
get_image()now accepts an optional$fallback_provider. If the primary provider (Wikipedia or Flickr) returns no image, it automatically tries the other. All call sites wire both providers.thumburlat 1024px. Better metadata extraction with null-safe handling._bsuffix, 1024px). Removedorientationfilter. Switched tourlencode(). Fixed constructor to callparent::__construct(). Added null checks on all API responses.get_json()returnsfalseon failure instead of crashing.get_com_en_name()uses a static cache. Debug logging tobirdnet_img.log. Image cache DBs renamed to*_v4.dbto force rebuild.New Features
scripts/analytics.php, 945 lines): KPI cards, hourly activity heatmap, species trends, confidence distribution, time-period filtering with Chart.js.scripts/species.php, 333 lines): Searchable, sortable species catalog with time-period filtering and summary KPIs.GET /api/v1/analytics/activity?days=N— Hourly detection counts.GET /api/v1/analytics/stats?days=N— Aggregate stats.GET /api/v1/detections/recent?limit=N— Most recent detections.GET /api/v1/detections/timeline?date=YYYY-MM-DD— Full day timeline with hourly grouping and 5-minute same-species clustering.GET /api/v1/species/search?q=term— Autocomplete search (common + scientific names).stats.php): Confidence distribution and seasonal presence bar charts.scripts/utils/weather.py): Hourly Open-Meteo sync storing temperature and condition codes inbirds.db, with cron template.fetch_stats()now returnsnewspeciestally,topspecies, andtopspeciescount.?ajax_chart_data=truereturns JSON species/hourly data for client-side chart rendering, with session-based image caching.UI/UX
<input>passes the selected subview via query string.index.php.:rootvariables for colors, spacing, shadows, radii). Sidebar styles added. Light theme expanded (~900 → 2,000 lines). Dark theme rewritten from 972 lines to 118 lines using variable overrides.#e8f4f2), heatmap palette fromGreenstoBlues_r.onerrorfallback and null-safe image array access throughout.Bug Fixes
advanced.php: Fixed two variable name bugs —freqshift_reconnect_delaycomparison was using$freqshift_hi, andraw_spectrogramcomparison was using undefined$RAW_SPECTROGRAM.spectrogram.php: Fixed delay calculation fromDateInterval::format('%s')(partial seconds) togetTimestamp()subtraction (total seconds). Changed file discovery fromglob()toscandir(). Wrapped parent audio access in try/catch for cross-origin safety. Handled autoplay policy blocks with.catch().helpers.py: Removed redundantos.path.join()double-prependingRECS_DIR. Settings path now checksBIRDNET_CONFenv var before defaulting.Infrastructure
php-mbstringfrom install dependencies.insights.phpsymlink toclear_all_data.sh.Nachtzuster/BirdNET-Pitozach7036/BirdNET-Pi.New Files
scripts/insights.phpscripts/insights_logic.phpscripts/analytics.phpscripts/species.phpscripts/clear_image_cache.phpscripts/utils/weather.pytemplates/weather.cronhomepage/static/dashboard-charts.jshomepage/static/timeline-view.js