forked from iarv/meshtastic-map
Compare commits
2 Commits
master
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a69db9290 | ||
|
|
3cccf80d07 |
15
package-lock.json
generated
15
package-lock.json
generated
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@prisma/client": "^6.16.2",
|
||||
"command-line-args": "^6.0.1",
|
||||
"command-line-usage": "^7.0.3",
|
||||
"command-line-usage": "^7.0.4",
|
||||
"compression": "^1.8.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.2.1",
|
||||
@@ -69,7 +69,6 @@
|
||||
"integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.2.0",
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
@@ -2010,7 +2009,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001737",
|
||||
"electron-to-chromium": "^1.5.211",
|
||||
@@ -2395,15 +2393,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/command-line-usage": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.3.tgz",
|
||||
"integrity": "sha512-PqMLy5+YGwhMh1wS04mVG44oqDsgyLRSKJBdOo1bnYhMKBW65gZF1dRp2OZRhiTjgUHljy99qkO7bsctLaw35Q==",
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.4.tgz",
|
||||
"integrity": "sha512-85UdvzTNx/+s5CkSgBm/0hzP80RFHAa7PsfeADE5ezZF3uHz3/Tqj9gIKGT9PTtpycc3Ua64T0oVulGfKxzfqg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"array-back": "^6.2.2",
|
||||
"chalk-template": "^0.4.0",
|
||||
"table-layout": "^4.1.0",
|
||||
"typical": "^7.1.1"
|
||||
"table-layout": "^4.1.1",
|
||||
"typical": "^7.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
@@ -5150,7 +5148,6 @@
|
||||
"devOptional": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@prisma/config": "6.16.2",
|
||||
"@prisma/engines": "6.16.2"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@prisma/client": "^6.16.2",
|
||||
"command-line-args": "^6.0.1",
|
||||
"command-line-usage": "^7.0.3",
|
||||
"command-line-usage": "^7.0.4",
|
||||
"compression": "^1.8.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.2.1",
|
||||
|
||||
16
src/index.js
16
src/index.js
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user