Moved prop. from Device to Security & Hide PKI Eye
This commit is contained in:
@@ -36,19 +36,6 @@ export const Device = (): JSX.Element => {
|
|||||||
formatEnumName: true,
|
formatEnumName: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "toggle",
|
|
||||||
name: "serialEnabled",
|
|
||||||
label: "Serial Output Enabled",
|
|
||||||
description: "Enable the device's serial console",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "toggle",
|
|
||||||
name: "debugLogEnabled",
|
|
||||||
label: "Enabled Debug Log",
|
|
||||||
description:
|
|
||||||
"Output debugging information to the device's serial port (auto disables when serial client is connected)",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "number",
|
type: "number",
|
||||||
name: "buttonGpio",
|
name: "buttonGpio",
|
||||||
@@ -86,12 +73,6 @@ export const Device = (): JSX.Element => {
|
|||||||
label: "Double Tap as Button Press",
|
label: "Double Tap as Button Press",
|
||||||
description: "Treat double tap as button press",
|
description: "Treat double tap as button press",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "toggle",
|
|
||||||
name: "isManaged",
|
|
||||||
label: "Managed",
|
|
||||||
description: "Is this device managed by a mesh administator",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "disableTripleClick",
|
name: "disableTripleClick",
|
||||||
|
|||||||
@@ -3,20 +3,23 @@ import type { SecurityValidation } from "@app/validation/config/security.js";
|
|||||||
import { useDevice } from "@core/stores/deviceStore.js";
|
import { useDevice } from "@core/stores/deviceStore.js";
|
||||||
import { Protobuf } from "@meshtastic/js";
|
import { Protobuf } from "@meshtastic/js";
|
||||||
import { fromByteArray, toByteArray } from "base64-js";
|
import { fromByteArray, toByteArray } from "base64-js";
|
||||||
|
import { Eye, EyeOff } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export const Security = (): JSX.Element => {
|
export const Security = (): JSX.Element => {
|
||||||
const { config, nodes, hardware, setWorkingConfig } = useDevice();
|
const { config, nodes, hardware, setWorkingConfig } = useDevice();
|
||||||
|
|
||||||
const [adminKey, setAdminKey] = useState<string>(
|
|
||||||
fromByteArray(config.security?.adminKey ?? new Uint8Array(0)),
|
|
||||||
);
|
|
||||||
const [privateKey, setPrivateKey] = useState<string>(
|
const [privateKey, setPrivateKey] = useState<string>(
|
||||||
fromByteArray(config.security?.privateKey ?? new Uint8Array(0)),
|
fromByteArray(config.security?.privateKey ?? new Uint8Array(0)),
|
||||||
);
|
);
|
||||||
|
const [privateKeyVisible, setPrivateKeyVisible] = useState<boolean>(false);
|
||||||
const [publicKey, setPublicKey] = useState<string>(
|
const [publicKey, setPublicKey] = useState<string>(
|
||||||
fromByteArray(config.security?.publicKey ?? new Uint8Array(0)),
|
fromByteArray(config.security?.publicKey ?? new Uint8Array(0)),
|
||||||
);
|
);
|
||||||
|
const [adminKey, setAdminKey] = useState<string>(
|
||||||
|
fromByteArray(config.security?.adminKey ?? new Uint8Array(0)),
|
||||||
|
);
|
||||||
|
const [adminKeyVisible, setAdminKeyVisible] = useState<boolean>(false);
|
||||||
|
|
||||||
const onSubmit = (data: SecurityValidation) => {
|
const onSubmit = (data: SecurityValidation) => {
|
||||||
setWorkingConfig(
|
setWorkingConfig(
|
||||||
@@ -48,10 +51,22 @@ export const Security = (): JSX.Element => {
|
|||||||
description: "Settings for the Security configuration",
|
description: "Settings for the Security configuration",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: privateKeyVisible ? "text" : "password",
|
||||||
name: "privateKey",
|
name: "privateKey",
|
||||||
label: "Private Key",
|
label: "Private Key",
|
||||||
description: "Used to create a shared key with a remote device",
|
description: "Used to create a shared key with a remote device",
|
||||||
|
disabledBy: [
|
||||||
|
{
|
||||||
|
fieldName: "adminChannelEnabled",
|
||||||
|
invert: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
properties: {
|
||||||
|
action: {
|
||||||
|
icon: privateKeyVisible ? EyeOff : Eye,
|
||||||
|
onClick: () => setPrivateKeyVisible(!privateKeyVisible),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
@@ -70,21 +85,28 @@ export const Security = (): JSX.Element => {
|
|||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "adminChannelEnabled",
|
name: "adminChannelEnabled",
|
||||||
label: "Admin Channel",
|
label: "Allow Legacy Admin",
|
||||||
description:
|
description:
|
||||||
"Allow incoming device control over the insecure legacy admin channel",
|
"Allow incoming device control over the insecure legacy admin channel",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "isManaged",
|
name: "isManaged",
|
||||||
label: "Is Managed",
|
label: "Managed",
|
||||||
description:
|
description:
|
||||||
'If true, device is considered to be "managed" by a mesh administrator via admin messages',
|
'If true, device is considered to be "managed" by a mesh administrator via admin messages',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "text",
|
type: adminKeyVisible ? "text" : "password",
|
||||||
name: "adminKey",
|
name: "adminKey",
|
||||||
label: "Admin Key",
|
label: "Admin Key",
|
||||||
|
disabledBy: [{ fieldName: "adminChannelEnabled" }],
|
||||||
|
properties: {
|
||||||
|
action: {
|
||||||
|
icon: adminKeyVisible ? EyeOff : Eye,
|
||||||
|
onClick: () => setAdminKeyVisible(!adminKeyVisible),
|
||||||
|
},
|
||||||
|
},
|
||||||
description:
|
description:
|
||||||
"The public key authorized to send admin messages to this node",
|
"The public key authorized to send admin messages to this node",
|
||||||
},
|
},
|
||||||
@@ -97,19 +119,19 @@ export const Security = (): JSX.Element => {
|
|||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "bluetoothLoggingEnabled",
|
name: "bluetoothLoggingEnabled",
|
||||||
label: "Bluetooth Logging",
|
label: "Allow Bluetooth Logging",
|
||||||
description: "Enables device (serial style logs) over Bluetooth",
|
description: "Enables device (serial style logs) over Bluetooth",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "debugLogApiEnabled",
|
name: "debugLogApiEnabled",
|
||||||
label: "Debug Log API",
|
label: "Enable Debug Log API",
|
||||||
description: "Output live debug logging over serial",
|
description: "Output live debug logging over serial",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "serialEnabled",
|
name: "serialEnabled",
|
||||||
label: "Serial",
|
label: "Serial Output Enabled",
|
||||||
description: "Serial Console over the Stream API",
|
description: "Serial Console over the Stream API",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user