This commit is contained in:
Jesse-Ma
2022-05-27 14:29:30 +08:00
parent af75777b4e
commit 0d10a1802a
32 changed files with 1909 additions and 1 deletions

44
public/index.html Normal file
View File

@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="">
<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">
<link rel="icon" href="<%= BASE_URL %>favicon.png">
<title><%= htmlWebpackPlugin.options.title %></title>
<style>
body {
}
</style>
<script src="https://www.recaptcha.net/recaptcha/api.js?render=6Le0CJwfAAAAAGk0J6aDngi7Dya-b0qyFRdIf6Wu"></script>
<script type="text/javascript">
const CAPTCHA_CLIENT_SECRET = "6Le0CJwfAAAAAGk0J6aDngi7Dya-b0qyFRdIf6Wu";
window.onload = () => {
document.querySelector('button').addEventListener('click', () => {
grecaptcha.execute(CAPTCHA_CLIENT_SECRET, {action: 'homepage'}).then(function (token) {
console.log('客户端token:' + token);
fetch('/recaptcha/validate?token=' + token, {
method: 'GET'
}).then(response => {
if (response.ok) {
response.json().then(message => {
console.log('服务端验证');
console.log(message);
});
}
});
});
});
};
</script>
</head>
<body style="background-color: #dddddd;">
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>