From c4565d97b08b4e20e8055adad62ea30ce4132fec Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Fri, 21 Jun 2024 15:06:19 -0400 Subject: [PATCH 1/2] add ability to enable/disable HTTPS connections --- .../PageComponents/Connect/HTTP.tsx | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index 30e70169..e5179bc1 100644 --- a/src/components/PageComponents/Connect/HTTP.tsx +++ b/src/components/PageComponents/Connect/HTTP.tsx @@ -24,17 +24,13 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { ) ? "meshtastic.local" : window.location.hostname, - tls: location.protocol === "https:", + tls: false, }, }); - const tlsEnabled = useWatch({ - control, - name: "tls", - defaultValue: location.protocol === "https:", - }); const [connectionInProgress, setConnectionInProgress] = useState(false); + const [https, setHTTPS] = useState(false); const onSubmit = handleSubmit(async (data) => { setConnectionInProgress(true); @@ -46,7 +42,7 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { await connection.connect({ address: data.ip, fetchInterval: 2000, - tls: data.tls, + tls: https, }); setSelectedDevice(id); @@ -60,8 +56,7 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => {
{ control={control} render={({ field: { value, ...rest } }) => ( <> - + {checked ? setHTTPS(true) : setHTTPS(false) }} {...rest} /> From d8261a649bbdd10d7c676353a8ddbbec78c9256d Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Fri, 21 Jun 2024 15:09:29 -0400 Subject: [PATCH 2/2] add disabled --- src/components/PageComponents/Connect/HTTP.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index e5179bc1..50bdfdcc 100644 --- a/src/components/PageComponents/Connect/HTTP.tsx +++ b/src/components/PageComponents/Connect/HTTP.tsx @@ -69,6 +69,7 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { {checked ? setHTTPS(true) : setHTTPS(false) }} + disabled={connectionInProgress} {...rest} />