page counter per lang
This commit is contained in:
parent
9df029453b
commit
2c42e35c63
1 changed files with 4 additions and 6 deletions
10
main.go
10
main.go
|
@ -136,7 +136,7 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
db.Inc("page_counter")
|
db.Inc("page_counter" + defaultLang)
|
||||||
|
|
||||||
conn, err := grpc.Dial(
|
conn, err := grpc.Dial(
|
||||||
fileSrvHost+":"+fileSrvPort,
|
fileSrvHost+":"+fileSrvPort,
|
||||||
|
@ -238,14 +238,12 @@ func renderIndex(w gemini.ResponseWriter, client TreeManagerClient) {
|
||||||
|
|
||||||
lastRebuild, found := db.Get("last_rebuild")
|
lastRebuild, found := db.Get("last_rebuild")
|
||||||
if !found {
|
if !found {
|
||||||
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pageCounter, found := db.Get("page_counter")
|
pageCounter, found := db.Get("page_counter_" + defaultLang)
|
||||||
if !found {
|
if !found {
|
||||||
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
|
pageCounter = "1"
|
||||||
return
|
db.Save("page_counter_"+defaultLang, "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
w.SetMediaType("text/gemini")
|
w.SetMediaType("text/gemini")
|
||||||
|
|
Loading…
Reference in a new issue