Reset button for HTTP proxy

This commit is contained in:
rift 2024-01-15 10:30:21 -06:00
parent 2c22a6afc6
commit fbff40d7f8

View file

@ -14,6 +14,14 @@ function ProxyInput(props: BareInputProps) {
const bareServer = localStorage.getItem("bare") || "/bare/"; const bareServer = localStorage.getItem("bare") || "/bare/";
const HTTPProxy = localStorage.getItem("HTTPProxy") || ""; const HTTPProxy = localStorage.getItem("HTTPProxy") || "";
const [inputValue, setInputValue] = useState(HTTPProxy); const [inputValue, setInputValue] = useState(HTTPProxy);
function resetProxy() {
set("HTTPProxy", "");
localStorage.setItem("HTTPProxy", "");
uninstallServiceWorkers();
window.location.reload();
}
function validateUrl(url: string) { function validateUrl(url: string) {
let finalUrl = url; let finalUrl = url;
@ -110,12 +118,20 @@ function ProxyInput(props: BareInputProps) {
id="pinput" id="pinput"
className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-sm" className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-sm"
/> />
<div class="flex flex-row gap-4">
<div <div
className="font-roboto mt-2 flex h-4 w-36 cursor-pointer flex-row items-center justify-center rounded-xl border border-input-border-color bg-input p-5 text-center text-lg" className="font-roboto mt-2 flex h-4 w-36 cursor-pointer flex-row items-center justify-center rounded-xl border border-input-border-color bg-input p-5 text-center text-lg"
onClick={handleChange} onClick={handleChange}
> >
{t("settings.bare.select")} {t("settings.bare.select")}
</div> </div>
<div
className="font-roboto mt-2 flex h-4 w-36 cursor-pointer flex-row items-center justify-center rounded-xl border border-input-border-color bg-input p-5 text-center text-lg"
onClick={resetProxy}
>
Reset
</div>
</div>
</div> </div>
</div> </div>
); );