2018-06-10 09:29:24 +00:00
|
|
|
from django.conf.urls import include, url
|
|
|
|
from dynamic_preferences.api.viewsets import GlobalPreferencesViewSet
|
2017-06-23 21:00:42 +00:00
|
|
|
from rest_framework import routers
|
2018-05-08 14:32:07 +00:00
|
|
|
from rest_framework.urlpatterns import format_suffix_patterns
|
2018-06-10 09:29:24 +00:00
|
|
|
from rest_framework_jwt import views as jwt_views
|
|
|
|
|
2018-03-25 15:24:08 +00:00
|
|
|
from funkwhale_api.activity import views as activity_views
|
2017-06-23 21:00:42 +00:00
|
|
|
from funkwhale_api.music import views
|
|
|
|
from funkwhale_api.playlists import views as playlists_views
|
2018-05-08 14:32:07 +00:00
|
|
|
from funkwhale_api.subsonic.views import SubsonicViewSet
|
2017-06-23 21:00:42 +00:00
|
|
|
|
|
|
|
router = routers.SimpleRouter()
|
2018-06-09 13:36:16 +00:00
|
|
|
router.register(r"settings", GlobalPreferencesViewSet, base_name="settings")
|
|
|
|
router.register(r"activity", activity_views.ActivityViewSet, "activity")
|
|
|
|
router.register(r"tags", views.TagViewSet, "tags")
|
|
|
|
router.register(r"tracks", views.TrackViewSet, "tracks")
|
2018-09-22 12:29:30 +00:00
|
|
|
router.register(r"uploads", views.UploadViewSet, "uploads")
|
2018-09-06 18:35:02 +00:00
|
|
|
router.register(r"libraries", views.LibraryViewSet, "libraries")
|
|
|
|
router.register(r"listen", views.ListenViewSet, "listen")
|
2018-06-09 13:36:16 +00:00
|
|
|
router.register(r"artists", views.ArtistViewSet, "artists")
|
|
|
|
router.register(r"albums", views.AlbumViewSet, "albums")
|
2018-12-04 14:13:37 +00:00
|
|
|
router.register(r"licenses", views.LicenseViewSet, "licenses")
|
2018-06-09 13:36:16 +00:00
|
|
|
router.register(r"playlists", playlists_views.PlaylistViewSet, "playlists")
|
2017-06-29 21:26:57 +00:00
|
|
|
router.register(
|
2018-06-09 13:36:16 +00:00
|
|
|
r"playlist-tracks", playlists_views.PlaylistTrackViewSet, "playlist-tracks"
|
|
|
|
)
|
2017-06-26 18:19:09 +00:00
|
|
|
v1_patterns = router.urls
|
2017-06-23 21:00:42 +00:00
|
|
|
|
2018-05-08 14:32:07 +00:00
|
|
|
subsonic_router = routers.SimpleRouter(trailing_slash=False)
|
2018-06-09 13:36:16 +00:00
|
|
|
subsonic_router.register(r"subsonic/rest", SubsonicViewSet, base_name="subsonic")
|
2018-05-08 14:32:07 +00:00
|
|
|
|
|
|
|
|
2017-06-26 18:19:09 +00:00
|
|
|
v1_patterns += [
|
2018-12-19 13:04:26 +00:00
|
|
|
url(r"^oembed/$", views.OembedView.as_view(), name="oembed"),
|
2018-06-09 13:36:16 +00:00
|
|
|
url(
|
|
|
|
r"^instance/",
|
|
|
|
include(("funkwhale_api.instance.urls", "instance"), namespace="instance"),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^manage/",
|
|
|
|
include(("funkwhale_api.manage.urls", "manage"), namespace="manage"),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^federation/",
|
2018-02-17 20:21:08 +00:00
|
|
|
include(
|
2018-06-09 13:36:16 +00:00
|
|
|
("funkwhale_api.federation.api_urls", "federation"), namespace="federation"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^providers/",
|
|
|
|
include(("funkwhale_api.providers.urls", "providers"), namespace="providers"),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^favorites/",
|
|
|
|
include(("funkwhale_api.favorites.urls", "favorites"), namespace="favorites"),
|
|
|
|
),
|
|
|
|
url(r"^search$", views.Search.as_view(), name="search"),
|
|
|
|
url(
|
|
|
|
r"^radios/",
|
|
|
|
include(("funkwhale_api.radios.urls", "radios"), namespace="radios"),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^history/",
|
|
|
|
include(("funkwhale_api.history.urls", "history"), namespace="history"),
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^users/",
|
|
|
|
include(("funkwhale_api.users.api_urls", "users"), namespace="users"),
|
|
|
|
),
|
|
|
|
url(r"^token/$", jwt_views.obtain_jwt_token, name="token"),
|
|
|
|
url(r"^token/refresh/$", jwt_views.refresh_jwt_token, name="token_refresh"),
|
2017-06-23 21:00:42 +00:00
|
|
|
]
|
2017-06-26 18:19:09 +00:00
|
|
|
|
|
|
|
urlpatterns = [
|
2018-06-09 13:36:16 +00:00
|
|
|
url(r"^v1/", include((v1_patterns, "v1"), namespace="v1"))
|
|
|
|
] + format_suffix_patterns(subsonic_router.urls, allowed=["view"])
|