From 33b7a5043c7c6019a26340aa8138c8af24d89a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter?= Date: Wed, 30 Jul 2025 13:56:53 +0200 Subject: [PATCH] Fix page if incorrect formatted url --- views/index.eta | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/views/index.eta b/views/index.eta index e41c48c..3852196 100644 --- a/views/index.eta +++ b/views/index.eta @@ -58,11 +58,30 @@

You have reached the end of the IPv4 Internet. - <% if (it.back_to_url) { %> + <% if (it.back_to_url) { + let normalizedUrl = it.back_to_url; + let displayDomain = it.domain; + + try { + if (it.back_to_url) { + // Normalize URL by adding protocol if missing + if (!it.back_to_url.startsWith('http')) { + normalizedUrl = `http://${it.back_to_url}`; + } + + const url = new URL(normalizedUrl); + displayDomain = url.hostname; + } + } catch (e) { + // Fall back to original values if parsing fails + normalizedUrl = it.back_to_url; + displayDomain = it.domain || it.back_to_url; + } + %>

- The site <%= it.domain %> is not reachable by IPv4. + The site <%= displayDomain %> is not reachable by IPv4. To access - <%= it.domain %>, + <%= displayDomain %>, you need to enable IPv6 on your computer.

<% } %>