Auto commit: 2026-02-17T22:31:25.089Z

This commit is contained in:
Flatlogic Bot 2026-02-17 22:31:25 +00:00
parent d62b79d60a
commit 39ef6459d5
4 changed files with 35 additions and 3 deletions

View File

@ -7,7 +7,20 @@ $method = $_SERVER['REQUEST_METHOD'];
if ($method === 'GET') {
try {
// Limpiar mensajes y archivos de más de 6 horas
// Borrar fotos (tipo image) que tengan más de 5 segundos
$stOld = db()->prepare("SELECT message FROM messages WHERE type = 'image' AND created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)");
$stOld->execute();
$imagesToDelete = $stOld->fetchAll(PDO::FETCH_ASSOC);
foreach ($imagesToDelete as $img) {
$path = __DIR__ . '/../' . $img['message'];
if (file_exists($path) && is_file($path)) {
unlink($path);
}
}
db()->query("DELETE FROM messages WHERE type = 'image' AND created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)");
// Limpiar otros mensajes y archivos de más de 6 horas
$oldImages = db()->prepare("SELECT message FROM messages WHERE type = 'image' AND created_at < DATE_SUB(NOW(), INTERVAL 6 HOUR)");
$oldImages->execute();
$filesToDelete = $oldImages->fetchAll(PDO::FETCH_ASSOC);

View File

@ -7,6 +7,19 @@ $method = $_SERVER['REQUEST_METHOD'];
if ($method === 'GET') {
try {
// Borrar fotos de la galería que tengan más de 5 segundos
$stOld = db()->prepare("SELECT image_url FROM gallery WHERE created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)");
$stOld->execute();
$imagesToDelete = $stOld->fetchAll(PDO::FETCH_ASSOC);
foreach ($imagesToDelete as $img) {
$path = __DIR__ . '/../' . $img['image_url'];
if (file_exists($path) && is_file($path)) {
// unlink($path); // Opcional: borrar el archivo físico.
// Pero si viene del chat, el chat ya lo borra si habilitamos lo mismo ahí.
}
}
db()->query("DELETE FROM gallery WHERE created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)");
$stmt = db()->prepare("SELECT * FROM gallery ORDER BY created_at DESC LIMIT 50");
$stmt->execute();
$images = $stmt->fetchAll(PDO::FETCH_ASSOC);

View File

@ -2374,7 +2374,12 @@ $twitter_link = "https://twitter.com/";
let content = '';
if (msg.type === 'image') {
content = `<img src="${msg.message}" style="max-width: 100%; border-radius: 8px; margin-top: 5px; cursor: pointer;" onclick="window.open('${msg.message}', '_blank')">`;
content = `
<div style="position: relative; display: inline-block;">
<img src="${msg.message}" style="max-width: 100%; border-radius: 8px; margin-top: 5px; cursor: pointer;" onclick="window.open('${msg.message}', '_blank')">
<div style="position: absolute; top: 10px; right: 10px; background: rgba(255,0,0,0.7); color: white; font-size: 0.5rem; padding: 2px 5px; border-radius: 4px; font-weight: 800; border: 1px solid rgba(255,255,255,0.3);"><i class="bi bi-clock-history"></i> 5s</div>
</div>
`;
} else {
content = `<div style="font-size: 0.85rem; line-height: 1.4; ${isLike ? 'font-weight: 600;' : ''}">${msg.message}</div>`;
}
@ -2985,6 +2990,7 @@ $twitter_link = "https://twitter.com/";
container.innerHTML = data.images.map(img => `
<div class="gallery-item" onclick="openLightbox('${img.image_url}', '${img.username}', '${img.caption || ''}')">
<img src="${img.image_url}" alt="Foto de ${img.username}">
<div style="position: absolute; top: 5px; right: 5px; background: rgba(255,0,0,0.8); color: white; font-size: 0.5rem; padding: 2px 4px; border-radius: 4px; font-weight: 800; z-index: 5;">5s</div>
<div class="gallery-overlay">
<span class="gallery-username">@${img.username}</span>
<span class="gallery-likes"><i class="bi bi-heart-fill"></i> ${img.likes}</span>
@ -3222,7 +3228,7 @@ $twitter_link = "https://twitter.com/";
// Update cycles
setInterval(updateMetadata, 30000);
setInterval(fetchTopSongs, 60000);
setInterval(fetchGallery, 60000);
setInterval(fetchGallery, 3000); // Frecuencia aumentada para fotos efímeras (5s)
setInterval(fetchLeaderboard, 60000);
// Theme Toggle Functionality

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 KiB