diff --git a/README.md b/README.md
index ff9ce573..b77c4887 100644
--- a/README.md
+++ b/README.md
@@ -81,7 +81,6 @@ Option | description
------ | -----------
Repository | Path to your own copy of the repository
Templates | Path containing the templates
-GoogleMapsAPIKey | Google Maps API key that you can [obtain here](https://developers.google.com/maps/documentation/javascript/get-api-key).
OutputMode | auto: based on the *Accept* header content
redirect: do an HTTP redirect to the destination
json: return a JSON formatted document (also known as API mode)
ListenAddress | Local address and port to bind
Gzip | Use gzip compression for the JSON responses
diff --git a/config/config.go b/config/config.go
index 3e7f79c2..e407a792 100644
--- a/config/config.go
+++ b/config/config.go
@@ -43,7 +43,6 @@ var (
DisallowRedirects: false,
WeightDistributionRange: 1.5,
DisableOnMissingFile: false,
- GoogleMapsAPIKey: "",
}
config *Configuration
configMutex sync.RWMutex
@@ -78,8 +77,6 @@ type Configuration struct {
RedisSentinelMasterName string `yaml:"RedisSentinelMasterName"`
RedisSentinels []sentinels `yaml:"RedisSentinels"`
-
- GoogleMapsAPIKey string `yaml:"GoogleMapsAPIKey"`
}
type fallback struct {
diff --git a/contrib/docker/mirrorbits.conf b/contrib/docker/mirrorbits.conf
index 32566994..43b996f8 100644
--- a/contrib/docker/mirrorbits.conf
+++ b/contrib/docker/mirrorbits.conf
@@ -2,7 +2,6 @@
Repository: /srv/repo
Templates: /go/src/github.com/etix/mirrorbits/templates/
-GoogleMapsAPIKey:
OutputMode: auto
ListenAddress: :8080
Gzip: false
diff --git a/http/pagerenderer.go b/http/pagerenderer.go
index 841fbe52..e2e3d7dc 100644
--- a/http/pagerenderer.go
+++ b/http/pagerenderer.go
@@ -120,8 +120,6 @@ func (w *MirrorListRenderer) Write(ctx *Context, results *mirrors.Results) (stat
// Create a temporary output buffer to render the page
var buf bytes.Buffer
- // Generate the URL for the map
- results.MapURL = mirrors.GetMirrorMapURL(results.MirrorList, results.ClientInfo)
ctx.ResponseWriter().Header().Set("Content-Type", "text/html; charset=utf-8")
// Render the page into the buffer
diff --git a/mirrorbits.conf b/mirrorbits.conf
index 8cd6bfd4..f436c314 100644
--- a/mirrorbits.conf
+++ b/mirrorbits.conf
@@ -2,7 +2,6 @@
Repository: /srv/repo
Templates: /usr/share/mirrorbits/
-GoogleMapsAPIKey:
OutputMode: json
ListenAddress: :8080
Gzip: false
diff --git a/mirrors/mirrors.go b/mirrors/mirrors.go
index 1c42ddc1..ca131db6 100644
--- a/mirrors/mirrors.go
+++ b/mirrors/mirrors.go
@@ -4,7 +4,6 @@
package mirrors
import (
- "bytes"
"fmt"
"math/rand"
"strconv"
@@ -211,46 +210,10 @@ func SetMirrorState(r *database.Redis, id string, state bool, reason string) err
return err
}
-// GetMirrorMapURL returns the URL of a map containing the location of the closest mirrors
-// as well as the client's guessed location.
-func GetMirrorMapURL(mirrors Mirrors, clientInfo network.GeoIPRecord) string {
- var buffer bytes.Buffer
- buffer.WriteString("//maps.googleapis.com/maps/api/staticmap?size=600x320&sensor=false&visual_refresh=true")
-
- if key := GetConfig().GoogleMapsAPIKey; key != "" {
- buffer.WriteString(fmt.Sprintf("&key=%s", key))
- }
-
- if clientInfo.IsValid() {
- buffer.WriteString(fmt.Sprintf("&markers=size:mid|color:red|%f,%f", clientInfo.Latitude, clientInfo.Longitude))
- }
-
- count := 1
- for i, mirror := range mirrors {
- if count > 9 {
- break
- }
- if i == 0 && clientInfo.IsValid() {
- // Draw a path between the client and the mirror
- buffer.WriteString(fmt.Sprintf("&path=color:0x17ea0bdd|weight:5|%f,%f|%f,%f",
- clientInfo.Latitude, clientInfo.Longitude,
- mirror.Latitude, mirror.Longitude))
- }
- color := "blue"
- if mirror.Weight > 0 {
- color = "green"
- }
- buffer.WriteString(fmt.Sprintf("&markers=color:%s|label:%d|%f,%f", color, count, mirror.Latitude, mirror.Longitude))
- count++
- }
- return buffer.String()
-}
-
// Results is the resulting struct of a request and is
// used by the renderers to generate the final page.
type Results struct {
FileInfo filesystem.FileInfo
- MapURL string `json:"-"`
IP string
ClientInfo network.GeoIPRecord
MirrorList Mirrors
diff --git a/mirrors/mirrors_test.go b/mirrors/mirrors_test.go
index 9198be32..e8541158 100644
--- a/mirrors/mirrors_test.go
+++ b/mirrors/mirrors_test.go
@@ -12,7 +12,6 @@ import (
"time"
"github.com/etix/geoip"
- "github.com/etix/mirrorbits/config"
"github.com/etix/mirrorbits/database"
"github.com/etix/mirrorbits/network"
. "github.com/etix/mirrorbits/testing"
@@ -520,65 +519,3 @@ func TestSetMirrorState(t *testing.T) {
}
}
-func TestGetMirrorMapUrl(t *testing.T) {
- config.SetConfiguration(&config.Configuration{})
-
- m := Mirrors{
- Mirror{
- ID: "M0",
- Latitude: -80.0,
- Longitude: 80.0,
- },
- Mirror{
- ID: "M1",
- Latitude: -60.0,
- Longitude: 60.0,
- },
- Mirror{
- ID: "M2",
- Latitude: -40.0,
- Longitude: 40.0,
- },
- Mirror{
- ID: "M3",
- Latitude: -20.0,
- Longitude: 20.0,
- },
- }
-
- c := network.GeoIPRecord{
- GeoIPRecord: &geoip.GeoIPRecord{
- Latitude: -10.0,
- Longitude: 10.0,
- },
- ASNum: 4444,
- }
-
- result := GetMirrorMapURL(m, c)
-
- if !strings.HasPrefix(result, "//maps.googleapis.com") {
- t.Fatalf("Bad format")
- }
-
- if !strings.Contains(result, "color:red") {
- t.Fatalf("Missing client marker?")
- }
-
- if strings.Count(result, "label:") != len(m) {
- t.Fatalf("Missing some mirror markers?")
- }
-
- if strings.Contains(result, "key=") {
- t.Fatalf("Result should not contain an api key")
- }
-
- config.SetConfiguration(&config.Configuration{
- GoogleMapsAPIKey: "qwerty",
- })
-
- result = GetMirrorMapURL(m, c)
-
- if !strings.Contains(result, "key=qwerty") {
- t.Fatalf("Result must contain the api key")
- }
-}
diff --git a/templates/mirrorlist.html b/templates/mirrorlist.html
index 1306e6ec..e535bc62 100644
--- a/templates/mirrorlist.html
+++ b/templates/mirrorlist.html
@@ -26,6 +26,45 @@
chart.draw(data, options);
}
+
+
+
+
{{end}}
{{define "body"}}
@@ -53,10 +92,74 @@ File
+
+
Mirrors