Put static assets in a separate directory so they can be delivered directly by nginx

This commit is contained in:
Ian Renton
2026-07-25 16:49:49 +01:00
parent 555a8418a9
commit 3c4c595288
20 changed files with 157 additions and 130 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ from datetime import timedelta
from PIL import Image, ImageDraw, ImageFont
from requests_cache import CachedSession
test = os.listdir("./")
test = os.listdir("/")
for item in test:
if item.endswith(".png"):
os.remove(os.path.join("./", item))
os.remove(os.path.join("/", item))
cache = CachedSession("/tmp/cache", expire_after=timedelta(days=30))
data = cache.get("https://raw.githubusercontent.com/k0swe/dxcc-json/refs/heads/main/dxcc.json").json()
+1 -1
View File
@@ -184,7 +184,7 @@ function addAlertRowsToTable(tbody, alerts) {
// Format DX flag
let dx_flag = "<i class='fa-solid fa-globe-africa'></i>";
if (a["dx_dxcc_id"] && a["dx_dxcc_id"] != null && a["dx_dxcc_id"] !== 0) {
dx_flag = `<img src="img/flags/${a['dx_dxcc_id']}.png" class="flag" width="24" alt="${dx_country}" title="${dx_country}"/>`;
dx_flag = `<img src="static/img/flags/${a['dx_dxcc_id']}.png" class="flag" width="24" alt="${dx_country}" title="${dx_country}"/>`;
}
// Format dx calls
+2 -2
View File
@@ -249,7 +249,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
dx_flag = "";
}
if (s["dx_dxcc_id"] && s["dx_dxcc_id"] != null && s["dx_dxcc_id"] !== 0) {
dx_flag = `<img src="img/flags/${s['dx_dxcc_id']}.png" class="flag" width="24" alt="${dx_country}" title="${dx_country}"/>`;
dx_flag = `<img src="static/img/flags/${s['dx_dxcc_id']}.png" class="flag" width="24" alt="${dx_country}" title="${dx_country}"/>`;
}
// Format the frequency
@@ -319,7 +319,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Format DE flag
let de_flag = "<i class='fa-solid fa-circle-question'></i>";
if (s["de_dxcc_id"] && s["de_dxcc_id"] != null && s["de_dxcc_id"] !== 0) {
de_flag = `<img src="img/flags/${s['de_dxcc_id']}.png" class="flag" width="24" alt="${de_country}" title="${de_country}"/>`;
de_flag = `<img src="static/img/flags/${s['de_dxcc_id']}.png" class="flag" width="24" alt="${de_country}" title="${de_country}"/>`;
}
// Format de call
-29
View File
@@ -1,29 +0,0 @@
{
"dir": "ltr",
"lang": "English",
"name": "Spothole",
"short_name": "Spothole",
"scope": "/",
"display": "standalone",
"start_url": "https://spothole.app/",
"background_color": "white",
"theme_color": "white",
"description": "An Amateur Radio spotting tool bringing together DX clusters and outdoor programmes, providing a universal JSON API and web interface.",
"related_applications": [],
"prefer_related_applications": false,
"icons": [
{
"src": "/img/icon-192-pwa.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "/img/icon-512-pwa.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"url": "https://spothole.app"
}
+52 -23
View File
@@ -1,28 +1,57 @@
const CACHE_NAME = 'Spothole';
const CACHE_URLS = [
'index.html',
'./',
'apidocs',
'apidocs/openapi.yml',
'about',
'css/style.css',
'js/add-spot.js',
'js/alerts.js',
'js/bands.js',
'js/common.js',
'js/map.js',
'js/spots.js',
'js/spotsbandsandmap.js',
'js/status.js',
'img/logo.png',
'img/favicon.ico',
'img/icon-32.png',
'img/icon-192.png',
'img/icon-512.png',
'fa/css/fontawesome.min.css',
'fa/css/solid.min.css',
'fa/webfonts/fa-solid-900.ttf',
'fa/webfonts/fa-solid-900.woff2'
'static/apidocs/openapi.yml',
'static/audio/ping.mp3',
'static/css/style.css',
'static/js/add-spot.js',
'static/js/alerts.js',
'static/js/bands.js',
'static/js/common.js',
'static/js/geo.js',
'static/js/map.js',
'static/js/spots.js',
'static/js/spotsbandsandmap.js',
'static/js/status.js',
'static/js/ui-ham.js',
'static/js/utils.js',
'static/img/logo.png',
'static/img/favicon.ico',
'static/img/icon-32.png',
'static/img/icon-192.png',
'static/img/icon-512.png',
'static/vendor/img/markers_default@2x.png',
'static/vendor/img/markers_shadow.png',
'static/vendor/img/markers_default.png',
'static/vendor/img/markers_shadow@2x.png',
'static/vendor/css/bootstrap-5.3.8.min.css',
'static/vendor/css/images/marker-icon.png',
'static/vendor/css/images/layers-2x.png',
'static/vendor/css/images/marker-shadow.png',
'static/vendor/css/images/layers.png',
'static/vendor/css/images/marker-icon-2x.png',
'static/vendor/css/leaflet-extra-markers-1.2.2.min.css',
'static/vendor/css/leaflet-1.9.4.min.css',
'static/vendor/css/fontawesome-6.7.2.min.css',
'static/vendor/css/solid-6.7.2.min.css',
'static/vendor/js/jquery-3.7.1.min.js',
'static/vendor/js/chart-4.4.9.umd.min.js',
'static/vendor/js/oms-leaflet-0.2.7.min.js',
'static/vendor/js/leaflet-workedallbritainireland.js',
'static/vendor/js/leaflet-providers-2.0.0.js',
'static/vendor/js/text-image-0.7.0.js',
'static/vendor/js/leaflet-vectorgrid-1.3.0.js',
'static/vendor/js/leaflet-ituzones.js',
'static/vendor/js/tinycolor2-1.6.0.min.js',
'static/vendor/js/bootstrap-5.3.8.bundle.min.js',
'static/vendor/js/moment-2.29.4.min.js',
'static/vendor/js/leaflet-cqzones.js',
'static/vendor/js/leaflet-extra-markers-1.2.2.min.js',
'static/vendor/js/leaflet-terminator-1.1.0.min.js',
'static/vendor/js/leaflet-1.9.4.min.js',
'static/vendor/js/leaflet-geodesic-2.7.2.umd.min.js',
'static/vendor/js/leaflet-maidenhead.js',
'static/vendor/webfonts/fa-solid-900.ttf',
'static/vendor/webfonts/fa-solid-900.woff2'
];
self.addEventListener('fetch', (event) => {
File diff suppressed because one or more lines are too long