mirror of
https://github.com/sequentialread/pow-captcha.git
synced 2025-03-30 15:08:29 +00:00
77 lines
1.9 KiB
HTML
77 lines
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>📋 Todo List</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<style>
|
|
.botdeterrent-container {
|
|
margin-top: 1em;
|
|
font-size: 10px;
|
|
}
|
|
li::marker {
|
|
font-size: 1.2em;
|
|
}
|
|
li {
|
|
font-size: 1em;
|
|
}
|
|
input[type='text'] {
|
|
width: 25em;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>📋 Todo List</h1>
|
|
<ol>
|
|
{{ range $index, $item := .Items }}
|
|
<li>{{ $item }}</li>
|
|
{{ end }}
|
|
<li>
|
|
<form method="POST" action="/">
|
|
<input type="text" name="item" />
|
|
<input type="hidden" name="challenge" value="{{ .Challenge }}" />
|
|
<input type="hidden" name="nonce" />
|
|
<input type="submit" disabled="true" value="Add" />
|
|
<div class="botdeterrent-container"
|
|
data-pow-bot-deterrent-url="http://localhost:8080/"
|
|
data-pow-bot-deterrent-challenge="{{ .Challenge }}"
|
|
data-pow-bot-deterrent-callback="myPowCallback">
|
|
</div>
|
|
</form>
|
|
|
|
</li>
|
|
</ol>
|
|
<script>
|
|
window.myPowCallback = (nonce) => {
|
|
document.querySelector("form input[name='nonce']").value = nonce;
|
|
document.querySelector("form input[type='submit']").disabled = false;
|
|
};
|
|
</script>
|
|
<script src="/static/botdeterrent.js"></script>
|
|
<!-- <script src='./static/scrypt_wasm.js'></script>
|
|
<script>
|
|
const { scrypt } = wasm_bindgen;
|
|
|
|
async function run() {
|
|
console.log("a");
|
|
await wasm_bindgen();
|
|
|
|
console.log(scrypt(hexEncode('password in hex'), hexEncode('password in hex'), 4096, 8, 1, 16))
|
|
}
|
|
|
|
run();
|
|
|
|
function hexEncode(s){
|
|
var hex, i;
|
|
|
|
var result = "";
|
|
for (i=0; i<s.length; i++) {
|
|
hex = s.charCodeAt(i).toString(16);
|
|
result += ("000"+hex).slice(-4);
|
|
}
|
|
return result
|
|
}
|
|
|
|
</script> -->
|
|
</body>
|
|
</html> |