From 185331f10bb276b62164eb1f6838324a52592c15 Mon Sep 17 00:00:00 2001
From: Arminas 
Date: Thu, 5 Jan 2023 18:38:01 +0200
Subject: [PATCH] Created about page
Created about page with version check and some basic info. Removed footer.
---
 handler/routes.go    |   7 +++
 main.go              |   1 +
 router/router.go     |   6 ++
 templates/about.html | 139 +++++++++++++++++++++++++++++++++++++++++++
 templates/base.html  |  13 +++-
 5 files changed, 164 insertions(+), 2 deletions(-)
 create mode 100644 templates/about.html
diff --git a/handler/routes.go b/handler/routes.go
index 3ddbb2d..a7c5983 100644
--- a/handler/routes.go
+++ b/handler/routes.go
@@ -808,3 +808,10 @@ func ApplyServerConfig(db store.IStore, tmplBox *rice.Box) echo.HandlerFunc {
 		return c.JSON(http.StatusOK, jsonHTTPResponse{true, "Applied server config successfully"})
 	}
 }
+
+// AboutPage handler
+func AboutPage() echo.HandlerFunc {
+	return func(c echo.Context) error {
+		return c.Render(http.StatusOK, "about.html", map[string]interface{}{})
+	}
+}
diff --git a/main.go b/main.go
index 3f0cd13..88b8674 100644
--- a/main.go
+++ b/main.go
@@ -147,6 +147,7 @@ func main() {
 		sendmail = emailer.NewSmtpMail(util.SmtpHostname, util.SmtpPort, util.SmtpUsername, util.SmtpPassword, util.SmtpNoTLSCheck, util.SmtpAuthType, util.EmailFromName, util.EmailFrom, util.SmtpEncryption)
 	}
 
+	app.GET(util.BasePath+"/about", handler.AboutPage())
 	app.GET(util.BasePath+"/_health", handler.Health())
 	app.POST(util.BasePath+"/new-client", handler.NewClient(db), handler.ValidSession, handler.ContentTypeJson)
 	app.POST(util.BasePath+"/update-client", handler.UpdateClient(db), handler.ValidSession, handler.ContentTypeJson)
diff --git a/router/router.go b/router/router.go
index 0f9facc..9aeaf1b 100644
--- a/router/router.go
+++ b/router/router.go
@@ -93,6 +93,11 @@ func New(tmplBox *rice.Box, extraData map[string]string, secret []byte) *echo.Ec
 		log.Fatal(err)
 	}
 
+	aboutPageString, err := tmplBox.String("about.html")
+	if err != nil {
+		log.Fatal(err)
+	}
+
 	// create template list
 	funcs := template.FuncMap{
 		"StringsJoin": strings.Join,
@@ -105,6 +110,7 @@ func New(tmplBox *rice.Box, extraData map[string]string, secret []byte) *echo.Ec
 	templates["global_settings.html"] = template.Must(template.New("global_settings").Funcs(funcs).Parse(tmplBaseString + tmplGlobalSettingsString))
 	templates["status.html"] = template.Must(template.New("status").Funcs(funcs).Parse(tmplBaseString + tmplStatusString))
 	templates["wake_on_lan_hosts.html"] = template.Must(template.New("wake_on_lan_hosts").Funcs(funcs).Parse(tmplBaseString + tmplWakeOnLanHostsString))
+	templates["about.html"] = template.Must(template.New("about").Funcs(funcs).Parse(tmplBaseString + aboutPageString))
 
 	e.Logger.SetLevel(log.DEBUG)
 	e.Pre(middleware.RemoveTrailingSlash())
diff --git a/templates/about.html b/templates/about.html
new file mode 100644
index 0000000..4fc6b77
--- /dev/null
+++ b/templates/about.html
@@ -0,0 +1,139 @@
+{{ define "title"}}
+About
+{{ end }}
+
+{{ define "top_css"}}
+{{ end }}
+
+{{ define "username"}}
+{{ .username }}
+{{ end }}
+
+{{ define "page_title"}}
+About
+{{ end }}
+
+{{ define "page_content"}}
+
+    
+        
+        
+            
+            
+                
+                    
+                    
+                    
+                        
+                            
+                            
+                        
+                        
+                            
+                            
+                        
+                        
+                            
+                            
+                        
+                        
+                            
+                            
+                        
+                        
+                        
+                        
Copyright ©
+                            
+                            Wireguard UI.
+                         All rights reserved.
+
+                    
+                
+                
+            
+        
+        
+    
                             
                         
+                        
+                        
+                            
+                            
+                            
+                                About
+                            
+                            
+                        
                     
                 
                 
@@ -281,7 +290,7 @@
             
         
         
-
+