From f8e4ecaaa1974d185850c17c30a36654b581adea Mon Sep 17 00:00:00 2001 From: miaawong Date: Tue, 22 Oct 2024 09:59:41 -0400 Subject: [PATCH] clean up logic --- kurl_proxy/cmd/main.go | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/kurl_proxy/cmd/main.go b/kurl_proxy/cmd/main.go index 5e5409701a..4e7810d75c 100644 --- a/kurl_proxy/cmd/main.go +++ b/kurl_proxy/cmd/main.go @@ -275,34 +275,11 @@ func getHttpServer(fingerprint string, acceptAnonymousUploads bool, assetsDir st } appIcon := template.URL(app.Spec.Icon) - c.HTML(http.StatusOK, "welcome.html", gin.H{ - "fingerprintSHA1": fingerprint, - "AppIcon": appIcon, - "AppTitle": app.Spec.Title, - "IsEmbeddedCluster": isEmbeddedCluster(), - }) - }) - r.GET("/insecure", func(c *gin.Context) { - if !acceptAnonymousUploads { - log.Println("TLS certs already uploaded, redirecting to https") - target := url.URL{ - Scheme: "https", - Host: c.Request.Host, - Path: c.Request.URL.Path, - RawQuery: c.Request.URL.RawQuery, - } - // Returns StatusFound (302) to avoid browser caching - c.Redirect(http.StatusFound, target.String()) - return - } - - app, err := kotsadmApplication() - - if err != nil { - log.Printf("No kotsadm application metadata: %v", err) // continue + htmlPage := "welcome.html" + if c.Request.URL.Path == "/insecure" { + htmlPage = "insecure.html" } - appIcon := template.URL(app.Spec.Icon) - c.HTML(http.StatusOK, "insecure.html", gin.H{ + c.HTML(http.StatusOK, htmlPage, gin.H{ "fingerprintSHA1": fingerprint, "AppIcon": appIcon, "AppTitle": app.Spec.Title,