Rewrite Strix from scratch as single binary
Complete architecture rewrite following go2rtc patterns: - pkg/ for pure logic (camdb, tester, probe, generate) - internal/ for application glue with Init() modules - Single HTTP server on :4567 with all endpoints - zerolog with password masking and memory ring buffer - Environment-based config only (no YAML files) API endpoints: /api/search, /api/streams, /api/test, /api/probe, /api/generate, /api/health, /api/log Dependencies: go2rtc v1.9.14, go-sqlite3, miekg/dns, zerolog
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package generate
|
||||
|
||||
import "strings"
|
||||
|
||||
func fullDiff(config string) []DiffLine {
|
||||
lines := strings.Split(config, "\n")
|
||||
diff := make([]DiffLine, len(lines))
|
||||
for i, line := range lines {
|
||||
diff[i] = DiffLine{Line: i + 1, Text: line, Type: "added"}
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
||||
func diffWithContext(lines []string, added map[int]bool, ctx int) []DiffLine {
|
||||
visible := make(map[int]bool)
|
||||
for idx := range added {
|
||||
for c := -ctx; c <= ctx; c++ {
|
||||
if j := idx + c; j >= 0 && j < len(lines) {
|
||||
visible[j] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var diff []DiffLine
|
||||
for i, line := range lines {
|
||||
if !visible[i] {
|
||||
continue
|
||||
}
|
||||
t := "context"
|
||||
if added[i] {
|
||||
t = "added"
|
||||
}
|
||||
diff = append(diff, DiffLine{Line: i + 1, Text: line, Type: t})
|
||||
}
|
||||
return diff
|
||||
}
|
||||
Reference in New Issue
Block a user