aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/index.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-07 11:14:42 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-07 11:14:42 +0200
commit61950198e3bf06555f48e8f51c882a4c3cce5128 (patch)
treea7701a44804d4a2a634f3410d400545ea82d1c45 /client-web/source/index.ts
parent832f48f29098cc6f840ade90db3b94efa67c6833 (diff)
downloadkeks-meet-61950198e3bf06555f48e8f51c882a4c3cce5128.tar
keks-meet-61950198e3bf06555f48e8f51c882a4c3cce5128.tar.bz2
keks-meet-61950198e3bf06555f48e8f51c882a4c3cce5128.tar.zst
REFACTOR! pt.1
Diffstat (limited to 'client-web/source/index.ts')
-rw-r--r--client-web/source/index.ts55
1 files changed, 55 insertions, 0 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts
new file mode 100644
index 0000000..fbb77d4
--- /dev/null
+++ b/client-web/source/index.ts
@@ -0,0 +1,55 @@
+/// <reference lib="dom" />
+
+import { get_query_params } from "./helper.ts"
+import { log } from "./logger.ts"
+import { create_menu } from "./menu.ts";
+import { Room } from "./room.ts"
+
+export const servers: RTCConfiguration = {
+ iceServers: [{ urls: ["stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19302"] }],
+ iceCandidatePoolSize: 10,
+}
+
+export interface User {
+ peer: RTCPeerConnection
+ stream: MediaStream,
+}
+
+export const parameters = get_query_params()
+
+window.onload = () => main()
+
+export function main() {
+ document.body.querySelector("p")?.remove()
+ log("*", "starting up")
+ if (window.location.pathname.startsWith("/room/")) {
+ const room_name = window.location.pathname.substring("/room/".length)
+ const room = new Room(room_name)
+ create_menu(room)
+ document.body.append(room.el)
+ } else {
+ create_menu()
+ document.body.append(create_start_screen())
+ }
+}
+
+function create_start_screen() {
+ const with_text_content = (a: string) => (b: string) => {
+ const e = document.createElement(a)
+ e.textContent = b
+ return e
+ }
+ const p = with_text_content("p")
+ const h2 = with_text_content("h2")
+
+ const el = document.createElement("div")
+ el.append(
+ h2("keks-meet"),
+ p("A web conferencing application using webrtc"),
+ p("keks-meet is free software! It is licenced under the terms of the third version of the GNU Affero General Public Licence only."),
+ p("To get started, just enter a unique idenfier, click 'Join', then share the URL with your partner.")
+ )
+
+
+ return el
+}