From 3662a6efa8ec9b9c4757f4967df50392d6500641 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Mon, 7 Sep 2026 23:35:14 +0200 Subject: [PATCH] Fixed server port being open after quit and date being 1970 if missing Date wil be hidden if no set, and of GEO data is also missing "Not available" will be shown under "Photo info" --- server.py | 1 + show.html | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index f13ab18..d4f5c78 100644 --- a/server.py +++ b/server.py @@ -264,5 +264,6 @@ class SlideshowHandler(http.server.SimpleHTTPRequestHandler): if __name__ == "__main__": os.chdir(os.path.dirname(os.path.abspath(__file__))) print(f"Serving slideshow on http://0.0.0.0:{cfg['PORT']}") + socketserver.TCPServer.allow_reuse_address = True with socketserver.TCPServer(("", cfg['PORT']), SlideshowHandler) as httpd: httpd.serve_forever() diff --git a/show.html b/show.html index db0a523..b838165 100644 --- a/show.html +++ b/show.html @@ -181,14 +181,20 @@ day: 'numeric' }); if (typeof data.geo_data == 'undefined' || data.geo_data == null) { - document.getElementById('photo-GeoData').textContent = "" + document.getElementById('photo-GeoData').textContent = "" }else if(typeof data.geo_data.GeoData.features[0].properties.name !== 'undefined' & data.geo_data.GeoData.features[0].properties.name !== null & data.geo_data.GeoData.features[0].properties.name !== 'undefined' ){ document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.name + " - " + data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country; }else{ - document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country; + document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country; } - document.getElementById('photo-Date').textContent = formatted; + if((typeof data.capture_date == 'undefined' || data.capture_date == null) && (typeof data.geo_data == 'undefined' || data.geo_data == null)){ + document.getElementById('photo-Date').textContent = "Not available" + }else if (typeof data.capture_date == 'undefined' || data.capture_date == null) { + document.getElementById('photo-Date').textContent = "" + }else{ + document.getElementById('photo-Date').textContent = formatted; + } } // --- Clock ---