Error & formating fixes
This commit is contained in:
@@ -66,7 +66,7 @@ export function DynamicForm<T extends FieldValues>({
|
|||||||
if (!disabledBy) return false;
|
if (!disabledBy) return false;
|
||||||
|
|
||||||
return disabledBy.some((field) => {
|
return disabledBy.some((field) => {
|
||||||
if (field.fieldName === "always") return true
|
if (field.fieldName === "always") return true;
|
||||||
const value = getValues(field.fieldName);
|
const value = getValues(field.fieldName);
|
||||||
if (value === "always") return true;
|
if (value === "always") return true;
|
||||||
if (typeof value === "boolean") return field.invert ? value : !value;
|
if (typeof value === "boolean") return field.invert ? value : !value;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { SecurityValidation } from "@app/validation/config/security.js"
|
|
||||||
import { DynamicForm } from "@app/components/Form/DynamicForm.js";
|
import { DynamicForm } from "@app/components/Form/DynamicForm.js";
|
||||||
|
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";
|
||||||
@@ -9,13 +9,13 @@ export const Security = (): JSX.Element => {
|
|||||||
const { config, nodes, hardware, setWorkingConfig } = useDevice();
|
const { config, nodes, hardware, setWorkingConfig } = useDevice();
|
||||||
|
|
||||||
const [adminKey, setAdminKey] = useState<string>(
|
const [adminKey, setAdminKey] = useState<string>(
|
||||||
fromByteArray(config.security?.adminKey ?? new Uint8Array(0))
|
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 [publicKey, setPublicKey] = useState<string>(
|
const [publicKey, setPublicKey] = useState<string>(
|
||||||
fromByteArray(config.security?.publicKey ?? new Uint8Array(0))
|
fromByteArray(config.security?.publicKey ?? new Uint8Array(0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onSubmit = (data: SecurityValidation) => {
|
const onSubmit = (data: SecurityValidation) => {
|
||||||
@@ -28,10 +28,10 @@ export const Security = (): JSX.Element => {
|
|||||||
adminKey: toByteArray(adminKey),
|
adminKey: toByteArray(adminKey),
|
||||||
privateKey: toByteArray(privateKey),
|
privateKey: toByteArray(privateKey),
|
||||||
publicKey: toByteArray(publicKey),
|
publicKey: toByteArray(publicKey),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
)
|
);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<DynamicForm<SecurityValidation>
|
<DynamicForm<SecurityValidation>
|
||||||
@@ -40,7 +40,7 @@ export const Security = (): JSX.Element => {
|
|||||||
...config.security,
|
...config.security,
|
||||||
adminKey: adminKey,
|
adminKey: adminKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
publicKey: publicKey
|
publicKey: publicKey,
|
||||||
}}
|
}}
|
||||||
fieldGroups={[
|
fieldGroups={[
|
||||||
{
|
{
|
||||||
@@ -57,8 +57,9 @@ export const Security = (): JSX.Element => {
|
|||||||
type: "text",
|
type: "text",
|
||||||
name: "publicKey",
|
name: "publicKey",
|
||||||
label: "Public Key",
|
label: "Public Key",
|
||||||
description: "Sent out to other nodes on the mesh to allow them to compute a shared secret key",
|
description:
|
||||||
disabledBy: [ { fieldName: "always" } ]
|
"Sent out to other nodes on the mesh to allow them to compute a shared secret key",
|
||||||
|
disabledBy: [{ fieldName: "always" }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -70,20 +71,23 @@ export const Security = (): JSX.Element => {
|
|||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "adminChannelEnabled",
|
name: "adminChannelEnabled",
|
||||||
label: "Admin Channel",
|
label: "Admin Channel",
|
||||||
description: "Allow incoming device control over the insecure legacy admin channel",
|
description:
|
||||||
|
"Allow incoming device control over the insecure legacy admin channel",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "isManaged",
|
name: "isManaged",
|
||||||
label: "Is Managed",
|
label: "Is Managed",
|
||||||
description: 'If true, device is considered to be "managed" by a mesh administrator via admin messages',
|
description:
|
||||||
|
'If true, device is considered to be "managed" by a mesh administrator via admin messages',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
name: "adminKey",
|
name: "adminKey",
|
||||||
label: "Admin Key",
|
label: "Admin Key",
|
||||||
description: "The public key authorized to send admin messages to this node",
|
description:
|
||||||
}
|
"The public key authorized to send admin messages to this node",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -106,11 +110,11 @@ export const Security = (): JSX.Element => {
|
|||||||
type: "toggle",
|
type: "toggle",
|
||||||
name: "serialEnabled",
|
name: "serialEnabled",
|
||||||
label: "Serial",
|
label: "Serial",
|
||||||
description: "Serial Console over the Stream API"
|
description: "Serial Console over the Stream API",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export const Sidebar = ({ children }: SidebarProps): JSX.Element => {
|
|||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<ZapIcon size={24} viewBox={"0 0 36 24"} />
|
<ZapIcon size={24} viewBox={"0 0 36 24"} />
|
||||||
<Subtle>
|
<Subtle>
|
||||||
{myNode?.deviceMetrics?.voltage.toPrecision(3) ?? "UNK"} volts
|
{myNode?.deviceMetrics?.voltage?.toPrecision(3) ?? "UNK"} volts
|
||||||
</Subtle>
|
</Subtle>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
|
|||||||
+4
-4
@@ -144,8 +144,8 @@ export const MapPage = (): JSX.Element => {
|
|||||||
{waypoints.map((wp) => (
|
{waypoints.map((wp) => (
|
||||||
<Marker
|
<Marker
|
||||||
key={wp.id}
|
key={wp.id}
|
||||||
longitude={wp.longitudeI / 1e7}
|
longitude={(wp.longitudeI ?? 0) / 1e7}
|
||||||
latitude={wp.latitudeI / 1e7}
|
latitude={(wp.latitudeI ?? 0) / 1e7}
|
||||||
anchor="bottom"
|
anchor="bottom"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
@@ -163,8 +163,8 @@ export const MapPage = (): JSX.Element => {
|
|||||||
return (
|
return (
|
||||||
<Marker
|
<Marker
|
||||||
key={node.num}
|
key={node.num}
|
||||||
longitude={node.position.longitudeI / 1e7}
|
longitude={(node.position.longitudeI ?? 0) / 1e7}
|
||||||
latitude={node.position.latitudeI / 1e7}
|
latitude={(node.position.latitudeI ?? 0) / 1e7}
|
||||||
style={{ filter: darkMode ? "invert(1)" : "" }}
|
style={{ filter: darkMode ? "invert(1)" : "" }}
|
||||||
anchor="bottom"
|
anchor="bottom"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import { Protobuf } from "@meshtastic/js";
|
|||||||
import { IsBoolean, IsEnum, IsInt } from "class-validator";
|
import { IsBoolean, IsEnum, IsInt } from "class-validator";
|
||||||
|
|
||||||
export class BluetoothValidation
|
export class BluetoothValidation
|
||||||
implements Omit<Protobuf.Config.Config_BluetoothConfig, keyof Message>
|
implements
|
||||||
|
Omit<
|
||||||
|
Protobuf.Config.Config_BluetoothConfig,
|
||||||
|
keyof Message | "deviceLoggingEnabled"
|
||||||
|
>
|
||||||
{
|
{
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { Protobuf } from "@meshtastic/js";
|
|||||||
import { IsArray, IsBoolean, IsEnum, IsInt, Max, Min } from "class-validator";
|
import { IsArray, IsBoolean, IsEnum, IsInt, Max, Min } from "class-validator";
|
||||||
|
|
||||||
export class LoRaValidation
|
export class LoRaValidation
|
||||||
implements Omit<Protobuf.Config.Config_LoRaConfig, keyof Message>
|
implements
|
||||||
|
Omit<Protobuf.Config.Config_LoRaConfig, keyof Message | "paFanDisabled">
|
||||||
{
|
{
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
usePreset: boolean;
|
usePreset: boolean;
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import type { Protobuf } from "@meshtastic/js";
|
|||||||
import { IsBoolean, IsInt, IsNumber, Max, Min } from "class-validator";
|
import { IsBoolean, IsInt, IsNumber, Max, Min } from "class-validator";
|
||||||
|
|
||||||
export class PowerValidation
|
export class PowerValidation
|
||||||
implements Omit<Protobuf.Config.Config_PowerConfig, keyof Message>
|
implements
|
||||||
|
Omit<Protobuf.Config.Config_PowerConfig, keyof Message | "powermonEnables">
|
||||||
{
|
{
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
isPowerSaving: boolean;
|
isPowerSaving: boolean;
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import type { Protobuf } from "@meshtastic/js";
|
|||||||
import { IsBoolean, IsString } from "class-validator";
|
import { IsBoolean, IsString } from "class-validator";
|
||||||
|
|
||||||
export class SecurityValidation
|
export class SecurityValidation
|
||||||
implements Omit<Protobuf.Config.Config_SecurityConfig, keyof Message | "adminKey" | "privateKey" | "publicKey">
|
implements
|
||||||
|
Omit<
|
||||||
|
Protobuf.Config.Config_SecurityConfig,
|
||||||
|
keyof Message | "adminKey" | "privateKey" | "publicKey"
|
||||||
|
>
|
||||||
{
|
{
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
adminChannelEnabled: boolean;
|
adminChannelEnabled: boolean;
|
||||||
@@ -28,4 +32,4 @@ export class SecurityValidation
|
|||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
serialEnabled: boolean;
|
serialEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import { IsBoolean, IsInt } from "class-validator";
|
|||||||
|
|
||||||
export class StoreForwardValidation
|
export class StoreForwardValidation
|
||||||
implements
|
implements
|
||||||
Omit<Protobuf.ModuleConfig.ModuleConfig_StoreForwardConfig, keyof Message>
|
Omit<
|
||||||
|
Protobuf.ModuleConfig.ModuleConfig_StoreForwardConfig,
|
||||||
|
keyof Message | "isServer"
|
||||||
|
>
|
||||||
{
|
{
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user