Add usage commands, a vendor-neutral usage format and a knowledge base
This commit is contained in:
@@ -632,6 +632,24 @@ func (s *Server) CheckPermissions(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, perms)
|
||||
}
|
||||
|
||||
func (s *Server) GetUsageCommands(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, s.agents.UsageCommands())
|
||||
}
|
||||
|
||||
func (s *Server) UpdateUsageCommands(w http.ResponseWriter, r *http.Request) {
|
||||
req := api.UsageCommands{}
|
||||
if !readJSON(w, r, &req) {
|
||||
return
|
||||
}
|
||||
|
||||
err := s.agents.SetUsageCommands(r.Context(), actor(r), req)
|
||||
if err != nil {
|
||||
writeStoreError(w, err)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, s.agents.UsageCommands())
|
||||
}
|
||||
|
||||
func (s *Server) status(ctx context.Context) (api.Status, error) {
|
||||
c, err := s.store.Counts(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user