aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-07-15 21:28:23 +0000
committerFuwn <[email protected]>2021-07-15 21:28:23 +0000
commit1588d2eeb29d74e7a70f87d7f8db3bb13da12950 (patch)
tree9cb5f3b9fa2079fe6f23aa899cb514c76a8993a9
parentfeat(skills): add go (diff)
downloadspace-1588d2eeb29d74e7a70f87d7f8db3bb13da12950.tar.xz
space-1588d2eeb29d74e7a70f87d7f8db3bb13da12950.zip
feat(templates): poc for a sysinfo footer item
-rw-r--r--go.mod1
-rw-r--r--route.go9
-rw-r--r--space.go2
-rw-r--r--template.go7
4 files changed, 13 insertions, 6 deletions
diff --git a/go.mod b/go.mod
index 96de27a..c126311 100644
--- a/go.mod
+++ b/go.mod
@@ -4,6 +4,7 @@ go 1.16
require (
github.com/pitr/gig v0.9.8
+ // github.com/shirou/gopsutil v3.21.6+incompatible
github.com/sonyarouje/simdb v0.1.0
github.com/spf13/viper v1.8.1
)
diff --git a/route.go b/route.go
index 4d5aacc..f6abef7 100644
--- a/route.go
+++ b/route.go
@@ -10,11 +10,14 @@ import (
)
func createRoute(route string, template string, content string) {
+ // hostInformation, _ := host.Info()
+
g.Handle(route, func(c gig.Context) error {
return c.Render(template, IndexTemplate{
- Content: GetContent(content),
- Quote: utilities.GetRandomQuote(),
- Hits: database.Get(route) + 1,
+ Content: GetContent(content),
+ Quote: utilities.GetRandomQuote(),
+ Hits: database.Get(route) + 1,
+ // SystemInfo: fmt.Sprintf("Host: %s %s, Uptime: %d seconds, Routes: %d", strings.Title(hostInformation.Platform), strings.Title(hostInformation.OS), int64(time.Since(startTime).Seconds()), len(g.Routes())),
Copyright: utilities.GetCopyright(),
})
})
diff --git a/space.go b/space.go
index 976ae7c..8f6f506 100644
--- a/space.go
+++ b/space.go
@@ -22,6 +22,8 @@ var g = gig.Default()
var hitsTracker = make(map[string]int)
+// var startTime = time.Now()
+
// Initialize templates
func init() {
templates, _ := fs.Sub(contentFilesystem, "content/templates")
diff --git a/template.go b/template.go
index 2e992d7..3d5687b 100644
--- a/template.go
+++ b/template.go
@@ -17,9 +17,10 @@ type Template struct {
}
type IndexTemplate struct {
- Content string
- Quote string
- Hits int
+ Content string
+ Quote string
+ Hits int
+ // SystemInfo string
Copyright string
}
type ErrorTemplate struct {