Add debugging endpoints for SMS hooks

These work, barely, I'm not getting any of the data I wanted to be
getting.
This commit is contained in:
Eli Ribble 2025-12-12 21:53:09 +00:00
parent 5f86274b16
commit 13fcfffcd6
No known key found for this signature in database
2 changed files with 20 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package main
import (
"errors"
"fmt"
"net/http"
"strconv"
"strings"
@ -177,6 +178,22 @@ func getSource(w http.ResponseWriter, r *http.Request, u *models.User) {
htmlSource(w, r, u, globalid)
}
func getSMS(w http.ResponseWriter, r *http.Request) {
org := chi.URLParam(r, "org")
to := r.URL.Query().Get("error")
from := r.URL.Query().Get("error")
message := r.URL.Query().Get("error")
files := r.URL.Query().Get("error")
id := r.URL.Query().Get("error")
date := r.URL.Query().Get("error")
log.Info().Str("org", org).Str("to", to).Str("from", from).Str("message", message).Str("files", files).Str("id", id).Str("date", date).Msg("Got SMS Message")
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-type", "text/plain")
// Signifies to Voip.ms that the callback worked.
fmt.Fprintf(w, "ok")
}
func getVectorTiles(w http.ResponseWriter, r *http.Request, u *models.User) {
org_id := chi.URLParam(r, "org_id")
tileset_id := chi.URLParam(r, "tileset_id")

View file

@ -131,6 +131,9 @@ func main() {
r.Post("/signin", postSignin)
r.Get("/signup", getSignup)
r.Post("/signup", postSignup)
r.Get("/sms", getSMS)
r.Get("/sms.php", getSMS)
r.Get("/sms/{org}", getSMS)
// Authenticated endpoints
r.Method("GET", "/cell/{cell}", NewEnsureAuth(getCellDetails))