From 256886f2e80c529a012ba5fa9b0b792af6c5c7fb Mon Sep 17 00:00:00 2001 From: ajvpot <553597+ajvpot@users.noreply.github.com> Date: Tue, 9 Sep 2025 04:01:19 +0200 Subject: [PATCH] Node info page improvements, search, neighbors --- package-lock.json | 283 ++++++++++- package.json | 3 + public/favicon.svg | 28 ++ src/app/api-docs/page.tsx | 97 +++- .../node/[publicKey]/neighbors/route.ts | 55 +++ .../api/meshcore/node/[publicKey]/route.ts | 33 +- src/app/api/meshcore/search/route.ts | 82 ++++ src/app/favicon.ico | Bin 25931 -> 0 bytes src/app/layout.tsx | 15 +- src/app/meshcore/node/[publicKey]/page.tsx | 454 +++++++++++++----- src/app/search/page.tsx | 164 +++++++ src/app/stats/page.tsx | 39 ++ src/components/AdvertDetails.tsx | 168 +++++++ src/components/ChatMessageItem.tsx | 262 +--------- src/components/ConfigContext.tsx | 2 +- src/components/ContactQRCode.tsx | 47 ++ src/components/Header.tsx | 14 +- src/components/MapView.tsx | 170 ++++++- src/components/PathDisplay.tsx | 29 ++ src/components/PathVisualization.tsx | 284 +++++++++++ src/components/QueryProvider.tsx | 23 + src/components/SearchInput.tsx | 84 ++++ src/components/SearchResults.tsx | 160 ++++++ src/hooks/useMeshcoreSearch.ts | 79 +++ src/hooks/useNeighbors.ts | 46 ++ src/hooks/useSearchQuery.ts | 124 +++++ src/lib/clickhouse/actions.ts | 322 +++++++++++-- 27 files changed, 2629 insertions(+), 438 deletions(-) create mode 100644 public/favicon.svg create mode 100644 src/app/api/meshcore/node/[publicKey]/neighbors/route.ts create mode 100644 src/app/api/meshcore/search/route.ts delete mode 100644 src/app/favicon.ico create mode 100644 src/app/search/page.tsx create mode 100644 src/components/AdvertDetails.tsx create mode 100644 src/components/ContactQRCode.tsx create mode 100644 src/components/PathDisplay.tsx create mode 100644 src/components/PathVisualization.tsx create mode 100644 src/components/QueryProvider.tsx create mode 100644 src/components/SearchInput.tsx create mode 100644 src/components/SearchResults.tsx create mode 100644 src/hooks/useMeshcoreSearch.ts create mode 100644 src/hooks/useNeighbors.ts create mode 100644 src/hooks/useSearchQuery.ts diff --git a/package-lock.json b/package-lock.json index a250afe..c88bf5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,9 @@ "@clickhouse/client": "^1.11.2", "@headlessui/react": "^2.2.4", "@heroicons/react": "^2.2.0", + "@tanstack/react-query": "^5.87.1", "@types/leaflet": "^1.9.19", + "@types/qrcode": "^1.5.5", "aes-js": "^3.1.2", "class-variance-authority": "^0.7.1", "clickhouse": "^2.6.0", @@ -22,6 +24,7 @@ "moment": "^2.30.1", "next": "15.3.4", "next-themes": "^0.4.6", + "qrcode": "^1.5.4", "react": "^19.0.0", "react-d3-tree": "^3.6.6", "react-dom": "^19.1.0", @@ -1415,6 +1418,30 @@ "tailwindcss": "4.1.11" } }, + "node_modules/@tanstack/query-core": { + "version": "5.87.1", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.87.1.tgz", + "integrity": "sha512-HOFHVvhOCprrWvtccSzc7+RNqpnLlZ5R6lTmngb8aq7b4rc2/jDT0w+vLdQ4lD9bNtQ+/A4GsFXy030Gk4ollA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.87.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.87.1.tgz", + "integrity": "sha512-YKauf8jfMowgAqcxj96AHs+Ux3m3bWT1oSVKamaRPXSnW2HqSznnTCEkAVqctF1e/W9R/mPcyzzINIgpOH94qg==", + "dependencies": { + "@tanstack/query-core": "5.87.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, "node_modules/@tanstack/react-virtual": { "version": "3.13.12", "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.13.12.tgz", @@ -1496,11 +1523,18 @@ "version": "20.19.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.4.tgz", "integrity": "sha512-OP+We5WV8Xnbuvw0zC2m4qfB/BJvjyCwtNjhHdJxV1639SGSKrLmJkc3fMnp2Qy8nJyHp8RO6umxELN/dS1/EA==", - "dev": true, "dependencies": { "undici-types": "~6.21.0" } }, + "node_modules/@types/qrcode": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.5.tgz", + "integrity": "sha512-CdfBi/e3Qk+3Z/fXYShipBT13OJ2fDO2Q2w5CIP5anLTLIndQG9z6P1cnm+8zCWSpm5dnxMFd/uREtb0EXuQzg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/react": { "version": "19.1.8", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", @@ -2082,11 +2116,18 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -2449,6 +2490,14 @@ "node": ">=6" } }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001726", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001726.tgz", @@ -2534,6 +2583,16 @@ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, "node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2567,7 +2626,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "devOptional": true, "dependencies": { "color-name": "~1.1.4" }, @@ -2578,8 +2636,7 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "devOptional": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/color-string": { "version": "1.9.1", @@ -2832,6 +2889,14 @@ } } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -2897,6 +2962,11 @@ "node": ">=8" } }, + "node_modules/dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" + }, "node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -3743,6 +3813,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -4217,6 +4295,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-generator-function": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", @@ -5362,6 +5448,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5378,7 +5472,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, "engines": { "node": ">=8" } @@ -5420,6 +5513,14 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/possible-typed-array-names": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", @@ -5495,6 +5596,22 @@ "node": ">=6" } }, + "node_modules/qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "dependencies": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/qs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", @@ -5675,6 +5792,19 @@ "node": ">= 4" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "node_modules/resolve": { "version": "1.22.10", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", @@ -5839,6 +5969,11 @@ "node": ">=10" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -6092,6 +6227,24 @@ "node": ">=10.0.0" } }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "node_modules/string.prototype.includes": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz", @@ -6199,6 +6352,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -6567,8 +6731,7 @@ "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "dev": true + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" }, "node_modules/unrs-resolver": { "version": "1.10.1", @@ -6729,6 +6892,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" + }, "node_modules/which-typed-array": { "version": "1.1.19", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", @@ -6759,6 +6927,24 @@ "node": ">=0.10.0" } }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, "node_modules/yallist": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", @@ -6768,6 +6954,87 @@ "node": ">=18" } }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 762391e..8f31ce3 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "@clickhouse/client": "^1.11.2", "@headlessui/react": "^2.2.4", "@heroicons/react": "^2.2.0", + "@tanstack/react-query": "^5.87.1", "@types/leaflet": "^1.9.19", + "@types/qrcode": "^1.5.5", "aes-js": "^3.1.2", "class-variance-authority": "^0.7.1", "clickhouse": "^2.6.0", @@ -23,6 +25,7 @@ "moment": "^2.30.1", "next": "15.3.4", "next-themes": "^0.4.6", + "qrcode": "^1.5.4", "react": "^19.0.0", "react-d3-tree": "^3.6.6", "react-dom": "^19.1.0", diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..47ed759 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,28 @@ + diff --git a/src/app/api-docs/page.tsx b/src/app/api-docs/page.tsx index eb7b850..a57b82e 100644 --- a/src/app/api-docs/page.tsx +++ b/src/app/api-docs/page.tsx @@ -209,7 +209,7 @@ export default function ApiDocsPage() {
Retrieve detailed information about a specific meshcore node including recent adverts and location history.
+Retrieve detailed information about a specific meshcore node including recent adverts, location history, and MQTT uplink status.
public_key - The node's public key identifiernode_name - Display name of the nodelatitude/longitude - Current position coordinateshas_location - Whether the node has location data (0/1)is_repeater - Whether the node acts as a repeater (0/1)is_chat_node - Whether the node supports chat (0/1)is_room_server - Whether the node is a room server (0/1)has_name - Whether the node has a name (0/1)last_seen - Most recent activity timestampfirst_seen - First time this node was observedadv_timestamp - Advertisement timestamporigin_path_pubkey_tuples - Array of [origin, path, pubkey] tuplesadvert_count - Number of adverts in this groupearliest_timestamp/latest_timestamp - Time range for this advert grouplatitude/longitude - Position at time of advertis_repeater/is_chat_node/is_room_server/has_location - Node capabilities at time of advertmesh_timestamp - When this location was recordedlatitude/longitude - Location coordinateshas_packets - Whether any MQTT packets have been receivedis_uplinked - Whether node has been active in last 7 daystopics - Array of MQTT topic informationtopic - MQTT topic name (e.g., "meshcore", "meshcore/pdx")broker - MQTT broker URLlast_packet_time - Most recent packet timestamp for this topicis_recent - Whether this topic has been active in last 7 days (0/1)
@@ -269,13 +326,18 @@ export default function ApiDocsPage() {
"is_chat_node": 1,
"is_room_server": 0,
"has_name": 1,
- "last_seen": "2025-09-07T00:59:18"
+ "last_seen": "2025-09-07T00:59:18",
+ "first_seen": "2025-09-01T10:00:00"
},
"recentAdverts": [
{
- "mesh_timestamp": "2025-09-07T00:59:18",
- "path": "7ffb7e",
- "path_len": 3,
+ "adv_timestamp": "2025-09-07T00:59:18",
+ "origin_path_pubkey_tuples": [
+ ["origin_node", "7ffb7e", "origin_pubkey_hex"]
+ ],
+ "advert_count": 1,
+ "earliest_timestamp": "2025-09-07T00:59:18",
+ "latest_timestamp": "2025-09-07T00:59:18",
"latitude": 47.54969,
"longitude": -122.28085999999999,
"is_repeater": 1,
@@ -288,11 +350,27 @@ export default function ApiDocsPage() {
{
"mesh_timestamp": "2025-09-07T00:59:18",
"latitude": 47.54969,
- "longitude": -122.28085999999999,
- "path": "7ffb7e",
- "path_len": 3
+ "longitude": -122.28085999999999
}
- ]
+ ],
+ "mqtt": {
+ "is_uplinked": true,
+ "has_packets": true,
+ "topics": [
+ {
+ "topic": "meshcore",
+ "broker": "tcp://mqtt.davekeogh.com:1883",
+ "last_packet_time": "2025-09-07T00:59:18",
+ "is_recent": 1
+ },
+ {
+ "topic": "meshcore/pdx",
+ "broker": "tcp://mqtt.davekeogh.com:1883",
+ "last_packet_time": "2025-09-06T15:30:45",
+ "is_recent": 1
+ }
+ ]
+ }
}`}
This will return detailed information about the specified meshcore node including recent adverts, location history, and MQTT uplink status.
diff --git a/src/app/api/meshcore/node/[publicKey]/neighbors/route.ts b/src/app/api/meshcore/node/[publicKey]/neighbors/route.ts new file mode 100644 index 0000000..b1afa34 --- /dev/null +++ b/src/app/api/meshcore/node/[publicKey]/neighbors/route.ts @@ -0,0 +1,55 @@ +import { NextResponse } from "next/server"; +import { getMeshcoreNodeNeighbors } from "@/lib/clickhouse/actions"; + +export async function GET( + req: Request, + { params }: { params: Promise<{ publicKey: string }> } +) { + try { + const { publicKey } = await params; + const { searchParams } = new URL(req.url); + const lastSeen = searchParams.get("lastSeen"); + + if (!publicKey) { + return NextResponse.json({ + error: "Public key is required", + code: "MISSING_PUBLIC_KEY" + }, { status: 400 }); + } + + // Validate public key format (basic validation) + if (publicKey.length < 10) { + return NextResponse.json({ + error: "Invalid public key format", + code: "INVALID_PUBLIC_KEY" + }, { status: 400 }); + } + + const neighbors = await getMeshcoreNodeNeighbors(publicKey, lastSeen); + + // Check if the parent node exists by trying to get basic node info + // This is a lightweight check to ensure the node exists before returning neighbors + if (!neighbors || neighbors.length === 0) { + // We could add a check here to verify the parent node exists + // For now, we'll return an empty array which is valid for nodes with no neighbors + return NextResponse.json([]); + } + + return NextResponse.json(neighbors); + } catch (error) { + console.error("Error fetching meshcore node neighbors:", error); + + // Check if it's a ClickHouse connection error + if (error instanceof Error && error.message.includes('ClickHouse')) { + return NextResponse.json({ + error: "Database temporarily unavailable", + code: "DATABASE_ERROR" + }, { status: 503 }); + } + + return NextResponse.json({ + error: "Failed to fetch neighbors", + code: "INTERNAL_ERROR" + }, { status: 500 }); + } +} diff --git a/src/app/api/meshcore/node/[publicKey]/route.ts b/src/app/api/meshcore/node/[publicKey]/route.ts index 8146f1e..4904478 100644 --- a/src/app/api/meshcore/node/[publicKey]/route.ts +++ b/src/app/api/meshcore/node/[publicKey]/route.ts @@ -11,18 +11,45 @@ export async function GET( const limit = parseInt(searchParams.get("limit") || "50", 10); if (!publicKey) { - return NextResponse.json({ error: "Public key is required" }, { status: 400 }); + return NextResponse.json({ + error: "Public key is required", + code: "MISSING_PUBLIC_KEY" + }, { status: 400 }); + } + + // Validate public key format (basic validation) + if (publicKey.length < 10) { + return NextResponse.json({ + error: "Invalid public key format", + code: "INVALID_PUBLIC_KEY" + }, { status: 400 }); } const nodeInfo = await getMeshcoreNodeInfo(publicKey, limit); if (!nodeInfo) { - return NextResponse.json({ error: "Node not found" }, { status: 404 }); + return NextResponse.json({ + error: "Node not found", + code: "NODE_NOT_FOUND", + publicKey: publicKey + }, { status: 404 }); } return NextResponse.json(nodeInfo); } catch (error) { console.error("Error fetching meshcore node info:", error); - return NextResponse.json({ error: "Failed to fetch node info" }, { status: 500 }); + + // Check if it's a ClickHouse connection error + if (error instanceof Error && error.message.includes('ClickHouse')) { + return NextResponse.json({ + error: "Database temporarily unavailable", + code: "DATABASE_ERROR" + }, { status: 503 }); + } + + return NextResponse.json({ + error: "Failed to fetch node info", + code: "INTERNAL_ERROR" + }, { status: 500 }); } } diff --git a/src/app/api/meshcore/search/route.ts b/src/app/api/meshcore/search/route.ts new file mode 100644 index 0000000..b07841d --- /dev/null +++ b/src/app/api/meshcore/search/route.ts @@ -0,0 +1,82 @@ +import { NextResponse } from "next/server"; +import { searchMeshcoreNodes } from "@/lib/clickhouse/actions"; + +export async function GET(req: Request) { + try { + const { searchParams } = new URL(req.url); + const query = searchParams.get("q"); + const region = searchParams.get("region"); + const lastSeen = searchParams.get("lastSeen"); + const limit = parseInt(searchParams.get("limit") || "50", 10); + + // Validate limit + if (limit < 1 || limit > 200) { + return NextResponse.json({ + error: "Limit must be between 1 and 200", + code: "INVALID_LIMIT" + }, { status: 400 }); + } + + // If no query provided, return empty results + if (!query || query.trim().length === 0) { + return NextResponse.json({ + results: [], + total: 0, + query: query || "", + region: region || null + }); + } + + // Validate query length + if (query.length > 100) { + return NextResponse.json({ + error: "Query too long (max 100 characters)", + code: "QUERY_TOO_LONG" + }, { status: 400 }); + } + + // Validate lastSeen parameter + let lastSeenValue: string | null = null; + if (lastSeen !== null) { + const lastSeenNum = parseInt(lastSeen, 10); + if (isNaN(lastSeenNum) || lastSeenNum < 0) { + return NextResponse.json({ + error: "lastSeen must be a positive number (seconds)", + code: "INVALID_LAST_SEEN" + }, { status: 400 }); + } + lastSeenValue = lastSeen; + } + + const results = await searchMeshcoreNodes({ + query: query.trim(), + region: region || undefined, + lastSeen: lastSeenValue, + limit + }); + + return NextResponse.json({ + results, + total: results.length, + query: query.trim(), + region: region || null, + lastSeen: lastSeenValue, + limit + }); + } catch (error) { + console.error("Error searching meshcore nodes:", error); + + // Check if it's a ClickHouse connection error + if (error instanceof Error && error.message.includes('ClickHouse')) { + return NextResponse.json({ + error: "Database temporarily unavailable", + code: "DATABASE_ERROR" + }, { status: 503 }); + } + + return NextResponse.json({ + error: "Failed to search nodes", + code: "INTERNAL_ERROR" + }, { status: 500 }); + } +} diff --git a/src/app/favicon.ico b/src/app/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXdAMQaiH zm^r3v#$Q#2T=X>bsY#D%s!bhs^M9PMAcHbCc0FMHV{u-dwlL;a1eJ63v5U*?Q_8JO zT#50!RD619#j_Uf))0ooADz~*9&lN!bBDRUgE>Vud-i5ck%vT=r^yD*^?Mp@Q^v+V zG#-?gKlr}Eeqifb{|So?HM&g91P8|av8hQoCmQXkd?7wIJw b z_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W!in#C zI@}sc Zlr3-NFJ@NFaJlhyfcw{k^vvtGl`N9xSo**rDW4S}i zM9{fMPWo%4wYDG~BZ18BD+}h|GQKc-g^{++3MY>}W_uq7jGHx{mwE9fZiPCoxN$+7 zrODGGJrOkcPQUB(FD5aoS4g~7#6NR^ma7-!>mHuJfY5kTe6PpNNKC9GGRiu^L31uG z$7v`*JknQHsYB!Tm_W{a32TM099djW%5e+j0Ve_ct}IM>XLF1Ap+YvcrLV=|CKo6S zb+ 9Nl3_YdKP6%Cxy@6TxZ>;4&nTneadr z_ES90ydCev)LV!dN=#(*f}|ZORFdvkYBni^aLbUk>BajeWIOcmHP#8S)*2U~QKI%S zyrLmtPqb&TphJ;>yAxri#;{uyk`JJqODDw%(Z=2 `1uc}br^V%>j!gS)D*q*f_-qf8&D;W1dJgQMlaH5er zN2U<%Smb7==vE}dDI8K7cKz!vs^73o9f>2sgiTzWcwY|BMYHH5%Vn7#kiw&eItCqa zIkR2~Q}>X=Ar8W|^Ms41Fm8o6IB2_j60eOeBB1Br!boW7JnoeX6Gs)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M =hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S( O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d0a6443..a7d6006 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; import Header from "../components/Header"; import { ConfigProvider } from "../components/ConfigContext"; +import { QueryProvider } from "../components/QueryProvider"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -17,6 +18,10 @@ const geistMono = Geist_Mono({ export const metadata: Metadata = { title: "MeshExplorer", description: "A real-time map, chat client, and packet analysis tool for mesh networks using MeshCore and Meshtastic.", + icons: { + icon: { url: "/favicon.svg", type: "image/svg+xml" }, + apple: { url: "/favicon.svg", type: "image/svg+xml" } + }, }; export const viewport: Viewport = { @@ -38,10 +43,12 @@ export default function RootLayout({ style={{ '--header-height': '64px' } as React.CSSProperties} > -- +- {children} -+ + ++ {children} +