feat(flash-file): expose cover URL as flash_file.thumb
Incoming flash cards already carry a cover link; map it to flash_file.data.thumb. Older cards without a cover leave it empty. Fixes #367
This commit is contained in:
7 files changed
+48
-7
No files matched your search
@@ -213,7 +213,7 @@ export const ELEMENT_MANIFEST = {
|
||||
},
|
||||
flash_file: {
|
||||
directions: { D: 'yes', S: 'yes', P: 'by-design-no', W: 'by-design-no' },
|
||||
fields: fieldsFor<'flash_file'>()(['filesetId', 'sceneType', 'fileName']),
|
||||
fields: fieldsFor<'flash_file'>()(['filesetId', 'sceneType', 'fileName', 'thumbUrl']),
|
||||
requiredFields: ['filesetId'],
|
||||
note: '闪传文件:收侧解码 markdown commonElem(旧卡 JSON data.fileSetId,现网 extType=1/extInfo + open_fileset scheme,#199/#200/#358);发送走 send_flash_msg,故 P/W 按设计不支持',
|
||||
},
|
||||
|
||||
@@ -191,6 +191,8 @@ export interface FlashFileElement {
|
||||
filesetId: string;
|
||||
sceneType?: number;
|
||||
fileName?: string;
|
||||
/** Cover URL from the incoming card, when present. */
|
||||
thumbUrl?: string;
|
||||
}
|
||||
|
||||
type MessageElementVariant =
|
||||
|
||||
@@ -1070,11 +1070,13 @@ function decodeFlashTransfer(md: MarkdownData): MessageElement | null {
|
||||
fileName = md.summary.replace(/^\[QQ闪传\]\s*/, '').trim();
|
||||
}
|
||||
|
||||
const thumbUrl = (ext?.thumbnail?.download?.downloadUrl ?? '').trim();
|
||||
return {
|
||||
type: 'flash_file',
|
||||
filesetId,
|
||||
fileName,
|
||||
sceneType: card?.sceneType ?? 0,
|
||||
...(thumbUrl ? { thumbUrl } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user