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.
26 lines
1.3 KiB
26 lines
1.3 KiB
/* |
|
* https://github.com/morethanwords/tweb |
|
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
|
*/ |
|
|
|
import type {DownloadMediaOptions, DownloadOptions} from '../../../mtproto/apiFileManager'; |
|
import getDocumentDownloadOptions from '../docs/getDocumentDownloadOptions'; |
|
import getPhotoDownloadOptions from '../photos/getPhotoDownloadOptions'; |
|
import getWebDocumentDownloadOptions from '../webDocs/getWebDocumentDownloadOptions'; |
|
import isWebDocument from '../webDocs/isWebDocument'; |
|
import getDownloadFileNameFromOptions from './getDownloadFileNameFromOptions'; |
|
|
|
export default function getDownloadMediaDetails(options: DownloadMediaOptions) { |
|
const {media, thumb, queueId, onlyCache} = options; |
|
|
|
let downloadOptions: DownloadOptions; |
|
if(media._ === 'document') downloadOptions = getDocumentDownloadOptions(media, thumb as any, queueId, onlyCache); |
|
else if(media._ === 'photo') downloadOptions = getPhotoDownloadOptions(media, thumb as any, queueId, onlyCache); |
|
else if(isWebDocument(media)) downloadOptions = getWebDocumentDownloadOptions(media); |
|
|
|
downloadOptions.downloadId = options.downloadId; |
|
|
|
const fileName = getDownloadFileNameFromOptions(downloadOptions); |
|
return {fileName, downloadOptions}; |
|
}
|
|
|