PATCH /admin/api/v1/audio Body: {"identifier": {"description":"...","filepath":"...","volume":80}, ...} Replaces the entire sounds configuration.
(w http.ResponseWriter, r *http.Request)
| 80 | // Body: {"identifier": {"description":"...","filepath":"...","volume":80}, ...} |
| 81 | // Replaces the entire sounds configuration. |
| 82 | func apiV1PatchAudio(w http.ResponseWriter, r *http.Request) { |
| 83 | var patches map[string]audio.AudioConfig |
| 84 | if err := json.NewDecoder(r.Body).Decode(&patches); err != nil { |
| 85 | writeAPIError(w, http.StatusBadRequest, "malformed request body: "+err.Error()) |
| 86 | return |
| 87 | } |
| 88 | |
| 89 | if err := audio.SaveAudio(patches); err != nil { |
| 90 | writeAPIError(w, http.StatusInternalServerError, err.Error()) |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | writeJSON(w, http.StatusOK, APIResponse[audioAPIResponse]{ |
| 95 | Success: true, |
| 96 | Data: audioAPIResponse{ |
| 97 | Sounds: audio.GetAllAudio(), |
| 98 | Music: audio.GetMusicFiles(), |
| 99 | SoundFiles: audio.GetSoundFiles(), |
| 100 | }, |
| 101 | }) |
| 102 | } |
| 103 | |
| 104 | // DELETE /admin/api/v1/audio/{identifier} |
| 105 | // Removes a single sound entry from audio.yaml. |
nothing calls this directly
no test coverage detected