built new web

This commit is contained in:
2025-05-27 13:17:11 +03:00
parent d84cc7a72c
commit b7d2c524d6
13 changed files with 291 additions and 76 deletions

View File

@@ -1,55 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WASM Example</title>
</head>
<body>
<h1>WASM Example</h1>
<div>
<label for="userAgent">User Agent:</label>
<input type="text" id="userAgent" placeholder="Например, Mozilla/5.0">
</div>
<div>
<label for="url">URL:</label>
<input type="text" id="url" placeholder="Например, http://example.com">
</div>
<button id="getSecretValue">Получить секретное значение</button>
<p id="result"></p>
<script type="module">
import init, { get_secret_value } from './hublib.js';
async function runWasm() {
await init();
document.getElementById('getSecretValue').addEventListener('click', async () => {
const userAgent = document.getElementById('userAgent').value || navigator.userAgent;
const secretValue = get_secret_value(BigInt(Math.floor(Date.now() / 1000)), userAgent, url);
document.getElementById('result').innerText = secretValue;
const txt = 'https://api.id.hublab.ru/api/v1/guestlogin?given_time=' +
serverTs.timestamp +
'&user_agent=' + userAgent +
'&gotten_sign=' + secretValue;
const response1 = await makePostRequest(txt)
document.getElementById('result-check').innerText = response1.ok;
});
}
runWasm();
</script>
</body>
</html>