Skip to content
Snippets Groups Projects
Verified Commit 9d73a77f authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Use a dedicated scope for throttling subsonic to avoid intrusive rate-limiting

parent 82692f11
No related branches found
No related tags found
No related merge requests found
......@@ -759,6 +759,10 @@ THROTTLING_RATES = {
"rate": THROTTLING_USER_RATES.get("anonymous-update", "1000/day"),
"description": "Anonymous PATCH and PUT requests on resource detail",
},
"subsonic": {
"rate": THROTTLING_USER_RATES.get("subsonic", "1000/hour"),
"description": "All subsonic API requests",
},
# potentially spammy / dangerous endpoints
"authenticated-reports": {
"rate": THROTTLING_USER_RATES.get("authenticated-reports", "100/day"),
......
......@@ -104,6 +104,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
content_negotiation_class = negotiation.SubsonicContentNegociation
authentication_classes = [authentication.SubsonicAuthentication]
permission_classes = [rest_permissions.IsAuthenticated]
throttling_scopes = {"*": {"authenticated": "subsonic", "anonymous": "subsonic"}}
def dispatch(self, request, *args, **kwargs):
if not preferences.get("subsonic__enabled"):
......
Use a dedicated scope for throttling subsonic to avoid intrusive rate-limiting
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment