From 8ba14ff8f16f2ce9722b241448a0c8d9a4122d00 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 22 Apr 2020 21:58:51 +0200 Subject: [PATCH] Support Subsonic API without `.view` Some client such as Volusonic use routes without `.view` suffix. --- controllers/subsonic/bookmark.py | 10 ++- controllers/subsonic/browsing.py | 74 ++++++++++++++----- controllers/subsonic/chat.py | 4 +- controllers/subsonic/jukebox.py | 2 +- controllers/subsonic/listing.py | 26 +++++-- controllers/subsonic/media_annotation.py | 24 +++++- .../subsonic/media_library_scanning.py | 8 +- controllers/subsonic/media_retrieval.py | 44 +++++++++-- controllers/subsonic/playlist.py | 18 +++-- controllers/subsonic/podcast.py | 13 +++- controllers/subsonic/radio.py | 5 +- controllers/subsonic/searching.py | 18 ++++- controllers/subsonic/share.py | 24 +++++- controllers/subsonic/system.py | 12 ++- controllers/subsonic/user_management.py | 16 +++- 15 files changed, 238 insertions(+), 60 deletions(-) diff --git a/controllers/subsonic/bookmark.py b/controllers/subsonic/bookmark.py index 59d0164..2bc1aac 100644 --- a/controllers/subsonic/bookmark.py +++ b/controllers/subsonic/bookmark.py @@ -9,7 +9,11 @@ class MusicSubsonicBookmarks(http.Controller): @http.route( - ["/rest/getBookmarks.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getBookmarks.view", "/rest/getBookmarks"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getBookmarks(self, **kwargs): rest = SubsonicREST(kwargs) @@ -26,9 +30,13 @@ def getBookmarks(self, **kwargs): @http.route( [ "/rest/createBookmark.view", + "/rest/createBookmark", "/rest/deleteBookmark.view", + "/rest/deleteBookmark", "/rest/getPlayQueue.view", + "/rest/getPlayQueue", "/rest/savePlayQueue.view", + "/rest/savePlayQueue", ], type="http", auth="public", diff --git a/controllers/subsonic/browsing.py b/controllers/subsonic/browsing.py index 1d43788..2863e2c 100644 --- a/controllers/subsonic/browsing.py +++ b/controllers/subsonic/browsing.py @@ -14,7 +14,7 @@ class MusicSubsonicBrowsing(http.Controller): @http.route( - ["/rest/getMusicFolders.view"], + ["/rest/getMusicFolders.view", "/rest/getMusicFolders"], type="http", auth="public", csrf=False, @@ -37,7 +37,11 @@ def getMusicFolders(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getIndexes.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getIndexes.view", "/rest/getIndexes"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getIndexes(self, **kwargs): rest = SubsonicREST(kwargs) @@ -91,7 +95,7 @@ def getIndexes(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getMusicDirectory.view"], + ["/rest/getMusicDirectory.view", "/rest/getMusicDirectory"], type="http", auth="public", csrf=False, @@ -128,7 +132,11 @@ def getMusicDirectory(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getGenres.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getGenres.view", "/rest/getGenres"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getGenres(self, **kwargs): rest = SubsonicREST(kwargs) @@ -143,7 +151,11 @@ def getGenres(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getArtists.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getArtists.view", "/rest/getArtists"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getArtists(self, **kwargs): rest = SubsonicREST(kwargs) @@ -181,7 +193,11 @@ def getArtists(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getArtist.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getArtist.view", "/rest/getArtist"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getArtist(self, **kwargs): rest = SubsonicREST(kwargs) @@ -208,7 +224,11 @@ def getArtist(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getAlbum.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getAlbum.view", "/rest/getAlbum"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getAlbum(self, **kwargs): rest = SubsonicREST(kwargs) @@ -235,7 +255,11 @@ def getAlbum(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getSong.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getSong.view", "/rest/getSong"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getSong(self, **kwargs): rest = SubsonicREST(kwargs) @@ -258,7 +282,11 @@ def getSong(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getVideos.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getVideos.view", "/rest/getVideos"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getVideos(self, **kwargs): rest = SubsonicREST(kwargs) @@ -273,7 +301,11 @@ def getVideos(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getVideoInfo.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getVideoInfo.view", "/rest/getVideoInfo"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getVideoInfo(self, **kwargs): # TODO: support video infos @@ -285,7 +317,7 @@ def getVideoInfo(self, **kwargs): return request.make_error(code="30", message="Videos are not supported yet") @http.route( - ["/rest/getArtistInfo.view"], + ["/rest/getArtistInfo.view", "/rest/getArtistInfo"], type="http", auth="public", csrf=False, @@ -320,7 +352,7 @@ def getArtistInfo(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getArtistInfo2.view"], + ["/rest/getArtistInfo2.view", "/rest/getArtistInfo2"], type="http", auth="public", csrf=False, @@ -355,7 +387,11 @@ def getArtistInfo2(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getAlbumInfo.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getAlbumInfo.view", "/rest/getAlbumInfo"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getAlbumInfo(self, **kwargs): rest = SubsonicREST(kwargs) @@ -378,7 +414,7 @@ def getAlbumInfo(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getAlbumInfo2.view"], + ["/rest/getAlbumInfo2.view", "/rest/getAlbumInfo2"], type="http", auth="public", csrf=False, @@ -405,7 +441,7 @@ def getAlbumInfo2(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getSimilarSongs.view"], + ["/rest/getSimilarSongs.view", "/rest/getSimilarSongs"], type="http", auth="public", csrf=False, @@ -415,7 +451,7 @@ def getSimilarSongs(self, **kwargs): return self.getSimilarSongs2(**dict(kwargs, tag_name="similarSongs")) @http.route( - ["/rest/getSimilarSongs2.view"], + ["/rest/getSimilarSongs2.view", "/rest/getSimilarSongs2"], type="http", auth="public", csrf=False, @@ -445,7 +481,11 @@ def getSimilarSongs2(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getTopSongs.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getTopSongs.view", "/rest/getTopSongs"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getTopSongs(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/chat.py b/controllers/subsonic/chat.py index 5125a4e..2f66a7a 100644 --- a/controllers/subsonic/chat.py +++ b/controllers/subsonic/chat.py @@ -9,7 +9,7 @@ class MusicSubsonicChat(http.Controller): @http.route( - ["/rest/getChatMessages.view"], + ["/rest/getChatMessages.view", "/rest/getChatMessages"], type="http", auth="public", csrf=False, @@ -28,7 +28,7 @@ def getChatMessages(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/addChatMessage.view"], + ["/rest/addChatMessage.view", "/rest/addChatMessage"], type="http", auth="public", csrf=False, diff --git a/controllers/subsonic/jukebox.py b/controllers/subsonic/jukebox.py index ebc9f52..015e1cb 100644 --- a/controllers/subsonic/jukebox.py +++ b/controllers/subsonic/jukebox.py @@ -7,7 +7,7 @@ class MusicSubsonicJukebox(http.Controller): @http.route( - ["/rest/jukeboxControl.view"], + ["/rest/jukeboxControl.view", "/rest/jukeboxControl"], type="http", auth="public", csrf=False, diff --git a/controllers/subsonic/listing.py b/controllers/subsonic/listing.py index 33c1c77..0372deb 100644 --- a/controllers/subsonic/listing.py +++ b/controllers/subsonic/listing.py @@ -17,7 +17,11 @@ def _uniquify_list(seq): class MusicSubsonicListing(http.Controller): @http.route( - ["/rest/getAlbumList.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getAlbumList.view", "/rest/getAlbumList"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getAlbumList(self, **kwargs): rest = SubsonicREST(kwargs) @@ -149,7 +153,7 @@ def getAlbumList(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getAlbumList2.view"], + ["/rest/getAlbumList2.view", "/rest/getAlbumList2"], type="http", auth="public", csrf=False, @@ -297,7 +301,7 @@ def getAlbumList2(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getRandomSongs.view"], + ["/rest/getRandomSongs.view", "/rest/getRandomSongs"], type="http", auth="public", csrf=False, @@ -349,7 +353,7 @@ def getRandomSongs(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getSongsByGenre.view"], + ["/rest/getSongsByGenre.view", "/rest/getSongsByGenre"], type="http", auth="public", csrf=False, @@ -398,7 +402,7 @@ def getSongsByGenre(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getNowPlaying.view"], + ["/rest/getNowPlaying.view", "/rest/getNowPlaying"], type="http", auth="public", csrf=False, @@ -419,7 +423,11 @@ def getNowPlaying(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getStarred.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getStarred.view", "/rest/getStarred"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getStarred(self, **kwargs): rest = SubsonicREST(kwargs) @@ -458,7 +466,11 @@ def getStarred(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getStarred2.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getStarred2.view", "/rest/getStarred2"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getStarred2(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/media_annotation.py b/controllers/subsonic/media_annotation.py index 7ec75d7..af6d3f1 100644 --- a/controllers/subsonic/media_annotation.py +++ b/controllers/subsonic/media_annotation.py @@ -10,7 +10,11 @@ class MusicSubsonicMediaAnnotation(http.Controller): @http.route( - ["/rest/star.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/star.view", "/rest/star"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def star(self, **kwargs): rest = SubsonicREST(kwargs) @@ -45,7 +49,11 @@ def star(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/unstar.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/unstar.view", "/rest/unstar"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def unstar(self, **kwargs): rest = SubsonicREST(kwargs) @@ -80,7 +88,11 @@ def unstar(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/setRating.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/setRating.view", "/rest/setRating"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def setRating(self, **kwargs): rest = SubsonicREST(kwargs) @@ -121,7 +133,11 @@ def setRating(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/scrobble.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/scrobble.view", "/rest/scrobble"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def scrobble(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/media_library_scanning.py b/controllers/subsonic/media_library_scanning.py index 7aac236..43ee1d0 100644 --- a/controllers/subsonic/media_library_scanning.py +++ b/controllers/subsonic/media_library_scanning.py @@ -10,7 +10,7 @@ class MusicSubsonicMediaLibraryScanning(http.Controller): @http.route( - ["/rest/getScanStatus.view"], + ["/rest/getScanStatus.view", "/rest/getScanStatus"], type="http", auth="public", csrf=False, @@ -31,7 +31,11 @@ def getScanStatus(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/startScan.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/startScan.view", "/rest/startScan"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def startScan(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/media_retrieval.py b/controllers/subsonic/media_retrieval.py index 357ab0a..9fdc3be 100644 --- a/controllers/subsonic/media_retrieval.py +++ b/controllers/subsonic/media_retrieval.py @@ -21,7 +21,11 @@ class MusicSubsonicMediaRetrieval(http.Controller): @http.route( - ["/rest/stream.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/stream.view", "/rest/stream"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def stream(self, **kwargs): rest = SubsonicREST(kwargs) @@ -77,7 +81,11 @@ def stream(self, **kwargs): return Response(data, mimetype=mimetype, direct_passthrough=True) @http.route( - ["/rest/download.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/download.view", "/rest/download"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def download(self, **kwargs): rest = SubsonicREST(kwargs) @@ -95,7 +103,13 @@ def download(self, **kwargs): return http.send_file(track.path, as_attachment=True) - @http.route(["/rest/hls.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"]) + @http.route( + ["/rest/hls.view", "/rest/hls"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], + ) def hls(self, **kwargs): rest = SubsonicREST(kwargs) success, response = rest.check_login() @@ -105,7 +119,11 @@ def hls(self, **kwargs): return rest.make_error(code="30", message="Feature not supported by server.") @http.route( - ["/rest/getCaptions.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getCaptions.view", "/rest/getCaptions"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getCaptions(self, **kwargs): rest = SubsonicREST(kwargs) @@ -116,7 +134,11 @@ def getCaptions(self, **kwargs): return rest.make_error(code="30", message="Feature not supported by server.") @http.route( - ["/rest/getCoverArt.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getCoverArt.view", "/rest/getCoverArt"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getCoverArt(self, **kwargs): rest = SubsonicREST(kwargs) @@ -172,7 +194,11 @@ def getCoverArt(self, **kwargs): return http.send_file(image_stream, filename=folderId + image_ext) @http.route( - ["/rest/getLyrics.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getLyrics.view", "/rest/getLyrics"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getLyrics(self, **kwargs): rest = SubsonicREST(kwargs) @@ -190,7 +216,11 @@ def getLyrics(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getAvatar.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getAvatar.view", "/rest/getAvatar"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getAvatar(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/playlist.py b/controllers/subsonic/playlist.py index cd42c23..6471f9b 100644 --- a/controllers/subsonic/playlist.py +++ b/controllers/subsonic/playlist.py @@ -10,7 +10,11 @@ class MusicSubsonicPlaylist(http.Controller): @http.route( - ["/rest/getPlaylists.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getPlaylists.view", "/rest/getPlaylists"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getPlaylists(self, **kwargs): rest = SubsonicREST(kwargs) @@ -29,7 +33,11 @@ def getPlaylists(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getPlaylist.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getPlaylist.view", "/rest/getPlaylist"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getPlaylist(self, **kwargs): rest = SubsonicREST(kwargs) @@ -56,7 +64,7 @@ def getPlaylist(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/createPlaylist.view"], + ["/rest/createPlaylist.view", "/rest/createPlaylist"], type="http", auth="public", csrf=False, @@ -106,7 +114,7 @@ def createPlaylist(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/updatePlaylist.view"], + ["/rest/updatePlaylist.view", "/rest/updatePlaylist"], type="http", auth="public", csrf=False, @@ -161,7 +169,7 @@ def updatePlaylist(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/deletePlaylist.view"], + ["/rest/deletePlaylist.view", "/rest/deletePlaylist"], type="http", auth="public", csrf=False, diff --git a/controllers/subsonic/podcast.py b/controllers/subsonic/podcast.py index 424f24f..45547f4 100644 --- a/controllers/subsonic/podcast.py +++ b/controllers/subsonic/podcast.py @@ -9,7 +9,11 @@ class MusicSubsonicPodcast(http.Controller): @http.route( - ["/rest/getPodcasts.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getPodcasts.view", "/rest/getPodcasts"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getPodcasts(self, **kwargs): rest = SubsonicREST(kwargs) @@ -24,7 +28,7 @@ def getPodcasts(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getNewestPodcasts.view"], + ["/rest/getNewestPodcasts.view", "/rest/getNewestPodcasts"], type="http", auth="public", csrf=False, @@ -45,10 +49,15 @@ def getNewestPodcasts(self, **kwargs): @http.route( [ "/rest/refreshPodcasts.view", + "/rest/refreshPodcasts", "/rest/createPodcastChannel.view", + "/rest/createPodcastChannel", "/rest/deletePodcastChannel.view", + "/rest/deletePodcastChannel", "/rest/deletePodcastEpisode.view", + "/rest/deletePodcastEpisode", "/rest/downloadPodcastEpisode.view", + "/rest/downloadPodcastEpisode", ], type="http", auth="public", diff --git a/controllers/subsonic/radio.py b/controllers/subsonic/radio.py index 8edb5ca..6b78bef 100644 --- a/controllers/subsonic/radio.py +++ b/controllers/subsonic/radio.py @@ -9,7 +9,7 @@ class MusicSubsonicRadio(http.Controller): @http.route( - ["/rest/getInternetRadioStations.view"], + ["/rest/getInternetRadioStations.view", "/rest/getInternetRadioStations"], type="http", auth="public", csrf=False, @@ -30,8 +30,11 @@ def getInternetRadioStations(self, **kwargs): @http.route( [ "/rest/createInternetRadioStation.view", + "/rest/createInternetRadioStation", "/rest/updateInternetRadioStation.view", + "/rest/updateInternetRadioStation", "/rest/deleteInternetRadioStation.view", + "/rest/deleteInternetRadioStation", ], type="http", auth="public", diff --git a/controllers/subsonic/searching.py b/controllers/subsonic/searching.py index 8c5c27f..fecca17 100644 --- a/controllers/subsonic/searching.py +++ b/controllers/subsonic/searching.py @@ -12,7 +12,11 @@ class MusicSubsonicSearching(http.Controller): @http.route( - ["/rest/search.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/search.view", "/rest/search"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def search(self, **kwargs): rest = SubsonicREST(kwargs) @@ -113,7 +117,11 @@ def search(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/search2.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/search2.view", "/rest/search2"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def search2(self, **kwargs): rest = SubsonicREST(kwargs) @@ -178,7 +186,11 @@ def search2(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/search3.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/search3.view", "/rest/search3"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def search3(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/share.py b/controllers/subsonic/share.py index 178aec6..165dd06 100644 --- a/controllers/subsonic/share.py +++ b/controllers/subsonic/share.py @@ -9,7 +9,11 @@ class MusicSubsonicShare(http.Controller): @http.route( - ["/rest/getShares.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getShares.view", "/rest/getShares"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getShares(self, **kwargs): rest = SubsonicREST(kwargs) @@ -26,7 +30,11 @@ def getShares(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/createShare.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/createShare.view", "/rest/createShare"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def createShare(self, **kwargs): rest = SubsonicREST(kwargs) @@ -37,7 +45,11 @@ def createShare(self, **kwargs): return rest.make_error(code="30", message="Feature not supported by server.") @http.route( - ["/rest/updateShare.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/updateShare.view", "/rest/updateShare"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def updateShare(self, **kwargs): rest = SubsonicREST(kwargs) @@ -49,7 +61,11 @@ def updateShare(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/deleteShare.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/deleteShare.view", "/rest/deleteShare"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def deleteShare(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/system.py b/controllers/subsonic/system.py index 47fb83f..c125f70 100644 --- a/controllers/subsonic/system.py +++ b/controllers/subsonic/system.py @@ -9,7 +9,11 @@ class MusicSubsonicSystem(http.Controller): @http.route( - ["/rest/ping.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/ping.view", "/rest/ping"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def ping(self, **kwargs): rest = SubsonicREST(kwargs) @@ -17,7 +21,11 @@ def ping(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getLicense.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getLicense.view", "/rest/getLicense"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getLicense(self, **kwargs): rest = SubsonicREST(kwargs) diff --git a/controllers/subsonic/user_management.py b/controllers/subsonic/user_management.py index dad7132..3c91ed2 100644 --- a/controllers/subsonic/user_management.py +++ b/controllers/subsonic/user_management.py @@ -10,7 +10,11 @@ class MusicSubsonicUserManagement(http.Controller): @http.route( - ["/rest/getUser.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getUser.view", "/rest/getUser"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getUser(self, **kwargs): rest = SubsonicREST(kwargs) @@ -35,7 +39,11 @@ def getUser(self, **kwargs): return rest.make_response(root) @http.route( - ["/rest/getUsers.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"] + ["/rest/getUsers.view", "/rest/getUsers"], + type="http", + auth="public", + csrf=False, + methods=["GET", "POST"], ) def getUsers(self, **kwargs): rest = SubsonicREST(kwargs) @@ -57,9 +65,13 @@ def getUsers(self, **kwargs): @http.route( [ "/rest/createUser.view", + "/rest/createUser", "/rest/updateUser.view", + "/rest/updateUser", "/rest/deleteUser.view", + "/rest/deleteUser", "/rest/changePassword.view", + "/rest/changePassword", ], type="http", auth="public",