[gimp-web/wip/Jehan/issue-236-new-sponsor-page] content, plugins: adding a way to ignore known geoip discrepancies.



commit d68602a92b4fe4e8f3c53abc04254a677ff53c5b
Author: Jehan <jehan girinstud io>
Date:   Tue Aug 31 14:59:36 2021 +0200

    content, plugins: adding a way to ignore known geoip discrepancies.
    
    After an email discussion with Klaus-Uwe Mitterer about the
    GeoIP-detected location being different from declared one, I was
    answered:
    
    > We get this question a lot - the mirror is actually located in Graz,
    > Austria. GeoIP lookups return the weirdest of results, as we are
    > leasing the subnet we are using from someone else, who in turn seems
    > to be leasing it from someone else yet again. I tried getting the data
    > corrected in a few of those GeoIP databases, but that doesn't seem to
    > help for very long...
    
    So let's consider this one ok for now, by adding logics in the json file
    (and the parsing script) to handle geoIP detection differences with a
    reason. Also I was told that mirror.kumi.systems is now the prefered
    domain (and I can indeed see that mirror.klaus-uwe.me is an alias for
    this other domain). I asked the admin to do the request for this
    directly to the GNOME infrastructure tracker, because we use their
    configuration. Still I change the URL for the "about" (not the mirror
    URL) and the public name of the mirror to "Kumi Systems".

 content/downloads/mirrors.json       | 10 +++++++---
 plugins/gimp_mirrors/gimp_mirrors.py | 10 ++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/content/downloads/mirrors.json b/content/downloads/mirrors.json
index 0eaf21a6..96061888 100644
--- a/content/downloads/mirrors.json
+++ b/content/downloads/mirrors.json
@@ -71,11 +71,15 @@
       "about": "https://mirror.jaleco.com";,
       "more": [ "https://gitlab.gnome.org/Infrastructure/gimp-web/-/issues/63"; ]
     },
-    "Klaus-Uwe Mitterer": {
-      "location": "Vienna",
+    "Kumi Systems": {
+      "location": "Graz",
       "country": "Austria",
+      "geoip": {
+                 "country": "Germany",
+                 "reason": "We get this question a lot - the mirror is actually located in Graz, Austria. 
GeoIP lookups return the weirdest of results, as we are leasing the subnet we are using from someone else, 
who in turn seems to be leasing it from someone else yet again. I tried getting the data corrected in a few 
of those GeoIP databases, but that doesn't seem to help for very long... [email exchange between Jehan and 
Klaus-Uwe Mitterer on 2021-08-29]"
+               },
       "mirrors": [ "https://mirror.klaus-uwe.me/gimp/gimp/"; ],
-      "about": "https://mirror.klaus-uwe.me/";,
+      "about": "https://mirror.kumi.systems/";,
       "more": [ "https://gitlab.gnome.org/Infrastructure/gimp-web/-/issues/31";,
                 "https://gitlab.gnome.org/Infrastructure/gimp-web/-/issues/79"; ]
     },
diff --git a/plugins/gimp_mirrors/gimp_mirrors.py b/plugins/gimp_mirrors/gimp_mirrors.py
index fd1048a4..439d7088 100644
--- a/plugins/gimp_mirrors/gimp_mirrors.py
+++ b/plugins/gimp_mirrors/gimp_mirrors.py
@@ -83,10 +83,12 @@ def do_mirrors(path, context):
                         country = gi.country_name_by_name(domain)
 
                         if country != data[record]['country']:
-                            print('WARNING: mismatch between GeoIP detection and declared mirror location:')
-                            print('         GeoIP detected country for "{}" ({}): "{}"'.format(record, 
domain, country))
-                            print('         Declared country for "{}" ({}): "{}"'.format(record, domain,
-                                                                                       
data[record]['country']))
+                            if 'geoip' not in data[record] or data[record]['geoip']['country'] != country:
+                                # Known mismatch with a reason.
+                                print('WARNING: mismatch between GeoIP detection and declared mirror 
location:')
+                                print('         GeoIP detected country for "{}" ({}): "{}"'.format(record, 
domain, country))
+                                print('         Declared country for "{}" ({}): "{}"'.format(record, domain,
+                                                                                           
data[record]['country']))
                             # If this happens, use the declared country,
                             # yet still print a warning for verification.
                             country = data[record]['country']


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]