From f39177f6658c2de9ef180a4aced714c13308db57 Mon Sep 17 00:00:00 2001
From: Francesco Gramegna <francesco.gramegna@epfl.ch>
Date: Tue, 17 Dec 2024 13:49:27 +0000
Subject: [PATCH] ShareUrl: 127.0.0.1 now treated as localhost

Now treating 127.0.0.1 the same as localhost in the dynamic shareUrl creation (since some people would still connect in this way).
---
 js/src/main/scala/cs214/webapp/client/Pages.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/js/src/main/scala/cs214/webapp/client/Pages.scala b/js/src/main/scala/cs214/webapp/client/Pages.scala
index 1a299b5..2c04b5e 100644
--- a/js/src/main/scala/cs214/webapp/client/Pages.scala
+++ b/js/src/main/scala/cs214/webapp/client/Pages.scala
@@ -275,7 +275,7 @@ case class AppPage(appId: AppId, uiId: UIId, instanceId: InstanceId, userId: Use
         .replace("{{hostName}}", hostName + (if port.nonEmpty then f":$port" else ""))
         .replace("{{userId}}", URLEncoder.encode(userId, "UTF-8"))
       val shareUrlHost = 
-        if hostName == "localhost" then appInfo.hostAddress else hostName
+        if (hostName == "localhost" || hostname == "127.0.0.1") then appInfo.hostAddress else hostName
       
       val shareUrl = f"$hypertextProtocol://${shareUrlHost}${if port.nonEmpty then f":$port" else ""}${appInfo.shareSubUrl}"
           
-- 
GitLab