From c23a650c0dbcd4c213892d614c4a819a78054979 Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 15 Oct 2025 16:07:52 -0700 Subject: [PATCH 1/5] fixed map to show only channels with locations --- meshview/templates/map.html | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index fd471a7..146fc8c 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -199,19 +199,6 @@ loadTranslations().then(async () => { return 'Unknown'; } - async function fetchAdditionalChannels() { - try { - const res = await fetch('/api/channels?period_type=day&length=3'); - if (!res.ok) return []; - const data = await res.json(); - if (!data || !Array.isArray(data.channels)) return []; - return data.channels.filter(ch => typeof ch === 'string' && ch.trim().length > 0); - } catch (err) { - console.error('Channel list fetch failed:', err); - return []; - } - } - const nodeMap = new Map(); nodes.forEach(n => nodeMap.set(n.id, n)); function isInvalidCoord(node) { return !node || !node.lat || !node.long || node.lat===0 || node.long===0 || Number.isNaN(node.lat) || Number.isNaN(node.long); } @@ -258,8 +245,6 @@ loadTranslations().then(async () => { if (customView) map.setView([customView.lat,customView.lng],customView.zoom); else map.fitBounds(areaBounds); - const extraChannels = await fetchAdditionalChannels(); - extraChannels.forEach(raw => channelSet.add(channelKey(raw))); channelList = Array.from(channelSet).sort(); // ---- LocalStorage for Filter Preferences ---- From 084647eec109b13cf51bd7611e58f14fb8b89508 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Wed, 15 Oct 2025 16:23:59 -0700 Subject: [PATCH 2/5] Start adding language support --- meshview/templates/map.html | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 6c455e0..56bbfdc 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -258,26 +258,24 @@ loadTranslations().then(async () => { if (customView) map.setView([customView.lat,customView.lng],customView.zoom); else map.fitBounds(areaBounds); - const extraChannels = await fetchAdditionalChannels(); - extraChannels.forEach(raw => channelSet.add(channelKey(raw))); channelList = Array.from(channelSet).sort(); // ---- LocalStorage for Filter Preferences ---- const FILTER_STORAGE_KEY = 'meshview_map_filters'; - + function getDefaultFilters() { return { routersOnly: false, channels: {} }; } - + function saveFiltersToLocalStorage() { const filters = { routersOnly: document.getElementById("filter-routers-only").checked, channels: {} }; - + channelList.forEach(channel => { let filterId = `filter-${channel.replace(/\s+/g, '-').toLowerCase()}`; let checkbox = document.getElementById(filterId); @@ -285,10 +283,10 @@ loadTranslations().then(async () => { filters.channels[channel] = checkbox.checked; } }); - + localStorage.setItem(FILTER_STORAGE_KEY, JSON.stringify(filters)); } - + function loadFiltersFromLocalStorage() { try { const stored = localStorage.getItem(FILTER_STORAGE_KEY); @@ -300,7 +298,7 @@ loadTranslations().then(async () => { } return null; } - + function renderChannelFilters(savedFilters) { const filterContainer = document.getElementById("filter-container"); filterContainer.querySelectorAll('label[data-channel-filter="true"]').forEach(el => el.remove()); @@ -322,18 +320,18 @@ loadTranslations().then(async () => { filterContainer.appendChild(label); }); } - + function resetFiltersToDefaults() { localStorage.removeItem(FILTER_STORAGE_KEY); document.getElementById("filter-routers-only").checked = false; renderChannelFilters(null); updateMarkers(); - + const button = document.getElementById('reset-filters-button'); const originalText = button.textContent; button.textContent = '✓ Filters Reset!'; button.style.backgroundColor = '#2196F3'; - + setTimeout(() => { button.textContent = originalText; button.style.backgroundColor = '#f44336'; @@ -362,7 +360,7 @@ loadTranslations().then(async () => { let marker=markerById[node.id]; if(marker) marker.setStyle({fillOpacity:shouldShow?1:0}); }); - + // Save filters to localStorage whenever they change saveFiltersToLocalStorage(); @@ -378,7 +376,7 @@ loadTranslations().then(async () => { return checkbox ? checkbox.checked : true; }); } - + // Apply initial filters (from localStorage or defaults) updateMarkers(); @@ -581,4 +579,4 @@ loadTranslations().then(async () => { if(mapInterval>0) startPacketFetcher(true); }); -{% endblock %} +{% endblock %} \ No newline at end of file From 021bc54f9d2f821c36fc3b368c7e72f47de9d81e Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Wed, 15 Oct 2025 16:25:34 -0700 Subject: [PATCH 3/5] Start adding language support --- meshview/templates/map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 56bbfdc..0ab0c94 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -260,7 +260,7 @@ loadTranslations().then(async () => { channelList = Array.from(channelSet).sort(); - // ---- LocalStorage for Filter Preferences ---- + // ---- LocalStorage for Filter Preferences --- const FILTER_STORAGE_KEY = 'meshview_map_filters'; function getDefaultFilters() { From 454c8ff6e2d2c23f6f6dab936d42c81f41737244 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Wed, 15 Oct 2025 16:27:43 -0700 Subject: [PATCH 4/5] Start adding language support --- meshview/templates/map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 0ab0c94..56bbfdc 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -260,7 +260,7 @@ loadTranslations().then(async () => { channelList = Array.from(channelSet).sort(); - // ---- LocalStorage for Filter Preferences --- + // ---- LocalStorage for Filter Preferences ---- const FILTER_STORAGE_KEY = 'meshview_map_filters'; function getDefaultFilters() { From a002cde2d70e1079233bf9b519a240c4e208cf91 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Wed, 15 Oct 2025 21:32:50 -0700 Subject: [PATCH 5/5] Revert "fixed map to show only channels with locations" --- meshview/templates/map.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 56bbfdc..449137d 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -258,6 +258,8 @@ loadTranslations().then(async () => { if (customView) map.setView([customView.lat,customView.lng],customView.zoom); else map.fitBounds(areaBounds); + const extraChannels = await fetchAdditionalChannels(); + extraChannels.forEach(raw => channelSet.add(channelKey(raw))); channelList = Array.from(channelSet).sort(); // ---- LocalStorage for Filter Preferences ----