Turns out captchas can be larger than 1KB. And turns out people use websites from inside Instagram.
This commit is contained in:
parent
f0fcb9f916
commit
3dc8f16de0
2 changed files with 16 additions and 15 deletions
|
@ -17,6 +17,6 @@ public record InsertMessageRequestDto
|
||||||
|
|
||||||
[JsonPropertyName("captchaResponse")]
|
[JsonPropertyName("captchaResponse")]
|
||||||
[Required(ErrorMessage = "The captcha challenge response is required")]
|
[Required(ErrorMessage = "The captcha challenge response is required")]
|
||||||
[StringLength(1024)]
|
[StringLength(2048)]
|
||||||
public string CaptchaResponse { get; init; }
|
public string CaptchaResponse { get; init; }
|
||||||
}
|
}
|
|
@ -133,22 +133,23 @@ document
|
||||||
captchaResponse,
|
captchaResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(this.action, {
|
const dataJson = JSON.stringify(data);
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.status >= 200 && response.status <= 299) {
|
const xhr = new XMLHttpRequest();
|
||||||
alert("Note added successfully!");
|
xhr.open("POST", this.action, true);
|
||||||
this.reset(); // Clear the form fields
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
} else {
|
xhr.setRequestHeader('Content-Length', dataJson.length);
|
||||||
const problem = await response.json();
|
xhr.send(dataJson);
|
||||||
alert(problem);
|
|
||||||
|
xhr.onload = function () {
|
||||||
|
if (xhr.status >= 200 && xhr.status <= 299) {
|
||||||
|
alert("Message sent successfully.");
|
||||||
|
this.reset(); // Clear the form fields
|
||||||
|
} else {
|
||||||
|
alert("An error " + xhr.status + "occurred: " + xhr.responseText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue