mirror of
https://github.com/Kugelschieber/marvinblum.git
synced 2026-01-18 14:50:27 +00:00
Updated dependencies and integrated Pirsch v1.2.0.
This commit is contained in:
2
go.mod
2
go.mod
@@ -7,7 +7,7 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/emvi/api-go v0.2.2
|
github.com/emvi/api-go v0.2.2
|
||||||
github.com/emvi/logbuch v1.1.1
|
github.com/emvi/logbuch v1.1.1
|
||||||
github.com/emvi/pirsch v1.1.1
|
github.com/emvi/pirsch v1.2.0
|
||||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||||
github.com/gorilla/mux v1.7.4
|
github.com/gorilla/mux v1.7.4
|
||||||
github.com/gosimple/slug v1.9.0
|
github.com/gosimple/slug v1.9.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -11,6 +11,8 @@ github.com/emvi/pirsch v1.1.0 h1:uMnxWqbcKLpt1iBNP52aocCkgpfZAisvKcF0VzpVHv8=
|
|||||||
github.com/emvi/pirsch v1.1.0/go.mod h1:+YmBbltJ3feZz9L/QQyqwywltYvQKBfzrGD51TPKl5g=
|
github.com/emvi/pirsch v1.1.0/go.mod h1:+YmBbltJ3feZz9L/QQyqwywltYvQKBfzrGD51TPKl5g=
|
||||||
github.com/emvi/pirsch v1.1.1 h1:memw5fHl6ZY1dcB4Ic5tTtsbQkU9wTCjBlXi4G8D20o=
|
github.com/emvi/pirsch v1.1.1 h1:memw5fHl6ZY1dcB4Ic5tTtsbQkU9wTCjBlXi4G8D20o=
|
||||||
github.com/emvi/pirsch v1.1.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
github.com/emvi/pirsch v1.1.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
|
github.com/emvi/pirsch v1.2.0 h1:k5OJwgE8/Zdq7raQNRF4aNHxWxPq7En51gWMMEFzinA=
|
||||||
|
github.com/emvi/pirsch v1.2.0/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
|||||||
10
main.go
10
main.go
@@ -60,7 +60,7 @@ func logEnvConfig() {
|
|||||||
|
|
||||||
func serveAbout() http.HandlerFunc {
|
func serveAbout() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tracker.Hit(r)
|
tracker.Hit(r, nil)
|
||||||
tplCache.Render(w, "about.html", struct {
|
tplCache.Render(w, "about.html", struct {
|
||||||
Articles []emvi.Article
|
Articles []emvi.Article
|
||||||
}{
|
}{
|
||||||
@@ -71,14 +71,14 @@ func serveAbout() http.HandlerFunc {
|
|||||||
|
|
||||||
func serveLegal() http.HandlerFunc {
|
func serveLegal() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tracker.Hit(r)
|
tracker.Hit(r, nil)
|
||||||
tplCache.Render(w, "legal.html", nil)
|
tplCache.Render(w, "legal.html", nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func serveBlogPage() http.HandlerFunc {
|
func serveBlogPage() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tracker.Hit(r)
|
tracker.Hit(r, nil)
|
||||||
tplCache.Render(w, "blog.html", struct {
|
tplCache.Render(w, "blog.html", struct {
|
||||||
Articles map[int][]emvi.Article
|
Articles map[int][]emvi.Article
|
||||||
}{
|
}{
|
||||||
@@ -105,7 +105,7 @@ func serveBlogArticle() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// track the hit if the article was found, otherwise we don't care
|
// track the hit if the article was found, otherwise we don't care
|
||||||
tracker.Hit(r)
|
tracker.Hit(r, nil)
|
||||||
|
|
||||||
tplCache.RenderWithoutCache(w, "article.html", struct {
|
tplCache.RenderWithoutCache(w, "article.html", struct {
|
||||||
Title string
|
Title string
|
||||||
@@ -121,7 +121,7 @@ func serveBlogArticle() http.HandlerFunc {
|
|||||||
|
|
||||||
func serveTracking() http.HandlerFunc {
|
func serveTracking() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tracker.Hit(r)
|
tracker.Hit(r, nil)
|
||||||
start, _ := strconv.Atoi(r.URL.Query().Get("start"))
|
start, _ := strconv.Atoi(r.URL.Query().Get("start"))
|
||||||
|
|
||||||
if start > 365 {
|
if start > 365 {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func GetHourlyVisitorsToday() (template.JS, template.JS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetActiveVisitors() int {
|
func GetActiveVisitors() int {
|
||||||
visitors, err := analyzer.ActiveVisitors(time.Minute * 5)
|
visitors, err := analyzer.ActiveVisitors(pirsch.NullTenant, time.Minute*5)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logbuch.Error("Error reading active visitors", logbuch.Fields{"err": err})
|
logbuch.Error("Error reading active visitors", logbuch.Fields{"err": err})
|
||||||
@@ -96,11 +96,6 @@ func GetActiveVisitors() int {
|
|||||||
return visitors
|
return visitors
|
||||||
}
|
}
|
||||||
|
|
||||||
func getStartTime(start int) time.Time {
|
|
||||||
startTime := today()
|
|
||||||
return startTime.Add(-time.Hour * 24 * time.Duration(start-1))
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLabelsAndData(visitors []pirsch.VisitorsPerDay) (template.JS, template.JS) {
|
func getLabelsAndData(visitors []pirsch.VisitorsPerDay) (template.JS, template.JS) {
|
||||||
var labels strings.Builder
|
var labels strings.Builder
|
||||||
var dp strings.Builder
|
var dp strings.Builder
|
||||||
|
|||||||
Reference in New Issue
Block a user