Skip to content

Commit

Permalink
clean up logic
Browse files Browse the repository at this point in the history
  • Loading branch information
miaawong committed Oct 22, 2024
1 parent d41b76e commit f8e4eca
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions kurl_proxy/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f8e4eca

Please sign in to comment.