diff options
author | metamuffin <metamuffin@disroot.org> | 2023-09-08 14:17:21 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-09-08 14:17:21 +0200 |
commit | 83e409a979d722db9ad44fc9d22945f23a18e712 (patch) | |
tree | f3cba80214e06a90b3d4416fc76ac4727f40198c | |
parent | 458968182f7cbad51ca1799da70602b6803efa2f (diff) | |
download | keks-meet-83e409a979d722db9ad44fc9d22945f23a18e712.tar keks-meet-83e409a979d722db9ad44fc9d22945f23a18e712.tar.bz2 keks-meet-83e409a979d722db9ad44fc9d22945f23a18e712.tar.zst |
add new watches
-rw-r--r-- | client-web/source/preferences/decl.ts | 6 | ||||
-rw-r--r-- | client-web/source/room_watches.ts | 33 | ||||
-rw-r--r-- | readme.md | 49 |
3 files changed, 48 insertions, 40 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") + ) ) } @@ -16,7 +16,7 @@ a simple secure web conferencing application - Rooms (created on demand, do not persist) - Chat (supports text and images) - Minimal user-interface -- Should work with screen readers +- Should work with screen readers ## Licence @@ -112,28 +112,31 @@ reload if the section changes. Booleans can be either `1`, `true`, `yes` or their opposites. A convenience function for changing params is also exported: `window.change_pref(key, value)` -| Option name | Type | Default | Description | -| ------------------------------- | ------- | ----------- | -------------------------------------------------------------------- | -| `username` | string | `"guest-…"` | Username | -| `warn_redirect` | boolean | `false` | Internal option that is set by a server redirect. | -| `image_view_popup` | boolean | `true` | Open image in popup instead of new tab | -| `webrtc_debug` | boolean | `false` | Show additional information for WebRTC related stuff | -| `microphone_enabled` | boolean | `false` | Add one microphone track on startup | -| `screencast_enabled` | boolean | `false` | Add one screencast track on startup | -| `camera_enabled` | boolean | `false` | Add one camera track on startup | -| `rnnoise` | boolean | `true` | Use RNNoise for noise suppression | -| `native_noise_suppression` | boolean | `false` | Suggest the browser to do noise suppression | -| `microphone_gain` | number | `1` | Amplify microphone volume | -| `video_fps` | number | - | Preferred framerate (in 1/s) for screencast and camera | -| `video_resolution` | number | - | Preferred width for screencast and camera | -| `camera_facing_mode` | string | - | Prefer user-facing or env-facing camera (`"environment"` / `"user"`) | -| `auto_gain_control` | boolean | - | Automatically adjust mic gain | -| `echo_cancellation` | boolean | - | Cancel echo | -| `optional_audio_default_enable` | boolean | `true` | Enable audio tracks by default | -| `optional_video_default_enable` | boolean | `false` | Enable video tracks by default | -| `notify_chat` | boolean | `true` | Send notifications for incoming chat messages | -| `notify_join` | boolean | `true` | Send notifications when users join | -| `notify_leave` | boolean | `true` | Send notifications when users leave | +| Option name | Type | Default | Description | +| ------------------------------- | ------- | ----------- | ------------------------------------------------------------------------------ | +| `username` | string | `"guest-…"` | Username | +| `warn_redirect` | boolean | `false` | Internal option that is set by a server redirect. | +| `image_view_popup` | boolean | `true` | Open image in popup instead of new tab | +| `webrtc_debug` | boolean | `false` | Show additional information for WebRTC related stuff | +| `microphone_enabled` | boolean | `false` | Add one microphone track on startup | +| `screencast_enabled` | boolean | `false` | Add one screencast track on startup | +| `camera_enabled` | boolean | `false` | Add one camera track on startup | +| `rnnoise` | boolean | `true` | Use RNNoise for noise suppression | +| `native_noise_suppression` | boolean | `false` | Suggest the browser to do noise suppression | +| `microphone_gain` | number | `1` | Amplify microphone volume | +| `video_fps` | number | - | Preferred framerate (in 1/s) for screencast and camera | +| `video_resolution` | number | - | Preferred width for screencast and camera | +| `camera_facing_mode` | string | - | Prefer user-facing or env-facing camera (`"environment"` / `"user"`) | +| `auto_gain_control` | boolean | - | Automatically adjust mic gain | +| `echo_cancellation` | boolean | - | Cancel echo | +| `audio_activity_threshold` | number | `0.003` | Audio activity threshold | +| `optional_audio_default_enable` | boolean | `true` | Enable audio tracks by default | +| `optional_video_default_enable` | boolean | `false` | Enable video tracks by default | +| `notify_chat` | boolean | `true` | Send notifications for incoming chat messages | +| `notify_join` | boolean | `true` | Send notifications when users join | +| `notify_leave` | boolean | `true` | Send notifications when users leave | +| `enable_onbeforeunload` | boolean | `true` | Prompt for confirmation when leaving the site while local resources are active | +| `room_watches` | string | `"public"` | Known rooms (as semicolon seperated list of name=secret pairs) | ## Protocol |