Added ?remove params to clean up fetches to not receive 403 error code.

This commit is contained in:
Alexander Andreev 2022-10-19 21:06:31 +04:00
parent 7c39ad7c3c
commit 3891945371
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -33,12 +33,13 @@ captcha_refresh.addEventListener("click", async e => {
captcha_refresh.disabled = true;
setTimeout(async () => {
captcha_refresh.disabled = false;
await fetch(`/captcha/${g_current_captcha_id}`); }, 3000);
await fetch(`/captcha/${g_current_captcha_id}?remove`); }, 3000);
document.getElementsByName("captcha_answer")[0].value = "";
await getNewCaptcha();
});
// Remove unused CAPTCHA on a server.
window.addEventListener("unload", () => fetch(`/captcha/${g_current_captcha_id}`));
window.addEventListener("unload", () => fetch(`/captcha/${g_current_captcha_id}?remove`));
setInterval(async () => {
captcha_remain.innerText = --g_captcha_timeout_remain;