Widget and demo changes

This commit is contained in:
Tiago Rangel
2025-01-13 20:28:12 +00:00
parent 72a92c7e55
commit d4b4464ffb
4 changed files with 15 additions and 18 deletions
+10 -10
View File
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cap demo</title>
</head>
<body>
<cap-widget id="cap" data-api-endpoint="/api/"></cap-widget>
</body>
<script src="https://cdn.jsdelivr.net/npm/@cap.js/widget"></script>
</html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cap demo</title>
</head>
<body>
<cap-widget id="cap" data-api-endpoint="/api/"></cap-widget>
</body>
<script src="https://raw.githubusercontent.com/tiagorangel1/cap/refs/heads/main/widget/cap.min.js"></script>
</html>
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@cap.js/widget",
"version": "0.0.5",
"version": "0.0.6",
"description": "Cap widget",
"keywords": [
"captcha",
+3 -6
View File
@@ -50,14 +50,11 @@
try {
// MARK: Todo
const apiEndpoint =
location.hostname === "localhost"
? "/api/"
: this.#el.getAttribute("cap-api-endpoint");
const apiEndpoint = this.#el.getAttribute("cap-api-endpoint");
const { challenge, target, token } = await (
await fetch(
`${apiEndpoint || "https://trycap.glitch.me/api/"}challenge`,
`${apiEndpoint}challenge`,
{
method: "POST",
}
@@ -71,7 +68,7 @@
const resp = await (
await fetch(
`${apiEndpoint || "https://trycap.glitch.me/api/"}redeem`,
`${apiEndpoint}redeem`,
{
method: "POST",
body: JSON.stringify({ token, solutions }),