mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-11-30 16:02:58 +08:00
20 lines
611 B
TypeScript
20 lines
611 B
TypeScript
import type { ExportRequest } from './export'
|
|
|
|
export type ImageExportAttempt = {
|
|
allowThumbnail: boolean
|
|
preferThumbnail: boolean
|
|
}
|
|
|
|
export function getImageExportAttempts(
|
|
request: Pick<ExportRequest, 'preferOriginal' | 'fallbackThumbnail'>
|
|
): ImageExportAttempt[] {
|
|
if (request.preferOriginal === false) {
|
|
return [{ allowThumbnail: true, preferThumbnail: true }]
|
|
}
|
|
const attempts: ImageExportAttempt[] = [{ allowThumbnail: false, preferThumbnail: false }]
|
|
if (request.fallbackThumbnail !== false) {
|
|
attempts.push({ allowThumbnail: true, preferThumbnail: true })
|
|
}
|
|
return attempts
|
|
}
|