Add Frigate config merging and camera database updates

- Refactor Frigate generator to support adding cameras to existing configs
- Add text-based YAML parsing to preserve formatting and comments
- Implement duplicate camera/stream name detection and auto-numbering
- Add support for inserting cameras into existing go2rtc and cameras sections
- Update UI: add textarea for existing config input and generate button
- Preserve user's existing configuration when adding new cameras
- Add example config template for new users
- Update ConfigPanel to initialize Frigate tab instead of auto-generating
- Add FrigateGenerator import to main.js
- Add custom styles for Frigate config input and output sections
- Support both empty config (create from scratch) and existing config (merge) modes

Camera database updates:
- Add OpenIPC firmware camera support (257 models)
- Add Yi-Hack firmware variants (v4, v5, Allwinner, MStar)
- Add Fang-Hacks firmware support
- Add OpenMiko firmware support
- Update Sonoff camera models
- Update Thingino firmware camera models
This commit is contained in:
eduard256
2025-11-11 22:32:59 +03:00
parent 5d0b3e6527
commit 627409cf56
14 changed files with 1660 additions and 132 deletions
+43
View File
@@ -3,6 +3,7 @@ import { StreamDiscoveryAPI } from './api/stream-discovery.js';
import { SearchForm } from './ui/search-form.js';
import { StreamCarousel } from './ui/stream-carousel.js';
import { ConfigPanel } from './ui/config-panel.js';
import { FrigateGenerator } from './config-generators/frigate/index.js';
import { showToast } from './utils/toast.js';
class StrixApp {
@@ -106,6 +107,9 @@ class StrixApp {
document.getElementById('btn-add-sub-stream').addEventListener('click', () => this.addSubStream());
document.getElementById('btn-remove-sub').addEventListener('click', () => this.removeSubStream());
// Frigate config generation
document.getElementById('btn-generate-frigate').addEventListener('click', () => this.generateFrigateConfig());
document.getElementById('btn-new-search').addEventListener('click', () => {
this.reset();
this.showScreen('address');
@@ -354,6 +358,11 @@ class StrixApp {
}
this.isSelectingSubStream = true;
// Clear Frigate output section (but NOT the user's input textarea)
document.getElementById('frigate-output-section').classList.add('hidden');
document.getElementById('config-frigate').textContent = '';
showToast('Select a sub stream from available streams');
this.showScreen('discovery');
}
@@ -365,6 +374,40 @@ class StrixApp {
showToast('Sub stream removed');
}
/**
* Generate Frigate config by adding camera to existing config
*/
generateFrigateConfig() {
const existingConfig = document.getElementById('existing-frigate-config').value;
const mainStream = this.selectedMainStream;
const subStream = this.selectedSubStream;
if (!mainStream) {
showToast('No main stream selected', 'error');
return;
}
try {
// Generate config using FrigateGenerator
const newConfig = FrigateGenerator.generate(existingConfig, mainStream, subStream);
// Show result
document.getElementById('config-frigate').textContent = newConfig;
document.getElementById('frigate-output-section').classList.remove('hidden');
// Scroll to result
document.getElementById('frigate-output-section').scrollIntoView({
behavior: 'smooth',
block: 'nearest'
});
showToast('Config generated successfully!');
} catch (error) {
showToast(`Error: ${error.message}`, 'error');
console.error('Config generation error:', error);
}
}
updateSubStreamUI() {
const subStreamInfo = document.getElementById('sub-stream-info');
const addSubStreamBtn = document.getElementById('btn-add-sub-stream');