Track power events

This commit is contained in:
DaneEveritt
2022-07-04 17:55:17 -04:00
parent 9eab08b92f
commit 0380488cd2
2 changed files with 18 additions and 7 deletions

View File

@@ -368,6 +368,10 @@ func (h *Handler) HandleInbound(ctx context.Context, m Message) error {
return nil
}
_ = h.ra.Save(h.server, server.ActivityPower, server.ActivityMeta{
"signal": string(action),
})
return err
}
case SendServerLogsEvent:
@@ -424,15 +428,10 @@ func (h *Handler) HandleInbound(ctx context.Context, m Message) error {
}
}
// Track this command sending event in the local database.
e := h.ra.Event(server.ActivityCommandSent, server.ActivityMeta{
_ = h.ra.Save(h.server, server.ActivityConsoleCommand, server.ActivityMeta{
"command": strings.Join(m.Args, ""),
})
if err := e.Save(); err != nil {
h.server.Log().WithField("error", err).Error("activity: failed to persist event to database")
}
return h.server.Environment.SendCommand(strings.Join(m.Args, ""))
}
}