mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-08-09 10:22:56 +02:00
deploy: 53b75ede11
This commit is contained in:
@@ -9,14 +9,12 @@ async function deviceRolesChart() {
|
||||
ctx.fillText('Loading data...', canvas.width / 2, canvas.height / 2);
|
||||
|
||||
try {
|
||||
const response = await fetch('https://map.sthlm-mesh.se/api/v1/nodes/');
|
||||
const data = await response.json();
|
||||
|
||||
await fetchNodes();
|
||||
const predefinedLabels = ['CLIENT', 'CLIENT_MUTE', 'CLIENT_HIDDEN', 'ROUTER_LATE', 'ROUTER', 'ROUTER_CLIENT'];
|
||||
|
||||
// Count role occurrences
|
||||
const roleCounts = {};
|
||||
data.nodes.forEach(node => {
|
||||
nodes.forEach(node => {
|
||||
const role = node.role_name || "UNKNOWN";
|
||||
roleCounts[role] = (roleCounts[role] || 0) + 1;
|
||||
});
|
||||
|
||||
+8
-13
@@ -1,21 +1,16 @@
|
||||
function countNodesSince(daysAgo) {
|
||||
const now = new Date();
|
||||
const threshold = new Date(now);
|
||||
threshold.setDate(threshold.getDate() - daysAgo);
|
||||
return nodes.filter(node => new Date(node.updated_at) >= threshold).length;
|
||||
}
|
||||
|
||||
async function nodesSeen() {
|
||||
const response = await fetch('https://map.sthlm-mesh.se/api/v1/nodes/');
|
||||
const data = await response.json();
|
||||
const nodes = data.nodes;
|
||||
const now = new Date();
|
||||
|
||||
|
||||
const countNodesSince = (daysAgo) => {
|
||||
const threshold = new Date(now);
|
||||
threshold.setDate(threshold.getDate() - daysAgo);
|
||||
return nodes.filter(node => new Date(node.updated_at) >= threshold).length;
|
||||
};
|
||||
await fetchNodes();
|
||||
|
||||
document.getElementById("count-30").textContent = countNodesSince(30);
|
||||
document.getElementById("count-7").textContent = countNodesSince(7);
|
||||
document.getElementById("count-1").textContent = countNodesSince(1);
|
||||
|
||||
}
|
||||
|
||||
nodesSeen();
|
||||
nodesSeen();
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
let allNodes = [];
|
||||
let highlightedIndex = -1;
|
||||
let chartInstance;
|
||||
|
||||
|
||||
async function fetchNodes() {
|
||||
const res = await fetch('https://map.sthlm-mesh.se/api/v1/nodes/');
|
||||
const data = await res.json();
|
||||
|
||||
const threshold = new Date();
|
||||
threshold.setDate(threshold.getDate() - 1);
|
||||
allNodes = data.nodes.filter(node => new Date(node.updated_at) >= threshold);
|
||||
}
|
||||
|
||||
function filterSuggestions(query) {
|
||||
const lowerQuery = query.toLowerCase();
|
||||
return allNodes?.filter(node => node.long_name?.toLowerCase().includes(lowerQuery)) || [];
|
||||
const threshold = new Date();
|
||||
threshold.setDate(threshold.getDate() - 1);
|
||||
return nodes
|
||||
.filter(node => new Date(node.updated_at) >= threshold)
|
||||
.filter(node => node.long_name?.toLowerCase().includes(lowerQuery)) || [];
|
||||
}
|
||||
|
||||
function showSuggestions(matches) {
|
||||
@@ -178,4 +172,4 @@ async function portnumDistributionChart(nodeId = null) {
|
||||
}
|
||||
}
|
||||
|
||||
fetchNodes().then(() => portnumDistributionChart());
|
||||
portnumDistributionChart();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
let nodes = [];
|
||||
let fetchPromise = null;
|
||||
|
||||
async function fetchNodes() {
|
||||
if (nodes.length > 0) return;
|
||||
|
||||
if (!fetchPromise) {
|
||||
fetchPromise = fetch('https://map.sthlm-mesh.se/api/v1/nodes/')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
nodes = data.nodes;
|
||||
fetchPromise = null; // reset after successful fetch
|
||||
})
|
||||
.catch(err => {
|
||||
fetchPromise = null; // reset on failure
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
await fetchPromise;
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://sthlm-mesh.se/docs/settings/</loc><lastmod>2025-02-26T18:39:36+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/device_role/</loc><lastmod>2025-02-26T18:42:15+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/position/</loc><lastmod>2025-02-22T09:11:26+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/mqtt/</loc><lastmod>2025-03-31T19:16:34+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/neighbor_info/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/kartor/</loc><lastmod>2025-03-08T20:11:28+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/solar_nodes/</loc><lastmod>2025-04-12T20:27:51+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/communities/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/categories/</loc></url><url><loc>https://sthlm-mesh.se/docs/</loc><lastmod>2025-03-03T22:48:04+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/messages/</loc><lastmod>2025-04-10T17:24:25+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-04-10T07:31:33+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/about/</loc><lastmod>2025-02-23T18:02:23+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/status/</loc><lastmod>2025-04-09T22:07:50+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-04-13T13:44:19+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/tags/</loc></url></urlset>
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://sthlm-mesh.se/docs/settings/</loc><lastmod>2025-02-26T18:39:36+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/device_role/</loc><lastmod>2025-02-26T18:42:15+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/position/</loc><lastmod>2025-02-22T09:11:26+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/mqtt/</loc><lastmod>2025-03-31T19:16:34+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/neighbor_info/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/kartor/</loc><lastmod>2025-03-08T20:11:28+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/solar_nodes/</loc><lastmod>2025-04-12T20:27:51+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/communities/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/categories/</loc></url><url><loc>https://sthlm-mesh.se/docs/</loc><lastmod>2025-03-03T22:48:04+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/messages/</loc><lastmod>2025-04-10T17:24:25+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-04-10T07:31:33+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/about/</loc><lastmod>2025-02-23T18:02:23+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/status/</loc><lastmod>2025-04-14T22:55:54+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-04-13T13:44:19+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/tags/</loc></url></urlset>
|
||||
+3
-2
@@ -6,11 +6,11 @@ Skapade paket per nod Grafen nedan visar vilka noder som har skickat flest paket
|
||||
– Senaste 7 dagarna
|
||||
– Senaste 30 dagarna
|
||||
Text Meddelanden Antalet meddelanden per timme senaste 7 dygnen. Grafen visar meddelanden som skickats på LongFast kanalen, men även okrypterade meddelanden mellan noder. De meddelanden som skickas går att se här.
|
||||
Skapade paket per nod Grafen nedan visar vilka noder som har skickat flest paket under det senaste dygnet. Graferna bygger på MQTT-data från ett begränsat antal noder."><meta property="og:type" content="article"><meta property="og:url" content="https://sthlm-mesh.se/status/"><meta property="article:section" content><meta property="article:modified_time" content="2025-04-09T22:07:50+02:00"><meta itemprop=name content="Mesh Status"><meta itemprop=description content="Antal Enheter – Hörts idag
|
||||
Skapade paket per nod Grafen nedan visar vilka noder som har skickat flest paket under det senaste dygnet. Graferna bygger på MQTT-data från ett begränsat antal noder."><meta property="og:type" content="article"><meta property="og:url" content="https://sthlm-mesh.se/status/"><meta property="article:section" content><meta property="article:modified_time" content="2025-04-14T22:55:54+02:00"><meta itemprop=name content="Mesh Status"><meta itemprop=description content="Antal Enheter – Hörts idag
|
||||
– Senaste 7 dagarna
|
||||
– Senaste 30 dagarna
|
||||
Text Meddelanden Antalet meddelanden per timme senaste 7 dygnen. Grafen visar meddelanden som skickats på LongFast kanalen, men även okrypterade meddelanden mellan noder. De meddelanden som skickas går att se här.
|
||||
Skapade paket per nod Grafen nedan visar vilka noder som har skickat flest paket under det senaste dygnet. Graferna bygger på MQTT-data från ett begränsat antal noder."><meta itemprop=dateModified content="2025-04-09T22:07:50+02:00"><meta itemprop=wordCount content="313"><meta itemprop=keywords content><meta name=twitter:card content="summary"><meta name=twitter:title content="Mesh Status"><meta name=twitter:description content="Antal Enheter – Hörts idag
|
||||
Skapade paket per nod Grafen nedan visar vilka noder som har skickat flest paket under det senaste dygnet. Graferna bygger på MQTT-data från ett begränsat antal noder."><meta itemprop=dateModified content="2025-04-14T22:55:54+02:00"><meta itemprop=wordCount content="313"><meta itemprop=keywords content><meta name=twitter:card content="summary"><meta name=twitter:title content="Mesh Status"><meta name=twitter:description content="Antal Enheter – Hörts idag
|
||||
– Senaste 7 dagarna
|
||||
– Senaste 30 dagarna
|
||||
Text Meddelanden Antalet meddelanden per timme senaste 7 dygnen. Grafen visar meddelanden som skickats på LongFast kanalen, men även okrypterade meddelanden mellan noder. De meddelanden som skickas går att se här.
|
||||
@@ -22,6 +22,7 @@ Eftersom vi har begränsad bandbredd är det viktigt att hålla nere trafiken. E
|
||||
Vi ser gärna att man använder en noggrannhet på ±182m eller noggrannare. Detta är dock inte möjligt att ställa in i iPhone Appen.
|
||||
För mer info se vår <a href=https://sthlm-mesh.se/docs/position/#position-precision>dokumentation</a>.</p><div id=positionPrecisionContainer style=min-height:200px;width:100%;max-width:1000px><canvas id=positionPrecisionChart></canvas></div><h2 id=packet-typer>Packet typer<a class=td-heading-self-link href=#packet-typer aria-label="Heading self-link"></a></h2><p>Fördelningen av olika pakettyper i nätverket under de senaste dygnet. Diagrammet visar hur nätverket används, inklusive meddelanden, positionstelemetri och andra systempaket. Sökrutan till höger kan användas för att visa antalet paket av respektive typ för en given nod.</p><div class="d-flex justify-content-end m-0 p-0" style=max-width:1000px><div class=dropdown style=width:40%;min-width:300px><div class="input-group pe-3"><input id=nodeSearch type=text class=form-control placeholder="Node Name" autocomplete=off>
|
||||
<button id=clearFilterBtn class="btn btn-outline-info" type=button>✕</button></div><ul id=suggestions class="dropdown-menu w-100" style=display:none;max-height:300px;overflow-y:auto;position:absolute;z-index:1000></ul></div></div><div id=portnumDistributionContainer style=min-height:150px;width:100%;max-width:1000px><canvas id=portnumDistribution></canvas></div><h2 id=hårdvarumodeller>Hårdvarumodeller<a class=td-heading-self-link href=#h%c3%a5rdvarumodeller aria-label="Heading self-link"></a></h2><p>Antalet enheter av respektive hårdvarutyp som synts i meshet de senaste 30 dagarna.</p><div id=hardwareChartContainer style=width:100%;max-width:1000px><canvas id=hardwareChart></canvas></div></div></div></section><div><a id=td-block-1 class=td-offset-anchor></a></div><section class="row td-box td-box--info td-box--height-auto"><div class=col><div class=container><h2 id=om>OM<a class=td-heading-self-link href=#om aria-label="Heading self-link"></a></h2><p>Graferna baseras på data från <a href=https://map.sthlm-mesh.se>map.sthlm-mesh.se</a>, där data samlas in från ett par noder i Stockholmsområdet. Data hämtas från API’t, som vi dessutom har utökat med fler funktioner för att möjliggöra mer analys. Visualisering sker genom biblioteket <a href=https://www.chartjs.org/>chartjs.org</a>.</p></div></div></section><script src=https://cdn.jsdelivr.net/npm/chart.js></script>
|
||||
<script src=/js/status/shared.js></script>
|
||||
<script src=/js/status/messagesChart.js></script>
|
||||
<script src=/js/status/most-active-nodes.js></script>
|
||||
<script src=/js/status/hardwareChart.js></script>
|
||||
|
||||
Reference in New Issue
Block a user