From a1375edb7d6d01d023e64f6a1b5da31d5f844b13 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 28 Jan 2021 18:08:46 +0100 Subject: [PATCH] allow people to use custom silhouettes --- 88-tar1090.conf | 7 +++++++ html/config.js | 7 +++++++ html/script.js | 2 +- install.sh | 2 ++ nginx.conf | 6 ++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/88-tar1090.conf b/88-tar1090.conf index ef782bbd3..da78cad74 100644 --- a/88-tar1090.conf +++ b/88-tar1090.conf @@ -9,6 +9,7 @@ alias.url += ( "/INSTANCE/data/" => "SOURCE_DIR/", "/INSTANCE/chunks/" => "/run/SERVICE/", "/INSTANCE/globe_history/" => "/var/globe_history/", + "/INSTANCE/aircraft_sil/" => "/usr/local/share/tar1090/aircraft_sil/", "/INSTANCE/" => "HTMLPATH/" ) @@ -69,6 +70,12 @@ $HTTP["url"] =~ "^/INSTANCE/flags-tiny" { "Cache-Control" => "public, max-age=1209600", ) } +$HTTP["url"] =~ "^/INSTANCE/aircraft_sil" { + setenv.add-response-header += ( + "Cache-Control" => "public, max-age=1209600", + ) +} + $HTTP["url"] =~ "^/INSTANCE/config.js$" { setenv.add-response-header += ( "Cache-Control" => "public, must-revalidate", diff --git a/html/config.js b/html/config.js index de8538494..2c8094e59 100644 --- a/html/config.js +++ b/html/config.js @@ -242,6 +242,13 @@ HideCols = [ ] +// showing small pictures / silhouettes +//showPictures = true; +// this shows small pictures in the details but they need to be provided by the user in the folder /usr/local/share/tar1090/aircraft_sil +// pictures need to be named A330.png and so forth with the type code in the form TYPE.png +// provide ZZZZ.png to be shown when the type is not known. +// this feature is provided as is please don't expect tar1090's support for getting the pictures right. + //enableDWD = true; // Display only the last leg of a flight in globeIndex mode. diff --git a/html/script.js b/html/script.js index 8df3a8fab..bcea458ca 100644 --- a/html/script.js +++ b/html/script.js @@ -2039,7 +2039,7 @@ function refreshSelected() { if (showPictures) { let type = selected.icaoType ? selected.icaoType : 'ZZZZ'; - let new_html = ""; + let new_html = ""; if (new_html != selectedPhotoCache) { $('#selected_photo').html(new_html); selectedPhotoCache = new_html; diff --git a/install.sh b/install.sh index f77277a24..fd69a777a 100755 --- a/install.sh +++ b/install.sh @@ -16,6 +16,8 @@ lighttpd=no nginx=no mkdir -p $ipath +mkdir -p $ipath/aircraft_sil + if ! id -u tar1090 &>/dev/null then diff --git a/nginx.conf b/nginx.conf index 0f83b07de..7ecdc6637 100644 --- a/nginx.conf +++ b/nginx.conf @@ -52,6 +52,12 @@ location /INSTANCE/chunks/ { } } +location /INSTANCE/aircraft_sil/ { + alias /usr/local/share/tar1090/aircraft_sil/; + add_header Cache-Control "public, max-age=1209600"; + try_files $uri /aircraft_sil/ZZZZ.png; +} + location /INSTANCE { alias HTMLPATH/; try_files $uri $uri/ =404;