add clear cookies button
This commit is contained in:
1 parent
000447b77c
commit
da571a645b
8 files changed
+76
No files matched your search
@@ -91,6 +91,19 @@ function bindSettingsEvents(): void {
|
||||
tm.saveUpstreamProxy();
|
||||
closeSettings();
|
||||
});
|
||||
document.querySelectorAll('.btn-clear-cookies').forEach((btn) => {
|
||||
btn.addEventListener('click', async () => {
|
||||
const platform = (btn as HTMLElement).dataset.platform!;
|
||||
const status = document.getElementById('clearCookiesStatus')!;
|
||||
status.textContent = `Clearing ${platform} cookies...`;
|
||||
try {
|
||||
const removed = await window.bridge.clearCookies(platform);
|
||||
status.textContent = `Cleared ${removed} ${platform} cookies. Log in again to use it.`;
|
||||
} catch {
|
||||
status.textContent = `Failed to clear ${platform} cookies.`;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function bindErrorPopup(): void {
|
||||
@@ -161,6 +174,7 @@ function openSettings(): void {
|
||||
(document.getElementById('upstreamSocks') as HTMLInputElement).value = tm.upstreamProxy.socks;
|
||||
(document.getElementById('upstreamUser') as HTMLInputElement).value = tm.upstreamProxy.user;
|
||||
(document.getElementById('upstreamPass') as HTMLInputElement).value = tm.upstreamProxy.pass;
|
||||
document.getElementById('clearCookiesStatus')!.textContent = '';
|
||||
}
|
||||
|
||||
function closeSettings(): void {
|
||||
|
||||
Reference in new issue
Block a user