This commit is contained in:
lizandrogd
2026-01-21 14:17:04 -05:00
parent b202c039b1
commit 16591537c7
2 changed files with 17 additions and 1 deletions
+14 -1
View File
@@ -613,7 +613,20 @@ if (empty($user_id)) {
} else if (isValidMediaUrl(msg.local_file)) {
thumbUrl = `/${msg.local_file}`;
} else if (isValidMediaUrl(msg.media_url_external)) {
thumbUrl = msg.media_url_external;
// Si es una URL externa de Facebook/lookaside, usar el proxy para incluir Authorization
const external = msg.media_url_external;
if (/lookaside\.fbsbx\.com|graph\.facebook\.com|facebook\.com/i.test(external)) {
// Intentar extraer mid del query string para usar ?id=
const midMatch = external.match(/[?&]mid=([^&]+)/i);
if (midMatch && midMatch[1]) {
const mid = decodeURIComponent(midMatch[1]);
thumbUrl = `/api/version/media-url.php?id=${encodeURIComponent(mid)}`;
} else {
thumbUrl = `/api/version/media-url.php?url=${encodeURIComponent(external)}`;
}
} else {
thumbUrl = external;
}
} else if (isValidMediaUrl(msg.media_url)) {
thumbUrl = msg.media_url;
}