From eb92bd903311c52e90b8ec16cd45fd7b42f35dd9 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 15 Feb 2026 18:22:05 +0000 Subject: [PATCH] Auto commit: 2026-02-15T18:22:05.866Z --- admin.php | 40 ++++- api/chat.php | 34 +++++ db/migrations/002_create_settings_table.sql | 6 + index.php | 160 +++++++++++++++++++- 4 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 api/chat.php create mode 100644 db/migrations/002_create_settings_table.sql diff --git a/admin.php b/admin.php index d534cba..b0c3785 100644 --- a/admin.php +++ b/admin.php @@ -20,20 +20,34 @@ $active_phones = $stmt->fetchAll(); $stmt = $db->query("SELECT country, country_code, lat, lon, COUNT(*) as count FROM visitor_logs WHERE last_activity > DATE_SUB(NOW(), INTERVAL 10 MINUTE) GROUP BY country_code"); $locations = $stmt->fetchAll(); +// Handle Video Password Update +if (isset($_POST['update_video_pass'])) { + $new_pass = trim($_POST['video_pass']); + $stmt = $db->prepare("INSERT INTO settings (setting_key, setting_value) VALUES ('video_room_password', ?) ON DUPLICATE KEY UPDATE setting_value = ?"); + $stmt->execute([$new_pass, $new_pass]); + $success_msg = "Contraseña de la sala de video actualizada."; +} + +// Get current video password +$stmt = $db->prepare("SELECT setting_value FROM settings WHERE setting_key = 'video_room_password'"); +$stmt->execute(); +$current_video_pass = $stmt->fetchColumn() ?: "lili123"; + ?> - Admin Dashboard - Lili Records + @@ -46,6 +60,30 @@ $locations = $stmt->fetchAll(); + +
+ + +
+
+
+
Control de Sala de Video
+
+
+ + +
+
+ +
+
+ Esta contraseña será solicitada a los usuarios que intenten activar su cámara en la web. +
+
+
+
+
+
diff --git a/api/chat.php b/api/chat.php new file mode 100644 index 0000000..1b9b389 --- /dev/null +++ b/api/chat.php @@ -0,0 +1,34 @@ +prepare("SELECT * FROM messages ORDER BY created_at DESC LIMIT 50"); + $stmt->execute(); + $messages = $stmt->fetchAll(PDO::FETCH_ASSOC); + echo json_encode(array_reverse($messages)); + } catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + } +} elseif ($method === 'POST') { + $input = json_decode(file_get_contents('php://input'), true); + $username = $input['username'] ?? 'Anónimo'; + $message = $input['message'] ?? ''; + + if (empty($message)) { + echo json_encode(['error' => 'Mensaje vacío']); + exit; + } + + try { + $stmt = db()->prepare("INSERT INTO messages (username, message) VALUES (?, ?)"); + $stmt->execute([$username, $message]); + echo json_encode(['success' => true]); + } catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + } +} diff --git a/db/migrations/002_create_settings_table.sql b/db/migrations/002_create_settings_table.sql new file mode 100644 index 0000000..aa65dd5 --- /dev/null +++ b/db/migrations/002_create_settings_table.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS settings ( + setting_key VARCHAR(50) PRIMARY KEY, + setting_value TEXT +); + +INSERT IGNORE INTO settings (setting_key, setting_value) VALUES ('video_room_password', 'lili123'); diff --git a/index.php b/index.php index ea152b0..6d64581 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,12 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? 'assets/pasted-20260215-1646 $whatsapp_link = "https://chat.whatsapp.com/DkG96pTzAFO3hvLqmzwmTY"; $whatsapp_number = '+5359177041'; $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; + +// Fetch video room password +$db = db(); +$stmt = $db->prepare("SELECT setting_value FROM settings WHERE setting_key = 'video_room_password'"); +$stmt->execute(); +$video_room_pass = $stmt->fetchColumn() ?: "lili123"; ?> @@ -592,10 +598,13 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; overflow-y: auto; padding-top: 4rem; } - .player-section { - max-width: 100%; + .player-section, .interaction-center { + max-width: 100% !important; margin-bottom: 2rem; } + .interaction-center { + grid-template-columns: 1fr !important; + } .image-section { padding-left: 0; width: 100%; @@ -699,7 +708,47 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; + +
+ +
+

+ CHAT EN VIVO +

+
+ +
Cargando mensajes...
+
+
+ + + +
+
+ +
+

+ VIDEO EN VIVO +

+
+ +
+ +

Únete a la sala de video para que otros usuarios te vean en vivo.

+ +

Integrado con la comunidad Lili Records

+
+
+
+ LIVE +
+
+
@@ -862,6 +911,71 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; window.open('', '_blank'); } + // --- Chat Functionality --- + const chatMessages = document.getElementById('chat-messages'); + const chatUser = document.getElementById('chat-user'); + const chatMsg = document.getElementById('chat-msg'); + let lastMessageCount = 0; + + async function fetchMessages() { + try { + const response = await fetch('api/chat.php'); + const messages = await response.json(); + + if (messages.length !== lastMessageCount) { + chatMessages.innerHTML = ''; + messages.forEach(msg => { + const div = document.createElement('div'); + div.style.background = 'rgba(255,255,255,0.05)'; + div.style.padding = '0.8rem'; + div.style.borderRadius = '12px'; + div.style.borderLeft = `4px solid ${msg.username === chatUser.value ? 'var(--primary-color)' : 'rgba(255,255,255,0.2)'}`; + + div.innerHTML = ` +
${msg.username}
+
${msg.message}
+
${new Date(msg.created_at).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}
+ `; + chatMessages.appendChild(div); + }); + chatMessages.scrollTop = chatMessages.scrollHeight; + lastMessageCount = messages.length; + } + } catch (error) { + console.error('Chat error:', error); + } + } + + async function sendChatMessage() { + const user = chatUser.value.trim() || 'Anónimo'; + const message = chatMsg.value.trim(); + if (!message) return; + + try { + const response = await fetch('api/chat.php', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ username: user, message: message }) + }); + const result = await response.json(); + if (result.success) { + chatMsg.value = ''; + fetchMessages(); + } + } catch (error) { + console.error('Error sending message:', error); + } + } + + chatMsg.addEventListener('keypress', (e) => { + if (e.key === 'Enter') sendChatMessage(); + }); + + // Initial fetch and poll + fetchMessages(); + setInterval(fetchMessages, 3000); + // --- End Chat Functionality --- + // Fetch Now Playing Metadata from RadioKing async function updateMetadata() { try { @@ -921,6 +1035,48 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; updateMetadata(); setInterval(updateMetadata, 30000); + // --- Video Call Functionality --- + function startVideo() { + const roomPassword = ''; + const userPass = prompt("Introduce la contraseña de la sala (Solicítala en el grupo de WhatsApp):"); + + if (userPass !== roomPassword) { + if (userPass !== null) alert("Contraseña incorrecta. Solo miembros autorizados pueden unirse."); + return; + } + + const container = document.getElementById('video-container'); + const placeholder = document.getElementById('jitsi-placeholder'); + placeholder.style.display = 'none'; + + // Load Jitsi External API + const script = document.createElement('script'); + script.src = "https://meet.jit.si/external_api.js"; + script.onload = () => { + const domain = "meet.jit.si"; + const options = { + roomName: "LiliRecordsLive_Sala_Privada_2026", + width: "100%", + height: "100%", + parentNode: container, + configOverwrite: { + startWithAudioMuted: true, + startWithVideoMuted: false, + prejoinPageEnabled: false + }, + interfaceConfigOverwrite: { + TOOLBAR_BUTTONS: [ + 'microphone', 'camera', 'closedcaptions', 'desktop', 'fullscreen', + 'fodeviceselection', 'hangup', 'profile', 'chat', 'settings', 'raisehand', + 'videoquality', 'filmstrip', 'tileview', 'videobackgroundblur' + ], + } + }; + const api = new JitsiMeetExternalAPI(domain, options); + }; + document.head.appendChild(script); + } + // Handle possible audio interruptions audio.addEventListener('error', function(e) { console.error('Audio error:', e);