ui changes

This commit is contained in:
biglyderv 2025-04-02 22:55:51 -04:00
parent 747389c697
commit 16290ebdb7
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
5 changed files with 34 additions and 19 deletions

0
README.md Normal file
View file

View file

@ -14,6 +14,7 @@ app.use(express.static('static'));
app.post('/', async function (req, res) {
let id = 'web:' + createHash('sha256').update(req.ip).digest('hex');
console.log(req.ip)
id = id.slice(0, 24);
if (!sessions[id]) {

View file

@ -1,7 +1,12 @@
:root,
input,
button {
font-family: monospace;
}
body {
margin: 0;
padding-bottom: 3rem;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#form {
@ -12,7 +17,8 @@ body {
left: 0;
right: 0;
display: flex;
height: 3rem;
flex-wrap: wrap;
min-height: 3rem;
box-sizing: border-box;
backdrop-filter: blur(10px);
}
@ -36,7 +42,11 @@ body {
margin: 0.25rem;
border-radius: 3px;
outline: none;
}
button, button a {
color: #fff;
text-decoration: none;
}
#messages {

View file

@ -11,7 +11,9 @@
<body>
<ul id="messages"></ul>
<form id="form" action="">
<input id="input" autocomplete="off" /><button>Send</button>
<input id="input" autocomplete="off" />
<button><a href='#'>Send</a></button>
<button><a href='https://discord.com/invite/Wkr7PVk3cF'>Discord</a></button>
</form>
<script src='/index.js'></script>
</body>

View file

@ -3,8 +3,16 @@ var messages = document.getElementById('messages');
var form = document.getElementById('form');
var input = document.getElementById('input');
async function addMsg(msg) {
var item = document.createElement('li');
item.textContent = msg;
messages.appendChild(item);
window.scrollTo(0, document.body.scrollHeight);
}
async function main(e) {
e.preventDefault();
if (!input.value) return;
let msg = await fetch("/", {
@ -18,15 +26,9 @@ async function main(e) {
msg = await msg.text();
msg = msg.trim();
addMsg(input.value)
input.value = '';
var item = document.createElement('li');
item.textContent = msg;
messages.appendChild(item);
window.scrollTo(0, document.body.scrollHeight);
addMsg(msg)
}
form.addEventListener('submit', main);
input.value = 'test';
main({ preventDefault: () => { }})