Chat: Fix webpage video preview in Safari
This commit is contained in:
parent
83f6eebc58
commit
3e5bd0f488
@ -17,7 +17,7 @@ import * as cacheApi from '../../../util/cacheApi';
|
|||||||
type EntityType = (
|
type EntityType = (
|
||||||
'msg' | 'sticker' | 'wallpaper' | 'gif' | 'channel' | 'chat' | 'user' | 'photo' | 'stickerSet' | 'webDocument' |
|
'msg' | 'sticker' | 'wallpaper' | 'gif' | 'channel' | 'chat' | 'user' | 'photo' | 'stickerSet' | 'webDocument' |
|
||||||
'document'
|
'document'
|
||||||
);
|
);
|
||||||
|
|
||||||
const MEDIA_ENTITY_TYPES = new Set(['msg', 'sticker', 'gif', 'wallpaper', 'photo', 'webDocument', 'document']);
|
const MEDIA_ENTITY_TYPES = new Set(['msg', 'sticker', 'gif', 'wallpaper', 'photo', 'webDocument', 'document']);
|
||||||
const TGS_MIME_TYPE = 'application/x-tgsticker';
|
const TGS_MIME_TYPE = 'application/x-tgsticker';
|
||||||
@ -105,8 +105,9 @@ async function download(
|
|||||||
if (mediaMatch[1] === 'avatar' || mediaMatch[1] === 'profile') {
|
if (mediaMatch[1] === 'avatar' || mediaMatch[1] === 'profile') {
|
||||||
entityType = getEntityTypeById(entityId);
|
entityType = getEntityTypeById(entityId);
|
||||||
} else {
|
} else {
|
||||||
entityType = mediaMatch[1] as 'msg' | 'sticker' | 'wallpaper' | 'gif' | 'stickerSet' | 'photo' | 'webDocument' |
|
entityType = mediaMatch[1] as (
|
||||||
'document';
|
'msg' | 'sticker' | 'wallpaper' | 'gif' | 'stickerSet' | 'photo' | 'webDocument' | 'document'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (entityType) {
|
switch (entityType) {
|
||||||
@ -216,6 +217,10 @@ function getMessageMediaMimeType(message: GramJs.Message, sizeType?: string) {
|
|||||||
if (message.media instanceof GramJs.MessageMediaWebPage
|
if (message.media instanceof GramJs.MessageMediaWebPage
|
||||||
&& message.media.webpage instanceof GramJs.WebPage
|
&& message.media.webpage instanceof GramJs.WebPage
|
||||||
&& message.media.webpage.document instanceof GramJs.Document) {
|
&& message.media.webpage.document instanceof GramJs.Document) {
|
||||||
|
if (sizeType) {
|
||||||
|
return 'image/jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
return message.media.webpage.document.mimeType;
|
return message.media.webpage.document.mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user