misc fixes & max scale 200

main
jerl 2024-04-29 21:05:45 -07:00
parent 15acf67922
commit 03c0433c28
7 changed files with 16 additions and 7 deletions

View File

@ -157,7 +157,7 @@ function clickedTab(event) {
document.getElementById(`thread${window.threadId}`).tab = event.target.id;
}
render(document.body, html`
document.body.append(html.node`
<div id='home' class='column'>
<div id='threads'>
<h3>vybe</h3>
@ -170,7 +170,7 @@ render(document.body, html`
}>${window.name}</div>
</div>
<div id='profile' class='column hidden'>
<strong>authentication requests</strong>
<p><strong>authentication requests</strong></p>
<div id='authrequests'></div>
</div>
<hr class='separator' color='#666'>

View File

@ -27,6 +27,7 @@ async function auth() {
let register = document.getElementById('register');
if (!msg.success) {
console.log('authenticate failed', msg);
document.getElementById('result').innerText = msg.message;
register.classList.remove('hidden');
return;
}

View File

@ -90,7 +90,6 @@
}
.column {
flex: 1;
overflow: hidden;
}
.separator {
margin: 8px 2px;
@ -154,10 +153,12 @@
#message {
display: flex;
flex-direction: column;
min-height: 0; /* flex makes this auto so it can't shrink */
}
#messages {
margin: 2px;
flex-grow: 1;
overflow: auto;
}
#msginput {
display: flex;

View File

@ -18,11 +18,15 @@ let earliestMessage;
window.socket.on('new_message', message => {
if (message.thread !== window.threadId)
return;
document.getElementById('messages').appendChild(html.node`
const messages = document.getElementById('messages');
let scroll = messages.scrollHeight - messages.scrollTop <= messages.clientHeight;
messages.appendChild(html.node`
<div class='message'>
<strong>${message.name}: </strong>
${message.message}
</div>`);
if (scroll)
messages.scroll(0, messages.scrollHeight - messages.clientHeight);
if (!earliestMessage)
earliestMessage = message.id;
});

View File

@ -76,6 +76,8 @@ function add(s) {
};
span.onwheel = function(event) {
event.preventDefault();
if (event.deltaY < 0 && this.scale >= 200)
return;
this.scale *= 1 - event.deltaY * .001;
this.style.transform = `translate(-50%, -50%) scale(${this.scale})`;
save(this);

View File

@ -29,7 +29,8 @@ const authenticate = async (msg, respond, socket) => {
cleartextMessage: msg.message
}),
verificationKeys: key,
expectSigned: true
expectSigned: true,
date: new Date(Date.now() + 60000 * 4) // slightly in the future to compensate for some system times
});
const data = verification.data.split(' ');
if (data[0] !== 'vybe_auth') {

View File

@ -15,8 +15,8 @@ const get_keys = async (msg, respond) => {
message: "can't iterate user names"
});
}
const keys = await db.query(
`select name, pubkey from user where name in
const keys = await db.query( // todo: encryption !
`select name from user where name in
(${msg.names.map((i) => '?').join(',')})`,
msg.names
);