Get Voip.ms working again in the text system

Because we need it for the conference.
This commit is contained in:
Eli Ribble 2026-01-29 21:53:49 +00:00
parent a900c23090
commit d2d5f003d8
No known key found for this signature in database
8 changed files with 221 additions and 57 deletions

View file

@ -1,22 +1,25 @@
package api
import (
"io"
"net/http"
"os"
"github.com/rs/zerolog/log"
)
func debugSaveRequest(body []byte, err error, message string) {
// TODO(eliribble): avoid using a single static filename and instead securely generate
// this value
func debugSaveRequest(r *http.Request) {
tmpFile, err := os.CreateTemp("/tmp", "request-*.data")
if err != nil {
log.Error().Err(err).Msg(message)
log.Error().Err(err).Msg("failed to create temp file for debugSaveRequest")
return
}
output, err := os.OpenFile("/tmp/request.body", os.O_RDWR|os.O_CREATE, 0666)
defer tmpFile.Close()
_, err = io.Copy(tmpFile, r.Body)
if err != nil {
log.Info().Msg("Failed to open temp request.bady")
log.Error().Err(err).Msg("failed to copy request body in debugSaveRequest")
return
}
defer output.Close()
output.Write(body)
log.Info().Msg("Wrote request to /tmp/request.body")
log.Info().Str("filename", tmpFile.Name()).Msg("Saved request body")
}