From cdb00512f1b91341909fa421dc21fa2e19b087e4 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 23 Jan 2020 18:13:35 +0100 Subject: [PATCH] move database to /db2 to avoid caching issues with new format --- 88-tar1090.conf | 2 +- html/dbloader.js | 4 ++-- html/script.js | 4 ++-- install.sh | 6 +++--- nginx.conf | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/88-tar1090.conf b/88-tar1090.conf index 63ebd76..2372458 100644 --- a/88-tar1090.conf +++ b/88-tar1090.conf @@ -54,7 +54,7 @@ $HTTP["url"] =~ "^/INSTANCE/data/icao_.*\.json$" { "Cache-Control" => "public, max-age=10", ) } -$HTTP["url"] =~ "^/INSTANCE/db/.*\.json$" { +$HTTP["url"] =~ "^/INSTANCE/db2/.*\.json$" { setenv.add-response-header += ( "Cache-Control" => "public, max-age=100000", ) diff --git a/html/dbloader.js b/html/dbloader.js index eb89285..df050ea 100644 --- a/html/dbloader.js +++ b/html/dbloader.js @@ -73,7 +73,7 @@ function request_from_db(icao, level, defer) { function getIcaoAircraftTypeData(aircraftData, defer) { if (_aircraft_type_cache === null) { - $.getJSON("db/aircraft_types/icao_aircraft_types.json") + $.getJSON("db2/aircraft_types/icao_aircraft_types.json") .done(function(typeLookupData) { _aircraft_type_cache = typeLookupData; }) @@ -136,7 +136,7 @@ function db_ajax_request_complete() { } else { _request_count++; req = _request_queue.shift(); - const req_url = 'db/' + req.bkey + '.json'; + const req_url = 'db2/' + req.bkey + '.json'; ajaxreq = $.ajax({ url: req_url, cache: true, timeout: 30000, diff --git a/html/script.js b/html/script.js index cf44075..91f1c56 100644 --- a/html/script.js +++ b/html/script.js @@ -508,11 +508,11 @@ function initialize() { // Wait for history item downloads and append them to the buffer push_history(); // this will be needed later - $.getJSON("db/aircraft_types/icao_aircraft_types.json") + $.getJSON("db2/aircraft_types/icao_aircraft_types.json") .done(function(typeLookupData) { _aircraft_type_cache = typeLookupData; }) - $.getJSON("db/airport-coords.json") + $.getJSON("db2/airport-coords.json") .done(function(data) { _airport_coords_cache = data; }) diff --git a/install.sh b/install.sh index bcfca79..b3c0c4b 100755 --- a/install.sh +++ b/install.sh @@ -173,9 +173,9 @@ do rm -rf $html_path 2>/dev/null || true cp -r -T html $html_path - mkdir -p $html_path/db - cp -r -T $ipath/git-db/db $html_path/db - cp $ipath/git-db/airport-coords.json $html_path/db + mkdir -p $html_path/db2 + cp -r -T $ipath/git-db/db $html_path/db2 + cp $ipath/git-db/airport-coords.json $html_path/db2 mv /tmp/tar1090_config.js $html_path/config.js 2>/dev/null || true mv /tmp/tar1090_colors.css $html_path/colors.css 2>/dev/null || true diff --git a/nginx.conf b/nginx.conf index b9247c7..e582123 100644 --- a/nginx.conf +++ b/nginx.conf @@ -49,7 +49,7 @@ location /INSTANCE { alias HTMLPATH/; try_files $uri $uri/ =404; - location ~ db/.*\.json$ { + location ~ db2/.*\.json$ { add_header Cache-Control "public, max-age=100000"; } location ~ .*\.png$ {