Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the Proxy Disclaimer Cancel Button Issue #211

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ document.addEventListener("DOMContentLoaded", function () {
function showProxyDisclaimer() {
const message = "All proxy features are off by default.\n\nIf you enable search suggestions and CORS bypass proxy, it is strongly recommended to host your own proxy for enhanced privacy.\n\nBy default, the proxy will be set to https://mynt-proxy.rhythmcorehq.com, meaning all your data will go through this service, which may pose privacy concerns.";

confirm(message);
return confirm(message);
}

/* ------ Event Listeners ------ */
Expand Down Expand Up @@ -2047,12 +2047,21 @@ document.addEventListener("DOMContentLoaded", function () {
updatedigiClock();
});
useproxyCheckbox.addEventListener("change", function () {
saveCheckboxState("useproxyCheckboxState", useproxyCheckbox);
if (useproxyCheckbox.checked) {
showProxyDisclaimer();
proxyinputField.classList.remove("inactive");
saveActiveStatus("proxyinputField", "active");
// Show the disclaimer and check the user's choice
const userConfirmed = showProxyDisclaimer();
if (userConfirmed) {
// Only enable the proxy if the user confirmed
saveCheckboxState("useproxyCheckboxState", useproxyCheckbox);
proxyinputField.classList.remove("inactive");
saveActiveStatus("proxyinputField", "active");
} else {
// Revert the checkbox state if the user did not confirm
useproxyCheckbox.checked = false;
}
} else {
// If the checkbox is unchecked, disable the proxy
saveCheckboxState("useproxyCheckboxState", useproxyCheckbox);
proxyinputField.classList.add("inactive");
saveActiveStatus("proxyinputField", "inactive");
}
Expand Down