Commit Graph

11 Commits

Author SHA1 Message Date
eduard256 88e76eadb5 Refactor authentication system: centralize credential handling in Builder
Major architectural improvement to eliminate duplicate credential embedding
and simplify authentication logic across the codebase.

Changes:
- Builder now generates all URL variants with proper authentication upfront
  * RTSP: generates URLs with embedded credentials and without (for open cameras)
  * HTTP/JPEG/MJPEG: generates variants with query params and for Basic Auth
- Tester simplified to only test ready-to-use URLs without modification
  * Removed auth chain logic and multiple authentication method attempts
  * Removed AuthMethod enum and related complexity
  * Credentials automatically extracted from URLs when needed
- Scanner cleaned up by removing embedCredentialsInURL function
  * All TestStream calls now use single URL parameter
  * Removed AuthMethod from DiscoveredStream model

Benefits:
- Eliminates bug where credentials were added up to 3 times
- Centralizes all URL generation logic in one place (Builder)
- Cleaner, more maintainable code with clear separation of concerns
- Reduces complexity by ~200 lines of code
- All authentication scenarios still fully supported
2025-11-07 19:08:05 +03:00
eduard256 292d5f8049 Embed credentials in ONVIF device service URL when provided 2025-11-07 18:31:19 +03:00
eduard256 7fd1d78ffa Add dual-stream support for Frigate with optional sub-stream selection
Features:
- Optional sub-stream selection from already discovered streams
- No additional scanning required - reuse existing results
- UI: "Add Sub Stream" button to select secondary stream
- UI: "Remove Sub Stream" button to clear selection
- Smart stream routing in Frigate configs
- Go2RTC: generates _main and _sub stream names
- Frigate: detect on sub (CPU efficient), record on main (quality)
- Frigate: auto-detection of stream resolution
- Object detection: person, car, cat, dog
- Motion-based recording by default
- Live view streams configuration
- Support for any resolution: HD, 4K, 8K+
- Comprehensive documentation with examples
2025-11-06 22:53:50 +03:00
eduard256 74fe12bcf1 Improve camera model search with per-model ranking and two-stage loading
- Split camera results into individual models (Brand: Model format)
- Add model-specific relevance scoring for better search results
- Implement two-stage autocomplete: 10 results immediately, 50 after 1 second
- Filter out "Other" models from search results
- Sort models by relevance score (exact matches first)
- Add auto.json brand for automatic detection fallback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 00:43:03 +03:00
eduard256 1cfc2fa2e5 Add ONVIF device service endpoint discovery for PTZ control 2025-11-05 23:20:51 +03:00
eduard256 12dd7735ad Fix URL parameter replacement logic to preserve literal values 2025-11-05 23:20:44 +03:00
eduard256 a5c769dd6c Add credential embedding in stream URLs for SSE events
Embed username:password@ credentials in discovered stream URLs for
basic_auth and combined authentication methods, making URLs directly
usable by clients without additional auth handling.

**Changes:**
- Add embedCredentialsInURL() function in scanner.go
- Embed credentials for basic_auth and combined methods only
- Skip embedding for no_auth, query_params, digest, url_embedded
- Handle edge cases: empty credentials, existing credentials in URL
- Apply in scanDirectStream() and testURLsConcurrently()

**Security:**
- URL encoding handled by url.UserPassword()
- Checks prevent credential duplication
- Only processes when username AND password are provided

**Results:**
Before: http://10.0.20.112/snapshot.jpg
After:  http://admin:password@10.0.20.112/snapshot.jpg

Tested with Zosi ZG23213M camera - all 6 streams working correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 02:31:58 +03:00
eduard256 453769a376 Add multi-authentication support and comprehensive stream discovery
Major improvements to camera stream discovery system:

**Multi-Authentication Support:**
- Implement smart authentication fallback chain for HTTP/MJPEG/JPEG streams
- Add combined authentication method (Basic Auth header + query params) - fixes ZOSI cameras
- Support for: No Auth, Basic Auth, Query Params, Combined, Digest
- Auto-detect authentication method from URL and try appropriate chain

**Protocol & Detection Enhancements:**
- Add HLS (.m3u8) stream detection
- Add MPEG-DASH (.mpd) stream detection
- Add WebSocket stream detection
- Improve JPEG detection by URL extension when Content-Type is incorrect
- Add AuthMethod field to DiscoveredStream model

**Bug Fixes:**
- Fix port 0 bug: use default ports (HTTP=80, HTTPS=443, RTSP=554) when entry.Port==0
- Ensure URLs are built with correct ports from database or defaults

**Debug & Logging:**
- Add comprehensive DEBUG logging to builder.go (URL generation)
- Add comprehensive DEBUG logging to tester.go (stream testing & auth)
- Add comprehensive DEBUG logging to scanner.go (URL collection & deduplication)
- Log auth method detection, chain determination, and test results

**Results:**
- Tested with ZOSI ZG23213M camera: 4 streams found (was 0)
- Combined auth method successfully detects streams requiring both header + params
- Better coverage for cameras with non-standard authentication requirements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 02:15:21 +03:00
eduard256 bfade99c99 Fix ONVIF library integration and improve stream discovery
- Fix ONVIF CallMethod response parsing (returns *http.Response, not structs)
- Add proper XML SOAP envelope parsing for GetProfiles and GetStreamUri
- Use correct types from xsd/onvif package (StreamType, TransportProtocol, ReferenceToken)
- Add strix binary to .gitignore
- Update configuration and API routes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 23:04:10 +03:00
eduard256 f80f7ab314 Add Strix camera discovery system with comprehensive database
This commit adds the complete Strix IP camera stream discovery system:
- Go-based API server with SSE support for real-time updates
- 3,600+ camera brand database with stream URL patterns
- Intelligent fuzzy search across camera models
- ONVIF discovery and stream validation
- RESTful API with health check, camera search, and stream discovery
- Makefile for building and deployment
- Comprehensive README documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 17:45:04 +03:00
eduard256 6029766a8b Initial commit 2025-10-28 13:38:52 +03:00