diff options
Diffstat (limited to 'client-web/source/preferences')
-rw-r--r-- | client-web/source/preferences/decl.ts | 48 | ||||
-rw-r--r-- | client-web/source/preferences/mod.ts | 1 | ||||
-rw-r--r-- | client-web/source/preferences/ui.ts | 4 |
3 files changed, 26 insertions, 27 deletions
diff --git a/client-web/source/preferences/decl.ts b/client-web/source/preferences/decl.ts index a75f1d9..a8c33a6 100644 --- a/client-web/source/preferences/decl.ts +++ b/client-web/source/preferences/decl.ts @@ -17,34 +17,34 @@ const string = "", bool = false, number = 0; // example types for ts const optional = <T>(a: T): T | undefined => a export const PREF_DECLS = { - username: { type: string, default: "guest-" + hex_id(), description: "Username", allow_url: true }, - language: { type: optional(string), possible_values: Object.keys(LOCALES), description: "Interface Language", allow_url: true }, - warn_redirect: { type: bool, hidden: true, default: false, description: "Internal option that is set by a server redirect.", allow_url: true }, - image_view_popup: { type: bool, default: true, description: "Open image in popup instead of new tab" }, - webrtc_debug: { type: bool, default: false, description: "Show additional information for WebRTC related stuff" }, + username: { type: string, default: "guest-" + hex_id(), allow_url: true }, + language: { type: string, possible_values: ["system", ...Object.keys(LOCALES)], default: "system", allow_url: true }, + warn_redirect: { type: bool, hidden: true, default: false, allow_url: true }, + image_view_popup: { type: bool, default: true }, + webrtc_debug: { type: bool, default: false }, /* MEDIA */ - 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", 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", allow_url: true }, - audio_activity_threshold: { type: number, optional: true, default: 0.003, description: "Audio activity threshold" }, + microphone_enabled: { type: bool, default: false }, + screencast_enabled: { type: bool, default: false }, + camera_enabled: { type: bool, default: false }, + rnnoise: { type: bool, default: true, allow_url: true }, + native_noise_suppression: { type: bool, default: false }, + microphone_gain: { type: number, default: 1 }, + video_fps: { type: number }, + video_resolution: { type: number }, + camera_facing_mode: { type: optional(string), possible_values: ["environment", "user"] }, + auto_gain_control: { type: bool }, + echo_cancellation: { type: bool, allow_url: true }, + audio_activity_threshold: { type: number, optional: true, default: 0.003 }, // TODO differenciate between mic, cam and screen - optional_audio_default_enable: { type: bool, default: true, description: "Enable audio tracks by default" }, - optional_video_default_enable: { type: bool, default: false, description: "Enable video tracks by default" }, + optional_audio_default_enable: { type: bool, default: true }, + optional_video_default_enable: { type: bool, default: false }, - notify_chat: { type: bool, default: true, description: "Send notifications for incoming chat messages", allow_url: true }, - notify_join: { type: bool, default: true, description: "Send notifications when users join", allow_url: true }, - notify_leave: { type: bool, default: true, description: "Send notifications when users leave", allow_url: true }, + notify_chat: { type: bool, default: true, allow_url: true }, + notify_join: { type: bool, default: true, allow_url: true }, + notify_leave: { type: bool, default: true, allow_url: true }, - enable_onbeforeunload: { type: bool, default: true, description: "Prompt for confirmation when leaving the site while local resources are active" }, - room_watches: { type: string, default: "[]", hidden: true, description: "Known rooms (as semicolon seperated list of name=secret pairs)" } + enable_onbeforeunload: { type: bool, default: true }, + room_watches: { type: string, default: "[]", hidden: true } } diff --git a/client-web/source/preferences/mod.ts b/client-web/source/preferences/mod.ts index 49cd20f..1df57b1 100644 --- a/client-web/source/preferences/mod.ts +++ b/client-web/source/preferences/mod.ts @@ -10,7 +10,6 @@ import { PREF_DECLS } from "./decl.ts"; export interface PrefDecl<T> { default?: T, type: T, - description?: string, possible_values?: T[] optional?: boolean, hidden?: boolean diff --git a/client-web/source/preferences/ui.ts b/client-web/source/preferences/ui.ts index 47f3a4b..1be4458 100644 --- a/client-web/source/preferences/ui.ts +++ b/client-web/source/preferences/ui.ts @@ -18,7 +18,6 @@ export function ui_preferences(): HTMLElement { if (decl.possible_values) { const sel = document.createElement("select") sel.id = id - sel.value = JSON.stringify(PREFS[key]) for (const v of decl.possible_values) { const opt = document.createElement("option") opt.value = opt.textContent = JSON.stringify(v ?? null) @@ -28,6 +27,7 @@ export function ui_preferences(): HTMLElement { change_pref(key, JSON.parse(sel.value) ?? undefined) } on_pref_changed(key, () => sel.value = JSON.stringify(PREFS[key] ?? null)) + sel.value = JSON.stringify(PREFS[key]) prim_control = sel } else if (typeof decl.type == "boolean") { const checkbox = document.createElement("input") @@ -79,7 +79,7 @@ export function ui_preferences(): HTMLElement { use_opt_ = use_opt; } - const label = e("label", { for: id }, decl.description ?? `[${key}]`) + const label = e("label", { for: id }, PO.setting_descs[key] ?? `[${key}]`) return e("tr", { class: "pref" }, e("td", {}, label), e("td", {}, use_opt_ ?? ""), e("td", {}, prim_control ?? "")) }) |