Compare commits

...

3 Commits

3 changed files with 23 additions and 7 deletions

View File

@@ -58,7 +58,7 @@ services:
interval: 15s
timeout: 5s
retries: 6
start_interval: 5s
start_period: 5s
volumes:
database_data:

View File

@@ -547,10 +547,22 @@ app.get('/api/v1/nodes/:nodeId/traceroutes', async (req, res) => {
return;
}
// get latest traceroutes
// get latest traceroutes, deduplicated by packet_id
// We want replies where want_response is false and it will be "to" the
// requester.
const traceroutes = await prisma.$queryRaw`SELECT * FROM traceroutes WHERE want_response = false and \`to\` = ${node.node_id} and gateway_id is not null order by id desc limit ${count}`;
// Deduplicate by packet_id, keeping the latest traceroute (highest id) for each packet_id
const traceroutes = await prisma.$queryRaw`
SELECT t1.*
FROM traceroutes t1
INNER JOIN (
SELECT packet_id, MAX(id) as max_id
FROM traceroutes
WHERE want_response = false and \`to\` = ${node.node_id} and gateway_id is not null
GROUP BY packet_id
) t2 ON t1.packet_id = t2.packet_id AND t1.id = t2.max_id
ORDER BY t1.id DESC
LIMIT ${count}
`;
res.json({
traceroutes: traceroutes.map((trace) => {

View File

@@ -3224,7 +3224,7 @@
}
function getTerrainProfileImage(node1, node2) {
function getTerrainProfileImage(url,node1, node2) {
// line colour between nodes
const lineColour = "0000FF"; // blue
@@ -3242,7 +3242,7 @@
const node2ElevationMSL = node2.altitude ?? "";
// generate terrain profile image url
return "https://heywhatsthat.com/bin/profile-0904.cgi?" + new URLSearchParams({
return url + new URLSearchParams({
src: "meshtastic.liamcottle.net",
axes: 1, // include grid lines and a scale
metric: 1, // show metric units
@@ -3706,9 +3706,13 @@
}
// Add terrain profile image
const terrainImageUrl = getTerrainProfileImage(nodeA, nodeB);
tooltip += `<br/><br/>Terrain images from <a href="http://www.heywhatsthat.com" target="_blank">HeyWhatsThat.com</a>`;
const terrainImageUrl = getTerrainProfileImage("https://heywhatsthat.com/bin/profile-0904.cgi?", nodeA, nodeB);
tooltip += `<br/><br/>Terrain image from <a href="http://www.heywhatsthat.com" target="_blank">HeyWhatsThat.com</a>`;
tooltip += `<br/><a href="${terrainImageUrl}" target="_blank"><img src="${terrainImageUrl}" width="100%"></a>`;
const terrainImageUrl2 = getTerrainProfileImage("https://tjenavadärdetdär.se/?", nodeA, nodeB);
tooltip += `<br/>Terrain image from <a href="https://tjenavadärdetdär.se" target="_blank">TjenaVadÄrDetDär.se</a>`;
tooltip += `<br/><a href="${terrainImageUrl2}" target="_blank"><img src="${terrainImageUrl2}" width="100%"></a>`;
return tooltip;
}