crf exempt on echo bot
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ekaropolus 2025-09-16 23:03:52 -06:00
parent 34d8809bd1
commit 1a80d6be24

View File

@ -6,14 +6,8 @@ from django.views.decorators.csrf import csrf_exempt
def health(request): def health(request):
return JsonResponse({"ok": True, "service": "pxy_bots", "schema_ready": ["req.v1", "render.v1"]}) return JsonResponse({"ok": True, "service": "pxy_bots", "schema_ready": ["req.v1", "render.v1"]})
# pxy_bots/api/views.py @csrf_exempt
import json
from django.http import JsonResponse
def echo_render(request): def echo_render(request):
"""
Accepts req.v1 and returns a simple render_spec so you can validate the router.
"""
try: try:
data = json.loads(request.body.decode("utf-8") or "{}") data = json.loads(request.body.decode("utf-8") or "{}")
except Exception: except Exception:
@ -29,9 +23,5 @@ def echo_render(request):
{"type": "text", "text": f"echo: user={who} cmd={cmd}"}, {"type": "text", "text": f"echo: user={who} cmd={cmd}"},
{"type": "text", "text": f"you said: {text}"}, {"type": "text", "text": f"you said: {text}"},
], ],
"buttons": [
{"label": "Abrir Dashboard", "kind": "open_url", "url": "https://app.polisplexity.tech/"},
{"label": "Re-ejecutar 10", "kind": "callback_api", "action": "rerun", "params": {"minutes": 10}},
],
} }
return JsonResponse(spec) return JsonResponse(spec)