Auto commit: 2026-02-16T22:58:43.158Z

This commit is contained in:
Flatlogic Bot 2026-02-16 22:58:43 +00:00
parent 553f2310eb
commit 14bd0ad033
2 changed files with 132 additions and 4 deletions

38
api/report.php Normal file
View File

@ -0,0 +1,38 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../mail/MailService.php';
$input = json_decode(file_get_contents('php://input'), true);
if (!$input) {
echo json_encode(['success' => false, 'error' => 'No se recibieron datos.']);
exit;
}
$name = $input['name'] ?? 'Anónimo';
$email = $input['email'] ?? 'No proporcionado';
$issueType = $input['issue_type'] ?? 'No especificado';
$description = $input['description'] ?? 'Sin descripción';
$song = $input['current_song'] ?? 'Desconocida';
$subject = "Reporte de Problema - Lili Records Radio";
$html = "
<h2>Reporte de Problema</h2>
<p><b>Nombre:</b> $name</p>
<p><b>Email:</b> $email</p>
<p><b>Tipo de problema:</b> $issueType</p>
<p><b>Descripción:</b> $description</p>
<p><b>Canción sonando:</b> $song</p>
<hr>
<p>Enviado desde el reproductor web de Lili Records Radio.</p>
";
$txt = "Reporte de Problema\nNombre: $name\nEmail: $email\nTipo: $issueType\nDescripción: $description\nCanción: $song";
// Use the default MAIL_TO from .env
$res = MailService::sendMail(null, $subject, $html, $txt, ['reply_to' => $email !== 'No proporcionado' ? $email : null]);
if (!empty($res['success'])) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['success' => false, 'error' => $res['error'] ?? 'Error desconocido al enviar el reporte.']);
}

View File

