mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 12:07:01 +08:00
feat: 完善日报图片与公众号消息展示
修复日报图片读取格式与模型不支持时的友好降级 恢复话题关键词回退,确保词云在缺少顶层关键词时仍可展示 支持公众号多文章消息在聊天、日报、检索和 HTML 导出中完整呈现 迁移账号身份缓存并优化首次连接的账号占位信息 补充图片、词云、账号缓存与多文章消息回归测试
This commit is contained in:
+14
-8
@@ -321,7 +321,7 @@ function getLocalMediaMimeType(filePath: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function buildImageResponse(image: DecodedImage): {
|
||||
function buildImageResponse(image: DecodedImage, includeData = false): {
|
||||
success: true
|
||||
data: string
|
||||
isThumb: boolean
|
||||
@@ -330,7 +330,7 @@ function buildImageResponse(image: DecodedImage): {
|
||||
} {
|
||||
const mediaService = image.cacheFilePath ? getImageMediaService() : null
|
||||
const data =
|
||||
mediaService && image.cacheFilePath && existsSync(image.cacheFilePath)
|
||||
!includeData && mediaService && image.cacheFilePath && existsSync(image.cacheFilePath)
|
||||
? mediaService.createLocalMediaUrl(image.cacheFilePath)
|
||||
: image.data
|
||||
return {
|
||||
@@ -1126,7 +1126,12 @@ app.whenReady().then(async () => {
|
||||
imageMd5?: string,
|
||||
imageDatNameOrThumb?: string | boolean,
|
||||
_sessionId?: string,
|
||||
options?: { force?: boolean; preferThumbnail?: boolean; priority?: number }
|
||||
options?: {
|
||||
force?: boolean
|
||||
preferThumbnail?: boolean
|
||||
priority?: number
|
||||
includeData?: boolean
|
||||
}
|
||||
) => {
|
||||
let service = imageDecryptService
|
||||
if (!service) {
|
||||
@@ -1146,6 +1151,7 @@ app.whenReady().then(async () => {
|
||||
const imageDatName = typeof imageDatNameOrThumb === 'string' ? imageDatNameOrThumb : undefined
|
||||
const force = options?.force === true
|
||||
const preferThumbnail = options?.preferThumbnail === true
|
||||
const includeData = options?.includeData === true
|
||||
const priority = Number.isFinite(options?.priority) ? Number(options?.priority) : 0
|
||||
const imageCacheKey = [
|
||||
imageMd5 || '',
|
||||
@@ -1154,10 +1160,10 @@ app.whenReady().then(async () => {
|
||||
].join('|')
|
||||
const mediaService = getImageMediaService()
|
||||
const cachedImage = await service.getCachedDecodedImage(imageCacheKey, {
|
||||
includeData: !mediaService
|
||||
includeData: includeData || !mediaService
|
||||
})
|
||||
if (cachedImage && (!force || !cachedImage.isThumbnail)) {
|
||||
return buildImageResponse(cachedImage)
|
||||
return buildImageResponse(cachedImage, includeData)
|
||||
}
|
||||
|
||||
return enqueueColdImageLoad(async () => {
|
||||
@@ -1183,10 +1189,10 @@ app.whenReady().then(async () => {
|
||||
// A previous queued request may have populated the cache while this one waited.
|
||||
const queuedMediaService = getImageMediaService()
|
||||
const queuedCacheHit = await coldService.getCachedDecodedImage(imageCacheKey, {
|
||||
includeData: !queuedMediaService
|
||||
includeData: includeData || !queuedMediaService
|
||||
})
|
||||
if (queuedCacheHit && (!force || !queuedCacheHit.isThumbnail)) {
|
||||
return buildImageResponse(queuedCacheHit)
|
||||
return buildImageResponse(queuedCacheHit, includeData)
|
||||
}
|
||||
|
||||
let filePath = force
|
||||
@@ -1220,7 +1226,7 @@ app.whenReady().then(async () => {
|
||||
isThumbnail: coldService.isThumbnailFile(decrypted.filePath)
|
||||
}
|
||||
await coldService.cacheDecodedImage(imageCacheKey, decodedImage)
|
||||
return buildImageResponse(decodedImage)
|
||||
return buildImageResponse(decodedImage, includeData)
|
||||
}, priority)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user