2017-11-16 00:55:49 +01:00
|
|
|
from django.conf.urls import include, url
|
2016-12-20 02:30:08 +01:00
|
|
|
|
2016-10-27 15:08:42 +02:00
|
|
|
import analytics.views
|
2017-11-16 00:55:49 +01:00
|
|
|
from zerver.lib.rest import rest_dispatch
|
2013-11-05 19:30:18 +01:00
|
|
|
|
2016-05-19 17:33:30 +02:00
|
|
|
i18n_urlpatterns = [
|
2017-02-02 22:14:10 +01:00
|
|
|
# Server admin (user_profile.is_staff) visible stats pages
|
2016-10-27 15:08:42 +02:00
|
|
|
url(r'^activity$', analytics.views.get_activity,
|
|
|
|
name='analytics.views.get_activity'),
|
2017-01-12 23:18:37 +01:00
|
|
|
url(r'^realm_activity/(?P<realm_str>[\S]+)/$', analytics.views.get_realm_activity,
|
2016-10-27 15:08:42 +02:00
|
|
|
name='analytics.views.get_realm_activity'),
|
|
|
|
url(r'^user_activity/(?P<email>[\S]+)/$', analytics.views.get_user_activity,
|
|
|
|
name='analytics.views.get_user_activity'),
|
2018-05-18 02:16:29 +02:00
|
|
|
|
2018-04-15 18:43:48 +02:00
|
|
|
url(r'^stats/realm/(?P<realm_str>[\S]+)/$', analytics.views.stats_for_realm,
|
|
|
|
name='analytics.views.stats_for_realm'),
|
2018-05-18 02:16:29 +02:00
|
|
|
url(r'^stats/installation$', analytics.views.stats_for_installation,
|
|
|
|
name='analytics.views.stats_for_installation'),
|
2019-02-02 20:57:20 +01:00
|
|
|
url(r'^stats/remote/(?P<remote_server_id>[\S]+)/installation$',
|
|
|
|
analytics.views.stats_for_remote_installation,
|
|
|
|
name='analytics.views.stats_for_remote_installation'),
|
|
|
|
url(r'^stats/remote/(?P<remote_server_id>[\S]+)/realm/(?P<remote_realm_id>[\S]+)/$',
|
|
|
|
analytics.views.stats_for_remote_realm,
|
|
|
|
name='analytics.views.stats_for_remote_realm'),
|
2016-12-20 02:30:08 +01:00
|
|
|
|
|
|
|
# User-visible stats page
|
|
|
|
url(r'^stats$', analytics.views.stats,
|
|
|
|
name='analytics.views.stats'),
|
|
|
|
]
|
|
|
|
|
|
|
|
# These endpoints are a part of the API (V1), which uses:
|
|
|
|
# * REST verbs
|
|
|
|
# * Basic auth (username:password is email:apiKey)
|
|
|
|
# * Takes and returns json-formatted data
|
|
|
|
#
|
|
|
|
# See rest_dispatch in zerver.lib.rest for an explanation of auth methods used
|
|
|
|
#
|
|
|
|
# All of these paths are accessed by either a /json or /api prefix
|
|
|
|
v1_api_and_json_patterns = [
|
|
|
|
# get data for the graphs at /stats
|
|
|
|
url(r'^analytics/chart_data$', rest_dispatch,
|
|
|
|
{'GET': 'analytics.views.get_chart_data'}),
|
2018-04-15 18:43:48 +02:00
|
|
|
url(r'^analytics/chart_data/realm/(?P<realm_str>[\S]+)$', rest_dispatch,
|
|
|
|
{'GET': 'analytics.views.get_chart_data_for_realm'}),
|
2018-05-18 02:16:29 +02:00
|
|
|
url(r'^analytics/chart_data/installation$', rest_dispatch,
|
|
|
|
{'GET': 'analytics.views.get_chart_data_for_installation'}),
|
2019-02-02 20:57:20 +01:00
|
|
|
url(r'^analytics/chart_data/remote/(?P<remote_server_id>[\S]+)/installation$', rest_dispatch,
|
|
|
|
{'GET': 'analytics.views.get_chart_data_for_remote_installation'}),
|
|
|
|
url(r'^analytics/chart_data/remote/(?P<remote_server_id>[\S]+)/realm/(?P<remote_realm_id>[\S]+)$',
|
|
|
|
rest_dispatch,
|
|
|
|
{'GET': 'analytics.views.get_chart_data_for_remote_realm'}),
|
2016-12-20 02:30:08 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
i18n_urlpatterns += [
|
|
|
|
url(r'^api/v1/', include(v1_api_and_json_patterns)),
|
|
|
|
url(r'^json/', include(v1_api_and_json_patterns)),
|
2016-05-19 17:33:30 +02:00
|
|
|
]
|
2013-11-05 19:30:18 +01:00
|
|
|
|
2016-10-27 12:38:16 +02:00
|
|
|
urlpatterns = i18n_urlpatterns
|