feat(webui): add minimal dashboard (Pico.css) with tail, trigger, status; JSON endpoints: /api/info,/api/channels,/api/tail,/api/trigger; default compose/UI auth via HTTP_TOKEN

This commit is contained in:
Thomas Cravey 2025-08-16 15:24:50 -05:00
parent 26ae405e9b
commit 45d1d98e56
3 changed files with 212 additions and 0 deletions

View file

@ -67,6 +67,24 @@ func (s *Store) InsertMessage(ctx context.Context, m Message) error {
return err
}
// ListChannels returns distinct channel identifiers seen in the database.
func (s *Store) ListChannels(ctx context.Context) ([]string, error) {
rows, err := s.db.QueryContext(ctx, "SELECT DISTINCT channel FROM messages ORDER BY lower(channel)")
if err != nil {
return nil, err
}
defer rows.Close()
var out []string
for rows.Next() {
var ch string
if err := rows.Scan(&ch); err != nil {
return nil, err
}
out = append(out, ch)
}
return out, rows.Err()
}
func nullIfEmpty(s string) any {
if s == "" {
return nil