From 343f362434f36d8e97c0630600a6911f50e236e5 Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Thu, 6 Sep 2018 15:36:13 -0300
Subject: [PATCH] Show when data was last modified

---
 www/bridges.html  | 4 ++++
 www/css/index.css | 4 ++++
 www/index.html    | 4 ++++
 www/js/bridges.js | 3 ++-
 www/js/index.js   | 3 ++-
 5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/www/bridges.html b/www/bridges.html
index d6bcdba..f36cf6f 100644
--- a/www/bridges.html
+++ b/www/bridges.html
@@ -35,6 +35,10 @@
     </p>
 
     <div id="bridge_reachability" style="margin-top:1em; width:98%;"></div>
+
+    <p class="last-modified">
+        Last Modified: <span id="last-modified"></span>
+    </p>
 </div>
 <script type="text/javascript" src="js/bridges.js"></script>
 </body>
diff --git a/www/css/index.css b/www/css/index.css
index 9bb74a8..7ce5e66 100644
--- a/www/css/index.css
+++ b/www/css/index.css
@@ -32,3 +32,7 @@ button {
 #vanilla_tor, #tor-metrics, p {
     margin: 0 auto 0 auto;
 }
+
+.last-modified {
+    margin-top: 4em;
+}
diff --git a/www/index.html b/www/index.html
index 495095e..1d6dbb7 100644
--- a/www/index.html
+++ b/www/index.html
@@ -41,6 +41,10 @@
     <p style="margin-top:2em;">
         <a href="bridges.html">What about blocked bridges?</a>
     </p>
+
+    <p class="last-modified">
+        Last Modified: <span id="last-modified"></span>
+    </p>
 </div>
 <script type="text/javascript" src="js/index.js"></script>
 </body>
diff --git a/www/js/bridges.js b/www/js/bridges.js
index 4d29417..a515c42 100644
--- a/www/js/bridges.js
+++ b/www/js/bridges.js
@@ -53,7 +53,8 @@ var bridgeFilter = {field:"type", type:"in", value:["TB", "B"]}
 var ctrlFilter = {field:"ctrl", type:">=", value:80}
 
 $.getJSON("countries-bridges.json")
-.done(function( json ) {
+.done(function( json, textStatus, jqXHR ) {
+  $("#last-modified").html(jqXHR.getResponseHeader("Last-Modified"));
   $("#bridge_reachability").tabulator("setData", json);
   applyFilter();
 })
diff --git a/www/js/index.js b/www/js/index.js
index d7388c8..8aebdcd 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -20,7 +20,8 @@ $("#vanilla_tor").tabulator({
 });
 
 $.getJSON("countries.json")
-.done(function( json ) {
+.done(function( json, textStatus, jqXHR ) {
+  $("#last-modified").html(jqXHR.getResponseHeader("Last-Modified"));
   $("#vanilla_tor").tabulator("setData", json);
   showOoniBlocking();
 })
-- 
GitLab