fix server crash (temporary)

This commit is contained in:
CoolElectronics 2023-08-17 14:17:31 -04:00
parent 98c25278d6
commit 0b7ad50aab
No known key found for this signature in database
GPG key ID: F63593D168636C50
2 changed files with 6 additions and 18 deletions

View file

@ -273,7 +273,7 @@
{/if}
</div>
<Dialog headline="WARNING" open={showSwarmWarning}>
<Dialog headline="WARNING" bind:open={showSwarmWarning}>
<h2 class="text-2xl">
TLS has not currently been implemented for the Adrift Swarm. Your
data will not be private, and you should not sign into any
@ -288,7 +288,7 @@
>
</Dialog>
<Dialog headline="Log in to Connect" open={showLogin}>
<Dialog headline="Log in to Connect" bind:open={showLogin}>
<TextField name="email" bind:value={email} />
<TextField
name="password"
@ -440,21 +440,6 @@
spacer {
margin: 1em;
}
#loginpage {
padding: 2.5em;
}
.bigcard {
background-color: rgb(var(--m3-scheme-primary-container));
color: rgb(var(--m3-scheme-on-primary-container));
border-radius: 2rem;
display: flex;
flex-direction: column;
gap: 2rem;
text-align: center;
padding: 8rem 0 6rem 0;
margin-bottom: 2rem;
}
:global(body, html, #app) {
width: 100vw;
height: 100vh;

View file

@ -75,7 +75,10 @@ export async function answerRtc(data: any, onrespond: (answer: any) => void) {
dataChannel.onopen = () => {
console.log("opened");
server = new AdriftServer((msg) => dataChannel.send(msg));
server = new AdriftServer((msg) => {
if (dataChannel.readyState === "open")
dataChannel.send(msg)
});
};
dataChannel.onclose = () => {
console.log("closed");