-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow any CORS on api/v1/plugins/ and api/v1/plugins/metas/
- Loading branch information
1 parent
b7e7840
commit 744c4a3
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ | |
|
||
class PluginsConfig(AppConfig): | ||
name = 'plugins' | ||
|
||
def ready(self): | ||
from plugins import handlers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from corsheaders.signals import check_request_enabled | ||
import re | ||
|
||
_ALLOWED = re.compile(r'/api/v1/plugins/(metas/)?(search/)?(\d+/)?') | ||
|
||
|
||
def cors_allow_api_to_everyone(sender, request, **kwargs): | ||
return _ALLOWED.fullmatch(request.path) | ||
|
||
|
||
check_request_enabled.connect(cors_allow_api_to_everyone) | ||
|