From c67b6dfb6a9cbac62d19618a9bb1246c8b8917cc Mon Sep 17 00:00:00 2001 From: Urvish Patel Date: Tue, 22 Jul 2025 14:02:30 +0200 Subject: [PATCH] fix: update logic for waiting --- api/src/Controllers/LoginController.php | 8 ++++++-- app/pages/waiting.vue | 16 +++++++++------- index.php | 20 ++++++++++++++++---- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/api/src/Controllers/LoginController.php b/api/src/Controllers/LoginController.php index e7ca393..ab84061 100644 --- a/api/src/Controllers/LoginController.php +++ b/api/src/Controllers/LoginController.php @@ -29,9 +29,13 @@ class LoginController $configPath = __DIR__ . '/../../config.json'; $config = file_exists($configPath) ? json_decode(file_get_contents($configPath), true) : []; $name = $config[$domain] ?? null; - $params = (array)$request->getParsedBody(); - + if(!$name){ + return $this->json($response, [ + 'status' => 'not_found', + 'message' => 'Container not found', + ], 404); + } $captcha = new PCaptcha(); if (!$captcha->validate_captcha($params['panswer'])) { diff --git a/app/pages/waiting.vue b/app/pages/waiting.vue index 691f53a..5ac2fca 100644 --- a/app/pages/waiting.vue +++ b/app/pages/waiting.vue @@ -30,13 +30,13 @@ const checkStatus = async () => { try { const res = await $fetch(`${window.location.origin}/api/status?name=${name}`); status.value = res.status; - + if (interval.value) { + clearInterval(interval.value); + } if (res.status === 'ready') { ip.value = res.ip; - clearInterval(interval.value); - loading.value = false; // Redirect or show login link - window.location.href= redirect ?? `http://${res.ip}`; + window.location.href= 'http://'+ window.location.host; } } catch (error) { loading.value = false; @@ -44,8 +44,8 @@ const checkStatus = async () => { errorMessage.value = error?.data?.message || 'Internal server error!'; clearInterval(interval.value); setTimeout( () => { - router.replace(`/?auth=ok&redirect=${redirect}`); - }, 3000); + router.replace(`/app/?auth=ok&redirect=${redirect}`); + }, 5000); } }; @@ -56,7 +56,9 @@ onMounted(() => { }); onUnmounted(() => { - clearInterval(interval.value); + if (interval.value) { + clearInterval(interval.value); + } });