mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Disable camo on enterprise.
CUSTOMER13 doesn't want it, and there's currently no nginx config or configurable Camo URI, so it wouldn't work if image preview were enabled. (imported from commit 615d4a32acbc4d4d590f88cf4e7d45d8f49db1d3)
This commit is contained in:
@@ -2,7 +2,6 @@ class zulip::enterprise {
|
||||
include zulip::base
|
||||
include zulip::app_frontend
|
||||
include zulip::postgres_appdb
|
||||
include zulip::camo
|
||||
|
||||
apt::key {"A529EF65":
|
||||
source => "http://apt.zulip.com/enterprise.asc",
|
||||
|
||||
@@ -154,7 +154,7 @@ class InlineHttpsProcessor(markdown.treeprocessors.Treeprocessor):
|
||||
continue
|
||||
digest = hmac.new(settings.CAMO_KEY, url, hashlib.sha1).hexdigest()
|
||||
encoded_url = url.encode("hex")
|
||||
img.set("src", "https://external-content.zulipcdn.net/%s/%s" % (digest, encoded_url))
|
||||
img.set("src", "%s%s/%s" % (settings.CAMO_URI, digest, encoded_url))
|
||||
|
||||
class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
|
||||
def is_image(self, url):
|
||||
@@ -714,6 +714,8 @@ class Bugdown(markdown.Extension):
|
||||
"_begin")
|
||||
|
||||
md.treeprocessors.add("inline_interesting_links", InlineInterestingLinkProcessor(md), "_end")
|
||||
|
||||
if settings.CAMO_URI:
|
||||
md.treeprocessors.add("rewrite_to_https", InlineHttpsProcessor(md), "_end")
|
||||
|
||||
if self.getConfig("realm") == "mit.edu/zephyr_mirror":
|
||||
|
||||
@@ -49,6 +49,8 @@ MANDRILL_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxx'
|
||||
|
||||
# This should be synced with our camo installation
|
||||
CAMO_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
||||
|
||||
|
||||
# Leave EMAIL_HOST unset or empty if you do not wish for emails to be sent
|
||||
EMAIL_HOST = 'smtp.gmail.com'
|
||||
|
||||
@@ -261,6 +261,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
||||
'API_SUPER_USERS': set(),
|
||||
'ADMINS': '',
|
||||
'INLINE_IMAGE_PREVIEW': True,
|
||||
'CAMO_URI': None,
|
||||
'ENABLE_FEEDBACK': True,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user