aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvulonkaaz <7442677+vulonkaaz@users.noreply.github.com>2025-05-28 21:09:29 +0200
committervulonkaaz <7442677+vulonkaaz@users.noreply.github.com>2025-05-28 21:09:29 +0200
commit9a94241730fcfdc9ee315730c213e0d8add114c7 (patch)
tree0f9e548c9d40d4a80a0c659ba7b7260971556b58
parentc7f9c3edb05ab8dc1819c9686e7a6c4d60c1ba15 (diff)
rate limiting (frontend)
-rw-r--r--views/partials/canvas.html17
1 files changed, 11 insertions, 6 deletions
diff --git a/views/partials/canvas.html b/views/partials/canvas.html
index a336844..d51efc1 100644
--- a/views/partials/canvas.html
+++ b/views/partials/canvas.html
@@ -95,12 +95,17 @@
"Content-type": "application/json; charset=UTF-8"
}
})
- .then((response) => response.json())
- .then((json) => {
- if (json.status == "ok") {
- location.reload();
- }
- });
+ .then((response) => {
+ if (response.status === 429) {
+ alert("Rate limited! Only 5 messages every 10 minutes, sorry for the inconvenience");
+ }
+ return response.json();
+ })
+ .then((json) => {
+ if (json.status == "ok") {
+ location.reload();
+ }
+ });
}
const sendbtn = document.getElementById('sendbtn');
sendbtn.addEventListener("click", sendPic);