up
This commit is contained in:
+22
-9
@@ -619,17 +619,30 @@ if (empty($user_id)) {
|
||||
}
|
||||
|
||||
let fullUrl = '';
|
||||
if (isValidMediaUrl(msg.media_url_external)) {
|
||||
fullUrl = `/api/version/media-url.php?local=${encodeURIComponent(msg.media_url_external)}`;
|
||||
if (isValidMediaUrl(msg.local_file)) {
|
||||
fullUrl = `/api/version/media-url.php?local=${encodeURIComponent(msg.local_file)}`;
|
||||
} else if (isValidMediaUrl(msg.media_url_external)) {
|
||||
if (msg.media_url_external.indexOf('api/get_media.php?id=') !== -1) {
|
||||
const parts = msg.media_url_external.split('id=');
|
||||
const mid = parts[1] ? decodeURIComponent(parts[1]) : '';
|
||||
fullUrl = `/api/version/media-url.php?id=${encodeURIComponent(mid)}`;
|
||||
} else if (/^https?:\/\//i.test(msg.media_url_external)) {
|
||||
fullUrl = `/api/version/media-url.php?url=${encodeURIComponent(msg.media_url_external)}`;
|
||||
// Si la URL externa contiene un media id (api/get_media.php?id=... o mid=...), usar id para consultar Graph API
|
||||
const external = msg.media_url_external;
|
||||
let mid = '';
|
||||
|
||||
if (external.indexOf('api/get_media.php?id=') !== -1) {
|
||||
const parts = external.split('id=');
|
||||
mid = parts[1] ? decodeURIComponent(parts[1]) : '';
|
||||
} else {
|
||||
fullUrl = `/api/version/media-url.php?url=${encodeURIComponent(msg.media_url_external)}`;
|
||||
// Buscar parámetro mid en la query string (ej: ?mid=12345&...)
|
||||
const m = external.match(/[?&]mid=([^&]+)/i);
|
||||
if (m && m[1]) {
|
||||
mid = decodeURIComponent(m[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mid) {
|
||||
fullUrl = `/api/version/media-url.php?id=${encodeURIComponent(mid)}`;
|
||||
} else if (/^https?:\/\//i.test(external)) {
|
||||
fullUrl = `/api/version/media-url.php?url=${encodeURIComponent(external)}`;
|
||||
} else {
|
||||
fullUrl = `/api/version/media-url.php?url=${encodeURIComponent(external)}`;
|
||||
}
|
||||
} else {
|
||||
// No usar msg.media_url como fuente principal para apertura; dejar vacío para forzar 'no disponible'
|
||||
|
||||
Reference in New Issue
Block a user