aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/preferences/decl.ts
blob: 922e7ab414bb33ff580ce3edf4dd59448b70c17b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
    This file is part of keks-meet (https://codeberg.org/metamuffin/keks-meet)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2024 metamuffin <metamuffin.org>
*/

// TODO move this somewhere else
export const LANGS = ["en", "de", "et"]

export function hex_id(len = 8): string {
    if (len > 8) return hex_id() + hex_id(len - 8)
    return Math.floor(Math.random() * 16 ** len).toString(16).padStart(len, "0")
}

// TODO this could be simpler
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(), allow_url: true },
    language: { type: string, possible_values: ["system", ...LANGS], default: "system", allow_url: true },

    /* MEDIA */
    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"] },
    screencast_audio: { type: bool, default: false },
    auto_gain_control: { type: bool },
    echo_cancellation: { type: bool, allow_url: true },
    audio_activity_threshold: { type: number, optional: true, default: 0.003 },
    image_view_popup: { type: bool, default: true },
    microphone_enabled: { type: bool, default: false },
    screencast_enabled: { type: bool, default: false },
    camera_enabled: { type: bool, default: false },
    send_previews: { type: bool, default: true },
    preview_resolution: { type: number, default: 256, min: 16, max: 512 },
    preview_rate: { type: number, default: 8, min: 1, max: 60 },
    preview_encoding_quality: { type: number, default: 80, min: 10, max: 100 },

    // TODO differenciate between mic, cam and screen
    optional_audio_default_enable: { type: bool, default: true },
    optional_video_default_enable: { type: bool, default: false },

    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 },
    webrtc_debug: { type: bool, default: false },
    show_log: { type: bool, default: false },

    warn_redirect: { type: bool, hidden: true, default: false, allow_url: true },
    room_watches: { type: string, default: "[]", hidden: true },
}