This commit is contained in:
ajvpot
2025-07-23 00:00:00 +00:00
parent 329602c053
commit 5719f67493
4 changed files with 41 additions and 26 deletions

View File

@@ -5,12 +5,12 @@ export async function GET() {
try {
const query = `
WITH days AS (
SELECT arrayJoin(range(0, 30)) AS offset, toDate(subtractDays(today(), 29 - offset)) AS day
SELECT arrayJoin(range(0, 7)) AS offset, toDate(subtractDays(today(), 6 - offset)) AS day
),
all_nodes AS (
SELECT toDate(ingest_timestamp) AS day, public_key, latitude, longitude
FROM meshcore_adverts
WHERE ingest_timestamp >= subtractDays(today(), 30)
WHERE ingest_timestamp >= subtractDays(today(), 7)
),
node_days AS (
SELECT public_key, min(day) AS first_seen, any(latitude) AS latitude, any(longitude) AS longitude

View File

@@ -27,6 +27,14 @@ export default function StatsPage() {
return (
<div className="max-w-2xl mx-auto py-8 px-4">
<h1 className="text-2xl font-bold mb-6">MeshCore Network Stats</h1>
<div className="mb-6 p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg">
<p className="text-sm text-blue-800 dark:text-blue-200">
<strong>Note:</strong> The "Nodes Heard Over Time" data shows activity from the past 7 days.
This provides a focused view of recent network activity while maintaining good performance.
</p>
</div>
{loading ? (
<div>Loading...</div>
) : (

View File

@@ -108,17 +108,17 @@ export default function ChatBox({ showAllMessagesTab = false, className = "", st
<div className={`flex items-center justify-between ${startExpanded ? "px-4 py-2 border-b border-gray-200 dark:border-neutral-800" : ""}`} style={startExpanded ? {} : { minHeight: minimized ? '2rem' : '2rem' }}>
<span className="font-semibold text-gray-800 dark:text-gray-100">MeshCore Chat</span>
{!startExpanded && (
<button
className="p-1 rounded hover:bg-neutral-200 dark:hover:bg-neutral-800"
onClick={() => setMinimized((m) => !m)}
aria-label={minimized ? "Maximize MeshCore Chat" : "Minimize MeshCore Chat"}
>
{minimized ? (
<PlusIcon className="h-5 w-5" />
) : (
<MinusIcon className="h-5 w-5" />
)}
</button>
<button
className="p-1 rounded hover:bg-neutral-200 dark:hover:bg-neutral-800"
onClick={() => setMinimized((m) => !m)}
aria-label={minimized ? "Maximize MeshCore Chat" : "Minimize MeshCore Chat"}
>
{minimized ? (
<PlusIcon className="h-5 w-5" />
) : (
<MinusIcon className="h-5 w-5" />
)}
</button>
)}
</div>

View File

@@ -36,20 +36,27 @@ export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: {
useEffect(() => {
let cancelled = false;
(async () => {
const result = await decryptMeshcoreGroupMessage({
encrypted_message: msg.encrypted_message,
mac: msg.mac,
channel_hash: msg.channel_hash,
knownKeys,
parse: true,
});
if (!cancelled) {
if (result === null) {
try {
const result = await decryptMeshcoreGroupMessage({
encrypted_message: msg.encrypted_message,
mac: msg.mac,
channel_hash: msg.channel_hash,
knownKeys,
parse: true,
});
if (!cancelled) {
if (result === null) {
setParsed(null);
setError("Could not decrypt message with any known key.");
} else {
setParsed(result);
setError(null);
}
}
} catch (err) {
if (!cancelled) {
setParsed(null);
setError("Could not decrypt message with any known key.");
} else {
setParsed(result);
setError(null);
setError(err instanceof Error ? err.message : "Decryption error occurred.");
}
}
})();