Fix protobufs, add configOkToMqtt, add PKI icons

This commit is contained in:
Hunter Thornsberry
2024-09-09 16:22:48 -04:00
parent 78a35544c7
commit 2af93f1acd
8 changed files with 41 additions and 21 deletions

View File

@@ -21,7 +21,7 @@
},
"homepage": "https://meshtastic.org",
"dependencies": {
"@bufbuild/protobuf": "^2.0.0",
"@bufbuild/protobuf": "^1.10.0",
"@emeraldpay/hashicon-react": "^0.5.2",
"@meshtastic/js": "2.3.7-1",
"@radix-ui/react-accordion": "^1.2.0",
@@ -63,7 +63,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.2",
"@buf/meshtastic_protobufs.bufbuild_es": "2.0.0-20240906232734-3da561588c55.2",
"@buf/meshtastic_protobufs.bufbuild_es": "1.10.0-20240906232734-3da561588c55.1",
"@types/chrome": "^0.0.263",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",

24
pnpm-lock.yaml generated
View File

@@ -9,8 +9,8 @@ importers:
.:
dependencies:
'@bufbuild/protobuf':
specifier: ^2.0.0
version: 2.0.0
specifier: ^1.10.0
version: 1.10.0
'@emeraldpay/hashicon-react':
specifier: ^0.5.2
version: 0.5.2
@@ -130,8 +130,8 @@ importers:
specifier: ^1.8.2
version: 1.8.2
'@buf/meshtastic_protobufs.bufbuild_es':
specifier: 2.0.0-20240906232734-3da561588c55.2
version: 2.0.0-20240906232734-3da561588c55.2(@bufbuild/protobuf@2.0.0)
specifier: 1.10.0-20240906232734-3da561588c55.1
version: 1.10.0-20240906232734-3da561588c55.1(@bufbuild/protobuf@1.10.0)
'@types/chrome':
specifier: ^0.0.263
version: 0.0.263
@@ -354,13 +354,13 @@ packages:
cpu: [x64]
os: [win32]
'@buf/meshtastic_protobufs.bufbuild_es@2.0.0-20240906232734-3da561588c55.2':
resolution: {tarball: https://buf.build/gen/npm/v1/@buf/meshtastic_protobufs.bufbuild_es/-/meshtastic_protobufs.bufbuild_es-2.0.0-20240906232734-3da561588c55.2.tgz}
'@buf/meshtastic_protobufs.bufbuild_es@1.10.0-20240906232734-3da561588c55.1':
resolution: {tarball: https://buf.build/gen/npm/v1/@buf/meshtastic_protobufs.bufbuild_es/-/meshtastic_protobufs.bufbuild_es-1.10.0-20240906232734-3da561588c55.1.tgz}
peerDependencies:
'@bufbuild/protobuf': ^2.0.0
'@bufbuild/protobuf': ^1.10.0
'@bufbuild/protobuf@2.0.0':
resolution: {integrity: sha512-sw2JhwJyvyL0zlhG61aDzOVryEfJg2PDZFSV7i7IdC7nAE41WuXCru3QWLGiP87At0BMzKOoKO/FqEGoKygGZQ==}
'@bufbuild/protobuf@1.10.0':
resolution: {integrity: sha512-QDdVFLoN93Zjg36NoQPZfsVH9tZew7wKDKyV5qRdj8ntT4wQCOradQjRaTdwMhWUYsgKsvCINKKm87FdEk96Ag==}
'@emeraldpay/hashicon-react@0.5.2':
resolution: {integrity: sha512-XCoYKpq8QQOniiSZf5ouzdvXbKfG6q4ICHRqCO/GNofiF0Ra+LR/7+tomHlXVcLPBS9sDAoZQQw/Sr24KRAbJg==}
@@ -3340,11 +3340,11 @@ snapshots:
'@biomejs/cli-win32-x64@1.8.2':
optional: true
'@buf/meshtastic_protobufs.bufbuild_es@2.0.0-20240906232734-3da561588c55.2(@bufbuild/protobuf@2.0.0)':
'@buf/meshtastic_protobufs.bufbuild_es@1.10.0-20240906232734-3da561588c55.1(@bufbuild/protobuf@1.10.0)':
dependencies:
'@bufbuild/protobuf': 2.0.0
'@bufbuild/protobuf': 1.10.0
'@bufbuild/protobuf@2.0.0': {}
'@bufbuild/protobuf@1.10.0': {}
'@emeraldpay/hashicon-react@0.5.2':
dependencies:

View File

@@ -56,6 +56,13 @@ export const LoRa = (): JSX.Element => {
label: "Ignore MQTT",
description: "Don't forward MQTT messages over the mesh",
},
{
type: "toggle",
name: "configOkToMqtt",
label: "OK to MQTT",
description:
"When set to true, this configuration indicates that the user approves the packet to be uploaded to MQTT. If set to false, remote nodes are requested not to forward packets to MQTT",
},
],
},
{

View File

@@ -23,7 +23,7 @@ export const Security = (): JSX.Element => {
fromByteArray(config.security?.publicKey ?? new Uint8Array(0)),
);
const [adminKey, setAdminKey] = useState<string>(
fromByteArray(config.security?.adminKey ?? new Uint8Array(0)),
fromByteArray(config.security?.adminKey[0] ?? new Uint8Array(0)),
);
const [adminKeyVisible, setAdminKeyVisible] = useState<boolean>(false);
const [adminKeyBitCount, setAdminKeyBitCount] = useState<number>(
@@ -41,7 +41,7 @@ export const Security = (): JSX.Element => {
case: "security",
value: {
...data,
adminKey: toByteArray(adminKey),
adminKey: [toByteArray(adminKey)],
privateKey: toByteArray(privateKey),
publicKey: toByteArray(publicKey),
},

View File

@@ -40,7 +40,7 @@ export const PageLayout = ({
className="transition-all hover:text-accent"
onClick={action.onClick}
>
<action.icon className={action.iconClasses}/>
<action.icon className={action.iconClasses} />
</button>
))}
</div>

View File

@@ -80,13 +80,19 @@ export const MessagesPage = (): JSX.Element => {
chatType === "direct"
? [
{
icon: nodes.get(activeChat)?.user?.publicKey && nodes.get(activeChat)?.user?.publicKey.length > 0 ? LockIcon : LockOpenIcon,
iconClasses: nodes.get(activeChat)?.user?.publicKey && nodes.get(activeChat)?.user?.publicKey.length > 0 ? "text-green-600" : "text-yellow-300",
icon: nodes.get(activeChat)?.user?.publicKey.length
? LockIcon
: LockOpenIcon,
iconClasses: nodes.get(activeChat)?.user?.publicKey.length
? "text-green-600"
: "text-yellow-300",
async onClick() {
const targetNode = nodes.get(activeChat)?.num;
if (targetNode === undefined) return;
toast({
title: nodes.get(activeChat)?.user?.publicKey && nodes.get(activeChat)?.user?.publicKey.length > 0 ? "Chat is using PKI encryption." : "Chat is using PSK encryption.",
title: nodes.get(activeChat)?.user?.publicKey.length
? "Chat is using PKI encryption."
: "Chat is using PSK encryption.",
});
},
},

View File

@@ -75,7 +75,11 @@ export const NodesPage = (): JSX.Element => {
{(node.snr + 10) * 5}raw
</Mono>,
<Mono key="pki">
{ node.user?.publicKey && node.user?.publicKey.length > 0 ? <LockIcon className="text-green-600"/> : <LockOpenIcon className="text-yellow-300"/> }
{node.user?.publicKey && node.user?.publicKey.length > 0 ? (
<LockIcon className="text-green-600" />
) : (
<LockOpenIcon className="text-yellow-300" />
)}
</Mono>,
<Mono key="hops">
{node.lastHeard !== 0

View File

@@ -60,4 +60,7 @@ export class LoRaValidation
@IsBoolean()
ignoreMqtt: boolean;
@IsBoolean()
configOkToMqtt: boolean;
}