Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
94af11d7
Commit
94af11d7
authored
Aug 27, 2020
by
Ariel Fuggini
Committed by
JC Brand
Aug 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds setting to set non-image-extension image urls
parent
4d9d3913
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
src/converse-chatview.js
src/converse-chatview.js
+1
-0
src/templates/directives/body.js
src/templates/directives/body.js
+1
-1
src/utils/html.js
src/utils/html.js
+5
-1
No files found.
src/converse-chatview.js
View file @
94af11d7
...
@@ -67,6 +67,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -67,6 +67,7 @@ converse.plugins.add('converse-chatview', {
'
emoji
'
:
true
,
'
emoji
'
:
true
,
'
spoiler
'
:
true
'
spoiler
'
:
true
},
},
'
image_urls_regex
'
:
null
});
});
...
...
src/templates/directives/body.js
View file @
94af11d7
...
@@ -120,7 +120,7 @@ function addHyperlinks (text, onImgLoad, onImgClick) {
...
@@ -120,7 +120,7 @@ function addHyperlinks (text, onImgLoad, onImgClick) {
text
.
addTemplateResult
(
text
.
addTemplateResult
(
url_obj
.
start
,
url_obj
.
start
,
url_obj
.
end
,
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
.
convertToImageTag
(
url_text
,
onImgLoad
,
onImgClick
)
:
u
.
convertUrlToHyperlink
(
url_text
),
u
.
convertUrlToHyperlink
(
url_text
),
);
);
...
...
src/utils/html.js
View file @
94af11d7
...
@@ -75,8 +75,12 @@ function checkFileTypes (types, url) {
...
@@ -75,8 +75,12 @@ function checkFileTypes (types, url) {
}
}
u
.
isAudioURL
=
url
=>
checkFileTypes
([
'
.ogg
'
,
'
.mp3
'
,
'
.m4a
'
],
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
.
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
)
{
function
getFileName
(
uri
)
{
try
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment