Unverified Commit b7cd96aa authored by Chris's avatar Chris Committed by GitHub
Browse files

add image proxy config page and use message_source for editing when (#649)

available
parent 27dfa032
......@@ -40,6 +40,9 @@ export default class StorageSettings extends AdminSettings {
config.FileSettings.AmazonS3SSE = this.state.amazonS3SSE;
config.FileSettings.AmazonS3Trace = this.state.amazonS3Trace;
config.ServiceSettings.ImageProxyType = this.state.imageProxyType;
config.ServiceSettings.ImageProxyOptions = this.state.imageProxyOptions;
config.ServiceSettings.ImageProxyURL = this.state.imageProxyURL;
return config;
}
......@@ -58,7 +61,11 @@ export default class StorageSettings extends AdminSettings {
amazonS3Endpoint: config.FileSettings.AmazonS3Endpoint,
amazonS3SSL: config.FileSettings.AmazonS3SSL,
amazonS3SSE: config.FileSettings.AmazonS3SSE,
amazonS3Trace: config.FileSettings.AmazonS3Trace
amazonS3Trace: config.FileSettings.AmazonS3Trace,
imageProxyType: config.ServiceSettings.ImageProxyType,
imageProxyOptions: config.ServiceSettings.ImageProxyOptions,
imageProxyURL: config.ServiceSettings.ImageProxyURL
};
}
......@@ -355,6 +362,64 @@ export default class StorageSettings extends AdminSettings {
onChange={this.handleChange}
disabled={!this.state.enableFileAttachments}
/>
<DropdownSetting
id='imageProxyType'
values={[
{value: '', text: Utils.localizeMessage('admin.image.proxyTypeNone', 'None')},
{value: 'atmos/camo', text: 'atmos/camo'},
{value: 'willnorris/imageproxy', text: 'willnorris/imageproxy'}
]}
label={
<FormattedMessage
id='admin.image.proxyType'
defaultMessage='Image Proxy Type:'
/>
}
helpText={
<FormattedHTMLMessage
id='admin.image.proxyTypeDescription'
defaultMessage='Configure an image proxy to load all Markdown images through a proxy. The image proxy prevents users from making insecure image requests, provides caching for increased performance, and automates image adjustments such as resizing. See <a href="https://about.mattermost.com/default-image-proxy-documentation">documentation</a> to learn more.'
/>
}
value={this.state.imageProxyType}
onChange={this.handleChange}
/>
<TextSetting
id='imageProxyURL'
label={
<FormattedMessage
id='admin.image.proxyURL'
defaultMessage='Image Proxy URL:'
/>
}
helpText={
<FormattedMessage
id='admin.image.proxyURLDescription'
defaultMessage='URL of your image proxy server.'
/>
}
value={this.state.imageProxyURL}
onChange={this.handleChange}
disabled={!this.state.imageProxyType}
/>
<TextSetting
id='imageProxyOptions'
label={
<FormattedMessage
id='admin.image.proxyOptions'
defaultMessage='Image Proxy Options:'
/>
}
helpText={
<FormattedMessage
id='admin.image.proxyOptionsDescription'
defaultMessage='Additional options for basic image adjustments such as resizing, cropping, and rotation. Refer to your image proxy documentation to learn more about what options are supported.'
/>
}
value={this.state.imageProxyOptions}
onChange={this.handleChange}
disabled={!this.state.imageProxyType}
/>
</SettingsGroup>
);
}
......
......@@ -129,7 +129,7 @@ export default class EditPostModal extends React.PureComponent {
return;
}
if (updatedPost.message === editingPost.post.message) {
if (updatedPost.message === (editingPost.post.message_source || editingPost.post.message)) {
// no changes so just close the modal
this.handleHide();
return;
......@@ -183,7 +183,7 @@ export default class EditPostModal extends React.PureComponent {
handleEnter = () => {
this.setState({
editText: this.props.editingPost.post.message
editText: this.props.editingPost.post.message_source || this.props.editingPost.post.message
});
}
......
......@@ -519,6 +519,13 @@
"admin.image.maxFileSizeDescription": "Maximum file size for message attachments in megabytes. Caution: Verify server memory can support your setting choice. Large file sizes increase the risk of server crashes and failed uploads due to network interruptions.",
"admin.image.maxFileSizeExample": "50",
"admin.image.maxFileSizeTitle": "Maximum File Size:",
"admin.image.proxyOptions": "Image Proxy Options:",
"admin.image.proxyOptionsDescription": "Additional options for basic image adjustments such as resizing, cropping, and rotation. Refer to your image proxy documentation to learn more about what options are supported.",
"admin.image.proxyType": "Image Proxy Type:",
"admin.image.proxyTypeNone": "None",
"admin.image.proxyTypeDescription": "Configure an image proxy to load all Markdown images through a proxy. The image proxy prevents users from making insecure image requests, provides caching for increased performance, and automates image adjustments such as resizing. See <a href=\"https://about.mattermost.com/default-image-proxy-documentation\">documentation</a> to learn more.",
"admin.image.proxyURL": "Image Proxy URL:",
"admin.image.proxyURLDescription": "URL of your image proxy server.",
"admin.image.publicLinkDescription": "32-character salt added to signing of public image links. Randomly generated on install. Click \"Regenerate\" to create new salt.",
"admin.image.publicLinkExample": "E.g.: \"gxHVDcKUyP2y1eiyW8S8na1UYQAfq6J6\"",
"admin.image.publicLinkTitle": "Public Link Salt:",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment