diff --git a/nuxt4/app/components/streams/StreamViewer.vue b/nuxt4/app/components/streams/StreamViewer.vue index 0a2122a..e832645 100644 --- a/nuxt4/app/components/streams/StreamViewer.vue +++ b/nuxt4/app/components/streams/StreamViewer.vue @@ -13,9 +13,7 @@ variant="ghost" :loading="isLoading" @click="refreshStreams" - > - Actualizar - + /> @@ -70,6 +68,32 @@ + +
+
+
+
+ +
+
+

Conexion requerida

+

Inicia sesion en Streams para ver el video

+
+
+ + Iniciar Sesion + +
+
+ { + isConnecting.value = true + + const popup = window.open( + 'https://streams.nucleoriofrio.com/api', + 'streams_auth', + 'width=500,height=400,menubar=no,toolbar=no,location=no,status=no' + ) + + // Verificar cuando el popup carga y cerrarlo + const checkPopup = setInterval(() => { + try { + // Si el popup se cerró manualmente + if (!popup || popup.closed) { + clearInterval(checkPopup) + isConnecting.value = false + isStreamSessionActive.value = true + toast.add({ + title: 'Conectado', + description: 'Sesion de streams establecida', + icon: 'i-heroicons-check-circle', + color: 'success' + }) + return + } + + // Intentar acceder al contenido (solo funciona si ya autenticó) + if (popup.document && popup.document.body) { + // Cerrar después de 1 segundo para asegurar que la cookie se guardó + setTimeout(() => { + popup.close() + clearInterval(checkPopup) + isConnecting.value = false + isStreamSessionActive.value = true + toast.add({ + title: 'Conectado', + description: 'Sesion de streams establecida', + icon: 'i-heroicons-check-circle', + color: 'success' + }) + }, 1000) + } + } catch { + // Error de CORS significa que está en Authentik (aún autenticando) + } + }, 500) + + // Timeout máximo de 60 segundos + setTimeout(() => { + clearInterval(checkPopup) + isConnecting.value = false + if (popup && !popup.closed) { + popup.close() + } + }, 60000) +} + // Form state const eventForm = reactive({ label: 'eventoWhisper',