diff options
Diffstat (limited to 'client-web')
-rw-r--r-- | client-web/source/preferences/decl.ts | 6 | ||||
-rw-r--r-- | client-web/source/room_watches.ts | 33 |
2 files changed, 22 insertions, 17 deletions
diff --git a/client-web/source/preferences/decl.ts b/client-web/source/preferences/decl.ts index 5f2d8a2..2ef2921 100644 --- a/client-web/source/preferences/decl.ts +++ b/client-web/source/preferences/decl.ts @@ -24,14 +24,14 @@ export const PREF_DECLS = { microphone_enabled: { type: bool, default: false, description: "Add one microphone track on startup" }, screencast_enabled: { type: bool, default: false, description: "Add one screencast track on startup" }, camera_enabled: { type: bool, default: false, description: "Add one camera track on startup" }, - rnnoise: { type: bool, default: true, description: "Use RNNoise for noise suppression" }, + rnnoise: { type: bool, default: true, description: "Use RNNoise for noise suppression", allow_url: true }, native_noise_suppression: { type: bool, default: false, description: "Suggest the browser to do noise suppression" }, microphone_gain: { type: number, default: 1, description: "Amplify microphone volume" }, video_fps: { type: number, description: "Preferred framerate (in 1/s) for screencast and camera" }, video_resolution: { type: number, description: "Preferred width for screencast and camera" }, camera_facing_mode: { type: optional(string), possible_values: ["environment", "user"], description: "Prefer user-facing or env-facing camera" }, auto_gain_control: { type: bool, description: "Automatically adjust mic gain" }, - echo_cancellation: { type: bool, description: "Cancel echo" }, + echo_cancellation: { type: bool, description: "Cancel echo", allow_url: true }, audio_activity_threshold: { type: number, optional: true, default: 0.003, description: "Audio activity threshold" }, // TODO differenciate between mic, cam and screen @@ -43,5 +43,5 @@ export const PREF_DECLS = { notify_leave: { type: bool, default: true, description: "Send notifications when users leave" }, enable_onbeforeunload: { type: bool, default: true, description: "Prompt for confirmation when leaving the site while local resources are active" }, - room_watches: { type: string, default: "Public=public", description: "Known rooms (as semicolon seperated list of name=secret pairs)" } + room_watches: { type: string, default: "[]", hidden: true, description: "Known rooms (as semicolon seperated list of name=secret pairs)" } } diff --git a/client-web/source/room_watches.ts b/client-web/source/room_watches.ts index d91972d..37d6dce 100644 --- a/client-web/source/room_watches.ts +++ b/client-web/source/room_watches.ts @@ -1,5 +1,5 @@ import { e } from "./helper.ts"; -import { PREFS } from "./preferences/mod.ts"; +import { PREFS, change_pref } from "./preferences/mod.ts"; import { crypto_hash } from "./protocol/crypto.ts"; import { SignalingConnection } from "./protocol/mod.ts"; @@ -16,18 +16,9 @@ export function ui_room_watches(conn: SignalingConnection): HTMLElement { const watches: Watch[] = [] const update_watches = () => (conn.send_control({ watch_rooms: watches.map(w => w.hash) }), update_listing()); - (async () => { - for (const e of PREFS.room_watches.split(";")) { - const [name, secret] = e.split("="); - watches.push({ - name, - secret, - hash: await crypto_hash(secret), - user_count: 0 - }) - } - update_watches() - })() + const add_watch = async (secret: string) => watches.push({ name: secret.split("#")[0], secret, hash: await crypto_hash(secret), user_count: 0 }) + const save_watches = () => change_pref("room_watches", JSON.stringify(watches.map(w => w.secret))) + const load_watches = async () => { for (const secret of JSON.parse(PREFS.room_watches)) { await add_watch(secret) } update_watches() } conn.control_handler.add_listener(packet => { if (packet.room_info) { @@ -57,8 +48,22 @@ export function ui_room_watches(conn: SignalingConnection): HTMLElement { } } + load_watches() + + let input: HTMLInputElement; return e("div", { class: "room-watches" }, e("h2", {}, "Known Rooms"), - listing + listing, + e("div", { class: "room-watches-edit" }, + e("label", {}, "Add room:", input = e("input", { type: "text" })), + e("button", { + async onclick(_e) { + await add_watch(input.value) + update_watches() + save_watches() + input.value = "" + } + }, "Add") + ) ) } |