From 35fed173af9911e510e821fa96de6873ba7e6325 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 5 Mar 2025 08:14:59 -0500 Subject: [PATCH] fix: update TLS setting if URL is using HTTPS --- src/components/PageComponents/Connect/HTTP.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index 10a97890..263bff70 100644 --- a/src/components/PageComponents/Connect/HTTP.tsx +++ b/src/components/PageComponents/Connect/HTTP.tsx @@ -11,7 +11,6 @@ import { MeshDevice } from "@meshtastic/core"; import { TransportHTTP } from "@meshtastic/transport-http"; import { useState } from "react"; import { useForm, useController } from "react-hook-form"; -import { FieldWrapper } from "@components/Form/FormWrapper.tsx"; interface FormData { ip: string; @@ -19,8 +18,11 @@ interface FormData { } export const HTTP = ({ closeDialog }: TabElementProps) => { + const isURLHTTPS = location.protocol === "https:"; + const { addDevice } = useDeviceStore(); const { setSelectedDevice } = useAppStore(); + const { control, handleSubmit, register } = useForm({ defaultValues: { ip: ["client.meshtastic.org", "localhost"].includes( @@ -28,7 +30,7 @@ export const HTTP = ({ closeDialog }: TabElementProps) => { ) ? "meshtastic.local" : globalThis.location.host, - tls: false, + tls: isURLHTTPS ? true : false, }, }); @@ -39,8 +41,6 @@ export const HTTP = ({ closeDialog }: TabElementProps) => { const [connectionInProgress, setConnectionInProgress] = useState(false); const onSubmit = handleSubmit(async (data) => { - console.log(data); - setConnectionInProgress(true); const id = randId(); const device = addDevice(id); @@ -69,8 +69,8 @@ export const HTTP = ({ closeDialog }: TabElementProps) => {