Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1008 B
30 lines
1008 B
/* |
|
* https://github.com/morethanwords/tweb |
|
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
|
*/ |
|
|
|
import type {Document, PhotoSize, VideoSize} from '../../../../layer'; |
|
import type {DownloadOptions} from '../../../mtproto/apiFileManager'; |
|
import getDocumentInput from './getDocumentInput'; |
|
|
|
export default function getDocumentDownloadOptions(doc: Document.document, thumb?: PhotoSize.photoSize | VideoSize, queueId?: number, onlyCache?: boolean): DownloadOptions { |
|
const inputFileLocation = getDocumentInput(doc, thumb?.type); |
|
|
|
let mimeType: string; |
|
if(thumb?._ === 'photoSize') { |
|
mimeType = doc.sticker ? 'image/webp' : 'image/jpeg'/* doc.mime_type */; |
|
} else { |
|
mimeType = doc.mime_type || 'application/octet-stream'; |
|
} |
|
|
|
return { |
|
dcId: doc.dc_id, |
|
location: inputFileLocation, |
|
size: thumb ? thumb.size : doc.size, |
|
mimeType, |
|
fileName: doc.file_name, |
|
queueId, |
|
onlyCache |
|
}; |
|
}
|
|
|