diff --git a/app/helpers/ip_addresses_helper.rb b/app/helpers/ip_addresses_helper.rb index 61a833f22..cee60fec9 100644 --- a/app/helpers/ip_addresses_helper.rb +++ b/app/helpers/ip_addresses_helper.rb @@ -1,11 +1,13 @@ module IpAddressesHelper - def embedded_google_map(location, width, height, api_key: Danbooru.config.google_maps_api_key) + # https://www.bing.com/maps/embed-a-map + # https://docs.microsoft.com/en-us/bingmaps/articles/create-a-custom-map-url + def embedded_map(lat, long, width, height, zoom: 10) tag.iframe( width: width, height: height, frameborder: 0, allowfullscreen: true, - src: "https://www.google.com/maps/embed/v1/search?q=#{location}&key=#{api_key}" + src: "https://www.bing.com/maps/embed?w=#{width}&h=#{height}&cp=#{lat}~#{long}&lvl=#{zoom}" ) end end diff --git a/app/views/ip_addresses/_info.html.erb b/app/views/ip_addresses/_info.html.erb index 968369499..7cc2f5657 100644 --- a/app/views/ip_addresses/_info.html.erb +++ b/app/views/ip_addresses/_info.html.erb @@ -71,5 +71,5 @@
- <%= embedded_google_map("#{ip_info.dig(:location, :latitude)},#{ip_info.dig(:location, :longitude)}", 300, 200) %> + <%= embedded_map(ip_info.dig(:location, :latitude), ip_info.dig(:location, :longitude), 300, 200) %>
diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 9e890c39f..98a4d1710 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -486,12 +486,6 @@ module Danbooru [] end - # API key for Google Maps. Used for embedding maps on IP address lookup pages. - # Generate at https://console.developers.google.com/apis/credentials - def google_maps_api_key - nil - end - # Cloudflare API token. Used to purge URLs from Cloudflare's cache when a # post is replaced. The token must have 'zone.cache_purge' permissions. # https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys diff --git a/config/docker/docker-compose.test.yaml b/config/docker/docker-compose.test.yaml index 1a14ce0f1..42903d578 100644 --- a/config/docker/docker-compose.test.yaml +++ b/config/docker/docker-compose.test.yaml @@ -34,7 +34,6 @@ services: - DANBOORU_RAKISMET_KEY - DANBOORU_RAKISMET_URL - DANBOORU_IP_REGISTRY_API_KEY - - DANBOORU_GOOGLE_MAPS_API_KEY depends_on: - postgres user: root