Allow webm stickers in secret chats.

This commit is contained in:
levlam 2022-01-25 21:38:25 +03:00
parent a972252a46
commit 75e5a0b3fe

View File

@ -262,15 +262,9 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
mime_type = std::move(document->mime_type_); mime_type = std::move(document->mime_type_);
file_reference = document->file_reference_.as_slice().str(); file_reference = document->file_reference_.as_slice().str();
if (document_type == Document::Type::Sticker) { if (document_type == Document::Type::Sticker && StickersManager::has_webp_thumbnail(document->thumbs_)) {
if (StickersManager::has_webp_thumbnail(document->thumbs_)) {
thumbnail_format = PhotoFormat::Webp; thumbnail_format = PhotoFormat::Webp;
} }
if (mime_type == "video/webm") {
sticker_format = StickerFormat::Webm;
default_extension = Slice("webm");
}
}
fix_tgs_sticker_type(); fix_tgs_sticker_type();
if (owner_dialog_id.get_type() == DialogType::SecretChat) { if (owner_dialog_id.get_type() == DialogType::SecretChat) {
@ -383,6 +377,10 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
// do not allow web TGS stickers // do not allow web TGS stickers
// fix_tgs_sticker_type(); // fix_tgs_sticker_type();
} }
if (document_type == Document::Type::Sticker && mime_type == "video/webm") {
sticker_format = StickerFormat::Webm;
default_extension = Slice("webm");
}
LOG(DEBUG) << "Receive document with ID = " << id << " of type " << document_type; LOG(DEBUG) << "Receive document with ID = " << id << " of type " << document_type;
if (!is_web && !DcId::is_valid(dc_id)) { if (!is_web && !DcId::is_valid(dc_id)) {