Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
9bbf5467
Commit
9bbf5467
authored
Jun 08, 2023
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed parsing images in chat, they should be base64 encoded
parent
301b17e7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
chatwindow.py
blink/chatwindow.py
+3
-3
No files found.
blink/chatwindow.py
View file @
9bbf5467
...
@@ -2455,7 +2455,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2455,7 +2455,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
encrypted
=
False
encrypted
=
False
if
message
.
content_type
.
startswith
(
'image/'
):
if
message
.
content_type
.
startswith
(
'image/'
):
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
message
.
content
.
decode
(
'base64'
)
.
rstrip
())
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
message
.
content
.
rstrip
())
elif
message
.
content_type
.
startswith
(
'text/'
):
elif
message
.
content_type
.
startswith
(
'text/'
):
if
MessageManager
()
.
check_encryption
(
message
.
content_type
,
message
.
content
)
==
'OpenPGP'
:
if
MessageManager
()
.
check_encryption
(
message
.
content_type
,
message
.
content
)
==
'OpenPGP'
:
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
...
@@ -2614,7 +2614,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2614,7 +2614,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
for
message
in
messages
:
for
message
in
messages
:
encrypted
=
False
encrypted
=
False
if
message
.
content_type
.
startswith
(
'image/'
):
if
message
.
content_type
.
startswith
(
'image/'
):
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
message
.
content
.
decode
(
'base64'
)
.
rstrip
())
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
message
.
content
.
rstrip
())
elif
message
.
content_type
.
startswith
(
'text/'
):
elif
message
.
content_type
.
startswith
(
'text/'
):
if
MessageManager
()
.
check_encryption
(
message
.
content_type
,
message
.
content
)
==
'OpenPGP'
:
if
MessageManager
()
.
check_encryption
(
message
.
content_type
,
message
.
content
)
==
'OpenPGP'
:
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
content
=
f
'<img src={session.chat_widget.encrypted_icon.filename} class="inline-message-icon">Encrypted Message'
...
@@ -2700,7 +2700,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
...
@@ -2700,7 +2700,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
message
=
notification
.
data
.
message
message
=
notification
.
data
.
message
if
message
.
content_type
.
startswith
(
'image/'
):
if
message
.
content_type
.
startswith
(
'image/'
):
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
message
.
content
.
decode
(
'base64'
)
.
rstrip
())
content
=
'''<img src="data:{};base64,{}" class="scaled-to-fit" />'''
.
format
(
message
.
content_type
,
img_content
.
decode
(
)
.
rstrip
())
elif
message
.
content_type
.
startswith
(
'text/'
):
elif
message
.
content_type
.
startswith
(
'text/'
):
content
=
message
.
content
content
=
message
.
content
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
content
=
HtmlProcessor
.
autolink
(
content
if
message
.
content_type
==
'text/html'
else
QTextDocument
(
content
)
.
toHtml
())
...
...
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