misc fixes & max scale 200
parent
15acf67922
commit
03c0433c28
|
@ -157,7 +157,7 @@ function clickedTab(event) {
|
||||||
document.getElementById(`thread${window.threadId}`).tab = event.target.id;
|
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='home' class='column'>
|
||||||
<div id='threads'>
|
<div id='threads'>
|
||||||
<h3>vybe</h3>
|
<h3>vybe</h3>
|
||||||
|
@ -170,7 +170,7 @@ render(document.body, html`
|
||||||
}>${window.name}</div>
|
}>${window.name}</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='profile' class='column hidden'>
|
<div id='profile' class='column hidden'>
|
||||||
<strong>authentication requests</strong>
|
<p><strong>authentication requests</strong></p>
|
||||||
<div id='authrequests'></div>
|
<div id='authrequests'></div>
|
||||||
</div>
|
</div>
|
||||||
<hr class='separator' color='#666'>
|
<hr class='separator' color='#666'>
|
||||||
|
|
|
@ -27,6 +27,7 @@ async function auth() {
|
||||||
let register = document.getElementById('register');
|
let register = document.getElementById('register');
|
||||||
if (!msg.success) {
|
if (!msg.success) {
|
||||||
console.log('authenticate failed', msg);
|
console.log('authenticate failed', msg);
|
||||||
|
document.getElementById('result').innerText = msg.message;
|
||||||
register.classList.remove('hidden');
|
register.classList.remove('hidden');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,6 @@
|
||||||
}
|
}
|
||||||
.column {
|
.column {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
.separator {
|
.separator {
|
||||||
margin: 8px 2px;
|
margin: 8px 2px;
|
||||||
|
@ -154,10 +153,12 @@
|
||||||
#message {
|
#message {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
min-height: 0; /* flex makes this auto so it can't shrink */
|
||||||
}
|
}
|
||||||
#messages {
|
#messages {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
#msginput {
|
#msginput {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -18,11 +18,15 @@ let earliestMessage;
|
||||||
window.socket.on('new_message', message => {
|
window.socket.on('new_message', message => {
|
||||||
if (message.thread !== window.threadId)
|
if (message.thread !== window.threadId)
|
||||||
return;
|
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'>
|
<div class='message'>
|
||||||
<strong>${message.name}: </strong>
|
<strong>${message.name}: </strong>
|
||||||
${message.message}
|
${message.message}
|
||||||
</div>`);
|
</div>`);
|
||||||
|
if (scroll)
|
||||||
|
messages.scroll(0, messages.scrollHeight - messages.clientHeight);
|
||||||
if (!earliestMessage)
|
if (!earliestMessage)
|
||||||
earliestMessage = message.id;
|
earliestMessage = message.id;
|
||||||
});
|
});
|
||||||
|
|
|
@ -76,6 +76,8 @@ function add(s) {
|
||||||
};
|
};
|
||||||
span.onwheel = function(event) {
|
span.onwheel = function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
if (event.deltaY < 0 && this.scale >= 200)
|
||||||
|
return;
|
||||||
this.scale *= 1 - event.deltaY * .001;
|
this.scale *= 1 - event.deltaY * .001;
|
||||||
this.style.transform = `translate(-50%, -50%) scale(${this.scale})`;
|
this.style.transform = `translate(-50%, -50%) scale(${this.scale})`;
|
||||||
save(this);
|
save(this);
|
||||||
|
|
|
@ -29,7 +29,8 @@ const authenticate = async (msg, respond, socket) => {
|
||||||
cleartextMessage: msg.message
|
cleartextMessage: msg.message
|
||||||
}),
|
}),
|
||||||
verificationKeys: key,
|
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(' ');
|
const data = verification.data.split(' ');
|
||||||
if (data[0] !== 'vybe_auth') {
|
if (data[0] !== 'vybe_auth') {
|
||||||
|
|
|
@ -15,8 +15,8 @@ const get_keys = async (msg, respond) => {
|
||||||
message: "can't iterate user names"
|
message: "can't iterate user names"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const keys = await db.query(
|
const keys = await db.query( // todo: encryption !
|
||||||
`select name, pubkey from user where name in
|
`select name from user where name in
|
||||||
(${msg.names.map((i) => '?').join(',')})`,
|
(${msg.names.map((i) => '?').join(',')})`,
|
||||||
msg.names
|
msg.names
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue