mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-17 13:30:00 -04:00
Reset button for HTTP proxy
This commit is contained in:
parent
2c22a6afc6
commit
fbff40d7f8
1 changed files with 25 additions and 9 deletions
|
@ -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;
|
||||||
|
|
||||||
|
@ -56,10 +64,10 @@ function ProxyInput(props: BareInputProps) {
|
||||||
response.headers.get("x-bare-status") === "302"
|
response.headers.get("x-bare-status") === "302"
|
||||||
) {
|
) {
|
||||||
// Success!
|
// Success!
|
||||||
set("HTTPProxy", proxyUrl);
|
set("HTTPProxy", proxyUrl);
|
||||||
localStorage.setItem("HTTPProxy", proxyUrl);
|
localStorage.setItem("HTTPProxy", proxyUrl);
|
||||||
uninstallServiceWorkers();
|
uninstallServiceWorkers();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
|
@ -110,11 +118,19 @@ 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
|
<div class="flex flex-row gap-4">
|
||||||
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"
|
<div
|
||||||
onClick={handleChange}
|
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}
|
||||||
{t("settings.bare.select")}
|
>
|
||||||
|
{t("settings.bare.select")}
|
||||||
|
</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>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue