<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Galoy CLI Captcha Solver</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="/static/gt.js"></script>
</head>
<body class="flex flex-col items-center h-screen w-screen bg-gray-300">
<div class="w-2/5 p-4 bg-white shadow rounded-md mt-20">
<img class="w-24 mb-10" src="/static/galoy-logo.svg" />
<h1 class="text-3xl uppercase font-bold mb-3 text-gray-800">Galoy CLI Captcha Solver</h1>
<p class="text-sm text-gray-700 mb-2">
Please solve the captcha that will appear from Geetest.
Solving the captcha is necessary to prevent against scamming of SMS sending backend.
</p>
<p class="text-sm text-gray-700 font-bold" id="solved" style="display: none;">The captcha is solved, return back to the CLI.
You can close this browser window too.
</p>
<div id="captcha"></div>
<div class="mt-4">
<a class="uppercase text-xs font-mono bg-gray-700 text-white font-bold rounded p-1 flex justify-center items-center w-24" href="https://github.com/GaloyMoney/galoy-cli">GitHub</a>
</div>
</div>
<script>
const { id, challengeCode, newCaptcha, failbackMode } = JSON.parse(`{
"id": "{{id}}",
"newCaptcha": {{new_captcha}},
"failbackMode": {{failback_mode}},
"challengeCode": "{{challenge_code}}"
}`);
const captchaHandler = (captchaObj) => {
const onSuccess = () => {
const result = captchaObj.getValidate()
console.log(result);
fetch("/solve", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(result),
}).finally(res => {
console.log("Captcha Submitted!")
document.querySelector("#solved").style.display = "block";
})
}
captchaObj.appendTo("#captcha")
captchaObj
.onReady(() => { captchaObj.verify() })
.onSuccess(onSuccess)
.onError((err) => {
console.log("[Captcha error]:", err)
})
}
window.initGeetest(
{
gt: id,
challenge: challengeCode,
offline: failbackMode,
new_captcha: newCaptcha,
lang: "en",
product: "bind",
},
captchaHandler,
)
</script>
</body>
</html>