From 48b53e9de51061c2e3c3bdf6a262056bf19668eb Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 1 May 2021 23:38:36 +0200 Subject: [PATCH] Updates --- imports/shared-app/ConnectionHandler.d.ts | 10 +- .../connection/AbstractCommandHandler.d.ts | 18 +- .../shared-app/connection/ConnectionBase.d.ts | 7 +- .../connection/VideoConnection.d.ts | 13 + .../shared-app/connection/rtc/Connection.d.ts | 1 + .../shared-app/connection/rtc/SdpUtils.d.ts | 1 + .../i18n/{country.d.ts => CountryFlag.d.ts} | 0 imports/shared-app/i18n/Repository.d.ts | 26 ++ imports/shared-app/i18n/Translation.d.ts | 18 ++ imports/shared-app/i18n/localize.d.ts | 6 +- .../text/bbcode/YoutubeRenderer.d.ts | 2 +- imports/shared-app/text/bbcode/renderer.d.ts | 2 +- imports/shared-app/text/bbcode/url.d.ts | 2 +- imports/shared-app/tree/Channel.d.ts | 12 +- .../shared-app/tree/ChannelDefinitions.d.ts | 13 + imports/shared-app/tree/Client.d.ts | 3 +- imports/shared-app/tree/Server.d.ts | 87 +----- .../shared-app/tree/ServerDefinitions.d.ts | 108 +++++++ imports/shared-app/ui/elements/Modal.d.ts | 6 +- imports/shared-app/ui/elements/NetGraph.d.ts | 60 ++-- imports/shared-app/ui/elements/Tab.d.ts | 2 +- .../ui/frames/HostBannerController.d.ts | 2 +- .../ui/frames/HostBannerRenderer.d.ts | 1 + imports/shared-app/ui/frames/chat.d.ts | 11 +- .../ui/frames/video/Definitions.d.ts | 10 +- .../shared-app/ui/frames/video/Renderer.d.ts | 2 +- imports/shared-app/ui/modal/ModalAbout.d.ts | 1 - .../ui/modal/ModalChangeVolumeNew.d.ts | 4 +- .../shared-app/ui/modal/ModalChannelInfo.d.ts | 2 - .../shared-app/ui/modal/ModalServerInfo.d.ts | 2 - .../ui/modal/ModalServerInfoBandwidth.d.ts | 9 - imports/shared-app/ui/modal/ModalYesNo.d.ts | 6 - .../ui/modal/channel-edit/Controller.d.ts | 2 +- .../ui/modal/channel-info/Controller.d.ts | 2 + .../ui/modal/channel-info/Definitions.d.ts | 33 ++ .../ui/modal/channel-info/Renderer.d.ts | 14 + .../ui/modal/server-bandwidth/Controller.d.ts | 2 + .../modal/server-bandwidth/Definitions.d.ts | 6 + .../ui/modal/server-bandwidth/Renderer.d.ts | 12 + .../ui/modal/server-info/Controller.d.ts | 2 + .../ui/modal/server-info/Definitions.d.ts | 32 ++ .../ui/modal/server-info/Renderer.d.ts | 14 + .../ui/modal/settings/Heighlight.d.ts | 4 +- .../ui/modal/video-viewers/Controller.d.ts | 2 + .../ui/modal/video-viewers/Definitions.d.ts | 19 ++ .../ui/modal/video-viewers/Renderer.d.ts | 14 + .../ui/modal/yes-no/Controller.d.ts | 8 + .../ui/modal/yes-no/Definitions.d.ts | 11 + .../shared-app/ui/modal/yes-no/Renderer.d.ts | 14 + .../shared-app/ui/react-elements/Arrow.d.ts | 2 +- .../shared-app/ui/react-elements/Avatar.d.ts | 2 +- .../ui/react-elements/ErrorBoundary.d.ts | 2 +- .../ui/react-elements/FontSize.d.ts | 2 +- .../shared-app/ui/react-elements/Icon.d.ts | 4 +- .../ui/react-elements/InputField.d.ts | 14 +- .../ui/react-elements/RadioButton.d.ts | 2 +- .../shared-app/ui/react-elements/Tooltip.d.ts | 12 +- .../ui/react-elements/i18n/index.d.ts | 2 +- .../ui/react-elements/modal/Definitions.d.ts | 92 +++++- .../ui/react-elements/modal/Renderer.d.ts | 2 +- .../ui/tree/RendererDataProvider.d.ts | 2 - .../shared-app/ui/tree/RendererTreeEntry.d.ts | 3 - imports/shared-app/ui/utils/Variable.d.ts | 2 + imports/svg-sprites/country-flags.d.ts | 286 ++++++++++++++++++ installer/build.ts | 4 +- modules/core/main.ts | 33 +- modules/core/ui-loader/Loader.ts | 2 +- .../renderer/connection/ServerConnection.ts | 11 +- modules/tsconfig_main.json | 3 +- modules/tsconfig_renderer.json | 1 + native/serverconnection/test/js/audio.ts | 2 +- native/updater/logger.cpp | 7 +- native/updater/util.cpp | 49 +-- package-lock.json | 29 +- package.json | 2 +- 75 files changed, 926 insertions(+), 284 deletions(-) rename imports/shared-app/i18n/{country.d.ts => CountryFlag.d.ts} (100%) create mode 100644 imports/shared-app/i18n/Repository.d.ts create mode 100644 imports/shared-app/i18n/Translation.d.ts create mode 100644 imports/shared-app/tree/ChannelDefinitions.d.ts create mode 100644 imports/shared-app/tree/ServerDefinitions.d.ts delete mode 100644 imports/shared-app/ui/modal/ModalAbout.d.ts delete mode 100644 imports/shared-app/ui/modal/ModalChannelInfo.d.ts delete mode 100644 imports/shared-app/ui/modal/ModalServerInfo.d.ts delete mode 100644 imports/shared-app/ui/modal/ModalServerInfoBandwidth.d.ts delete mode 100644 imports/shared-app/ui/modal/ModalYesNo.d.ts create mode 100644 imports/shared-app/ui/modal/channel-info/Controller.d.ts create mode 100644 imports/shared-app/ui/modal/channel-info/Definitions.d.ts create mode 100644 imports/shared-app/ui/modal/channel-info/Renderer.d.ts create mode 100644 imports/shared-app/ui/modal/server-bandwidth/Controller.d.ts create mode 100644 imports/shared-app/ui/modal/server-bandwidth/Definitions.d.ts create mode 100644 imports/shared-app/ui/modal/server-bandwidth/Renderer.d.ts create mode 100644 imports/shared-app/ui/modal/server-info/Controller.d.ts create mode 100644 imports/shared-app/ui/modal/server-info/Definitions.d.ts create mode 100644 imports/shared-app/ui/modal/server-info/Renderer.d.ts create mode 100644 imports/shared-app/ui/modal/video-viewers/Controller.d.ts create mode 100644 imports/shared-app/ui/modal/video-viewers/Definitions.d.ts create mode 100644 imports/shared-app/ui/modal/video-viewers/Renderer.d.ts create mode 100644 imports/shared-app/ui/modal/yes-no/Controller.d.ts create mode 100644 imports/shared-app/ui/modal/yes-no/Definitions.d.ts create mode 100644 imports/shared-app/ui/modal/yes-no/Renderer.d.ts create mode 100644 imports/svg-sprites/country-flags.d.ts diff --git a/imports/shared-app/ConnectionHandler.d.ts b/imports/shared-app/ConnectionHandler.d.ts index 9b8a464..f30a7c7 100644 --- a/imports/shared-app/ConnectionHandler.d.ts +++ b/imports/shared-app/ConnectionHandler.d.ts @@ -1,9 +1,7 @@ import { AbstractServerConnection } from "./connection/ConnectionBase"; import { PermissionManager } from "./permission/PermissionManager"; import { GroupManager } from "./permission/GroupManager"; -import { ServerSettings } from "./settings"; import { SoundManager } from "./audio/Sounds"; -import { ConnectionProfile } from "./profiles/ConnectionProfile"; import { RecorderProfile } from "./voice/RecorderProfile"; import { Registry } from "./events"; import { FileManager } from "./file/FileManager"; @@ -19,6 +17,7 @@ import { SideBarManager } from "tc-shared/SideBarManager"; import { ServerEventLog } from "tc-shared/connectionlog/ServerEventLog"; import { PlaylistManager } from "tc-shared/music/PlaylistManager"; import { ConnectParameters } from "tc-shared/ui/modal/connect/Controller"; +import { ServerSettings } from "tc-shared/ServerSettings"; export declare enum InputHardwareState { MISSING = 0, START_FAILED = 1, @@ -113,7 +112,7 @@ export declare class ConnectionHandler { private localClientId; private localClient; private autoReconnectTimer; - private autoReconnectAttempt; + private isReconnectAttempt; private connectAttemptId; private echoTestRunning; private pluginCmdRegistry; @@ -124,8 +123,7 @@ export declare class ConnectionHandler { constructor(); initializeHandlerState(source?: ConnectionHandler): void; events(): Registry; - startConnectionNew(parameters: ConnectParameters, autoReconnectAttempt: boolean): Promise; - startConnection(addr: string, profile: ConnectionProfile, user_action: boolean, parameters: ConnectParametersOld): Promise; + startConnectionNew(parameters: ConnectParameters, isReconnectAttempt: boolean): Promise; disconnectFromServer(reason?: string): Promise; getClient(): LocalClientEntry; getClientId(): number; @@ -154,7 +152,7 @@ export declare class ConnectionHandler { message: string; }>; getVoiceRecorder(): RecorderProfile | undefined; - reconnect_properties(profile?: ConnectionProfile): ConnectParametersOld; + generateReconnectParameters(): ConnectParameters | undefined; private initializeWhisperSession; destroy(): void; setMicrophoneMuted(muted: boolean, dontPlaySound?: boolean): void; diff --git a/imports/shared-app/connection/AbstractCommandHandler.d.ts b/imports/shared-app/connection/AbstractCommandHandler.d.ts index 4df579f..cbaba1e 100644 --- a/imports/shared-app/connection/AbstractCommandHandler.d.ts +++ b/imports/shared-app/connection/AbstractCommandHandler.d.ts @@ -10,22 +10,22 @@ export declare abstract class AbstractCommandHandler { */ abstract handle_command(command: ServerCommand): boolean; } -export declare type ExplicitCommandHandler = (command: ServerCommand, consumed: boolean) => void | boolean; +export declare type CommandHandlerCallback = (command: ServerCommand, consumed: boolean) => void | boolean; export declare abstract class AbstractCommandHandlerBoss { readonly connection: AbstractServerConnection; protected command_handlers: AbstractCommandHandler[]; protected single_command_handler: SingleCommandHandler[]; protected explicitHandlers: { - [key: string]: ExplicitCommandHandler[]; + [key: string]: CommandHandlerCallback[]; }; protected constructor(connection: AbstractServerConnection); destroy(): void; - register_explicit_handler(command: string, callback: ExplicitCommandHandler): () => void; - unregister_explicit_handler(command: string, callback: ExplicitCommandHandler): boolean; - register_handler(handler: AbstractCommandHandler): void; - unregister_handler(handler: AbstractCommandHandler): void; - register_single_handler(handler: SingleCommandHandler): void; - remove_single_handler(handler: SingleCommandHandler): void; + registerCommandHandler(command: string, callback: CommandHandlerCallback): () => void; + unregisterCommandHandler(command: string, callback: CommandHandlerCallback): boolean; + registerHandler(handler: AbstractCommandHandler): void; + unregisterHandler(handler: AbstractCommandHandler): void; + registerSingleHandler(handler: SingleCommandHandler): void; + removeSingleHandler(handler: SingleCommandHandler): void; handlers(): AbstractCommandHandler[]; - invoke_handle(command: ServerCommand): boolean; + invokeCommand(command: ServerCommand): boolean; } diff --git a/imports/shared-app/connection/ConnectionBase.d.ts b/imports/shared-app/connection/ConnectionBase.d.ts index bc6dcf2..87ed6ce 100644 --- a/imports/shared-app/connection/ConnectionBase.d.ts +++ b/imports/shared-app/connection/ConnectionBase.d.ts @@ -43,7 +43,7 @@ export declare abstract class AbstractServerConnection { abstract getServerType(): "teaspeak" | "teamspeak" | "unknown"; abstract getVoiceConnection(): AbstractVoiceConnection; abstract getVideoConnection(): VideoConnection; - abstract command_handler_boss(): AbstractCommandHandlerBoss; + abstract getCommandHandler(): AbstractCommandHandlerBoss; abstract send_command(command: string, data?: any | any[], options?: CommandOptions): Promise; abstract remote_address(): ServerAddress; connectionProxyAddress(): ServerAddress | undefined; @@ -56,6 +56,11 @@ export declare abstract class AbstractServerConnection { export declare class ServerCommand { command: string; arguments: any[]; + switches: string[]; + constructor(command: string, payload: any[], switches: string[]); + getString(key: string, index?: number): string; + getInt(key: string, index?: number): number; + getUInt(key: string, index?: number): number; } export interface SingleCommandHandler { name?: string; diff --git a/imports/shared-app/connection/VideoConnection.d.ts b/imports/shared-app/connection/VideoConnection.d.ts index 3bfd979..c4bff90 100644 --- a/imports/shared-app/connection/VideoConnection.d.ts +++ b/imports/shared-app/connection/VideoConnection.d.ts @@ -73,11 +73,23 @@ export interface VideoClient { isBroadcastDismissed(broadcastType: VideoBroadcastType): boolean; showPip(broadcastType: VideoBroadcastType): Promise; } +export declare type VideoBroadcastViewer = { + clientId: number; + clientName: string; + clientUniqueId: string; + clientDatabaseId: number; +}; export interface LocalVideoBroadcastEvents { notify_state_changed: { oldState: LocalVideoBroadcastState; newState: LocalVideoBroadcastState; }; + notify_clients_joined: { + clients: VideoBroadcastViewer[]; + }; + notify_clients_left: { + clientIds: number[]; + }; } export declare type LocalVideoBroadcastState = { state: "stopped"; @@ -139,6 +151,7 @@ export interface LocalVideoBroadcast { changeSource(source: VideoSource, constraints: VideoBroadcastConfig): Promise; getConstraints(): VideoBroadcastConfig | undefined; stopBroadcasting(): any; + getViewer(): VideoBroadcastViewer[]; } export interface VideoConnection { getEvents(): Registry; diff --git a/imports/shared-app/connection/rtc/Connection.d.ts b/imports/shared-app/connection/rtc/Connection.d.ts index 4e773d6..50f2c2d 100644 --- a/imports/shared-app/connection/rtc/Connection.d.ts +++ b/imports/shared-app/connection/rtc/Connection.d.ts @@ -98,6 +98,7 @@ export declare class RTCConnection { reset(updateConnectionState: boolean): void; setTrackSource(type: RTCSourceTrackType, source: MediaStreamTrack | null): Promise; clearTrackSources(types: RTCSourceTrackType[]): Promise; + getTrackTypeFromSsrc(ssrc: number): RTCSourceTrackType | undefined; startVideoBroadcast(type: VideoBroadcastType, config: VideoBroadcastConfig): Promise; changeVideoBroadcastConfig(type: VideoBroadcastType, config: VideoBroadcastConfig): Promise; startAudioBroadcast(): Promise; diff --git a/imports/shared-app/connection/rtc/SdpUtils.d.ts b/imports/shared-app/connection/rtc/SdpUtils.d.ts index 4645d5d..45a54e3 100644 --- a/imports/shared-app/connection/rtc/SdpUtils.d.ts +++ b/imports/shared-app/connection/rtc/SdpUtils.d.ts @@ -7,6 +7,7 @@ export declare class SdpProcessor { reset(): void; getRemoteSsrcFromFromMediaId(mediaId: string): number | undefined; getLocalSsrcFromFromMediaId(mediaId: string): number | undefined; + getLocalMediaIdFromSsrc(ssrc: number): string | undefined; processIncomingSdp(sdpString: string, _mode: "offer" | "answer"): string; processOutgoingSdp(sdpString: string, _mode: "offer" | "answer"): string; private static generateRtpSSrcMapping; diff --git a/imports/shared-app/i18n/country.d.ts b/imports/shared-app/i18n/CountryFlag.d.ts similarity index 100% rename from imports/shared-app/i18n/country.d.ts rename to imports/shared-app/i18n/CountryFlag.d.ts diff --git a/imports/shared-app/i18n/Repository.d.ts b/imports/shared-app/i18n/Repository.d.ts new file mode 100644 index 0000000..22f3747 --- /dev/null +++ b/imports/shared-app/i18n/Repository.d.ts @@ -0,0 +1,26 @@ +import { CountryFlag } from "svg-sprites/country-flags"; +import { AbstractTranslationResolver } from "tc-shared/i18n/Translation"; +export declare type I18NContributor = { + name: string; + email: string; +}; +export declare type TranslationResolverCreateResult = { + status: "success"; + resolver: AbstractTranslationResolver; +} | { + status: "error"; + message: string; +}; +export declare abstract class I18NTranslation { + abstract getId(): string; + abstract getName(): string; + abstract getCountry(): CountryFlag; + abstract getDescription(): string; + abstract getContributors(): I18NContributor[]; + abstract createTranslationResolver(): Promise; +} +export declare abstract class I18NRepository { + abstract getName(): string; + abstract getDescription(): string; + abstract getTranslations(): Promise; +} diff --git a/imports/shared-app/i18n/Translation.d.ts b/imports/shared-app/i18n/Translation.d.ts new file mode 100644 index 0000000..4034f98 --- /dev/null +++ b/imports/shared-app/i18n/Translation.d.ts @@ -0,0 +1,18 @@ +export declare abstract class AbstractTranslationResolver { + private translationCache; + protected constructor(); + /** + * Translate the target message. + * @param message + */ + translateMessage(message: string): any; + protected invalidateCache(): void; + /** + * Register a translation into the cache. + * @param message + * @param translation + * @protected + */ + protected registerTranslation(message: string, translation: string): void; + protected abstract resolveTranslation(message: string): string; +} diff --git a/imports/shared-app/i18n/localize.d.ts b/imports/shared-app/i18n/localize.d.ts index 2a9f13b..fa78f07 100644 --- a/imports/shared-app/i18n/localize.d.ts +++ b/imports/shared-app/i18n/localize.d.ts @@ -34,9 +34,8 @@ export interface TranslationRepository { load_timestamp?: number; } export declare function tr(message: string, key?: string): string; +export declare function trJQuery(message: string, ...args: any[]): JQuery[]; export declare function tra(message: string, ...args: (string | number | boolean)[]): string; -export declare function tra(message: string, ...args: any[]): JQuery[]; -export declare function traj(message: string, ...args: any[]): JQuery[]; export declare function load_file(url: string, path: string): Promise; export declare function load_repository(url: string): Promise; export declare namespace config { @@ -66,11 +65,8 @@ export declare function initializeI18N(): Promise; declare global { interface Window { tr(message: string): string; - tra(message: string, ...args: (string | number | boolean | null | undefined)[]): string; - tra(message: string, ...args: any[]): JQuery[]; log: any; StaticSettings: any; } const tr: typeof window.tr; - const tra: typeof window.tra; } diff --git a/imports/shared-app/text/bbcode/YoutubeRenderer.d.ts b/imports/shared-app/text/bbcode/YoutubeRenderer.d.ts index 407e022..08e4db7 100644 --- a/imports/shared-app/text/bbcode/YoutubeRenderer.d.ts +++ b/imports/shared-app/text/bbcode/YoutubeRenderer.d.ts @@ -1,6 +1,6 @@ import * as React from "react"; export declare const isYoutubeLink: (text: string) => boolean; export declare const YoutubeRenderer: (props: { - children?: React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>[]; + children?: React.ReactElement | React.ReactElement[]; url: string; }) => JSX.Element; diff --git a/imports/shared-app/text/bbcode/renderer.d.ts b/imports/shared-app/text/bbcode/renderer.d.ts index 5105a85..bc5d8aa 100644 --- a/imports/shared-app/text/bbcode/renderer.d.ts +++ b/imports/shared-app/text/bbcode/renderer.d.ts @@ -4,7 +4,7 @@ import ReactRenderer from "vendor/xbbcode/renderer/react"; import HTMLRenderer from "vendor/xbbcode/renderer/html"; import "./emoji"; import "./highlight"; -import "./YoutubeController"; +import "./YoutubeRenderer"; import "./url"; import "./image"; export declare let BBCodeHandlerContext: Context; diff --git a/imports/shared-app/text/bbcode/url.d.ts b/imports/shared-app/text/bbcode/url.d.ts index 75690f1..ff77819 100644 --- a/imports/shared-app/text/bbcode/url.d.ts +++ b/imports/shared-app/text/bbcode/url.d.ts @@ -1,6 +1,6 @@ /// export declare const SimpleUrlRenderer: (props: { target: string; - children: any; + children; }) => JSX.Element; export declare function fixupJQueryUrlTags(container: JQuery): void; diff --git a/imports/shared-app/tree/Channel.d.ts b/imports/shared-app/tree/Channel.d.ts index 7f21b08..ef9b678 100644 --- a/imports/shared-app/tree/Channel.d.ts +++ b/imports/shared-app/tree/Channel.d.ts @@ -5,6 +5,7 @@ import { Registry } from "../events"; import { ChannelTreeEntry, ChannelTreeEntryEvents } from "./ChannelTreeEntry"; import { ClientIcon } from "svg-sprites/client-icons"; import { EventChannelData } from "tc-shared/connectionlog/Definitions"; +import { ChannelDescriptionResult } from "tc-shared/tree/ChannelDefinitions"; export declare enum ChannelType { PERMANENT = 0, SEMI_PERMANENT = 1, @@ -96,22 +97,23 @@ export declare class ChannelEntry extends ChannelTreeEntry { private _family_index; private _destroyed; private cachedPasswordHash; - private channelDescriptionCached; + private channelDescriptionCacheTimestamp; private channelDescriptionCallback; private channelDescriptionPromise; private collapsed; private subscribed; private subscriptionMode; - private client_list; + private clientList; private readonly clientPropertyChangedListener; constructor(channelTree: ChannelTree, channelId: number, channelName: string); destroy(): void; channelName(): string; channelDepth(): number; formattedChannelName(): string; - getChannelDescription(): Promise; + clearDescriptionCache(): void; + getChannelDescription(ignoreCache: boolean): Promise; + private doGetChannelDescriptionNew; isDescriptionCached(): boolean; - private doGetChannelDescription; registerClient(client: ClientEntry): void; unregisterClient(client: ClientEntry, noEvent?: boolean): void; private reorderClientList; @@ -128,7 +130,7 @@ export declare class ChannelEntry extends ChannelTreeEntry { value: string; }[]): void; generateBBCode(): string; - channelType(): ChannelType; + getChannelType(): ChannelType; joinChannel(ignorePasswordFlag?: boolean): Promise; requestChannelPassword(ignorePermission: PermissionType): Promise<{ hash: string; diff --git a/imports/shared-app/tree/ChannelDefinitions.d.ts b/imports/shared-app/tree/ChannelDefinitions.d.ts new file mode 100644 index 0000000..be5a6ca --- /dev/null +++ b/imports/shared-app/tree/ChannelDefinitions.d.ts @@ -0,0 +1,13 @@ +export declare type ChannelDescriptionResult = { + status: "success"; + description: string; + handlerId: string; +} | { + status: "empty"; +} | { + status: "no-permissions"; + failedPermission: string; +} | { + status: "error"; + message: string; +}; diff --git a/imports/shared-app/tree/Client.d.ts b/imports/shared-app/tree/Client.d.ts index 65729b4..8e2beb9 100644 --- a/imports/shared-app/tree/Client.d.ts +++ b/imports/shared-app/tree/Client.d.ts @@ -13,9 +13,9 @@ import { EventClient } from "tc-shared/connectionlog/Definitions"; export declare enum ClientType { CLIENT_VOICE = 0, CLIENT_QUERY = 1, - CLIENT_INTERNAL = 2, CLIENT_WEB = 3, CLIENT_MUSIC = 4, + CLIENT_TEASPEAK = 5, CLIENT_UNDEFINED = 5 } export declare class ClientProperties { @@ -184,6 +184,7 @@ export declare class ClientEntry ext set_connection_info(info: ClientConnectionInfo): void; setAudioVolume(value: number): void; getAudioVolume(): number; + getClientType(): ClientType; } export declare class LocalClientEntry extends ClientEntry { handle: ConnectionHandler; diff --git a/imports/shared-app/tree/Server.d.ts b/imports/shared-app/tree/Server.d.ts index bfce3f3..46d7e1d 100644 --- a/imports/shared-app/tree/Server.d.ts +++ b/imports/shared-app/tree/Server.d.ts @@ -2,83 +2,9 @@ import { ChannelTree } from "./ChannelTree"; import * as contextmenu from "../ui/elements/ContextMenu"; import { Registry } from "../events"; import { ChannelTreeEntry, ChannelTreeEntryEvents } from "./ChannelTreeEntry"; -export declare class ServerProperties { - virtualserver_host: string; - virtualserver_port: number; - virtualserver_name: string; - virtualserver_name_phonetic: string; - virtualserver_icon_id: number; - virtualserver_version: string; - virtualserver_platform: string; - virtualserver_unique_identifier: string; - virtualserver_clientsonline: number; - virtualserver_queryclientsonline: number; - virtualserver_channelsonline: number; - virtualserver_uptime: number; - virtualserver_created: number; - virtualserver_maxclients: number; - virtualserver_reserved_slots: number; - virtualserver_password: string; - virtualserver_flag_password: boolean; - virtualserver_ask_for_privilegekey: boolean; - virtualserver_welcomemessage: string; - virtualserver_hostmessage: string; - virtualserver_hostmessage_mode: number; - virtualserver_hostbanner_url: string; - virtualserver_hostbanner_gfx_url: string; - virtualserver_hostbanner_gfx_interval: number; - virtualserver_hostbanner_mode: number; - virtualserver_hostbutton_tooltip: string; - virtualserver_hostbutton_url: string; - virtualserver_hostbutton_gfx_url: string; - virtualserver_codec_encryption_mode: number; - virtualserver_default_music_group: number; - virtualserver_default_server_group: number; - virtualserver_default_channel_group: number; - virtualserver_default_channel_admin_group: number; - virtualserver_default_client_description: string; - virtualserver_default_channel_description: string; - virtualserver_default_channel_topic: string; - virtualserver_antiflood_points_tick_reduce: number; - virtualserver_antiflood_points_needed_command_block: number; - virtualserver_antiflood_points_needed_ip_block: number; - virtualserver_country_code: string; - virtualserver_complain_autoban_count: number; - virtualserver_complain_autoban_time: number; - virtualserver_complain_remove_time: number; - virtualserver_needed_identity_security_level: number; - virtualserver_weblist_enabled: boolean; - virtualserver_min_clients_in_channel_before_forced_silence: number; - virtualserver_channel_temp_delete_delay_default: number; - virtualserver_priority_speaker_dimm_modificator: number; - virtualserver_max_upload_total_bandwidth: number; - virtualserver_upload_quota: number; - virtualserver_max_download_total_bandwidth: number; - virtualserver_download_quota: number; - virtualserver_month_bytes_downloaded: number; - virtualserver_month_bytes_uploaded: number; - virtualserver_total_bytes_downloaded: number; - virtualserver_total_bytes_uploaded: number; -} -export interface ServerConnectionInfo { - connection_filetransfer_bandwidth_sent: number; - connection_filetransfer_bandwidth_received: number; - connection_filetransfer_bytes_sent_total: number; - connection_filetransfer_bytes_received_total: number; - connection_filetransfer_bytes_sent_month: number; - connection_filetransfer_bytes_received_month: number; - connection_packets_sent_total: number; - connection_bytes_sent_total: number; - connection_packets_received_total: number; - connection_bytes_received_total: number; - connection_bandwidth_sent_last_second_total: number; - connection_bandwidth_sent_last_minute_total: number; - connection_bandwidth_received_last_second_total: number; - connection_bandwidth_received_last_minute_total: number; - connection_connected_time: number; - connection_packetloss_total: number; - connection_ping: number; -} +import { HostBannerInfo } from "tc-shared/ui/frames/HostBannerDefinitions"; +import { ServerAudioEncryptionMode, ServerConnectionInfo, ServerConnectionInfoResult, ServerProperties } from "tc-shared/tree/ServerDefinitions"; +export * from "./ServerDefinitions"; export interface ServerAddress { host: string; port: number; @@ -90,6 +16,7 @@ export interface ServerEvents extends ChannelTreeEntryEvents { updated_properties: Partial; server_properties: ServerProperties; }; + notify_host_banner_updated: {}; } export declare class ServerEntry extends ChannelTreeEntry { remote_address: ServerAddress; @@ -99,6 +26,8 @@ export declare class ServerEntry extends ChannelTreeEntry { private info_request_promise; private info_request_promise_resolve; private info_request_promise_reject; + private requestInfoPromise; + private requestInfoPromiseTimestamp; private _info_connection_promise; private _info_connection_promise_timestamp; private _info_connection_promise_resolve; @@ -116,8 +45,12 @@ export declare class ServerEntry extends ChannelTreeEntry { }[]): void; updateProperties(): Promise; request_connection_info(): Promise; + requestConnectionInfo(): Promise; + private doRequestConnectionInfo; set_connection_info(info: ServerConnectionInfo): void; shouldUpdateProperties(): boolean; calculateUptime(): number; reset(): void; + generateHostBannerInfo(): HostBannerInfo; + getAudioEncryptionMode(): ServerAudioEncryptionMode; } diff --git a/imports/shared-app/tree/ServerDefinitions.d.ts b/imports/shared-app/tree/ServerDefinitions.d.ts new file mode 100644 index 0000000..8f52cf2 --- /dev/null +++ b/imports/shared-app/tree/ServerDefinitions.d.ts @@ -0,0 +1,108 @@ +export declare type ServerAudioEncryptionMode = "globally-on" | "globally-off" | "individual"; +export declare class ServerProperties { + virtualserver_host: string; + virtualserver_port: number; + virtualserver_name: string; + virtualserver_name_phonetic: string; + virtualserver_icon_id: number; + virtualserver_version: string; + virtualserver_platform: string; + virtualserver_unique_identifier: string; + virtualserver_clientsonline: number; + virtualserver_queryclientsonline: number; + virtualserver_channelsonline: number; + virtualserver_uptime: number; + virtualserver_created: number; + virtualserver_maxclients: number; + virtualserver_reserved_slots: number; + virtualserver_password: string; + virtualserver_flag_password: boolean; + virtualserver_ask_for_privilegekey: boolean; + virtualserver_welcomemessage: string; + virtualserver_hostmessage: string; + virtualserver_hostmessage_mode: number; + virtualserver_hostbanner_url: string; + virtualserver_hostbanner_gfx_url: string; + virtualserver_hostbanner_gfx_interval: number; + virtualserver_hostbanner_mode: number; + virtualserver_hostbutton_tooltip: string; + virtualserver_hostbutton_url: string; + virtualserver_hostbutton_gfx_url: string; + virtualserver_codec_encryption_mode: number; + virtualserver_default_music_group: number; + virtualserver_default_server_group: number; + virtualserver_default_channel_group: number; + virtualserver_default_channel_admin_group: number; + virtualserver_default_client_description: string; + virtualserver_default_channel_description: string; + virtualserver_default_channel_topic: string; + virtualserver_antiflood_points_tick_reduce: number; + virtualserver_antiflood_points_needed_command_block: number; + virtualserver_antiflood_points_needed_ip_block: number; + virtualserver_country_code: string; + virtualserver_complain_autoban_count: number; + virtualserver_complain_autoban_time: number; + virtualserver_complain_remove_time: number; + virtualserver_needed_identity_security_level: number; + virtualserver_weblist_enabled: boolean; + virtualserver_min_clients_in_channel_before_forced_silence: number; + virtualserver_channel_temp_delete_delay_default: number; + virtualserver_priority_speaker_dimm_modificator: number; + virtualserver_max_upload_total_bandwidth: number; + virtualserver_upload_quota: number; + virtualserver_max_download_total_bandwidth: number; + virtualserver_download_quota: number; + virtualserver_month_bytes_downloaded: number; + virtualserver_month_bytes_uploaded: number; + virtualserver_total_bytes_downloaded: number; + virtualserver_total_bytes_uploaded: number; +} +export declare const kServerConnectionInfoFields: { + connection_filetransfer_bandwidth_sent: string; + connection_filetransfer_bandwidth_received: string; + connection_filetransfer_bytes_sent_total: string; + connection_filetransfer_bytes_received_total: string; + connection_filetransfer_bytes_sent_month: string; + connection_filetransfer_bytes_received_month: string; + connection_packets_sent_total: string; + connection_bytes_sent_total: string; + connection_packets_received_total: string; + connection_bytes_received_total: string; + connection_bandwidth_sent_last_second_total: string; + connection_bandwidth_sent_last_minute_total: string; + connection_bandwidth_received_last_second_total: string; + connection_bandwidth_received_last_minute_total: string; + connection_connected_time: string; + connection_packetloss_total: string; + connection_ping: string; +}; +export interface ServerConnectionInfo { + connection_filetransfer_bandwidth_sent: number; + connection_filetransfer_bandwidth_received: number; + connection_filetransfer_bytes_sent_total: number; + connection_filetransfer_bytes_received_total: number; + connection_filetransfer_bytes_sent_month: number; + connection_filetransfer_bytes_received_month: number; + connection_packets_sent_total: number; + connection_bytes_sent_total: number; + connection_packets_received_total: number; + connection_bytes_received_total: number; + connection_bandwidth_sent_last_second_total: number; + connection_bandwidth_sent_last_minute_total: number; + connection_bandwidth_received_last_second_total: number; + connection_bandwidth_received_last_minute_total: number; + connection_connected_time: number; + connection_packetloss_total: number; + connection_ping: number; +} +export declare type ServerConnectionInfoResult = { + status: "success"; + result: ServerConnectionInfo; + resultCached: boolean; +} | { + status: "no-permission"; + failedPermission: string; +} | { + status: "error"; + message: string; +}; diff --git a/imports/shared-app/ui/elements/Modal.d.ts b/imports/shared-app/ui/elements/Modal.d.ts index df4fe87..21e2537 100644 --- a/imports/shared-app/ui/elements/Modal.d.ts +++ b/imports/shared-app/ui/elements/Modal.d.ts @@ -5,9 +5,9 @@ export declare enum ElementType { } export declare type BodyCreator = (() => JQuery | JQuery[] | string) | string | JQuery | JQuery[]; export declare const ModalFunctions: { - divify: (val: JQuery) => JQuery; - jqueriefy: (val: BodyCreator, type?: ElementType) => JQuery | JQuery[]; - warpProperties(data: any): ModalProperties; + divify: (val: JQuery) => JQuery; + jqueriefy: (val: BodyCreator, type?: ElementType) => JQuery[] | JQuery | undefined; + warpProperties(data: ModalProperties | any): ModalProperties; }; export declare class ModalProperties { template?: string; diff --git a/imports/shared-app/ui/elements/NetGraph.d.ts b/imports/shared-app/ui/elements/NetGraph.d.ts index 2cc3a10..8c4e840 100644 --- a/imports/shared-app/ui/elements/NetGraph.d.ts +++ b/imports/shared-app/ui/elements/NetGraph.d.ts @@ -5,19 +5,19 @@ export declare type Entry = { highlight?: boolean; }; export declare type Style = { - background_color: string; - separator_color: string; - separator_count: number; - separator_width: number; + backgroundColor: string; + separatorColor: string; + separatorCount: number; + separatorWidth: number; upload: { fill: string; stroke: string; - strike_width: number; + strokeWidth: number; }; download: { fill: string; stroke: string; - strike_width: number; + strokeWidth: number; }; }; export declare type TimeSpan = { @@ -33,33 +33,37 @@ export declare type TimeSpan = { }; }; export declare class Graph { - private static _loops; - readonly canvas: HTMLCanvasElement; + private static animateCallbacks; + private static registerAnimateCallback; + private static removerAnimateCallback; style: Style; - private _canvas_context; - private _entries; - private _entry_max; - private _max_space; - private _max_gap; - private _animate_loop; - _time_span: TimeSpan; - private _detailed_shown; - callback_detailed_info: (upload: number, download: number, timestamp: number, event: MouseEvent) => any; - callback_detailed_hide: () => any; - constructor(canvas: HTMLCanvasElement); + private canvas; + private canvasContext; + private entries; + private entriesMax; + private maxSpace; + private maxGap; + private animateLoop; + timeSpan: TimeSpan; + private detailShown; + callbackDetailedInfo: (upload: number, download: number, timestamp: number, event: MouseEvent) => any; + callbackDetailedHide: () => any; + constructor(); initialize(): void; - terminate(): void; - max_gap_size(value?: number): number; - private recalculate_cache; - insert_entry(entry: Entry): void; - insert_entries(entries: Entry[]): void; + finalize(): void; + initializeCanvas(canvas: HTMLCanvasElement | undefined): void; + maxGapSize(value?: number): number; + private recalculateCache; + entryCount(): number; + pushEntry(entry: Entry): void; + insertEntries(entries: Entry[]): void; resize(): void; cleanup(): void; - calculate_time_span(): { + calculateTimespan(): { begin: number; end: number; }; - draw(): void; - private on_mouse_move; - private on_mouse_leave; + private draw; + private onMouseMove; + private onMouseLeave; } diff --git a/imports/shared-app/ui/elements/Tab.d.ts b/imports/shared-app/ui/elements/Tab.d.ts index 1176f6a..beb8559 100644 --- a/imports/shared-app/ui/elements/Tab.d.ts +++ b/imports/shared-app/ui/elements/Tab.d.ts @@ -6,5 +6,5 @@ declare global { } } export declare const TabFunctions: { - tabify(template: JQuery, copy?: boolean): JQuery; + tabify(template: JQuery, copy?: boolean): JQuery; }; diff --git a/imports/shared-app/ui/frames/HostBannerController.d.ts b/imports/shared-app/ui/frames/HostBannerController.d.ts index 331c210..e83d8ed 100644 --- a/imports/shared-app/ui/frames/HostBannerController.d.ts +++ b/imports/shared-app/ui/frames/HostBannerController.d.ts @@ -1,6 +1,6 @@ import { ConnectionHandler } from "tc-shared/ConnectionHandler"; -import { Registry } from "tc-shared/events"; import { HostBannerUiEvents } from "tc-shared/ui/frames/HostBannerDefinitions"; +import { Registry } from "tc-shared/events"; export declare class HostBannerController { readonly uiEvents: Registry; private currentConnection; diff --git a/imports/shared-app/ui/frames/HostBannerRenderer.d.ts b/imports/shared-app/ui/frames/HostBannerRenderer.d.ts index 09c6e32..61acde9 100644 --- a/imports/shared-app/ui/frames/HostBannerRenderer.d.ts +++ b/imports/shared-app/ui/frames/HostBannerRenderer.d.ts @@ -3,6 +3,7 @@ import { HostBannerInfoSet, HostBannerUiEvents } from "tc-shared/ui/frames/HostB import * as React from "react"; export declare const HostBannerRenderer: React.MemoExoticComponent<(props: { banner: HostBannerInfoSet; + clickable: boolean; className?: string; }) => JSX.Element>; export declare const HostBanner: React.MemoExoticComponent<(props: { diff --git a/imports/shared-app/ui/frames/chat.d.ts b/imports/shared-app/ui/frames/chat.d.ts index dce18a8..99f3045 100644 --- a/imports/shared-app/ui/frames/chat.d.ts +++ b/imports/shared-app/ui/frames/chat.d.ts @@ -7,14 +7,19 @@ export declare enum ChatType { export declare function htmlEscape(message: string): string[]; export declare function formatElement(object: any, escape_html?: boolean): JQuery[]; export declare function formatMessage(pattern: string, ...objects: any[]): JQuery[]; -export declare function formatMessageString(pattern: string, ...args: string[]): string; +export declare function formatMessageString(pattern: string, ...args: (string | number | boolean)[]): string; export declare function parseMessageWithArguments(pattern: string, argumentCount: number): (string | number)[]; export declare namespace network { - const KB = 1024; + const KiB = 1024; + const MiB: number; + const GiB: number; + const TiB: number; + const kB = 1000; const MB: number; const GB: number; const TB: number; - function byteSizeToString(value: number): string; + function binarySizeToString(value: number): string; + function decimalSizeToString(value: number): string; function format_bytes(value: number, options?: { time?: string; unit?: string; diff --git a/imports/shared-app/ui/frames/video/Definitions.d.ts b/imports/shared-app/ui/frames/video/Definitions.d.ts index e9d4bb5..21af2fa 100644 --- a/imports/shared-app/ui/frames/video/Definitions.d.ts +++ b/imports/shared-app/ui/frames/video/Definitions.d.ts @@ -102,6 +102,7 @@ export interface ChannelVideoEvents { videoId: string; broadcastType: VideoBroadcastType; }; + action_show_viewers: {}; query_expended: {}; query_videos: {}; query_video: { @@ -120,6 +121,7 @@ export interface ChannelVideoEvents { broadcastType: VideoBroadcastType; }; query_subscribe_info: {}; + query_viewer_count: {}; notify_expended: { expended: boolean; }; @@ -139,10 +141,6 @@ export interface ChannelVideoEvents { videoId: string; statusIcon: ClientIcon; }; - notify_video_arrows: { - left: boolean; - right: boolean; - }; notify_spotlight: { videoId: string[]; }; @@ -159,5 +157,9 @@ export interface ChannelVideoEvents { notify_subscribe_info: { info: VideoSubscribeInfo; }; + notify_viewer_count: { + camera: number | undefined; + screen: number | undefined; + }; } export declare function makeVideoAutoplay(video: HTMLVideoElement): () => void; diff --git a/imports/shared-app/ui/frames/video/Renderer.d.ts b/imports/shared-app/ui/frames/video/Renderer.d.ts index d707372..817f240 100644 --- a/imports/shared-app/ui/frames/video/Renderer.d.ts +++ b/imports/shared-app/ui/frames/video/Renderer.d.ts @@ -1,9 +1,9 @@ import * as React from "react"; import { Registry } from "tc-shared/events"; import { ChannelVideoEvents } from "./Definitions"; +export declare const VideoIdContext: React.Context; export declare const RendererVideoEventContext: React.Context>; export declare const VideoContainer: React.MemoExoticComponent<(props: { - videoId: string; isSpotlight: boolean; }) => JSX.Element>; export declare const ChannelVideoRenderer: (props: { diff --git a/imports/shared-app/ui/modal/ModalAbout.d.ts b/imports/shared-app/ui/modal/ModalAbout.d.ts deleted file mode 100644 index ef03057..0000000 --- a/imports/shared-app/ui/modal/ModalAbout.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function spawnAbout(): void; diff --git a/imports/shared-app/ui/modal/ModalChangeVolumeNew.d.ts b/imports/shared-app/ui/modal/ModalChangeVolumeNew.d.ts index 56cdcf4..3f15145 100644 --- a/imports/shared-app/ui/modal/ModalChangeVolumeNew.d.ts +++ b/imports/shared-app/ui/modal/ModalChangeVolumeNew.d.ts @@ -18,5 +18,5 @@ export interface VolumeChangeEvents { }; "close-modal": {}; } -export declare function spawnClientVolumeChange(client: ClientEntry): import("../react-elements/modal/Definitions").ModalController; -export declare function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: number): import("../react-elements/modal/Definitions").ModalController; +export declare function spawnClientVolumeChange(client: ClientEntry): import("tc-shared/ui/react-elements/modal/Definitions").ModalController; +export declare function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: number): import("tc-shared/ui/react-elements/modal/Definitions").ModalController; diff --git a/imports/shared-app/ui/modal/ModalChannelInfo.d.ts b/imports/shared-app/ui/modal/ModalChannelInfo.d.ts deleted file mode 100644 index c75d1f9..0000000 --- a/imports/shared-app/ui/modal/ModalChannelInfo.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ChannelEntry } from "../../tree/Channel"; -export declare function openChannelInfo(channel: ChannelEntry): void; diff --git a/imports/shared-app/ui/modal/ModalServerInfo.d.ts b/imports/shared-app/ui/modal/ModalServerInfo.d.ts deleted file mode 100644 index ff0f200..0000000 --- a/imports/shared-app/ui/modal/ModalServerInfo.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ServerEntry } from "../../tree/Server"; -export declare function openServerInfo(server: ServerEntry): void; diff --git a/imports/shared-app/ui/modal/ModalServerInfoBandwidth.d.ts b/imports/shared-app/ui/modal/ModalServerInfoBandwidth.d.ts deleted file mode 100644 index 9f4f485..0000000 --- a/imports/shared-app/ui/modal/ModalServerInfoBandwidth.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ServerConnectionInfo, ServerEntry } from "../../tree/Server"; -import { Modal } from "../../ui/elements/Modal"; -export declare enum RequestInfoStatus { - SUCCESS = 0, - UNKNOWN = 1, - NO_PERMISSION = 2 -} -export declare type ServerBandwidthInfoUpdateCallback = (status: RequestInfoStatus, info?: ServerConnectionInfo) => any; -export declare function openServerInfoBandwidth(server: ServerEntry, update_callbacks?: ServerBandwidthInfoUpdateCallback[]): Modal; diff --git a/imports/shared-app/ui/modal/ModalYesNo.d.ts b/imports/shared-app/ui/modal/ModalYesNo.d.ts deleted file mode 100644 index 905add5..0000000 --- a/imports/shared-app/ui/modal/ModalYesNo.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { BodyCreator } from "../../ui/elements/Modal"; -export declare function spawnYesNo(header: BodyCreator, body: BodyCreator, callback: (_: boolean) => any, properties?: { - text_yes?: string; - text_no?: string; - closeable?: boolean; -}): import("../elements/Modal").Modal; diff --git a/imports/shared-app/ui/modal/channel-edit/Controller.d.ts b/imports/shared-app/ui/modal/channel-edit/Controller.d.ts index 3db2d3a..5d40fa6 100644 --- a/imports/shared-app/ui/modal/channel-edit/Controller.d.ts +++ b/imports/shared-app/ui/modal/channel-edit/Controller.d.ts @@ -6,4 +6,4 @@ export declare type ChannelEditChangedPermission = { permission: PermissionType; value: number; }; -export declare const spawnChannelEditNew: (connection: ConnectionHandler, channel: ChannelEntry, parent: ChannelEntry, callback: ChannelEditCallback) => void; +export declare const spawnChannelEditNew: (connection: ConnectionHandler, channel: ChannelEntry | undefined, parent: ChannelEntry | undefined, callback: ChannelEditCallback) => void; diff --git a/imports/shared-app/ui/modal/channel-info/Controller.d.ts b/imports/shared-app/ui/modal/channel-info/Controller.d.ts new file mode 100644 index 0000000..3f453d4 --- /dev/null +++ b/imports/shared-app/ui/modal/channel-info/Controller.d.ts @@ -0,0 +1,2 @@ +import { ChannelEntry } from "tc-shared/tree/Channel"; +export declare function spawnChannelInfo(channel: ChannelEntry): void; diff --git a/imports/shared-app/ui/modal/channel-info/Definitions.d.ts b/imports/shared-app/ui/modal/channel-info/Definitions.d.ts new file mode 100644 index 0000000..248233d --- /dev/null +++ b/imports/shared-app/ui/modal/channel-info/Definitions.d.ts @@ -0,0 +1,33 @@ +import { ServerAudioEncryptionMode } from "tc-shared/tree/ServerDefinitions"; +import { ChannelDescriptionResult } from "tc-shared/tree/ChannelDefinitions"; +export interface ModalChannelInfoVariables { + readonly name: string; + readonly type: "default" | "permanent" | "semi-permanent" | "temporary" | "unknown"; + readonly chatMode: { + mode: "private" | "none"; + } | { + mode: "public"; + history: number | 0 | -1; + }; + readonly currentClients: { + status: "subscribed"; + online: number; + limit: number | "unlimited" | "inherited"; + } | { + status: "unsubscribed"; + }; + readonly audioCodec: { + codec: number; + quality: number; + }; + readonly audioEncrypted: { + channel: boolean; + server: ServerAudioEncryptionMode; + }; + readonly password: boolean; + readonly topic: string; + readonly description: ChannelDescriptionResult; +} +export interface ModalChannelInfoEvents { + action_reload_description: {}; +} diff --git a/imports/shared-app/ui/modal/channel-info/Renderer.d.ts b/imports/shared-app/ui/modal/channel-info/Renderer.d.ts new file mode 100644 index 0000000..4e2c8b0 --- /dev/null +++ b/imports/shared-app/ui/modal/channel-info/Renderer.d.ts @@ -0,0 +1,14 @@ +import { AbstractModal } from "tc-shared/ui/react-elements/modal/Definitions"; +import React from "react"; +import { IpcRegistryDescription } from "tc-events"; +import { ModalChannelInfoEvents, ModalChannelInfoVariables } from "tc-shared/ui/modal/channel-info/Definitions"; +import { IpcVariableDescriptor } from "tc-shared/ui/utils/IpcVariable"; +declare class Modal extends AbstractModal { + private readonly events; + private readonly variables; + constructor(events: IpcRegistryDescription, variables: IpcVariableDescriptor); + protected onDestroy(): void; + renderBody(): React.ReactElement; + renderTitle(): string | React.ReactElement; +} +export default Modal; diff --git a/imports/shared-app/ui/modal/server-bandwidth/Controller.d.ts b/imports/shared-app/ui/modal/server-bandwidth/Controller.d.ts new file mode 100644 index 0000000..ae77e48 --- /dev/null +++ b/imports/shared-app/ui/modal/server-bandwidth/Controller.d.ts @@ -0,0 +1,2 @@ +import { ConnectionHandler } from "tc-shared/ConnectionHandler"; +export declare function spawnServerBandwidth(handler: ConnectionHandler): void; diff --git a/imports/shared-app/ui/modal/server-bandwidth/Definitions.d.ts b/imports/shared-app/ui/modal/server-bandwidth/Definitions.d.ts new file mode 100644 index 0000000..be9c9a2 --- /dev/null +++ b/imports/shared-app/ui/modal/server-bandwidth/Definitions.d.ts @@ -0,0 +1,6 @@ +import { ServerConnectionInfoResult } from "tc-shared/tree/ServerDefinitions"; +export interface ModalServerBandwidthEvents { + notify_connection_info: { + info: ServerConnectionInfoResult; + }; +} diff --git a/imports/shared-app/ui/modal/server-bandwidth/Renderer.d.ts b/imports/shared-app/ui/modal/server-bandwidth/Renderer.d.ts new file mode 100644 index 0000000..87b6242 --- /dev/null +++ b/imports/shared-app/ui/modal/server-bandwidth/Renderer.d.ts @@ -0,0 +1,12 @@ +import { AbstractModal } from "tc-shared/ui/react-elements/modal/Definitions"; +import React from "react"; +import { IpcRegistryDescription } from "tc-events"; +import { ModalServerBandwidthEvents } from "tc-shared/ui/modal/server-bandwidth/Definitions"; +declare class Modal extends AbstractModal { + private readonly events; + constructor(events: IpcRegistryDescription); + protected onDestroy(): void; + renderBody(): React.ReactElement; + renderTitle(): string | React.ReactElement; +} +export default Modal; diff --git a/imports/shared-app/ui/modal/server-info/Controller.d.ts b/imports/shared-app/ui/modal/server-info/Controller.d.ts new file mode 100644 index 0000000..9e4cadb --- /dev/null +++ b/imports/shared-app/ui/modal/server-info/Controller.d.ts @@ -0,0 +1,2 @@ +import { ConnectionHandler } from "tc-shared/ConnectionHandler"; +export declare function spawnServerInfoNew(handler: ConnectionHandler): void; diff --git a/imports/shared-app/ui/modal/server-info/Definitions.d.ts b/imports/shared-app/ui/modal/server-info/Definitions.d.ts new file mode 100644 index 0000000..2a2b64d --- /dev/null +++ b/imports/shared-app/ui/modal/server-info/Definitions.d.ts @@ -0,0 +1,32 @@ +import { HostBannerInfo } from "tc-shared/ui/frames/HostBannerDefinitions"; +import { ServerConnectionInfoResult } from "tc-shared/tree/ServerDefinitions"; +export interface ModalServerInfoVariables { + readonly name: string; + readonly region: string; + readonly slots: { + max: number; + used: number; + reserved: number; + queries: number; + }; + readonly firstRun: number; + readonly uptime: number; + readonly ipAddress: string; + readonly version: string; + readonly platform: string; + readonly connectionInfo: ServerConnectionInfoResult | { + status: "loading"; + }; + readonly uniqueId: string; + readonly channelCount: number; + readonly voiceDataEncryption: "global-on" | "global-off" | "channel-individual" | "unknown"; + readonly securityLevel: number; + readonly complainsUntilBan: number; + readonly hostBanner: HostBannerInfo; + readonly refreshAllowed: number; +} +export interface ModalServerInfoEvents { + action_show_bandwidth: {}; + action_refresh: {}; + action_close: {}; +} diff --git a/imports/shared-app/ui/modal/server-info/Renderer.d.ts b/imports/shared-app/ui/modal/server-info/Renderer.d.ts new file mode 100644 index 0000000..5bcadbb --- /dev/null +++ b/imports/shared-app/ui/modal/server-info/Renderer.d.ts @@ -0,0 +1,14 @@ +import { AbstractModal } from "tc-shared/ui/react-elements/modal/Definitions"; +import React from "react"; +import { IpcRegistryDescription } from "tc-events"; +import { ModalServerInfoEvents, ModalServerInfoVariables } from "tc-shared/ui/modal/server-info/Definitions"; +import { IpcVariableDescriptor } from "tc-shared/ui/utils/IpcVariable"; +declare class Modal extends AbstractModal { + private readonly events; + private readonly variables; + constructor(events: IpcRegistryDescription, variables: IpcVariableDescriptor); + protected onDestroy(): void; + renderBody(): React.ReactElement; + renderTitle(): string | React.ReactElement; +} +export default Modal; diff --git a/imports/shared-app/ui/modal/settings/Heighlight.d.ts b/imports/shared-app/ui/modal/settings/Heighlight.d.ts index 5fcf316..c1e0550 100644 --- a/imports/shared-app/ui/modal/settings/Heighlight.d.ts +++ b/imports/shared-app/ui/modal/settings/Heighlight.d.ts @@ -1,6 +1,6 @@ import * as React from "react"; export declare const HighlightContainer: (props: { - children: string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | React.ReactNode[]; + children: React.ReactNode | React.ReactNode[]; classList?: string; highlightedId?: string; onClick?: () => void; @@ -13,5 +13,5 @@ export declare const HighlightRegion: (props: React.HTMLProps & export declare const HighlightText: (props: { highlightId: string; className?: string; - children?: string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | React.ReactNode[]; + children?: React.ReactNode | React.ReactNode[]; }) => JSX.Element; diff --git a/imports/shared-app/ui/modal/video-viewers/Controller.d.ts b/imports/shared-app/ui/modal/video-viewers/Controller.d.ts new file mode 100644 index 0000000..17d785e --- /dev/null +++ b/imports/shared-app/ui/modal/video-viewers/Controller.d.ts @@ -0,0 +1,2 @@ +import { ConnectionHandler } from "tc-shared/ConnectionHandler"; +export declare function spawnVideoViewerInfo(handler: ConnectionHandler): void; diff --git a/imports/shared-app/ui/modal/video-viewers/Definitions.d.ts b/imports/shared-app/ui/modal/video-viewers/Definitions.d.ts new file mode 100644 index 0000000..3f7cc07 --- /dev/null +++ b/imports/shared-app/ui/modal/video-viewers/Definitions.d.ts @@ -0,0 +1,19 @@ +import { ClientIcon } from "svg-sprites/client-icons"; +import { VideoBroadcastType } from "tc-shared/connection/VideoConnection"; +export declare type VideoViewerInfo = { + handlerId: string; + clientName: string; + clientUniqueId: string; + clientStatus: ClientIcon | undefined; +}; +export declare type VideoViewerList = { + [T in VideoBroadcastType]?: number[]; +} & { + __internal_client_order: number[]; +}; +export interface ModalVideoViewersVariables { + viewerInfo: VideoViewerInfo | undefined; + videoViewers: VideoViewerList; +} +export interface ModalVideoViewersEvents { +} diff --git a/imports/shared-app/ui/modal/video-viewers/Renderer.d.ts b/imports/shared-app/ui/modal/video-viewers/Renderer.d.ts new file mode 100644 index 0000000..460a258 --- /dev/null +++ b/imports/shared-app/ui/modal/video-viewers/Renderer.d.ts @@ -0,0 +1,14 @@ +import { AbstractModal } from "tc-shared/ui/react-elements/modal/Definitions"; +import React from "react"; +import { IpcRegistryDescription } from "tc-events"; +import { ModalVideoViewersEvents, ModalVideoViewersVariables } from "tc-shared/ui/modal/video-viewers/Definitions"; +import { IpcVariableDescriptor } from "tc-shared/ui/utils/IpcVariable"; +declare class Modal extends AbstractModal { + private readonly events; + private readonly variables; + constructor(events: IpcRegistryDescription, variables: IpcVariableDescriptor); + protected onDestroy(): void; + renderBody(): React.ReactElement; + renderTitle(): string | React.ReactElement; +} +export default Modal; diff --git a/imports/shared-app/ui/modal/yes-no/Controller.d.ts b/imports/shared-app/ui/modal/yes-no/Controller.d.ts new file mode 100644 index 0000000..7d19b45 --- /dev/null +++ b/imports/shared-app/ui/modal/yes-no/Controller.d.ts @@ -0,0 +1,8 @@ +export interface YesNoParameters { + title: string; + question: string; + textYes?: string; + textNo?: string; + closeable?: boolean; +} +export declare function promptYesNo(properties: YesNoParameters): Promise; diff --git a/imports/shared-app/ui/modal/yes-no/Definitions.d.ts b/imports/shared-app/ui/modal/yes-no/Definitions.d.ts new file mode 100644 index 0000000..a399d54 --- /dev/null +++ b/imports/shared-app/ui/modal/yes-no/Definitions.d.ts @@ -0,0 +1,11 @@ +export interface ModalYesNoVariables { + readonly title: string; + readonly question: string; + readonly textYes: string | undefined; + readonly textNo: string | undefined; +} +export interface ModalYesNoEvents { + action_submit: { + status: boolean; + }; +} diff --git a/imports/shared-app/ui/modal/yes-no/Renderer.d.ts b/imports/shared-app/ui/modal/yes-no/Renderer.d.ts new file mode 100644 index 0000000..f6340a9 --- /dev/null +++ b/imports/shared-app/ui/modal/yes-no/Renderer.d.ts @@ -0,0 +1,14 @@ +import { AbstractModal } from "tc-shared/ui/react-elements/modal/Definitions"; +import { IpcRegistryDescription } from "tc-events"; +import { ModalYesNoEvents, ModalYesNoVariables } from "tc-shared/ui/modal/yes-no/Definitions"; +import React from "react"; +declare class Modal extends AbstractModal { + private readonly events; + private readonly variables; + constructor(events: IpcRegistryDescription, variables: IpcRegistryDescription); + protected onDestroy(): void; + color(): "none" | "blue" | "red"; + renderBody(): React.ReactElement; + renderTitle(): string | React.ReactElement; +} +export default Modal; diff --git a/imports/shared-app/ui/react-elements/Arrow.d.ts b/imports/shared-app/ui/react-elements/Arrow.d.ts index 009b9fa..120ef55 100644 --- a/imports/shared-app/ui/react-elements/Arrow.d.ts +++ b/imports/shared-app/ui/react-elements/Arrow.d.ts @@ -1,6 +1,6 @@ /// export declare const Arrow: (props: { - direction: NavigationReason; + direction: "up" | "down" | "left" | "right"; className?: string; onClick?: () => void; }) => JSX.Element; diff --git a/imports/shared-app/ui/react-elements/Avatar.d.ts b/imports/shared-app/ui/react-elements/Avatar.d.ts index 53a5fa9..9fd503b 100644 --- a/imports/shared-app/ui/react-elements/Avatar.d.ts +++ b/imports/shared-app/ui/react-elements/Avatar.d.ts @@ -1,7 +1,7 @@ import * as React from "react"; import { ClientAvatar } from "tc-shared/file/Avatars"; export declare const AvatarRenderer: React.MemoExoticComponent<(props: { - avatar: "default" | "loading" | ClientAvatar; + avatar: ClientAvatar | "loading" | "default"; className?: string; alt?: string; }) => JSX.Element>; diff --git a/imports/shared-app/ui/react-elements/ErrorBoundary.d.ts b/imports/shared-app/ui/react-elements/ErrorBoundary.d.ts index 2559447..49649a5 100644 --- a/imports/shared-app/ui/react-elements/ErrorBoundary.d.ts +++ b/imports/shared-app/ui/react-elements/ErrorBoundary.d.ts @@ -4,7 +4,7 @@ interface ErrorBoundaryState { } export declare class ErrorBoundary extends React.PureComponent<{}, ErrorBoundaryState> { constructor(props: any); - render(): {}; + render(): React.ReactNode; componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void; static getDerivedStateFromError(): Partial; } diff --git a/imports/shared-app/ui/react-elements/FontSize.d.ts b/imports/shared-app/ui/react-elements/FontSize.d.ts index 81ac10b..c21e09c 100644 --- a/imports/shared-app/ui/react-elements/FontSize.d.ts +++ b/imports/shared-app/ui/react-elements/FontSize.d.ts @@ -1,4 +1,4 @@ import * as React from "react"; export declare const FontSizeObserver: React.MemoExoticComponent<(props: { - children: (fontSize: number) => string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | React.ReactNode[]; + children: (fontSize: number) => React.ReactNode | React.ReactNode[]; }) => JSX.Element>; diff --git a/imports/shared-app/ui/react-elements/Icon.d.ts b/imports/shared-app/ui/react-elements/Icon.d.ts index 044445e..478e7b8 100644 --- a/imports/shared-app/ui/react-elements/Icon.d.ts +++ b/imports/shared-app/ui/react-elements/Icon.d.ts @@ -6,12 +6,12 @@ export declare const IconRenderer: (props: { className?: string; }) => JSX.Element; export declare const RemoteIconRenderer: (props: { - icon: RemoteIcon; + icon: RemoteIcon | undefined; className?: string; title?: string; }) => JSX.Element; export declare const RemoteIconInfoRenderer: React.MemoExoticComponent<(props: { - icon: RemoteIconInfo; + icon: RemoteIconInfo | undefined; className?: string; title?: string; }) => JSX.Element>; diff --git a/imports/shared-app/ui/react-elements/InputField.d.ts b/imports/shared-app/ui/react-elements/InputField.d.ts index 45011de..1ee625f 100644 --- a/imports/shared-app/ui/react-elements/InputField.d.ts +++ b/imports/shared-app/ui/react-elements/InputField.d.ts @@ -7,14 +7,14 @@ export declare const ControlledBoxedInputField: (props: { disabled?: boolean; editable?: boolean; value?: string; - rightIcon?: () => React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>; - leftIcon?: () => React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>; - inputBox?: () => React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>; + rightIcon?: () => ReactElement; + leftIcon?: () => ReactElement; + inputBox?: () => ReactElement; isInvalid?: boolean; className?: string; maxLength?: number; - size?: "small" | "normal" | "large"; - type?: "number" | "password" | "text"; + size?: "normal" | "large" | "small"; + type?: "text" | "password" | "number"; onChange: (newValue?: string) => void; onEnter?: () => void; onFocus?: () => void; @@ -60,7 +60,7 @@ export declare class BoxedInputField extends React.Component void; onBlur?: () => void; onChange?: (event?: React.ChangeEvent) => void; - children: React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>[]; + children: React.ReactElement | React.ReactElement[]; }) => JSX.Element; export interface SelectProperties { type?: "flat" | "boxed"; diff --git a/imports/shared-app/ui/react-elements/RadioButton.d.ts b/imports/shared-app/ui/react-elements/RadioButton.d.ts index 3243bb9..08bca66 100644 --- a/imports/shared-app/ui/react-elements/RadioButton.d.ts +++ b/imports/shared-app/ui/react-elements/RadioButton.d.ts @@ -1,6 +1,6 @@ import * as React from "react"; export declare const RadioButton: (props: { - children?: string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | React.ReactNode[]; + children?: React.ReactNode | string | React.ReactNode[]; name: string; selected: boolean; disabled?: boolean; diff --git a/imports/shared-app/ui/react-elements/Tooltip.d.ts b/imports/shared-app/ui/react-elements/Tooltip.d.ts index d6934f6..83259f0 100644 --- a/imports/shared-app/ui/react-elements/Tooltip.d.ts +++ b/imports/shared-app/ui/react-elements/Tooltip.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -import { ReactElement } from "react"; +import { ReactNode } from "react"; export interface TooltipState { forceShow: boolean; hovered: boolean; @@ -7,10 +7,14 @@ export interface TooltipState { pageY: number; } export interface TooltipProperties { - tooltip: () => ReactElement | ReactElement[] | string; + tooltip: () => ReactNode | ReactNode[] | string; className?: string; + /** + * Enable the tooltip already when the span is hovered + */ + spawnHover?: boolean; } -export declare class Tooltip extends React.Component { +export declare class Tooltip extends React.PureComponent { readonly tooltipId: string; private refContainer; private currentContainer; @@ -22,7 +26,7 @@ export declare class Tooltip extends React.Component React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>[]; + children?: React.ReactNode | React.ReactNode[]; className?: string; outerClassName?: string; }) => JSX.Element; diff --git a/imports/shared-app/ui/react-elements/i18n/index.d.ts b/imports/shared-app/ui/react-elements/i18n/index.d.ts index fcfa8f1..7dd85da 100644 --- a/imports/shared-app/ui/react-elements/i18n/index.d.ts +++ b/imports/shared-app/ui/react-elements/i18n/index.d.ts @@ -14,7 +14,7 @@ export declare class Translatable extends React.Component<{ export declare type VariadicTranslatableChild = React.ReactElement | string | number; export declare const VariadicTranslatable: (props: { text: string; - children?: string | number | React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)> | VariadicTranslatableChild[]; + children?: VariadicTranslatableChild[] | VariadicTranslatableChild; }) => JSX.Element; declare global { interface Window { diff --git a/imports/shared-app/ui/react-elements/modal/Definitions.d.ts b/imports/shared-app/ui/react-elements/modal/Definitions.d.ts index 84e20e7..b13931a 100644 --- a/imports/shared-app/ui/react-elements/modal/Definitions.d.ts +++ b/imports/shared-app/ui/react-elements/modal/Definitions.d.ts @@ -15,7 +15,12 @@ import { PermissionEditorEvents } from "tc-shared/ui/modal/permission/EditorDefi import { PermissionEditorServerInfo } from "tc-shared/ui/modal/permission/ModalRenderer"; import { ModalAvatarUploadEvents, ModalAvatarUploadVariables } from "tc-shared/ui/modal/avatar-upload/Definitions"; import { ModalInputProcessorEvents, ModalInputProcessorVariables } from "tc-shared/ui/modal/input-processor/Definitios"; +import { ModalServerInfoEvents, ModalServerInfoVariables } from "tc-shared/ui/modal/server-info/Definitions"; import { ModalAboutVariables } from "tc-shared/ui/modal/about/Definitions"; +import { ModalServerBandwidthEvents } from "tc-shared/ui/modal/server-bandwidth/Definitions"; +import { ModalYesNoEvents, ModalYesNoVariables } from "tc-shared/ui/modal/yes-no/Definitions"; +import { ModalChannelInfoEvents, ModalChannelInfoVariables } from "tc-shared/ui/modal/channel-info/Definitions"; +import { ModalVideoViewersEvents, ModalVideoViewersVariables } from "tc-shared/ui/modal/video-viewers/Definitions"; export declare type ModalType = "error" | "warning" | "info" | "none"; export declare type ModalRenderType = "page" | "dialog"; export interface ModalOptions { @@ -99,7 +104,7 @@ export declare abstract class AbstractModal { abstract renderBody(): ReactElement; abstract renderTitle(): string | React.ReactElement; type(): ModalType; - color(): "none" | "blue"; + color(): "none" | "blue" | "red"; verticalAlignment(): "top" | "center" | "bottom"; /** @deprecated */ protected onInitialize(): void; @@ -112,21 +117,80 @@ export declare abstract class InternalModal extends AbstractModal { export declare function constructAbstractModalClass(klass: new (...args: ModalConstructorArguments[T]) => AbstractModal, properties: ModalInstanceProperties, args: ModalConstructorArguments[T]): AbstractModal; export interface ModalConstructorArguments { "__internal__modal__": any[]; - "video-viewer": [IpcRegistryDescription, string]; - "channel-edit": [IpcRegistryDescription, boolean]; - "echo-test": [IpcRegistryDescription]; - "global-settings-editor": [IpcRegistryDescription]; + "modal-yes-no": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "video-viewer": [ + IpcRegistryDescription, + string + ]; + "channel-edit": [ + IpcRegistryDescription, + boolean + ]; + "channel-info": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "echo-test": [ + IpcRegistryDescription + ]; + "global-settings-editor": [ + IpcRegistryDescription + ]; "conversation": any; "css-editor": any; "channel-tree": any; "modal-connect": any; - "modal-invite": [IpcRegistryDescription, IpcVariableDescriptor, string]; - "modal-bookmarks": [IpcRegistryDescription, IpcVariableDescriptor]; - "modal-bookmark-add-server": [IpcRegistryDescription, IpcVariableDescriptor]; - "modal-poked": [IpcRegistryDescription, IpcVariableDescriptor]; - "modal-assign-server-groups": [IpcRegistryDescription, IpcVariableDescriptor]; - "modal-permission-edit": [PermissionEditorServerInfo, IpcRegistryDescription, IpcRegistryDescription]; - "modal-avatar-upload": [IpcRegistryDescription, IpcVariableDescriptor, string]; - "modal-input-processor": [IpcRegistryDescription, IpcVariableDescriptor]; - "modal-about": [IpcRegistryDescription, IpcVariableDescriptor]; + "modal-invite": [ + IpcRegistryDescription, + IpcVariableDescriptor, + string + ]; + "modal-bookmarks": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-bookmark-add-server": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-poked": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-assign-server-groups": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-permission-edit": [ + PermissionEditorServerInfo, + IpcRegistryDescription, + IpcRegistryDescription + ]; + "modal-avatar-upload": [ + IpcRegistryDescription, + IpcVariableDescriptor, + string + ]; + "modal-input-processor": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-about": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-server-info": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; + "modal-server-bandwidth": [ + IpcRegistryDescription + ]; + "modal-video-viewers": [ + IpcRegistryDescription, + IpcVariableDescriptor + ]; } diff --git a/imports/shared-app/ui/react-elements/modal/Renderer.d.ts b/imports/shared-app/ui/react-elements/modal/Renderer.d.ts index 0045435..61820e2 100644 --- a/imports/shared-app/ui/react-elements/modal/Renderer.d.ts +++ b/imports/shared-app/ui/react-elements/modal/Renderer.d.ts @@ -39,5 +39,5 @@ export declare class PageModalRenderer extends React.PureComponent<{ render(): JSX.Element; } export declare const WindowModalRenderer: (props: { - children: [React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>, React.ReactElement React.ReactElement React.Component)>) | (new (props: any) => React.Component)>]; + children: [React.ReactElement, React.ReactElement]; }) => JSX.Element; diff --git a/imports/shared-app/ui/tree/RendererDataProvider.d.ts b/imports/shared-app/ui/tree/RendererDataProvider.d.ts index d2804e8..9482ac7 100644 --- a/imports/shared-app/ui/tree/RendererDataProvider.d.ts +++ b/imports/shared-app/ui/tree/RendererDataProvider.d.ts @@ -67,10 +67,8 @@ export declare abstract class RDPEntry { selected: boolean; unread: boolean; private renderedInstance; - private destroyed; protected constructor(handle: RDPChannelTree, entryId: number); destroy(): void; - isDestroyed(): boolean; getEvents(): Registry; getHandlerId(): string; queryState(): void; diff --git a/imports/shared-app/ui/tree/RendererTreeEntry.d.ts b/imports/shared-app/ui/tree/RendererTreeEntry.d.ts index 2b981b5..8b2f716 100644 --- a/imports/shared-app/ui/tree/RendererTreeEntry.d.ts +++ b/imports/shared-app/ui/tree/RendererTreeEntry.d.ts @@ -1,4 +1,3 @@ -import { ReactComponentBase } from "tc-shared/ui/react-elements/ReactComponentBase"; import * as React from "react"; import { RDPEntry } from "tc-shared/ui/tree/RendererDataProvider"; export declare class UnreadMarkerRenderer extends React.Component<{ @@ -6,5 +5,3 @@ export declare class UnreadMarkerRenderer extends React.Component<{ }, {}> { render(): JSX.Element; } -export declare class RendererTreeEntry extends ReactComponentBase { -} diff --git a/imports/shared-app/ui/utils/Variable.d.ts b/imports/shared-app/ui/utils/Variable.d.ts index fa316ea..d9b00be 100644 --- a/imports/shared-app/ui/utils/Variable.d.ts +++ b/imports/shared-app/ui/utils/Variable.d.ts @@ -38,6 +38,8 @@ export declare abstract class UiVariableProvider(variable: T, customData?: any, ignoreCache?: boolean): Variables[T]; protected resolveVariable(variable: string, customData: any): Promise | any; protected doEditVariable(variable: string, customData: any, newValue: any): Promise | void; + private handleEditResult; + private handleEditError; protected abstract doSendVariable(variable: string, customData: any, value: any): any; } export declare type UiVariableStatus = { diff --git a/imports/svg-sprites/country-flags.d.ts b/imports/svg-sprites/country-flags.d.ts new file mode 100644 index 0000000..1726e18 --- /dev/null +++ b/imports/svg-sprites/country-flags.d.ts @@ -0,0 +1,286 @@ +/* + * DO NOT MODIFY THIS FILE! + * + * This file has been auto generated by the svg-sprite generator. + * Sprite source directory: G:\TeaSpeak\web\shared\img\country-flags + * Sprite count: 260 + */ +export type CountryFlagClass = "flag-abkhazia" | "flag-afghanistan" | "flag-aland_islands" | "flag-albania" | "flag-algeria" | "flag-american_samoa" | "flag-andorra" | "flag-angola" | "flag-anguilla" | "flag-antigua_and_barbuda" | "flag-argentina" | "flag-armenia" | "flag-aruba" | "flag-australia" | "flag-austria" | "flag-azerbaijan" | "flag-azores_islands" | "flag-bahamas" | "flag-bahrain" | "flag-balearic_islands" | "flag-bangladesh" | "flag-barbados" | "flag-basque_country" | "flag-belarus" | "flag-belgium" | "flag-belize" | "flag-benin" | "flag-bermuda" | "flag-bhutan" | "flag-bolivia" | "flag-bonaire" | "flag-bosnia_and_herzegovina" | "flag-botswana" | "flag-brazil" | "flag-british_columbia" | "flag-british_indian_ocean_territory" | "flag-british_virgin_islands" | "flag-brunei" | "flag-bulgaria" | "flag-burkina_faso" | "flag-burundi" | "flag-cambodia" | "flag-cameroon" | "flag-canada" | "flag-canary_islands" | "flag-cape_verde" | "flag-cayman_islands" | "flag-central_african_republic" | "flag-ceuta" | "flag-chad" | "flag-chile" | "flag-china" | "flag-christmas_island" | "flag-cocos_island" | "flag-colombia" | "flag-comoros" | "flag-cook_islands" | "flag-corsica" | "flag-costa_rica" | "flag-croatia" | "flag-cuba" | "flag-curacao" | "flag-cyprus" | "flag-czech_republic" | "flag-democratic_republic_of_congo" | "flag-denmark" | "flag-djibouti" | "flag-dominica" | "flag-dominican_republic" | "flag-east_timor" | "flag-ecuador" | "flag-egypt" | "flag-el_salvador" | "flag-england" | "flag-equatorial_guinea" | "flag-eritrea" | "flag-estonia" | "flag-ethiopia" | "flag-european_union" | "flag-falkland_islands" | "flag-faroe_islands" | "flag-fiji" | "flag-finland" | "flag-france" | "flag-french_polynesia" | "flag-gabon" | "flag-galapagos_islands" | "flag-gambia" | "flag-georgia" | "flag-germany" | "flag-ghana" | "flag-gibraltar" | "flag-greece" | "flag-greenland" | "flag-grenada" | "flag-guam" | "flag-guatemala" | "flag-guernsey" | "flag-guinea" | "flag-guinea_bissau" | "flag-haiti" | "flag-hawaii" | "flag-honduras" | "flag-hong_kong" | "flag-hungary" | "flag-iceland" | "flag-india" | "flag-indonesia" | "flag-iran" | "flag-iraq" | "flag-ireland" | "flag-isle_of_man" | "flag-israel" | "flag-italy" | "flag-ivory_coast" | "flag-jamaica" | "flag-japan" | "flag-jersey" | "flag-jordan" | "flag-kazakhstan" | "flag-kenya" | "flag-kosovo" | "flag-kuwait" | "flag-kyrgyzstan" | "flag-laos" | "flag-latvia" | "flag-lebanon" | "flag-lesotho" | "flag-liberia" | "flag-libya" | "flag-liechtenstein" | "flag-lithuania" | "flag-luxembourg" | "flag-macao" | "flag-madagascar" | "flag-madeira" | "flag-malawi" | "flag-malaysia" | "flag-maldives" | "flag-mali" | "flag-malta" | "flag-marshall_island" | "flag-martinique" | "flag-mauritania" | "flag-mauritius" | "flag-melilla" | "flag-mexico" | "flag-micronesia" | "flag-moldova" | "flag-monaco" | "flag-mongolia" | "flag-montenegro" | "flag-montserrat" | "flag-morocco" | "flag-mozambique" | "flag-myanmar" | "flag-namibia" | "flag-nauru" | "flag-nepal" | "flag-netherlands" | "flag-new_zealand" | "flag-nicaragua" | "flag-niger" | "flag-nigeria" | "flag-niue" | "flag-norfolk_island" | "flag-north_korea" | "flag-northen_cyprus" | "flag-northern_marianas_islands" | "flag-norway" | "flag-oman" | "flag-orkney_islands" | "flag-ossetia" | "flag-otan" | "flag-pakistan" | "flag-palau" | "flag-palestine" | "flag-panama" | "flag-papua_new_guinea" | "flag-paraguay" | "flag-peru" | "flag-philippines" | "flag-poland" | "flag-portugal" | "flag-puerto_rico" | "flag-qatar" | "flag-rapa_nui" | "flag-republic_of_macedonia" | "flag-republic_of_the_congo" | "flag-romania" | "flag-russia" | "flag-rwanda" | "flag-saba_island" | "flag-sahrawi_arab_democratic_republic" | "flag-saint_kitts_and_nevis" | "flag-samoa" | "flag-san_marino" | "flag-sao_tome_and_principe" | "flag-sardinia" | "flag-saudi_arabia" | "flag-scotland" | "flag-senegal" | "flag-serbia" | "flag-seychelles" | "flag-sicily" | "flag-sierra_leone" | "flag-singapore" | "flag-sint_eustatius" | "flag-sint_maarten" | "flag-slovakia" | "flag-slovenia" | "flag-solomon_islands" | "flag-somalia" | "flag-somaliland" | "flag-south_africa" | "flag-south_korea" | "flag-south_sudan" | "flag-spain" | "flag-sri_lanka" | "flag-st_barts" | "flag-st_lucia" | "flag-st_vincent_and_the_grenadines" | "flag-sudan" | "flag-suriname" | "flag-sweden" | "flag-switzerland" | "flag-syria" | "flag-taiwan" | "flag-tajikistan" | "flag-tanzania" | "flag-thailand" | "flag-tibet" | "flag-togo" | "flag-tokelau" | "flag-tonga" | "flag-transnistria" | "flag-trinidad_and_tobago" | "flag-tubalu" | "flag-tunisia" | "flag-turkey" | "flag-turkmenistan" | "flag-turks_and_caicos" | "flag-uganda" | "flag-ukraine" | "flag-united_arab_emirates" | "flag-united_kingdom" | "flag-united_nations" | "flag-united_states_of_america" | "flag-uruguay" | "flag-uzbekistn" | "flag-vanuatu" | "flag-vatican_city" | "flag-venezuela" | "flag-vietnam" | "flag-virgin_islands" | "flag-wales" | "flag-worldwide" | "flag-yemen" | "flag-zambia" | "flag-zimbabwe"; + +export enum CountryFlag { + Abkhazia = "flag-abkhazia", + Afghanistan = "flag-afghanistan", + AlandIslands = "flag-aland_islands", + Albania = "flag-albania", + Algeria = "flag-algeria", + AmericanSamoa = "flag-american_samoa", + Andorra = "flag-andorra", + Angola = "flag-angola", + Anguilla = "flag-anguilla", + AntiguaAndBarbuda = "flag-antigua_and_barbuda", + Argentina = "flag-argentina", + Armenia = "flag-armenia", + Aruba = "flag-aruba", + Australia = "flag-australia", + Austria = "flag-austria", + Azerbaijan = "flag-azerbaijan", + AzoresIslands = "flag-azores_islands", + Bahamas = "flag-bahamas", + Bahrain = "flag-bahrain", + BalearicIslands = "flag-balearic_islands", + Bangladesh = "flag-bangladesh", + Barbados = "flag-barbados", + BasqueCountry = "flag-basque_country", + Belarus = "flag-belarus", + Belgium = "flag-belgium", + Belize = "flag-belize", + Benin = "flag-benin", + Bermuda = "flag-bermuda", + Bhutan = "flag-bhutan", + Bolivia = "flag-bolivia", + Bonaire = "flag-bonaire", + BosniaAndHerzegovina = "flag-bosnia_and_herzegovina", + Botswana = "flag-botswana", + Brazil = "flag-brazil", + BritishColumbia = "flag-british_columbia", + BritishIndianOceanTerritory = "flag-british_indian_ocean_territory", + BritishVirginIslands = "flag-british_virgin_islands", + Brunei = "flag-brunei", + Bulgaria = "flag-bulgaria", + BurkinaFaso = "flag-burkina_faso", + Burundi = "flag-burundi", + Cambodia = "flag-cambodia", + Cameroon = "flag-cameroon", + Canada = "flag-canada", + CanaryIslands = "flag-canary_islands", + CapeVerde = "flag-cape_verde", + CaymanIslands = "flag-cayman_islands", + CentralAfricanRepublic = "flag-central_african_republic", + Ceuta = "flag-ceuta", + Chad = "flag-chad", + Chile = "flag-chile", + China = "flag-china", + ChristmasIsland = "flag-christmas_island", + CocosIsland = "flag-cocos_island", + Colombia = "flag-colombia", + Comoros = "flag-comoros", + CookIslands = "flag-cook_islands", + Corsica = "flag-corsica", + CostaRica = "flag-costa_rica", + Croatia = "flag-croatia", + Cuba = "flag-cuba", + Curacao = "flag-curacao", + Cyprus = "flag-cyprus", + CzechRepublic = "flag-czech_republic", + DemocraticRepublicOfCongo = "flag-democratic_republic_of_congo", + Denmark = "flag-denmark", + Djibouti = "flag-djibouti", + Dominica = "flag-dominica", + DominicanRepublic = "flag-dominican_republic", + EastTimor = "flag-east_timor", + Ecuador = "flag-ecuador", + Egypt = "flag-egypt", + ElSalvador = "flag-el_salvador", + England = "flag-england", + EquatorialGuinea = "flag-equatorial_guinea", + Eritrea = "flag-eritrea", + Estonia = "flag-estonia", + Ethiopia = "flag-ethiopia", + EuropeanUnion = "flag-european_union", + FalklandIslands = "flag-falkland_islands", + FaroeIslands = "flag-faroe_islands", + Fiji = "flag-fiji", + Finland = "flag-finland", + France = "flag-france", + FrenchPolynesia = "flag-french_polynesia", + Gabon = "flag-gabon", + GalapagosIslands = "flag-galapagos_islands", + Gambia = "flag-gambia", + Georgia = "flag-georgia", + Germany = "flag-germany", + Ghana = "flag-ghana", + Gibraltar = "flag-gibraltar", + Greece = "flag-greece", + Greenland = "flag-greenland", + Grenada = "flag-grenada", + Guam = "flag-guam", + Guatemala = "flag-guatemala", + Guernsey = "flag-guernsey", + Guinea = "flag-guinea", + GuineaBissau = "flag-guinea_bissau", + Haiti = "flag-haiti", + Hawaii = "flag-hawaii", + Honduras = "flag-honduras", + HongKong = "flag-hong_kong", + Hungary = "flag-hungary", + Iceland = "flag-iceland", + India = "flag-india", + Indonesia = "flag-indonesia", + Iran = "flag-iran", + Iraq = "flag-iraq", + Ireland = "flag-ireland", + IsleOfMan = "flag-isle_of_man", + Israel = "flag-israel", + Italy = "flag-italy", + IvoryCoast = "flag-ivory_coast", + Jamaica = "flag-jamaica", + Japan = "flag-japan", + Jersey = "flag-jersey", + Jordan = "flag-jordan", + Kazakhstan = "flag-kazakhstan", + Kenya = "flag-kenya", + Kosovo = "flag-kosovo", + Kuwait = "flag-kuwait", + Kyrgyzstan = "flag-kyrgyzstan", + Laos = "flag-laos", + Latvia = "flag-latvia", + Lebanon = "flag-lebanon", + Lesotho = "flag-lesotho", + Liberia = "flag-liberia", + Libya = "flag-libya", + Liechtenstein = "flag-liechtenstein", + Lithuania = "flag-lithuania", + Luxembourg = "flag-luxembourg", + Macao = "flag-macao", + Madagascar = "flag-madagascar", + Madeira = "flag-madeira", + Malawi = "flag-malawi", + Malaysia = "flag-malaysia", + Maldives = "flag-maldives", + Mali = "flag-mali", + Malta = "flag-malta", + MarshallIsland = "flag-marshall_island", + Martinique = "flag-martinique", + Mauritania = "flag-mauritania", + Mauritius = "flag-mauritius", + Melilla = "flag-melilla", + Mexico = "flag-mexico", + Micronesia = "flag-micronesia", + Moldova = "flag-moldova", + Monaco = "flag-monaco", + Mongolia = "flag-mongolia", + Montenegro = "flag-montenegro", + Montserrat = "flag-montserrat", + Morocco = "flag-morocco", + Mozambique = "flag-mozambique", + Myanmar = "flag-myanmar", + Namibia = "flag-namibia", + Nauru = "flag-nauru", + Nepal = "flag-nepal", + Netherlands = "flag-netherlands", + NewZealand = "flag-new_zealand", + Nicaragua = "flag-nicaragua", + Niger = "flag-niger", + Nigeria = "flag-nigeria", + Niue = "flag-niue", + NorfolkIsland = "flag-norfolk_island", + NorthKorea = "flag-north_korea", + NorthenCyprus = "flag-northen_cyprus", + NorthernMarianasIslands = "flag-northern_marianas_islands", + Norway = "flag-norway", + Oman = "flag-oman", + OrkneyIslands = "flag-orkney_islands", + Ossetia = "flag-ossetia", + Otan = "flag-otan", + Pakistan = "flag-pakistan", + Palau = "flag-palau", + Palestine = "flag-palestine", + Panama = "flag-panama", + PapuaNewGuinea = "flag-papua_new_guinea", + Paraguay = "flag-paraguay", + Peru = "flag-peru", + Philippines = "flag-philippines", + Poland = "flag-poland", + Portugal = "flag-portugal", + PuertoRico = "flag-puerto_rico", + Qatar = "flag-qatar", + RapaNui = "flag-rapa_nui", + RepublicOfMacedonia = "flag-republic_of_macedonia", + RepublicOfTheCongo = "flag-republic_of_the_congo", + Romania = "flag-romania", + Russia = "flag-russia", + Rwanda = "flag-rwanda", + SabaIsland = "flag-saba_island", + SahrawiArabDemocraticRepublic = "flag-sahrawi_arab_democratic_republic", + SaintKittsAndNevis = "flag-saint_kitts_and_nevis", + Samoa = "flag-samoa", + SanMarino = "flag-san_marino", + SaoTomeAndPrincipe = "flag-sao_tome_and_principe", + Sardinia = "flag-sardinia", + SaudiArabia = "flag-saudi_arabia", + Scotland = "flag-scotland", + Senegal = "flag-senegal", + Serbia = "flag-serbia", + Seychelles = "flag-seychelles", + Sicily = "flag-sicily", + SierraLeone = "flag-sierra_leone", + Singapore = "flag-singapore", + SintEustatius = "flag-sint_eustatius", + SintMaarten = "flag-sint_maarten", + Slovakia = "flag-slovakia", + Slovenia = "flag-slovenia", + SolomonIslands = "flag-solomon_islands", + Somalia = "flag-somalia", + Somaliland = "flag-somaliland", + SouthAfrica = "flag-south_africa", + SouthKorea = "flag-south_korea", + SouthSudan = "flag-south_sudan", + Spain = "flag-spain", + SriLanka = "flag-sri_lanka", + StBarts = "flag-st_barts", + StLucia = "flag-st_lucia", + StVincentAndTheGrenadines = "flag-st_vincent_and_the_grenadines", + Sudan = "flag-sudan", + Suriname = "flag-suriname", + Sweden = "flag-sweden", + Switzerland = "flag-switzerland", + Syria = "flag-syria", + Taiwan = "flag-taiwan", + Tajikistan = "flag-tajikistan", + Tanzania = "flag-tanzania", + Thailand = "flag-thailand", + Tibet = "flag-tibet", + Togo = "flag-togo", + Tokelau = "flag-tokelau", + Tonga = "flag-tonga", + Transnistria = "flag-transnistria", + TrinidadAndTobago = "flag-trinidad_and_tobago", + Tubalu = "flag-tubalu", + Tunisia = "flag-tunisia", + Turkey = "flag-turkey", + Turkmenistan = "flag-turkmenistan", + TurksAndCaicos = "flag-turks_and_caicos", + Uganda = "flag-uganda", + Ukraine = "flag-ukraine", + UnitedArabEmirates = "flag-united_arab_emirates", + UnitedKingdom = "flag-united_kingdom", + UnitedNations = "flag-united_nations", + UnitedStatesOfAmerica = "flag-united_states_of_america", + Uruguay = "flag-uruguay", + Uzbekistn = "flag-uzbekistn", + Vanuatu = "flag-vanuatu", + VaticanCity = "flag-vatican_city", + Venezuela = "flag-venezuela", + Vietnam = "flag-vietnam", + VirginIslands = "flag-virgin_islands", + Wales = "flag-wales", + Worldwide = "flag-worldwide", + Yemen = "flag-yemen", + Zambia = "flag-zambia", + Zimbabwe = "flag-zimbabwe", +} + +export const spriteEntries: { + id: string; + className: string; + width: number; + height: number; + xOffset: number; + yOffset: number; +}[]; + +export const spriteUrl: string; +export const classList: string[]; + +export const spriteWidth: number; +export const spriteHeight: number; \ No newline at end of file diff --git a/installer/build.ts b/installer/build.ts index 735854e..05657f2 100644 --- a/installer/build.ts +++ b/installer/build.ts @@ -1,5 +1,5 @@ import {Options} from "electron-packager"; -import * as packager from "electron-packager" +import packager from "electron-packager" const pkg = require('../package.json'); if(pkg.name !== "TeaClient") { @@ -344,7 +344,7 @@ async function downloadBundledUiPack(channel: string, targetDirectory: string) { } let path; -new Promise((resolve, reject) => packager(options, (err, appPaths) => err ? reject(err) : resolve(appPaths))).then(async app_paths => { +new Promise((resolve, reject) => packager(options, (err, appPaths) => err ? reject(err) : resolve(appPaths))).then(async app_paths => { console.log("Copying changelog file!"); /* We dont have promisify in our build system */ await fs.copy(path_helper.join(options.dir, "github", "ChangeLog.txt"), path_helper.join(app_paths[0], "ChangeLog.txt")); diff --git a/modules/core/main.ts b/modules/core/main.ts index 25bc0bd..c60cb70 100644 --- a/modules/core/main.ts +++ b/modules/core/main.ts @@ -116,15 +116,21 @@ async function handleAppReady() { callback: async () => true }); - const result = await electron.dialog.showMessageBox(null, { - type: type, - message: message, - title: title, - buttons: buttons.map(e => e.key) - } as MessageBoxOptions); - if(buttons[result.response].callback) { - if(await buttons[result.response].callback()) - return; + referenceApp(); + try { + const result = await electron.dialog.showMessageBox(null, { + type: type, + message: message, + title: title, + buttons: buttons.map(e => e.key) + } as MessageBoxOptions); + if(buttons[result.response].callback) { + if(await buttons[result.response].callback()) { + return; + } + } + } finally { + dereferenceApp(); } } @@ -135,13 +141,14 @@ async function handleAppReady() { } } + referenceApp(); try { const main = require("./main-window"); - - referenceApp(); await main.execute(); - dereferenceApp(); } catch (error) { + /* Reference will leak but we call exit manually */ + referenceApp(); + console.error(error); await electron.dialog.showMessageBox({ type: "error", @@ -150,6 +157,8 @@ async function handleAppReady() { buttons: ["close"] } as MessageBoxOptions); electron.app.exit(1); + } finally { + dereferenceApp(); } } diff --git a/modules/core/ui-loader/Loader.ts b/modules/core/ui-loader/Loader.ts index 3782a3a..ba2322a 100644 --- a/modules/core/ui-loader/Loader.ts +++ b/modules/core/ui-loader/Loader.ts @@ -1,5 +1,5 @@ import {is_debug} from "../main-window"; -import * as moment from "moment"; +import moment from "moment"; import * as fs from "fs-extra"; import * as os from "os"; diff --git a/modules/renderer/connection/ServerConnection.ts b/modules/renderer/connection/ServerConnection.ts index 6ebddb4..c5479df 100644 --- a/modules/renderer/connection/ServerConnection.ts +++ b/modules/renderer/connection/ServerConnection.ts @@ -206,8 +206,8 @@ export class ServerConnection extends AbstractServerConnection { this.rtcConnection = new RTCConnection(this, false); this.videoConnection = new RtpVideoConnection(this.rtcConnection); - this.commandHandler.register_handler(this.commandErrorHandler); - this.commandHandler.register_handler(this.defaultCommandHandler); + this.commandHandler.registerHandler(this.commandErrorHandler); + this.commandHandler.registerHandler(this.defaultCommandHandler); this.nativeHandle = spawn_native_server_connection(); this.nativeHandle.callback_disconnect = reason => { @@ -233,10 +233,7 @@ export class ServerConnection extends AbstractServerConnection { console.log("Received: %o %o %o", command, args, switches); //FIXME catch error - this.commandHandler.invoke_handle({ - command: command, - arguments: args - }); + this.commandHandler.invokeCommand(new ServerCommand(command, args, switches)); }; this.voiceConnection = new NativeVoiceConnectionWrapper(this, this.nativeHandle._voice_connection); @@ -333,7 +330,7 @@ export class ServerConnection extends AbstractServerConnection { return this.voiceConnection; } - command_handler_boss(): AbstractCommandHandlerBoss { + getCommandHandler(): AbstractCommandHandlerBoss { return this.commandHandler; } diff --git a/modules/tsconfig_main.json b/modules/tsconfig_main.json index 94712dc..c1b95a4 100644 --- a/modules/tsconfig_main.json +++ b/modules/tsconfig_main.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "sourceMap": true, - "moduleResolution": "node" + "moduleResolution": "node", + "esModuleInterop": true }, "include": [ "./core", diff --git a/modules/tsconfig_renderer.json b/modules/tsconfig_renderer.json index 27559b5..f26d202 100644 --- a/modules/tsconfig_renderer.json +++ b/modules/tsconfig_renderer.json @@ -4,6 +4,7 @@ "target": "es6", "sourceMap": true, "moduleResolution": "node", + "esModuleInterop": true, "baseUrl": "..", "paths": { diff --git a/native/serverconnection/test/js/audio.ts b/native/serverconnection/test/js/audio.ts index ac4d7b8..6bb65a6 100644 --- a/native/serverconnection/test/js/audio.ts +++ b/native/serverconnection/test/js/audio.ts @@ -27,7 +27,7 @@ function printDevices() { } async function levelMeterDevice(deviceId: string) { - const levelMeter = record.create_level_meter(deviceId); + const levelMeter = record.create_device_level_meter(deviceId); await new Promise((resolve, reject) => { levelMeter.start(error => { if(typeof error !== "undefined") { diff --git a/native/updater/logger.cpp b/native/updater/logger.cpp index b51fc8c..4d9d790 100644 --- a/native/updater/logger.cpp +++ b/native/updater/logger.cpp @@ -21,8 +21,10 @@ std::unique_ptr file_stream; std::string logging_session; void logger::log_raw(logger::level::value level, const char* format, ...) { - if(!log_buffer) + if(!log_buffer) { log_buffer = std::unique_ptr((char*) malloc(LOG_BUFFER_SIZE), ::free); + } + if(logging_session.empty()) { std::ostringstream os; os << std::uppercase << std::setfill('0') << std::setw(4) << std::hex << (uint32_t) rand(); @@ -66,8 +68,9 @@ void logger::flush() { bool logger::pipe_file(const std::string_view &target) { auto handle = std::make_unique(std::string(target.data(), target.size()), std::ofstream::app | std::ofstream::out); - if(!handle->good()) + if(!handle->good()) { return false; + } file_stream = std::move(handle); return true; } \ No newline at end of file diff --git a/native/updater/util.cpp b/native/updater/util.cpp index a3a2873..f15e31a 100644 --- a/native/updater/util.cpp +++ b/native/updater/util.cpp @@ -17,27 +17,29 @@ using namespace std; void execute_app(LPCTSTR lpApplicationName,LPSTR arguments) { - // additional information STARTUPINFO si; - PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + + PROCESS_INFORMATION pi; + memset(&pi, 0, sizeof(pi)); - // set the size of the structures - ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); // start the program up - auto result = CreateProcess( lpApplicationName, // the path - arguments, // Command line - nullptr, // Process handle not inheritable - nullptr, // Thread handle not inheritable - FALSE, // Set handle inheritance to FALSE - CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE , // No creation flags - nullptr, // Use parent's environment block - nullptr, // Use parent's starting directory - &si, // Pointer to STARTUPINFO structure - &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses) + auto result = CreateProcessA( + lpApplicationName, // the path + arguments, // Command line + nullptr, // Process handle not inheritable + nullptr, // Thread handle not inheritable + false, // Set handle inheritance to FALSE + 0, // No creation flags + nullptr, // Use parent's environment block + nullptr, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses) ); + (void) result; + // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); @@ -130,7 +132,7 @@ bool is_administrator() { extern bool request_administrator(int argc, char** argv) { char szPath[MAX_PATH]; - if (GetModuleFileName(nullptr, szPath, ARRAYSIZE(szPath))) { + if (GetModuleFileName(nullptr, szPath, MAX_PATH)) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.lpVerb = "runas"; @@ -140,10 +142,13 @@ extern bool request_administrator(int argc, char** argv) { if(argc > 1) { size_t param_size = 0; - for(int i = 1; i < argc; i++) + for(int i = 1; i < argc; i++) { param_size += strlen(argv[i]) + 1; + } sei.lpParameters = (char*) malloc(param_size); - if(!sei.lpParameters) return false; + if(!sei.lpParameters) { + return false; + } auto buf = (char*) sei.lpParameters; for(int i = 1; i < argc; i++) { @@ -152,11 +157,13 @@ extern bool request_administrator(int argc, char** argv) { buf += length; *buf++ = ' '; } - *(--buf) = 0; + *buf = 0; } - bool success = ShellExecuteEx(&sei); - if(sei.lpParameters) ::free((void*) sei.lpParameters); + bool success = ShellExecuteExA(&sei); + if(sei.lpParameters) { + ::free((void*) sei.lpParameters); + } return success; } return true; diff --git a/package-lock.json b/package-lock.json index 7454ce0..0ffa8a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "teaspeak_client", - "version": "1.5.0-9", + "name": "TeaClient", + "version": "1.5.3-1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4159,9 +4159,9 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "jquery": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", - "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" }, "jsbn": { "version": "0.1.1", @@ -4242,25 +4242,6 @@ } } }, - "jsrender": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/jsrender/-/jsrender-1.0.11.tgz", - "integrity": "sha512-1BFRSKCgO8T1o3QB16/CYqnxLVxgIdXnXBmZcyLQOlEwxVfktCHXcC7n2o9lziI//pKEc5QzI92vglvBnoddRw==", - "requires": { - "through2": "^3.0.1" - }, - "dependencies": { - "through2": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", - "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - } - } - }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", diff --git a/package.json b/package.json index 918b038..a3a3852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "TeaClient", - "version": "1.5.3-1", + "version": "1.5.3-2", "description": "", "main": "main.js", "scripts": {