@ -952,14 +952,14 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
<a id="lyrics-link" href="#" target="_blank" style="font-size: 0.7rem; color: var(--primary-color); text-decoration: none; margin-top: 8px; display: none; align-items: center; gap: 4px; opacity: 0.8; transition: opacity 0.2s;" onmouseover="this.style.opacity='1'" onmouseout="this.style.opacity='0.8'">
<i class="bi bi-music-note-list"></i> BUSCAR LETRA
</a>
<div id="share-links-container" style="display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px;">
<a id="whatsapp-share-track" href="#" target="_blank" style="font-size: 0.7rem; color: #25D366; text-decoration: none; display: none; align-items: center; gap: 4px; opacity: 0.8; transition: opacity 0.2s;" onmouseover="this.style.opacity='1'" onmouseout="this.style.opacity='0.8'">
<div id="share-links-container" style="display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px;">
<a id="whatsapp-share-track" href="#" target="_blank" style="font-size: 0.65rem; background: rgba(37, 211, 102, 0.1); border: 1px solid rgba(37, 211, 102, 0.3); color: #25D366; text-decoration: none; display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-weight: 700; transition: all 0.3s;" onmouseover="this.style.background='rgba(37, 211, 102, 0.2)';" onmouseout="this.style.background='rgba(37, 211, 102, 0.1)';">
<i class="bi bi-whatsapp"></i> COMPARTIR
</a>
<a id="facebook-share-track" href="#" target="_blank" style="font-size: 0.7rem; color: #1877F2; text-decoration: none; display: none; align-items: center; gap: 4px; opacity: 0.8; transition: opacity 0.2s;" onmouseover="this.style.opacity='1'" onmouseout="this.style.opacity='0.8'">
<a id="facebook-share-track" href="#" target="_blank" style="font-size: 0.65rem; background: rgba(24, 119, 242, 0.1); border: 1px solid rgba(24, 119, 242, 0.3); color: #1877F2; text-decoration: none; display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-weight: 700; transition: all 0.3s;" onmouseover="this.style.background='rgba(24, 119, 242, 0.2)';" onmouseout="this.style.background='rgba(24, 119, 242, 0.1)';">
<i class="bi bi-facebook"></i> FACEBOOK
</a>
<a id="twitter-share-track" href="#" target="_blank" style="font-size: 0.7rem; color: #1DA1F2; text-decoration: none; display: none; align-items: center; gap: 4px; opacity: 0.8; transition: opacity 0.2s;" onmouseover="this.style.opacity='1'" onmouseout="this.style.opacity='0.8'">
<a id="twitter-share-track" href="#" target="_blank" style="font-size: 0.65rem; background: rgba(29, 161, 242, 0.1); border: 1px solid rgba(29, 161, 242, 0.3); color: #1DA1F2; text-decoration: none; display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-weight: 700; transition: all 0.3s;" onmouseover="this.style.background='rgba(29, 161, 242, 0.2)';" onmouseout="this.style.background='rgba(29, 161, 242, 0.1)';">
<i class="bi bi-twitter-x"></i> POSTEAR
</a>
</div>
@ -979,6 +979,9 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
<button id="sleep-timer-btn" onclick="openSleepModal()" style="background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s;" title="Temporizador de apagado">
<i class="bi bi-clock"></i>
</button>
<button id="report-issue-btn" onclick="openReportModal()" style="background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #ff4444; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s;" title="Reportar un problema">
<i class="bi bi-exclamation-triangle-fill"></i>
</button>
</div>
<div id="sleep-countdown" style="display: none; text-align: center; margin-top: -0.5rem; font-size: 0.8rem; color: var(--accent-color); font-weight: bold; animation: fadeIn 0.5s;">
@ -1117,6 +1120,36 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
</div>
</div>
<!-- Report Issue Modal -->
<div id="report-modal" class="sleep-modal" onclick="closeReportModal()">
<div class="sleep-modal-content" onclick="event.stopPropagation()" style="max-width: 450px;">
<h3 style="margin-top: 0; color: #ff4444;">Reportar un Problema</h3>
<p style="opacity: 0.7; font-size: 0.9rem; margin-bottom: 1.5rem;">Cuéntanos qué está fallando para poder arreglarlo.</p>
<div class="interaction-form" style="margin-top: 0;">
<div class="form-group" style="margin-bottom: 1rem;">
<label for="report-issue-type">TIPO DE PROBLEMA</label>
<select id="report-issue-type" style="width: 100%; padding: 0.8rem; border-radius: 12px; border: 1px solid var(--glass-border); background-color: var(--glass-bg); color: var(--text-color); font-family: inherit; font-size: 0.95rem; outline: none; backdrop-filter: blur(4px);">
<option value="Audio cortado">Audio se corta</option>
<option value="No carga el stream">No carga el stream</option>
<option value="Metadata incorrecta">Canción/Artista incorrecto</option>
<option value="Problema en el chat">Problema en el chat</option>
<option value="Otro">Otro problema</option>
</select>
</div>
<div class="form-group" style="margin-bottom: 1.5rem;">
<label for="report-description">DESCRIPCIÓN</label>
<textarea id="report-description" placeholder="Describe brevemente el problema..." style="height: 100px;"></textarea>
</div>
<button onclick="submitReport()" id="submit-report-btn" class="send-whatsapp-btn" style="background-color: #ff4444; width: 100%;">
<i class="bi bi-megaphone-fill"></i> ENVIAR REPORTE
</button>
</div>
<button onclick="closeReportModal()" style="margin-top: 1.5rem; background: none; border: none; color: white; opacity: 0.5; cursor: pointer;">Cancelar</button>
</div>
</div>
<!-- Floating Social Links -->
<div class="social-float-container">
<a href="<?= $facebook_link ?>" class="social-float facebook" target="_blank" title="Facebook">
@ -1850,6 +1883,63 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
// --- End Sleep Timer & Upcoming Tracks ---
function openReportModal() {
const modal = document.getElementById('report-modal');
modal.style.display = 'flex';
setTimeout(() => modal.classList.add('show'), 10);
}
function closeReportModal() {
const modal = document.getElementById('report-modal');
modal.classList.remove('show');
setTimeout(() => modal.style.display = 'none', 300);
}
async function submitReport() {
const btn = document.getElementById('submit-report-btn');
const type = document.getElementById('report-issue-type').value;
const description = document.getElementById('report-description').value.trim();
const name = document.getElementById('user-name').value.trim() || 'Anónimo';
const phone = document.getElementById('user-phone').value.trim() || 'No proporcionado';
const currentSong = document.getElementById('track-title').innerText;
if (!description) {
alert('Por favor, describe el problema.');
return;
}
btn.disabled = true;
btn.innerHTML = '<i class="bi bi-hourglass-split"></i> ENVIANDO...';
try {
const response = await fetch('api/report.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: name,
email: phone, // Using phone as contact email since it's the identifier we have
issue_type: type,
description: description,
current_song: currentSong
})
});
const result = await response.json();
if (result.success) {
alert('Gracias por tu reporte. Lo revisaremos pronto.');
document.getElementById('report-description').value = '';
closeReportModal();
} else {
alert('Error: ' + (result.error || 'No se pudo enviar el reporte.'));
}
} catch (error) {
console.error('Report error:', error);
alert('Error de conexión al enviar el reporte.');
} finally {
btn.disabled = false;
btn.innerHTML = '<i class="bi bi-megaphone-fill"></i> ENVIAR REPORTE';
}
}
// Fetch Now Playing Metadata from RadioKing
let progressInterval = null;