summaryrefslogtreecommitdiff
path: root/client-web/source
diff options
context:
space:
mode:
Diffstat (limited to 'client-web/source')
-rw-r--r--client-web/source/index.ts3
-rw-r--r--client-web/source/local_user.ts2
-rw-r--r--client-web/source/room.ts19
-rw-r--r--client-web/source/user.ts2
4 files changed, 13 insertions, 13 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts
index 5695573..22b2baf 100644
--- a/client-web/source/index.ts
+++ b/client-web/source/index.ts
@@ -21,7 +21,8 @@ window.onload = () => main()
export async function main() {
document.body.querySelectorAll("p").forEach(e => e.remove())
log("*", "starting up")
- const room_name = window.location.pathname.substring("/".length)
+ const room_name = window.location.hash.substring(1)
+ if (room_name.length == 0) window.location.href = "/" // send them back to the start page
const conn = await (new SignalingConnection().connect(room_name))
const room = new Room(conn)
create_menu()
diff --git a/client-web/source/local_user.ts b/client-web/source/local_user.ts
index efedfc2..02d8da1 100644
--- a/client-web/source/local_user.ts
+++ b/client-web/source/local_user.ts
@@ -18,7 +18,7 @@ export class LocalUser extends User {
this.local = true
this.create_controls()
this.add_initial_tracks()
- log("usermodel", `added local user: ${this.name}`)
+ log("usermodel", `added local user: ${this.display_name}`)
}
async add_initial_tracks() {
diff --git a/client-web/source/room.ts b/client-web/source/room.ts
index 9f27230..961478e 100644
--- a/client-web/source/room.ts
+++ b/client-web/source/room.ts
@@ -6,19 +6,19 @@ import { User } from "./user.ts";
import { LocalUser } from "./local_user.ts";
import { ClientboundPacket, RelayMessage } from "../../common/packets.d.ts";
import { SignalingConnection } from "./protocol/mod.ts";
+import { ediv } from "./helper.ts";
export class Room {
- el: HTMLElement
- users: Map<number, User> = new Map()
- remote_users: Map<number, RemoteUser> = new Map()
- local_user!: LocalUser
- my_id!: number
+ public el: HTMLElement = ediv({ classes: ["room"] })
+ public users: Map<number, User> = new Map()
+ public remote_users: Map<number, RemoteUser> = new Map()
+ public local_user!: LocalUser
+ public my_id!: number
constructor(public signaling: SignalingConnection) {
- this.el = document.createElement("div")
- this.el.classList.add("room")
- this.signaling.control_handler = this.control_handler
- this.signaling.relay_handler = this.relay_handler
+ this.signaling.control_handler = (a) => this.control_handler(a)
+ this.signaling.relay_handler = (a, b) => this.relay_handler(a, b)
+ console.log("room", this.el)
}
control_handler(packet: ClientboundPacket) {
@@ -46,7 +46,6 @@ export class Room {
this.remote_users.get(p.id)!.leave()
this.users.delete(p.id)
this.remote_users.delete(p.id)
- return
}
}
diff --git a/client-web/source/user.ts b/client-web/source/user.ts
index 057cdf4..0bdf250 100644
--- a/client-web/source/user.ts
+++ b/client-web/source/user.ts
@@ -11,7 +11,7 @@ export abstract class User {
public name?: string
protected tracks: Set<TrackHandle> = new Set()
- constructor(public room: Room, public id: number,) {
+ constructor(public room: Room, public id: number) {
this.el = document.createElement("div")
this.el.classList.add("user")
this.room.el.append(this.el)