diff --git a/ChangeLog.md b/ChangeLog.md index 119036c9..02071dbb 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ - Rendering the server icon - Changing the favicon according to the clients status - Aborting all replaying audio streams when client mutes himself + - Fixed issue [#139](https://github.com/TeaSpeak/TeaWeb/issues/139) * **17.09.20** - Added a settings registry and some minor bug fixing diff --git a/shared/img/client-icons/client_hide.svg b/shared/img/client-icons/client_hide.svg deleted file mode 100644 index f99b82bc..00000000 --- a/shared/img/client-icons/client_hide.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/shared/img/client-icons/client_show.svg b/shared/img/client-icons/client_show.svg deleted file mode 100644 index b1e3ad60..00000000 --- a/shared/img/client-icons/client_show.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/shared/img/client-icons/teaspeak_logo.svg b/shared/img/client-icons/teaspeak_logo.svg new file mode 100644 index 00000000..92f46cc6 --- /dev/null +++ b/shared/img/client-icons/teaspeak_logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/shared/img/favicon/speaking.png b/shared/img/favicon/speaking.png deleted file mode 100644 index 832c9752..00000000 Binary files a/shared/img/favicon/speaking.png and /dev/null differ diff --git a/shared/js/tree/Client.ts b/shared/js/tree/Client.ts index 197cade4..8f235e5a 100644 --- a/shared/js/tree/Client.ts +++ b/shared/js/tree/Client.ts @@ -154,6 +154,7 @@ export interface ClientEvents extends ChannelTreeEntryEvents { notify_mute_state_change: { muted: boolean } notify_speak_state_change: { speaking: boolean }, notify_audio_level_changed: { newValue: number }, + notify_status_icon_changed: { newIcon: ClientIcon }, music_status_update: { player_buffered_index: number, @@ -170,6 +171,16 @@ export interface ClientEvents extends ChannelTreeEntryEvents { playlist_song_loaded: { song_id: number, success: boolean, error_msg?: string, metadata?: string }, } +const StatusIconUpdateKeys: (keyof ClientProperties)[] = [ + "client_away", + "client_input_hardware", + "client_output_hardware", + "client_output_muted", + "client_input_muted", + "client_is_channel_commander", + "client_talk_power" +]; + export class ClientEntry extends ChannelTreeEntry { readonly events: Registry; readonly view: React.RefObject = React.createRef(); @@ -207,6 +218,16 @@ export class ClientEntry extends ChannelTreeEntry { this._channel = null; this.voiceCallbackStateChanged = this.handleVoiceStateChange.bind(this); + + this.events.on(["notify_speak_state_change", "notify_mute_state_change"], () => this.events.fire_async("notify_status_icon_changed", { newIcon: this.getStatusIcon() })); + this.events.on("notify_properties_updated", event => { + for (const key of StatusIconUpdateKeys) { + if (key in event.updated_properties) { + this.events.fire_async("notify_status_icon_changed", { newIcon: this.getStatusIcon() }) + return; + } + } + }); } destroy() { @@ -218,6 +239,7 @@ export class ClientEntry extends ChannelTreeEntry { } this._channel = undefined; + this.events.destroy(); } setVoiceClient(handle: VoiceClient) { @@ -596,8 +618,6 @@ export class ClientEntry extends ChannelTreeEntry { callback: () => { createInputModal(tr("Change client description"), tr("New description:
"), () => true, result => { if(typeof(result) === "string") { - //TODO tr - console.log("Changing " + this.clientNickName() + "'s description to " + result); this.channelTree.client.serverConnection.send_command("clientedit", { clid: this.clientId(), client_description: result diff --git a/shared/svg-sprites/client-icons.d.ts b/shared/svg-sprites/client-icons.d.ts index d6d53744..bd13164f 100644 --- a/shared/svg-sprites/client-icons.d.ts +++ b/shared/svg-sprites/client-icons.d.ts @@ -3,9 +3,9 @@ * * This file has been auto generated by the svg-sprite generator. * Sprite source directory: D:\TeaSpeak\web\shared\img\client-icons - * Sprite count: 202 + * Sprite count: 201 */ -export type ClientIconClass = "client-about" | "client-activate_microphone" | "client-add" | "client-add_foe" | "client-add_folder" | "client-add_friend" | "client-addon-collection" | "client-addon" | "client-apply" | "client-arrow_down" | "client-arrow_left" | "client-arrow_right" | "client-arrow_up" | "client-away" | "client-ban_client" | "client-ban_list" | "client-bookmark_add" | "client-bookmark_add_folder" | "client-bookmark_duplicate" | "client-bookmark_manager" | "client-bookmark_remove" | "client-broken_image" | "client-browse-addon-online" | "client-capture" | "client-change_nickname" | "client-changelog" | "client-channel_chat" | "client-channel_collapse_all" | "client-channel_commander" | "client-channel_create" | "client-channel_create_sub" | "client-channel_default" | "client-channel_delete" | "client-channel_edit" | "client-channel_expand_all" | "client-channel_green" | "client-channel_green_subscribed" | "client-channel_green_subscribed2" | "client-channel_private" | "client-channel_red" | "client-channel_red_subscribed" | "client-channel_switch" | "client-channel_unsubscribed" | "client-channel_yellow" | "client-channel_yellow_subscribed" | "client-check_update" | "client-client_hide" | "client-client_show" | "client-close_button" | "client-complaint_list" | "client-conflict-icon" | "client-connect" | "client-contact" | "client-copy" | "client-copy_url" | "client-d_sound" | "client-d_sound_me" | "client-d_sound_user" | "client-default" | "client-default_for_all_bookmarks" | "client-delete" | "client-delete_avatar" | "client-disconnect" | "client-down" | "client-download" | "client-edit" | "client-edit_friend_foe_status" | "client-emoticon" | "client-error" | "client-file_home" | "client-file_refresh" | "client-filetransfer" | "client-find" | "client-folder" | "client-folder_up" | "client-group_100" | "client-group_200" | "client-group_300" | "client-group_500" | "client-group_600" | "client-guisetup" | "client-hardware_input_muted" | "client-hardware_output_muted" | "client-home" | "client-hoster_button" | "client-hotkeys" | "client-icon-pack" | "client-iconsview" | "client-iconviewer" | "client-identity_default" | "client-identity_export" | "client-identity_import" | "client-identity_manager" | "client-info" | "client-input_muted" | "client-input_muted_local" | "client-invite_buddy" | "client-is_talker" | "client-kick_channel" | "client-kick_server" | "client-listview" | "client-loading_image" | "client-message_incoming" | "client-message_info" | "client-message_outgoing" | "client-messages" | "client-microphone_broken" | "client-minimize_button" | "client-moderated" | "client-move_client_to_own_channel" | "client-music" | "client-new_chat" | "client-notifications" | "client-offline_messages" | "client-on_whisperlist" | "client-output_muted" | "client-permission_channel" | "client-permission_client" | "client-permission_overview" | "client-permission_server_groups" | "client-phoneticsnickname" | "client-ping_1" | "client-ping_2" | "client-ping_3" | "client-ping_4" | "client-ping_calculating" | "client-ping_disconnected" | "client-play" | "client-player_chat" | "client-player_commander_off" | "client-player_commander_on" | "client-player_off" | "client-player_on" | "client-player_whisper" | "client-plugins" | "client-poke" | "client-present" | "client-recording_start" | "client-recording_stop" | "client-refresh" | "client-register" | "client-reload" | "client-remove_foe" | "client-remove_friend" | "client-security" | "client-selectfolder" | "client-send_complaint" | "client-server_green" | "client-server_log" | "client-server_query" | "client-settings" | "client-sort_by_name" | "client-sound-pack" | "client-soundpack" | "client-stop" | "client-subscribe_mode" | "client-subscribe_to_all_channels" | "client-subscribe_to_channel" | "client-subscribe_to_channel_family" | "client-switch_advanced" | "client-switch_standard" | "client-sync-disable" | "client-sync-enable" | "client-sync-icon" | "client-tab_close_button" | "client-talk_power_grant" | "client-talk_power_grant_next" | "client-talk_power_request" | "client-talk_power_request_cancel" | "client-talk_power_revoke" | "client-talk_power_revoke_all_grant_next" | "client-temp_server_password" | "client-temp_server_password_add" | "client-textformat" | "client-textformat_bold" | "client-textformat_foreground" | "client-textformat_italic" | "client-textformat_underline" | "client-theme" | "client-toggle_server_query_clients" | "client-toggle_whisper" | "client-token" | "client-token_use" | "client-translation" | "client-unsubscribe_from_all_channels" | "client-unsubscribe_from_channel_family" | "client-unsubscribe_mode" | "client-up" | "client-upload" | "client-upload_avatar" | "client-urlcatcher" | "client-user-account" | "client-virtualserver_edit" | "client-volume" | "client-w2g" | "client-warning" | "client-warning_external_link" | "client-warning_info" | "client-warning_question" | "client-weblist" | "client-whisper" | "client-whisperlists"; +export type ClientIconClass = "client-about" | "client-activate_microphone" | "client-add" | "client-add_foe" | "client-add_folder" | "client-add_friend" | "client-addon-collection" | "client-addon" | "client-apply" | "client-arrow_down" | "client-arrow_left" | "client-arrow_right" | "client-arrow_up" | "client-away" | "client-ban_client" | "client-ban_list" | "client-bookmark_add" | "client-bookmark_add_folder" | "client-bookmark_duplicate" | "client-bookmark_manager" | "client-bookmark_remove" | "client-broken_image" | "client-browse-addon-online" | "client-capture" | "client-change_nickname" | "client-changelog" | "client-channel_chat" | "client-channel_collapse_all" | "client-channel_commander" | "client-channel_create" | "client-channel_create_sub" | "client-channel_default" | "client-channel_delete" | "client-channel_edit" | "client-channel_expand_all" | "client-channel_green" | "client-channel_green_subscribed" | "client-channel_green_subscribed2" | "client-channel_private" | "client-channel_red" | "client-channel_red_subscribed" | "client-channel_switch" | "client-channel_unsubscribed" | "client-channel_yellow" | "client-channel_yellow_subscribed" | "client-check_update" | "client-close_button" | "client-complaint_list" | "client-conflict-icon" | "client-connect" | "client-contact" | "client-copy" | "client-copy_url" | "client-d_sound" | "client-d_sound_me" | "client-d_sound_user" | "client-default" | "client-default_for_all_bookmarks" | "client-delete" | "client-delete_avatar" | "client-disconnect" | "client-down" | "client-download" | "client-edit" | "client-edit_friend_foe_status" | "client-emoticon" | "client-error" | "client-file_home" | "client-file_refresh" | "client-filetransfer" | "client-find" | "client-folder" | "client-folder_up" | "client-group_100" | "client-group_200" | "client-group_300" | "client-group_500" | "client-group_600" | "client-guisetup" | "client-hardware_input_muted" | "client-hardware_output_muted" | "client-home" | "client-hoster_button" | "client-hotkeys" | "client-icon-pack" | "client-iconsview" | "client-iconviewer" | "client-identity_default" | "client-identity_export" | "client-identity_import" | "client-identity_manager" | "client-info" | "client-input_muted" | "client-input_muted_local" | "client-invite_buddy" | "client-is_talker" | "client-kick_channel" | "client-kick_server" | "client-listview" | "client-loading_image" | "client-message_incoming" | "client-message_info" | "client-message_outgoing" | "client-messages" | "client-microphone_broken" | "client-minimize_button" | "client-moderated" | "client-move_client_to_own_channel" | "client-music" | "client-new_chat" | "client-notifications" | "client-offline_messages" | "client-on_whisperlist" | "client-output_muted" | "client-permission_channel" | "client-permission_client" | "client-permission_overview" | "client-permission_server_groups" | "client-phoneticsnickname" | "client-ping_1" | "client-ping_2" | "client-ping_3" | "client-ping_4" | "client-ping_calculating" | "client-ping_disconnected" | "client-play" | "client-player_chat" | "client-player_commander_off" | "client-player_commander_on" | "client-player_off" | "client-player_on" | "client-player_whisper" | "client-plugins" | "client-poke" | "client-present" | "client-recording_start" | "client-recording_stop" | "client-refresh" | "client-register" | "client-reload" | "client-remove_foe" | "client-remove_friend" | "client-security" | "client-selectfolder" | "client-send_complaint" | "client-server_green" | "client-server_log" | "client-server_query" | "client-settings" | "client-sort_by_name" | "client-sound-pack" | "client-soundpack" | "client-stop" | "client-subscribe_mode" | "client-subscribe_to_all_channels" | "client-subscribe_to_channel" | "client-subscribe_to_channel_family" | "client-switch_advanced" | "client-switch_standard" | "client-sync-disable" | "client-sync-enable" | "client-sync-icon" | "client-tab_close_button" | "client-talk_power_grant" | "client-talk_power_grant_next" | "client-talk_power_request" | "client-talk_power_request_cancel" | "client-talk_power_revoke" | "client-talk_power_revoke_all_grant_next" | "client-teaspeak_logo" | "client-temp_server_password" | "client-temp_server_password_add" | "client-textformat" | "client-textformat_bold" | "client-textformat_foreground" | "client-textformat_italic" | "client-textformat_underline" | "client-theme" | "client-toggle_server_query_clients" | "client-toggle_whisper" | "client-token" | "client-token_use" | "client-translation" | "client-unsubscribe_from_all_channels" | "client-unsubscribe_from_channel_family" | "client-unsubscribe_mode" | "client-up" | "client-upload" | "client-upload_avatar" | "client-urlcatcher" | "client-user-account" | "client-virtualserver_edit" | "client-volume" | "client-w2g" | "client-warning" | "client-warning_external_link" | "client-warning_info" | "client-warning_question" | "client-weblist" | "client-whisper" | "client-whisperlists"; export enum ClientIcon { About = "client-about", @@ -54,8 +54,6 @@ export enum ClientIcon { ChannelYellow = "client-channel_yellow", ChannelYellowSubscribed = "client-channel_yellow_subscribed", CheckUpdate = "client-check_update", - ClientHide = "client-client_hide", - ClientShow = "client-client_show", CloseButton = "client-close_button", ComplaintList = "client-complaint_list", ConflictIcon = "client-conflict-icon", @@ -179,6 +177,7 @@ export enum ClientIcon { TalkPowerRequestCancel = "client-talk_power_request_cancel", TalkPowerRevoke = "client-talk_power_revoke", TalkPowerRevokeAllGrantNext = "client-talk_power_revoke_all_grant_next", + TeaspeakLogo = "client-teaspeak_logo", TempServerPassword = "client-temp_server_password", TempServerPasswordAdd = "client-temp_server_password_add", Textformat = "client-textformat", diff --git a/web/app/ui/FaviconRenderer.tsx b/web/app/ui/FaviconRenderer.tsx index 46fb0e69..c08f549c 100644 --- a/web/app/ui/FaviconRenderer.tsx +++ b/web/app/ui/FaviconRenderer.tsx @@ -2,9 +2,8 @@ import * as loader from "tc-loader"; import {Stage} from "tc-loader"; import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import * as React from "react"; -import {useState} from "react"; import * as ReactDOM from "react-dom"; -import {ClientStatusIndicator} from "tc-shared/ui/tree/Client"; +import {useState} from "react"; import {server_connections} from "tc-shared/ConnectionManager"; import { @@ -67,12 +66,11 @@ const HandlerFaviconRenderer = (props: { connection: ConnectionHandler }) => { const [ showClientStatus, setShowClientStatus ] = useState(props.connection.connection_state === ConnectionState.CONNECTED); props.connection.events().reactUse("notify_connection_state_changed", event => setShowClientStatus(event.new_state === ConnectionState.CONNECTED)); + const [ statusIcon, setStatusIcon ] = useState(props.connection.getClient().getStatusIcon()); + props.connection.getClient().events.reactUse("notify_status_icon_changed", event => setStatusIcon(event.newIcon)); + if(showClientStatus) { - return } - key={"server"} - />; + return ; } else { return ; } diff --git a/web/audio-lib/src/lib.rs b/web/audio-lib/src/lib.rs index 6bb92f73..576bdc17 100644 --- a/web/audio-lib/src/lib.rs +++ b/web/audio-lib/src/lib.rs @@ -52,7 +52,6 @@ pub fn audio_client_create() -> AudioClientId { client.client_id } -/// Let the audio client say hi (mutable). /// If an error occurs or the client isn't known an exception will be thrown. #[wasm_bindgen] pub fn audio_client_enqueue_buffer(client_id: AudioClientId, buffer: &[u8], packet_id: u16, codec: u8, is_head_packet: bool) -> Result<(), JsValue> {