Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
502
Issue boards
Milestones
Wiki
Code
Merge requests
19
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
funkwhale
Commits
0d14cff0
Verified
Commit
0d14cff0
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
See
#261
: configuration and settings
parent
2eacf83b
No related branches found
No related tags found
1 merge request
!877
: Rate limiting
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/config/settings/common.py
+133
-2
133 additions, 2 deletions
api/config/settings/common.py
api/funkwhale_api/users/rest_auth_urls.py
+0
-1
0 additions, 1 deletion
api/funkwhale_api/users/rest_auth_urls.py
with
133 additions
and
3 deletions
api/config/settings/common.py
+
133
−
2
View file @
0d14cff0
...
...
@@ -616,6 +616,7 @@ REST_FRAMEWORK = {
"
django_filters.rest_framework.DjangoFilterBackend
"
,
),
"
DEFAULT_RENDERER_CLASSES
"
:
(
"
rest_framework.renderers.JSONRenderer
"
,),
"
NUM_PROXIES
"
:
env
.
int
(
"
NUM_PROXIES
"
,
default
=
1
),
}
THROTTLING_ENABLED
=
env
.
bool
(
"
THROTTLING_ENABLED
"
,
default
=
True
)
if
THROTTLING_ENABLED
:
...
...
@@ -625,10 +626,140 @@ if THROTTLING_ENABLED:
)
THROTTLING_SCOPES
=
{
"
*
"
:
{
"
anonymous
"
:
"
anonymous-wildcard
"
,
"
authenticated
"
:
"
authenticated-wildcard
"
}
"
*
"
:
{
"
anonymous
"
:
"
anonymous-wildcard
"
,
"
authenticated
"
:
"
authenticated-wildcard
"
},
"
create
"
:
{
"
authenticated
"
:
"
authenticated-create
"
,
"
anonymous
"
:
"
anonymous-create
"
,
},
"
list
"
:
{
"
authenticated
"
:
"
authenticated-list
"
,
"
anonymous
"
:
"
anonymous-list
"
},
"
retrieve
"
:
{
"
authenticated
"
:
"
authenticated-retrieve
"
,
"
anonymous
"
:
"
anonymous-retrieve
"
,
},
"
destroy
"
:
{
"
authenticated
"
:
"
authenticated-destroy
"
,
"
anonymous
"
:
"
anonymous-destroy
"
,
},
"
update
"
:
{
"
authenticated
"
:
"
authenticated-update
"
,
"
anonymous
"
:
"
anonymous-update
"
,
},
"
partial_update
"
:
{
"
authenticated
"
:
"
authenticated-update
"
,
"
anonymous
"
:
"
anonymous-update
"
,
},
}
THROTTLING_USER_RATES
=
env
.
dict
(
"
THROTTLING_RATES
"
,
default
=
{})
THROTTLING_RATES
=
{
"
anonymous-wildcard
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-wildcard
"
,
"
1000/h
"
),
"
description
"
:
"
Anonymous requests not covered by other limits
"
,
},
"
authenticated-wildcard
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-wildcard
"
,
"
2000/h
"
),
"
description
"
:
"
Authenticated requests not covered by other limits
"
,
},
"
authenticated-create
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-create
"
,
"
1000/hour
"
),
"
description
"
:
"
Authenticated POST requests
"
,
},
"
anonymous-create
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-create
"
,
"
1000/day
"
),
"
description
"
:
"
Anonymous POST requests
"
,
},
"
authenticated-list
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-list
"
,
"
10000/hour
"
),
"
description
"
:
"
Authenticated GET requests on resource lists
"
,
},
"
anonymous-list
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-list
"
,
"
10000/day
"
),
"
description
"
:
"
Anonymous GET requests on resource lists
"
,
},
"
authenticated-retrieve
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-retrieve
"
,
"
10000/hour
"
),
"
description
"
:
"
Authenticated GET requests on resource detail
"
,
},
"
anonymous-retrieve
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-retrieve
"
,
"
10000/day
"
),
"
description
"
:
"
Anonymous GET requests on resource detail
"
,
},
"
authenticated-destroy
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-destroy
"
,
"
500/hour
"
),
"
description
"
:
"
Authenticated DELETE requests on resource detail
"
,
},
"
anonymous-destroy
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-destroy
"
,
"
1000/day
"
),
"
description
"
:
"
Anonymous DELETE requests on resource detail
"
,
},
"
authenticated-update
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-update
"
,
"
1000/hour
"
),
"
description
"
:
"
Authenticated PATCH and PUT requests on resource detail
"
,
},
"
anonymous-update
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-update
"
,
"
1000/day
"
),
"
description
"
:
"
Anonymous PATCH and PUT requests on resource detail
"
,
},
# potentially spammy / dangerous endpoints
"
authenticated-reports
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-reports
"
,
"
100/day
"
),
"
description
"
:
"
Authenticated report submission
"
,
},
"
anonymous-reports
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-reports
"
,
"
10/day
"
),
"
description
"
:
"
Anonymous report submission
"
,
},
"
authenticated-oauth-app
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
authenticated-oauth-app
"
,
"
10/hour
"
),
"
description
"
:
"
Authenticated OAuth app creation
"
,
},
"
anonymous-oauth-app
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
anonymous-oauth-app
"
,
"
10/day
"
),
"
description
"
:
"
Anonymous OAuth app creation
"
,
},
"
oauth-authorize
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
oauth-authorize
"
,
"
100/hour
"
),
"
description
"
:
"
OAuth app authorization
"
,
},
"
oauth-token
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
oauth-token
"
,
"
100/hour
"
),
"
description
"
:
"
OAuth token creation
"
,
},
"
oauth-revoke-token
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
oauth-revoke-token
"
,
"
100/hour
"
),
"
description
"
:
"
OAuth token deletion
"
,
},
"
jwt-login
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
jwt-login
"
,
"
30/hour
"
),
"
description
"
:
"
JWT token creation
"
,
},
"
jwt-refresh
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
jwt-refresh
"
,
"
30/hour
"
),
"
description
"
:
"
JWT token refresh
"
,
},
"
signup
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
signup
"
,
"
10/day
"
),
"
description
"
:
"
Account creation
"
,
},
"
verify-email
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
verify-email
"
,
"
20/h
"
),
"
description
"
:
"
Email address confirmation
"
,
},
"
password-change
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
password-change
"
,
"
20/h
"
),
"
description
"
:
"
Password change (when authenticated)
"
,
},
"
password-reset
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
password-reset
"
,
"
20/h
"
),
"
description
"
:
"
Password reset request
"
,
},
"
password-reset-confirm
"
:
{
"
rate
"
:
THROTTLING_USER_RATES
.
get
(
"
password-reset-confirm
"
,
"
20/h
"
),
"
description
"
:
"
Password reset confirmation
"
,
},
}
THROTTLING_RATES
=
{
"
anonymous-wildcard
"
:
None
,
"
authenticated-wildcard
"
:
None
}
BROWSABLE_API_ENABLED
=
env
.
bool
(
"
BROWSABLE_API_ENABLED
"
,
default
=
False
)
if
BROWSABLE_API_ENABLED
:
...
...
This diff is collapsed.
Click to expand it.
api/funkwhale_api/users/rest_auth_urls.py
+
0
−
1
View file @
0d14cff0
from
django.conf.urls
import
url
from
django.views.generic
import
TemplateView
from
rest_auth
import
views
as
rest_auth_views
from
rest_auth.registration
import
views
as
registration_views
from
.
import
views
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment