Added /api/ prefix to CAPTCHA API URL.
This commit is contained in:
parent
c1b056e22b
commit
7026ee68c1
@ -10,10 +10,10 @@ function getColorScheme() {
|
||||
}
|
||||
|
||||
async function getNewCaptcha() {
|
||||
const id = await fetch("/captcha/").then(r => r.text());
|
||||
const id = await fetch("/api/captcha/", { method: "POST"}).then(r => r.text());
|
||||
g_current_captcha_id = id;
|
||||
captcha_hidden_field.value = id;
|
||||
setTimeout(() => { captcha_img.src = `/captcha/${id}/image?style=${getColorScheme()}` }, 600);
|
||||
setTimeout(() => { captcha_img.src = `/api/captcha/${id}/image?style=${getColorScheme()}` }, 600);
|
||||
g_captcha_timeout_remain = g_captcha_timeout_seconds;
|
||||
}
|
||||
|
||||
@ -33,13 +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}?remove`); }, 3000);
|
||||
await fetch(`/api/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}?remove`));
|
||||
window.addEventListener("unload", () => fetch(`/api/captcha/${g_current_captcha_id}?remove`));
|
||||
|
||||
setInterval(async () => {
|
||||
captcha_remain.innerText = --g_captcha_timeout_remain;
|
||||
|
Loading…
Reference in New Issue
Block a user