routing.py 583 Bytes
Newer Older
1
from channels.auth import AuthMiddlewareStack
2 3
from channels.routing import ProtocolTypeRouter, URLRouter

4
from django.conf.urls import url
5
from funkwhale_api.common.auth import TokenAuthMiddleware
6
from funkwhale_api.instance import consumers
7

Agate's avatar
Agate committed
8 9 10
application = ProtocolTypeRouter(
    {
        # Empty for now (http->django views is added by default)
11 12 13 14 15 16
        "websocket": AuthMiddlewareStack(
            TokenAuthMiddleware(
                URLRouter(
                    [url("^api/v1/activity$", consumers.InstanceActivityConsumer)]
                )
            )
Agate's avatar
Agate committed
17 18 19
        )
    }
)