Patch for ISO and Map display (#45)

This commit is contained in:
Johann Richard
2018-02-09 20:41:30 +01:00
committed by Martin Polden
parent 9f839c5f36
commit c195bae4fb
5 changed files with 83 additions and 25 deletions

View File

@ -63,6 +63,10 @@ $ bat -print=b {{ .Host }}/ip
<pre>
$ http {{ .Host }}/country
{{ .Country }}</pre>
<h2>Short country code (ISO 3166-1 alpha-2) lookup:</h2>
<pre>
$ http {{ .Host }}/country-iso
{{ .CountryISO }}</pre>
{{ end }}
{{ if .IsLookupCityEnabled }}
<h2>City lookup:</h2>
@ -76,8 +80,9 @@ $ http {{ .Host }}/city
<pre>
$ http {{ .Host }}/json
{ {{ if .IsLookupCityEnabled }}
"city": "{{ .City }}",{{ end }}{{ if .IsLookupCountryEnabled }}
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"city": "{{ .City }}",
"country": "{{ .Country }}",
"country_iso": "{{ .CountryISO }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"hostname": "{{ .Hostname }}",{{ end }}
"ip": "{{ .IP }}",
"ip_decimal": {{ .IPDecimal }}
@ -100,6 +105,13 @@ $ http {{ .Host }}/port/8080
}</pre>
{{ end }}
</div>
{{ if .IsLookupCountryEnabled }}{{ if ne .Country "Unknown"}}{{ if .IsLookupCityEnabled }}{{ if ne .City "Unknown"}}
<div class="pure-u-1 pure-u-md-1-1">
<h2>Map</h2>
<p><img src="https://maps.googleapis.com/maps/api/staticmap?size=600x200&amp;scale=2&amp;markers=color%3Aorange%7Clabel%3AS%7c{{ .City }},{{ .Country }}" width="600" height="200"/>
</p>
{{ end }}{{ end }}{{ end }}{{ end }}
</div>
<div class="pure-u-1 pure-u-md-1-1">
<h2>FAQ</h2>
<h3>How do I force IPv4 or IPv6 lookup?</h3>