mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-11 03:07:43 +00:00
wip draft a mini webhook
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
MINIO_BUCKET = "livekit-staging-livekit-egress"
|
||||
|
||||
# todo - discuss retry policy if the webhook fail
|
||||
@api_view(["POST"])
|
||||
def minio_webhook(request):
|
||||
|
||||
data = request.data
|
||||
|
||||
record = data["Records"][0]
|
||||
s3 = record['s3']
|
||||
bucket = s3['bucket']
|
||||
bucket_name = bucket['name']
|
||||
object = s3['object']
|
||||
filename = object['key']
|
||||
|
||||
if bucket_name != MINIO_BUCKET:
|
||||
return Response("Not interested in this bucket")
|
||||
|
||||
if object['contentType'] != 'audio/ogg':
|
||||
return Response("Not interested in this file type")
|
||||
|
||||
print('file received', filename)
|
||||
|
||||
return Response("")
|
||||
@@ -5,7 +5,7 @@ from django.urls import include, path
|
||||
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from core.api import get_frontend_configuration, viewsets
|
||||
from core.api import get_frontend_configuration, viewsets, demo
|
||||
from core.authentication.urls import urlpatterns as oidc_urls
|
||||
|
||||
# - Main endpoints
|
||||
@@ -24,6 +24,7 @@ urlpatterns = [
|
||||
*router.urls,
|
||||
*oidc_urls,
|
||||
path("config/", get_frontend_configuration, name="config"),
|
||||
path("minio-webhook/", demo.minio_webhook, name="demo"),
|
||||
]
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user