|
|
@@ -9,6 +9,7 @@ import ( |
|
|
"os" |
|
|
"os" |
|
|
"os/signal" |
|
|
"os/signal" |
|
|
"path/filepath" |
|
|
"path/filepath" |
|
|
|
|
|
"sort" |
|
|
"strconv" |
|
|
"strconv" |
|
|
"strings" |
|
|
"strings" |
|
|
"sync" |
|
|
"sync" |
|
|
@@ -516,6 +517,11 @@ func main() { |
|
|
_ = json.NewEncoder(w).Encode(sigSnap.get()) |
|
|
_ = json.NewEncoder(w).Encode(sigSnap.get()) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
http.HandleFunc("/api/decoders", func(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
|
|
_ = json.NewEncoder(w).Encode(decoderKeys(cfgManager.Snapshot())) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
http.HandleFunc("/api/recordings", func(w http.ResponseWriter, r *http.Request) { |
|
|
http.HandleFunc("/api/recordings", func(w http.ResponseWriter, r *http.Request) { |
|
|
if r.Method != http.MethodGet { |
|
|
if r.Method != http.MethodGet { |
|
|
http.Error(w, "method not allowed", http.StatusMethodNotAllowed) |
|
|
http.Error(w, "method not allowed", http.StatusMethodNotAllowed) |
|
|
@@ -825,6 +831,16 @@ func buildDecoderMap(cfg config.Config) map[string]string { |
|
|
return out |
|
|
return out |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func decoderKeys(cfg config.Config) []string { |
|
|
|
|
|
m := buildDecoderMap(cfg) |
|
|
|
|
|
keys := make([]string, 0, len(m)) |
|
|
|
|
|
for k := range m { |
|
|
|
|
|
keys = append(keys, k) |
|
|
|
|
|
} |
|
|
|
|
|
sort.Strings(keys) |
|
|
|
|
|
return keys |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func parseSince(raw string) (time.Time, error) { |
|
|
func parseSince(raw string) (time.Time, error) { |
|
|
if raw == "" { |
|
|
if raw == "" { |
|
|
return time.Time{}, nil |
|
|
return time.Time{}, nil |
|
|
|