adds setting to set non-image-extension image urls
This commit is contained in:
parent
4d9d391365
commit
94af11d7e3
@ -67,6 +67,7 @@ converse.plugins.add('converse-chatview', {
|
||||
'emoji': true,
|
||||
'spoiler': true
|
||||
},
|
||||
'image_urls_regex': null
|
||||
});
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@ function addHyperlinks (text, onImgLoad, onImgClick) {
|
||||
text.addTemplateResult(
|
||||
url_obj.start,
|
||||
url_obj.end,
|
||||
show_images && u.isImageURL(url_text) ?
|
||||
show_images && (u.isImageURL(url_text) || u.isWhitelistedImageURL(url_text)) ?
|
||||
u.convertToImageTag(url_text, onImgLoad, onImgClick) :
|
||||
u.convertUrlToHyperlink(url_text),
|
||||
);
|
||||
|
@ -75,8 +75,12 @@ function checkFileTypes (types, url) {
|
||||
}
|
||||
|
||||
u.isAudioURL = url => checkFileTypes(['.ogg', '.mp3', '.m4a'], url);
|
||||
u.isImageURL = url => checkFileTypes(['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.svg'], url);
|
||||
u.isVideoURL = url => checkFileTypes(['.mp4', '.webm'], url);
|
||||
u.isImageURL = url => checkFileTypes(['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.svg'], url);
|
||||
u.isWhitelistedImageURL = url => {
|
||||
const regex = _converse.api.settings.get('image_urls_regex');
|
||||
return regex ? regex.test(url) : false;
|
||||
}
|
||||
|
||||
function getFileName (uri) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user