Patch for a Map (#62)

Add map
This commit is contained in:
Johann Richard 2018-10-28 16:42:17 +01:00 committed by Martin Polden
parent e5c8310acb
commit cba0928a65
2 changed files with 17 additions and 3 deletions

View File

@ -222,12 +222,20 @@ func (s *Server) DefaultHandler(w http.ResponseWriter, r *http.Request) *appErro
}
var data = struct {
Response
Host string
JSON string
Port bool
Host string
BoxLatTop float64
BoxLatBottom float64
BoxLonLeft float64
BoxLonRight float64
JSON string
Port bool
}{
response,
r.Host,
response.Latitude + 0.05,
response.Latitude - 0.05,
response.Longitude - 0.05,
response.Longitude + 0.05,
string(json),
s.LookupPort != nil,
}

View File

@ -97,6 +97,12 @@ $ http {{ .Host }}/port/8080
}</pre>
{{ end }}
</div>
{{ if .City }}
<div class="pure-u-1 pure-u-md-1-1">
<h2>Map</h2>
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox={{ .BoxLonLeft }}%2C{{ .BoxLatBottom }}%2C{{ .BoxLonRight }}%2C{{ .BoxLatTop }}&amp;layer=mapnik&amp;marker={{ .Latitude }}%2C{{ .Longitude }}"></iframe>
</div>
{{ end }}
<div class="pure-u-1 pure-u-md-1-2">
<h2>FAQ</h2>
<h3>How do I force IPv4 or IPv6 lookup?</h3>