2013-04-23 18:51:17 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2012-10-15 22:52:08 +02:00
|
|
|
from django.conf import settings
|
2013-06-18 23:55:55 +02:00
|
|
|
import ujson
|
2015-08-19 02:58:20 +02:00
|
|
|
from zproject.backends import password_auth_enabled, dev_auth_enabled, google_auth_enabled
|
2012-10-15 22:52:08 +02:00
|
|
|
|
2012-10-30 21:20:52 +01:00
|
|
|
def add_settings(request):
|
2015-08-19 03:42:38 +02:00
|
|
|
realm = request.user.realm if hasattr(request.user, "realm") else None
|
2012-10-17 20:34:38 +02:00
|
|
|
return {
|
2015-08-21 11:48:43 +02:00
|
|
|
# We use the not_voyager variable name so that templates
|
2013-11-13 22:08:58 +01:00
|
|
|
# will render even if the appropriate context is not provided
|
|
|
|
# to the template
|
2015-08-21 11:48:43 +02:00
|
|
|
'not_voyager': not settings.VOYAGER,
|
2015-08-21 09:53:11 +02:00
|
|
|
'zulip_com': settings.ZULIP_COM,
|
2016-07-19 06:52:34 +02:00
|
|
|
'register_link_disabled': settings.REGISTER_LINK_DISABLED,
|
2016-07-19 06:49:47 +02:00
|
|
|
'show_oss_announcement': settings.SHOW_OSS_ANNOUNCEMENT,
|
2015-08-20 03:52:21 +02:00
|
|
|
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
|
|
|
|
'login_url': settings.HOME_NOT_LOGGED_IN,
|
|
|
|
'only_sso': settings.ONLY_SSO,
|
|
|
|
'external_api_path': settings.EXTERNAL_API_PATH,
|
|
|
|
'external_api_uri': settings.EXTERNAL_API_URI,
|
|
|
|
'external_uri_scheme': settings.EXTERNAL_URI_SCHEME,
|
|
|
|
'api_site_required': settings.EXTERNAL_API_PATH != "api.zulip.com",
|
2013-12-04 22:35:38 +01:00
|
|
|
'email_integration_enabled': settings.EMAIL_GATEWAY_BOT != "",
|
2015-08-20 03:52:21 +02:00
|
|
|
'email_gateway_example': settings.EMAIL_GATEWAY_EXAMPLE,
|
2016-06-03 01:02:58 +02:00
|
|
|
'open_realm_creation': settings.OPEN_REALM_CREATION,
|
2015-08-20 03:52:21 +02:00
|
|
|
'password_auth_enabled': password_auth_enabled(realm),
|
|
|
|
'dev_auth_enabled': dev_auth_enabled(),
|
|
|
|
'google_auth_enabled': google_auth_enabled(),
|
2016-06-18 18:57:22 +02:00
|
|
|
'development_environment': settings.DEVELOPMENT,
|
2012-10-17 20:34:38 +02:00
|
|
|
}
|
2013-06-17 18:01:22 +02:00
|
|
|
|
|
|
|
def add_metrics(request):
|
|
|
|
return {
|
2013-10-29 22:21:17 +01:00
|
|
|
'dropboxAppKey': settings.DROPBOX_APP_KEY
|
2013-06-17 18:01:22 +02:00
|
|
|
}
|