mirror of
https://github.com/dpup/meshstream.git
synced 2026-03-28 17:42:37 +01:00
Render admin packets differently
This commit is contained in:
41
web/src/components/packets/AdminMessagePacket.tsx
Normal file
41
web/src/components/packets/AdminMessagePacket.tsx
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Packet } from "../../lib/types";
|
||||||
|
import { Shield } from "lucide-react";
|
||||||
|
import { PacketCard } from "./PacketCard";
|
||||||
|
|
||||||
|
interface AdminMessagePacketProps {
|
||||||
|
packet: Packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AdminMessagePacket: React.FC<AdminMessagePacketProps> = ({ packet }) => {
|
||||||
|
return (
|
||||||
|
<PacketCard
|
||||||
|
packet={packet}
|
||||||
|
icon={<Shield />}
|
||||||
|
iconBgColor="bg-orange-500"
|
||||||
|
label="Admin Message"
|
||||||
|
>
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<div className="text-gray-300 text-sm flex items-center gap-2">
|
||||||
|
<Shield className="w-4 h-4 text-orange-400" />
|
||||||
|
<span>This message was an encrypted remote administration command</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-xs text-gray-400 bg-gray-800/50 p-3 rounded border border-gray-700/30">
|
||||||
|
Remote administration commands are encrypted using PKI and can only be decrypted by the authorized target device.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{packet.data.binaryData && (
|
||||||
|
<details className="mt-2">
|
||||||
|
<summary className="text-xs text-gray-500 cursor-pointer hover:text-gray-400 transition-colors">
|
||||||
|
Show encrypted data
|
||||||
|
</summary>
|
||||||
|
<div className="mt-2 font-mono text-neutral-300 text-xs bg-neutral-800/80 p-3 rounded-md overflow-auto tracking-wide leading-relaxed border border-neutral-700/40">
|
||||||
|
{packet.data.binaryData}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</PacketCard>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -10,6 +10,7 @@ import { MapReportPacket } from "./MapReportPacket";
|
|||||||
import { TraceroutePacket } from "./TraceroutePacket";
|
import { TraceroutePacket } from "./TraceroutePacket";
|
||||||
import { NeighborInfoPacket } from "./NeighborInfoPacket";
|
import { NeighborInfoPacket } from "./NeighborInfoPacket";
|
||||||
import { PrivateMessagePacket } from "./PrivateMessagePacket";
|
import { PrivateMessagePacket } from "./PrivateMessagePacket";
|
||||||
|
import { AdminMessagePacket } from "./AdminMessagePacket";
|
||||||
import { GenericPacket } from "./GenericPacket";
|
import { GenericPacket } from "./GenericPacket";
|
||||||
|
|
||||||
interface PacketRendererProps {
|
interface PacketRendererProps {
|
||||||
@@ -22,6 +23,10 @@ export const PacketRenderer: React.FC<PacketRendererProps> = ({ packet }) => {
|
|||||||
// If there's a decode error, check the error type
|
// If there's a decode error, check the error type
|
||||||
if (data.decodeError) {
|
if (data.decodeError) {
|
||||||
if (data.decodeError.startsWith('PRIVATE_CHANNEL:')) {
|
if (data.decodeError.startsWith('PRIVATE_CHANNEL:')) {
|
||||||
|
// Check if this is a PKI admin message
|
||||||
|
if (packet.info.channel === 'PKI' || packet.info.channel === 'pki') {
|
||||||
|
return <AdminMessagePacket packet={packet} />;
|
||||||
|
}
|
||||||
return <PrivateMessagePacket packet={packet} />;
|
return <PrivateMessagePacket packet={packet} />;
|
||||||
}
|
}
|
||||||
return <ErrorPacket packet={packet} />;
|
return <ErrorPacket packet={packet} />;
|
||||||
|
|||||||
Reference in New Issue
Block a user