From 2dc8d21c320949d0b5c8fcd77d41b5a8b228452d Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Tue, 28 Nov 2023 14:03:15 +0000 Subject: [PATCH] update --- .../src/components/InputSupplier.jsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/taxonium_website/src/components/InputSupplier.jsx b/taxonium_website/src/components/InputSupplier.jsx index cd951791..0bad97f0 100644 --- a/taxonium_website/src/components/InputSupplier.jsx +++ b/taxonium_website/src/components/InputSupplier.jsx @@ -30,17 +30,25 @@ export const InputSupplier = ({ inputHelper, className }) => { }); const [tempURL, setTempURL] = useState(""); + const [useProxy, setUseProxy] = useState(true); // New state for proxy usage + const { inputs, setInputs } = inputHelper; const [addingText, setAddingText] = useState(false); const [text, setText] = useState(""); + const addFromTempURL = useCallback(() => { - if (tempURL) { - inputHelper.addFromURL(tempURL); + let finalURL = tempURL; + if (useProxy) { + finalURL = `https://proxy.taxonium.org/proxy?url=${encodeURIComponent(tempURL)}`; + } + if (finalURL) { + inputHelper.addFromURL(finalURL); setTempURL(""); } - }, [tempURL, inputHelper]); + }, [tempURL, useProxy, inputHelper]); // Include useProxy in the dependency array + return (
@@ -196,6 +204,17 @@ export const InputSupplier = ({ inputHelper, className }) => { } }} />{" "} + { + tempURL !== "" && <> + setUseProxy(e.target.checked)} + />{" "} + Use Proxy + +} +