Resize sticker

This commit is contained in:
KnugiHK
2023-06-15 16:59:54 +08:00
parent a49a911e03
commit f7f6b01c86
4 changed files with 15 additions and 2 deletions

View File

@@ -62,6 +62,7 @@ class Message():
self.quoted_data = None
self.caption = None
self.thumb = None # Android specific
self.sticker = None
def to_json(self):
return {

View File

@@ -351,6 +351,8 @@ def messages(db, data, media_folder):
invalid = True
else:
if content["media_wa_type"] == 20: # Sticker
message.sticker = True
if content["key_from_me"] == 1:
if content["status"] == 5 and content["edit_version"] == 7 or table_message and content["message_type"] == 15:
msg = "Message deleted"

View File

@@ -129,6 +129,8 @@ def messages(db, data, media_folder):
quoted = content["ZMETADATA"][2:19]
message.reply = quoted.decode()
message.quoted_data = None # TODO
if content["ZMESSAGETYPE"] == 15: # Sticker
message.sticker = True
if content["ZISFROMME"] == 1:
if content["ZMESSAGETYPE"] == 14:

View File

@@ -82,6 +82,10 @@
.blue {
color: #70777a;
}
.sticker {
max-width: 100px !important;
max-height: 100px !important;
}
</style>
</head>
<body>
@@ -128,7 +132,9 @@
{{ msg.data | sanitize_except() }}
{% else %}
{% if "image/" in msg.mime %}
<a href="{{ msg.data }}"><img src="{{ msg.thumb if msg.thumb is not none else msg.data }}" /></a>
<a href="{{ msg.data }}">
<img src="{{ msg.thumb if msg.thumb is not none else msg.data }}" {{ 'class="sticker"' if msg.sticker }} />
</a>
{% elif "audio/" in msg.mime %}
<audio controls="controls" autobuffer="autobuffer">
<source src="{{ msg.data }}" />
@@ -206,7 +212,9 @@
{{ msg.data | sanitize_except() }}
{% else %}
{% if "image/" in msg.mime %}
<a href="{{ msg.data }}"><img src="{{ msg.thumb if msg.thumb is not none else msg.data }}" /></a>
<a href="{{ msg.data }}">
<img src="{{ msg.thumb if msg.thumb is not none else msg.data }}" {{ 'class="sticker"' if msg.sticker }}/>
</a>
{% elif "audio/" in msg.mime %}
<audio controls preload="auto">
<source src="{{ msg.data }}" />