diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index 30e70169..50bdfdcc 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) }} + disabled={connectionInProgress} {...rest} />