mirror of
https://github.com/meshtastic/web.git
synced 2025-12-24 00:00:01 -05:00
Remove deprecated meshtastic/js dependency (#638)
* Remove deprecated meshtastic/js dependency * Bump dependency version * Fix linting --------- Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
@@ -36,10 +36,9 @@
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.2.5",
|
||||
"@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.2",
|
||||
"@meshtastic/js": "npm:@jsr/meshtastic__js@2.6.0-0",
|
||||
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http",
|
||||
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth",
|
||||
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial",
|
||||
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http@0.2.1",
|
||||
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2",
|
||||
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial@0.2.1",
|
||||
"@noble/curves": "^1.9.0",
|
||||
"@radix-ui/react-accordion": "^1.2.8",
|
||||
"@radix-ui/react-checkbox": "^1.2.3",
|
||||
|
||||
@@ -34,7 +34,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
|
||||
it("renders the dialog when open is true", () => {
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const dialog = screen.getByRole("dialog");
|
||||
@@ -52,7 +52,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
|
||||
it("displays the correct links", () => {
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const docLink = screen.getByRole("link", {
|
||||
@@ -74,7 +74,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
|
||||
it("does not allow confirmation until checkbox is checked", () => {
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const confirmButton = screen.getByRole("button", { name: /confirm/i });
|
||||
@@ -90,7 +90,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
it("emits the correct event when closing via close button", () => {
|
||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const dismissButton = screen.getByRole("button", { name: /close/i });
|
||||
@@ -104,7 +104,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
it("emits the correct event when dismissing", () => {
|
||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const dismissButton = screen.getByRole("button", { name: /dismiss/i });
|
||||
@@ -118,7 +118,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
||||
it("emits the correct event when confirming", () => {
|
||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||
renderWithProviders(
|
||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
||||
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||
);
|
||||
|
||||
const checkbox = screen.getByRole("checkbox");
|
||||
|
||||
@@ -5,9 +5,10 @@ import { useAppStore } from "@core/stores/appStore.ts";
|
||||
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
||||
import { subscribeAll } from "@core/subscriptions.ts";
|
||||
import { randId } from "@core/utils/randId.ts";
|
||||
import { BleConnection, ServiceUuid } from "@meshtastic/js";
|
||||
import { TransportWebBluetooth } from "@meshtastic/transport-web-bluetooth";
|
||||
import { MeshDevice } from "@meshtastic/core";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useMessageStore } from "../../../core/stores/messageStore/index.ts";
|
||||
import { useMessageStore } from "@core/stores/messageStore/index.ts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export const BLE = (
|
||||
@@ -30,15 +31,13 @@ export const BLE = (
|
||||
|
||||
const onConnect = async (bleDevice: BluetoothDevice) => {
|
||||
const id = randId();
|
||||
const transport = await TransportWebBluetooth.createFromDevice(bleDevice);
|
||||
const device = addDevice(id);
|
||||
const connection = new MeshDevice(transport, id);
|
||||
connection.configure();
|
||||
setSelectedDevice(id);
|
||||
const connection = new BleConnection(id);
|
||||
await connection.connect({
|
||||
device: bleDevice,
|
||||
});
|
||||
device.addConnection(connection);
|
||||
subscribeAll(device, connection, messageStore);
|
||||
|
||||
closeDialog();
|
||||
};
|
||||
|
||||
@@ -71,7 +70,7 @@ export const BLE = (
|
||||
onClick={async () => {
|
||||
await navigator.bluetooth
|
||||
.requestDevice({
|
||||
filters: [{ services: [ServiceUuid] }],
|
||||
filters: [{ services: [TransportWebBluetooth.ServiceUuid] }],
|
||||
})
|
||||
.then((device) => {
|
||||
const exists = bleDevices.findIndex((d) => d.id === device.id);
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
MessageState,
|
||||
useMessageStore,
|
||||
} from "@core/stores/messageStore/index.ts";
|
||||
import { Protobuf, Types } from "@meshtastic/js";
|
||||
import { Protobuf, Types } from "@meshtastic/core";
|
||||
import { Message } from "@core/stores/messageStore/types.ts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
// import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import type { Types } from "@meshtastic/js";
|
||||
import {
|
||||
Message,
|
||||
MessageState,
|
||||
MessageType,
|
||||
} from "../stores/messageStore/index.ts";
|
||||
|
||||
import type { Types } from "@meshtastic/core";
|
||||
import { MessageState, MessageType } from "@core/stores/messageStore/index.ts";
|
||||
import { Message } from "@core/stores/messageStore/types.ts";
|
||||
class PacketToMessageDTO {
|
||||
channel: Types.ChannelNumber;
|
||||
to: number;
|
||||
|
||||
@@ -140,7 +140,7 @@ export const MessagesPage = () => {
|
||||
} else {
|
||||
console.warn("sendText completed but messageId is undefined");
|
||||
}
|
||||
} catch (e: any) {
|
||||
} catch (e: unknown) {
|
||||
console.error("Failed to send message:", e);
|
||||
const failedId = messageId ?? randId();
|
||||
if (chatType === MessageType.Broadcast) {
|
||||
|
||||
Reference in New Issue
Block a user