urls: Migrate zilencer urls to use modern django pattern.

This commit is contained in:
wowol 2020-04-28 15:45:25 +02:00 committed by Tim Abbott
parent ffed6b87dd
commit 049288eaeb
1 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,7 @@
from typing import Any
from django.conf.urls import include, url
from django.conf.urls import include
from django.urls import path
import zilencer.views
from zerver.lib.rest import rest_dispatch
@ -9,26 +10,26 @@ i18n_urlpatterns: Any = []
# Zilencer views following the REST API style
v1_api_and_json_patterns = [
url('^remotes/push/register$', rest_dispatch,
{'POST': 'zilencer.views.register_remote_push_device'}),
url('^remotes/push/unregister$', rest_dispatch,
{'POST': 'zilencer.views.unregister_remote_push_device'}),
url('^remotes/push/unregister/all$', rest_dispatch,
{'POST': 'zilencer.views.unregister_all_remote_push_devices'}),
url('^remotes/push/notify$', rest_dispatch,
{'POST': 'zilencer.views.remote_server_notify_push'}),
path('remotes/push/register', rest_dispatch,
{'POST': 'zilencer.views.register_remote_push_device'}),
path('remotes/push/unregister', rest_dispatch,
{'POST': 'zilencer.views.unregister_remote_push_device'}),
path('remotes/push/unregister/all', rest_dispatch,
{'POST': 'zilencer.views.unregister_all_remote_push_devices'}),
path('remotes/push/notify', rest_dispatch,
{'POST': 'zilencer.views.remote_server_notify_push'}),
# Push signup doesn't use the REST API, since there's no auth.
url('^remotes/server/register$', zilencer.views.register_remote_server),
path('remotes/server/register', zilencer.views.register_remote_server),
# For receiving table data used in analytics and billing
url('^remotes/server/analytics$', rest_dispatch,
{'POST': 'zilencer.views.remote_server_post_analytics'}),
url('^remotes/server/analytics/status$', rest_dispatch,
{'GET': 'zilencer.views.remote_server_check_analytics'}),
path('remotes/server/analytics', rest_dispatch,
{'POST': 'zilencer.views.remote_server_post_analytics'}),
path('remotes/server/analytics/status', rest_dispatch,
{'GET': 'zilencer.views.remote_server_check_analytics'}),
]
urlpatterns = [
url(r'^api/v1/', include(v1_api_and_json_patterns)),
url(r'^json/', include(v1_api_and_json_patterns)),
path('api/v1/', include(v1_api_and_json_patterns)),
path('json/', include(v1_api_and_json_patterns)),
]