Initial commit
This commit is contained in:
commit
9fe412be11
58 changed files with 6215 additions and 0 deletions
66
templates/index.html
Normal file
66
templates/index.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!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">
|
||||
<title>Registration</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<h1>Create new user</h1>
|
||||
<form action="/register" method="post" id="signup">
|
||||
<h1>Sign Up</h1>
|
||||
<div class="field">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" placeholder="Enter your profile name" />
|
||||
<small></small>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="email">PubKey:</label>
|
||||
<input type="text" id="pubkey" name="pubkey" placeholder="Enter your pubkey" />
|
||||
<small></small>
|
||||
</div>
|
||||
<button type="submit">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
const form = document.getElementById('signup');
|
||||
|
||||
form.addEventListener('submit', async (event) => {
|
||||
// stop form submission
|
||||
event.preventDefault();
|
||||
|
||||
const name = form.elements['name'];
|
||||
const pubkey = form.elements['pubkey'];
|
||||
|
||||
// getting the element's value
|
||||
let userName = name.value;
|
||||
let pubKey = pubkey.value;
|
||||
|
||||
console.log(`${userName}:${pubKey}`);
|
||||
const data = { name: userName, pubkey: pubKey};
|
||||
|
||||
// Send user data
|
||||
await postJSON(data);
|
||||
});
|
||||
|
||||
async function postJSON(data) {
|
||||
try {
|
||||
const response = await fetch("http://localhost:8085/register", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
console.log("Success:", result);
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</html>
|
70
templates/index.stpl
Normal file
70
templates/index.stpl
Normal file
|
@ -0,0 +1,70 @@
|
|||
<!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">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
<title>Registration</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<h1>Create new user</h1>
|
||||
<form action="/register" method="post" id="signup">
|
||||
<h1>Sign Up</h1>
|
||||
<div class="field">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" placeholder="Enter your profile name" />
|
||||
<small></small>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="email">PubKey:</label>
|
||||
<input type="text" id="pubkey" name="pubkey" placeholder="Enter your pubkey" />
|
||||
<small></small>
|
||||
</div>
|
||||
<button type="submit">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
const form = document.getElementById('signup');
|
||||
|
||||
form.addEventListener('submit', async (event) => {
|
||||
// stop form submission
|
||||
event.preventDefault();
|
||||
|
||||
const name = form.elements['name'];
|
||||
const pubkey = form.elements['pubkey'];
|
||||
|
||||
// getting the element's value
|
||||
let userName = name.value;
|
||||
let pubKey = pubkey.value;
|
||||
|
||||
console.log(`${userName}:${pubKey}`);
|
||||
const data = { name: userName, pubkey: pubKey};
|
||||
|
||||
// Send user data
|
||||
await postJSON(data);
|
||||
});
|
||||
|
||||
async function postJSON(data) {
|
||||
try {
|
||||
const response = await fetch("http://localhost:8085/register", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
console.log("Success:", result);
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</html>
|
BIN
templates/static/android-chrome-192x192.png
Normal file
BIN
templates/static/android-chrome-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
BIN
templates/static/android-chrome-512x512.png
Normal file
BIN
templates/static/android-chrome-512x512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 235 KiB |
BIN
templates/static/apple-touch-icon.png
Normal file
BIN
templates/static/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
templates/static/favicon-16x16.png
Normal file
BIN
templates/static/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 777 B |
BIN
templates/static/favicon-32x32.png
Normal file
BIN
templates/static/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
templates/static/favicon.ico
Normal file
BIN
templates/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
1
templates/static/site.webmanifest
Normal file
1
templates/static/site.webmanifest
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
Loading…
Add table
Add a link
Reference in a new issue