diff --git a/src/core/subscriptions.ts b/src/core/subscriptions.ts
index 8f1c1a09..4b09a854 100644
--- a/src/core/subscriptions.ts
+++ b/src/core/subscriptions.ts
@@ -1,9 +1,9 @@
import type { Device } from "@core/stores/deviceStore.ts";
-import { Protobuf, type Types } from "@meshtastic/core";
+import { MeshDevice, Protobuf } from "@meshtastic/core";
export const subscribeAll = (
device: Device,
- connection: Types.ConnectionType,
+ connection: MeshDevice,
) => {
let myNodeNum = 0;
@@ -70,6 +70,8 @@ export const subscribeAll = (
});
connection.events.onChannelPacket.subscribe((channel) => {
+ console.log('channel', channel);
+
device.addChannel(channel);
});
connection.events.onConfigPacket.subscribe((config) => {
@@ -80,6 +82,9 @@ export const subscribeAll = (
});
connection.events.onMessagePacket.subscribe((messagePacket) => {
+
+ console.log('messagePacket', messagePacket);
+
device.addMessage({
...messagePacket,
state: messagePacket.from !== myNodeNum ? "ack" : "waiting",
@@ -103,4 +108,11 @@ export const subscribeAll = (
time: meshPacket.rxTime,
});
});
+
+ connection.events.onQueueStatus.subscribe((queueStatus) => {
+ device.setQueueStatus(queueStatus);
+ if (queueStatus.free < 10) {
+ // start queueing messages
+ }
+ });
};
diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx
index 5fcaec55..a664b9ad 100644
--- a/src/pages/Messages.tsx
+++ b/src/pages/Messages.tsx
@@ -127,9 +127,7 @@ export const MessagesPage = () => {
@@ -140,7 +138,8 @@ export const MessagesPage = () => {
+ messages={messages.direct.get(node.num)}
+ />
)}
diff --git a/src/pages/Nodes.tsx b/src/pages/Nodes.tsx
index 9f96b987..0a786e3d 100644
--- a/src/pages/Nodes.tsx
+++ b/src/pages/Nodes.tsx
@@ -11,7 +11,7 @@ import { useDevice } from "@core/stores/deviceStore.ts";
import { Protobuf, type Types } from "@meshtastic/core";
import { numberToHexUnpadded } from "@noble/curves/abstract/utils";
import { LockIcon, LockOpenIcon } from "lucide-react";
-import { Fragment, type JSX, useCallback, useEffect, useState } from "react";
+import { type JSX, useCallback, useEffect, useState } from "react";
import { base16 } from "rfc4648";
export interface DeleteNoteDialogProps {
@@ -21,6 +21,8 @@ export interface DeleteNoteDialogProps {
const NodesPage = (): JSX.Element => {
const { nodes, hardware, connection } = useDevice();
+ console.log(connection);
+
const [selectedNode, setSelectedNode] = useState<
Protobuf.Mesh.NodeInfo | undefined
>(undefined);
@@ -61,6 +63,7 @@ const NodesPage = (): JSX.Element => {
};
}, [connection]);
+
const handleLocation = useCallback(
(location: Types.PacketMetadata) => {
if (location.to.valueOf() !== hardware.myNodeNum) return;
@@ -108,8 +111,8 @@ const NodesPage = (): JSX.Element => {
{node.user?.shortName ??
(node.user?.macaddr
? `${base16
- .stringify(node.user?.macaddr.subarray(4, 6) ?? [])
- .toLowerCase()}`
+ .stringify(node.user?.macaddr.subarray(4, 6) ?? [])
+ .toLowerCase()}`
: `${numberToHexUnpadded(node.num).slice(-4)}`)}
,
@@ -121,8 +124,8 @@ const NodesPage = (): JSX.Element => {
{node.user?.longName ??
(node.user?.macaddr
? `Meshtastic ${base16
- .stringify(node.user?.macaddr.subarray(4, 6) ?? [])
- .toLowerCase()}`
+ .stringify(node.user?.macaddr.subarray(4, 6) ?? [])
+ .toLowerCase()}`
: `!${numberToHexUnpadded(node.num)}`)}
,
@@ -158,9 +161,8 @@ const NodesPage = (): JSX.Element => {
{node.lastHeard !== 0
? node.viaMqtt === false && node.hopsAway === 0
? "Direct"
- : `${node.hopsAway?.toString()} ${
- node.hopsAway > 1 ? "hops" : "hop"
- } away`
+ : `${node.hopsAway?.toString()} ${node.hopsAway > 1 ? "hops" : "hop"
+ } away`
: "-"}
{node.viaMqtt === true ? ", via MQTT" : ""}
,
diff --git a/vite.config.ts b/vite.config.ts
index c2b9c95a..bce6f2b4 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,6 +2,7 @@ import { defineConfig } from "vite";
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import { execSync } from 'node:child_process';
+import path from "node:path";
let hash = '';
try {
@@ -29,6 +30,16 @@ export default defineConfig({
define: {
'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(hash),
},
+ resolve: {
+ alias: {
+ // Using Node's path and process.cwd() instead of Deno.cwd()
+ '@app': path.resolve(process.cwd(), './src'),
+ '@pages': path.resolve(process.cwd(), './src/pages'),
+ '@components': path.resolve(process.cwd(), './src/components'),
+ '@core': path.resolve(process.cwd(), './src/core'),
+ '@layouts': path.resolve(process.cwd(), './src/layouts'),
+ },
+ },
server: {
port: 3000
},