aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/style/logger.css7
-rw-r--r--source/client/room.ts6
-rw-r--r--source/packets.ts22
3 files changed, 10 insertions, 25 deletions
diff --git a/public/style/logger.css b/public/style/logger.css
index 77f0d41..cb76586 100644
--- a/public/style/logger.css
+++ b/public/style/logger.css
@@ -8,8 +8,6 @@
border-radius: 0.2em;
border: 0px solid transparent;
padding: 0.2em;
-
-
}
.logger-line {
@@ -19,11 +17,10 @@
animation-name: appear, disappear;
animation-timing-function: linear, linear;
animation-delay: 0s, 3s;
- animation-duration: 0.3s, 2s;
+ animation-duration: 0.3s, 1s;
animation-fill-mode: forwards, forwards;
}
-
@keyframes appear {
from {
margin-top: -1.2em;
@@ -34,8 +31,6 @@
}
}
-
-
@keyframes disappear {
from {
opacity: 1;
diff --git a/source/client/room.ts b/source/client/room.ts
index 45ccd84..145fb1b 100644
--- a/source/client/room.ts
+++ b/source/client/room.ts
@@ -5,7 +5,7 @@ import { RemoteUser } from "./remote_user.ts";
import { User } from "./user.ts";
import { LocalUser } from "./local_user.ts";
import { hex_id, parameter_string } from "./helper.ts";
-import { CSPacket, SCPacket } from "../packets.ts";
+import { PacketS, PacketC } from "../packets.ts";
export class Room {
@@ -29,11 +29,11 @@ export class Room {
this.local_user = new LocalUser(this, parameter_string("username", `guest-${hex_id()}`))
}
- websocket_send(data: CSPacket) {
+ websocket_send(data: PacketS) {
log("ws", `-> ${data.receiver ?? "*"}`, data)
this.websocket.send(JSON.stringify(data))
}
- websocket_message(packet: SCPacket) {
+ websocket_message(packet: PacketC) {
if (packet.join) {
log("*", `${this.name} ${packet.sender} joined`);
const ru = new RemoteUser(this, packet.sender)
diff --git a/source/packets.ts b/source/packets.ts
index ef65ce7..f42d99b 100644
--- a/source/packets.ts
+++ b/source/packets.ts
@@ -1,27 +1,17 @@
-
+// copy pasted from dom.lib.d.ts because it can not be referenced in the server.
type F_RTCSdpType = "answer" | "offer" | "pranswer" | "rollback";
-interface F_RTCSessionDescriptionInit {
- sdp?: string;
- type: F_RTCSdpType;
-}
-
-interface F_RTCIceCandidateInit {
- candidate?: string;
- sdpMLineIndex?: number | null;
- sdpMid?: string | null;
- usernameFragment?: string | null;
-}
-
+interface F_RTCSessionDescriptionInit { sdp?: string; type: F_RTCSdpType; }
+interface F_RTCIceCandidateInit { candidate?: string; sdpMLineIndex?: number | null; sdpMid?: string | null; usernameFragment?: string | null; }
-export interface SCPacket {
+export interface PacketC {
sender: string,
- data?: CSPacket,
+ data?: PacketS,
join?: boolean, // user just joined
leave?: boolean, // user left
stable?: boolean // user "joined" because you joined aka. user was already there
}
-export interface CSPacket {
+export interface PacketS {
receiver?: string
ice_candiate?: F_RTCIceCandidateInit
offer?: F_RTCSessionDescriptionInit