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:
parent
26ae405e9b
commit
45d1d98e56
3 changed files with 212 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue