Skip to content

Commit

Permalink
Remove "go" link for pages
Browse files Browse the repository at this point in the history
The site.Name is no longer the domain (it was before), it just worked
for me as I still have it set to "arp242.net".

We don't store the domain currently, so can't show it.
  • Loading branch information
arp242 committed Nov 7, 2019
1 parent a9b9116 commit c45a985
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -16,7 +16,7 @@ require (
zgo.at/validate v0.0.0-20191016030913-12666f2cd0d7
zgo.at/zdb v0.0.0-20191104065344-b275c8066da2
zgo.at/zhttp v0.0.0-20191016110155-3f03574a8867
zgo.at/zlog v1.0.4
zgo.at/zlog v1.0.5
zgo.at/zpack v0.0.0-20191017081413-891e9f24a4d3
zgo.at/ztest v0.0.0-20191016022435-f3e360521191
)
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -72,6 +72,8 @@ zgo.at/zlog v1.0.3 h1:VARDTSzp2tP0S0xYuITAlU/occFWEAbli7LM3ol/c+s=
zgo.at/zlog v1.0.3/go.mod h1:V3ytbwhdFfmcUglEwnvlJ0VKoFocxpfhRUAISEERmZ8=
zgo.at/zlog v1.0.4 h1:a6f3fQHOgLKRmkdrTo1R7ItBr9R2kiF/J69qJ59VhBU=
zgo.at/zlog v1.0.4/go.mod h1:V3ytbwhdFfmcUglEwnvlJ0VKoFocxpfhRUAISEERmZ8=
zgo.at/zlog v1.0.5 h1:8TColnNPK6v4ckxUJxYz5t+2Ml+s05aFNy/NpxLPcTk=
zgo.at/zlog v1.0.5/go.mod h1:V3ytbwhdFfmcUglEwnvlJ0VKoFocxpfhRUAISEERmZ8=
zgo.at/zpack v0.0.0-20191016105541-d45fd0334215 h1:W67riaNky3uU8IAtWvjXIP3UjaWHf8jMg3ljxX+jRmE=
zgo.at/zpack v0.0.0-20191016105541-d45fd0334215/go.mod h1:2laAAHqImmeiTlMAQ2PlMRBVhS6YKPkUoosMfdv7GXY=
zgo.at/zpack v0.0.0-20191017081413-891e9f24a4d3 h1:ukk6cQoZ9x3do1xVtDCDz48o4ulKXl4GzBTmPaPWp9I=
Expand Down
9 changes: 5 additions & 4 deletions handlers/backend.go
Expand Up @@ -160,10 +160,11 @@ func (h backend) count(w http.ResponseWriter, r *http.Request) error {
const day = 24 * time.Hour

func (h backend) index(w http.ResponseWriter, r *http.Request) error {
site := goatcounter.MustGetSite(r.Context())

// Cache much more aggressively for public displays. Don't care so much if
// it's outdated by an hour.
if goatcounter.MustGetSite(r.Context()).Settings.Public &&
goatcounter.GetUser(r.Context()).ID == 0 {
if site.Settings.Public && goatcounter.GetUser(r.Context()).ID == 0 {
w.Header().Set("Cache-Control", "public,max-age=3600")
w.Header().Set("Vary", "Cookie")
}
Expand Down Expand Up @@ -209,7 +210,7 @@ func (h backend) index(w http.ResponseWriter, r *http.Request) error {
}
}

l := zlog.Module("backend")
l := zlog.Module("backend").Field("site", site.ID)

var pages goatcounter.HitStats
total, totalDisplay, _, err := pages.List(r.Context(), start, end, nil)
Expand Down Expand Up @@ -245,7 +246,7 @@ func (h backend) index(w http.ResponseWriter, r *http.Request) error {
l = l.Since("refs.ListRefs")
}

subs, err := goatcounter.MustGetSite(r.Context()).ListSubs(r.Context())
subs, err := site.ListSubs(r.Context())
if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions pack/pack.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tpl/_backend_pages.gohtml
Expand Up @@ -9,7 +9,9 @@
<a class="rlink" href="?showrefs={{$h.Path}}&period-start={{tformat $.PeriodStart ""}}&period-end={{tformat $.PeriodEnd ""}}#{{$h.Path}}">{{$h.Path}}</a>
</div>
<div class="chart chart-bar">
{{/* We don't have the site domain, so can't link to it.
<a class="top go" target="_blank" href="https://{{$.Site.Name}}{{$h.Path}}">go</a>
*/}}
<span class="top max">{{nformat .Max}}</span>
<span class="half"></span>
{{bar_chart .Stats .Max}}
Expand Down

0 comments on commit c45a985

Please sign in to comment.