Added accedentally deleted imports

This commit is contained in:
WolverinDEV 2021-02-20 18:55:36 +01:00
parent 5e41be9f8a
commit d575281a22
341 changed files with 11766 additions and 2 deletions

4
.gitignore vendored
View File

@ -14,8 +14,8 @@ updater/postzip/TeaClient-linux.tar.gz
.deploy_secret
**/*.d.ts
modules/**/*.d.ts
!/imports/
!/modules/renderer/imports/.copy_*.d.ts
npm-debug.log
npm-debug.log

View File

@ -0,0 +1,199 @@
import { AbstractServerConnection } from "./connection/ConnectionBase";
import { PermissionManager } from "./permission/PermissionManager";
import { GroupManager } from "./permission/GroupManager";
import { ServerSettings } from "./settings";
import { SoundManager } from "./sound/Sounds";
import { ConnectionProfile } from "./profiles/ConnectionProfile";
import { RecorderProfile } from "./voice/RecorderProfile";
import { Registry } from "./events";
import { FileManager } from "./file/FileManager";
import { PluginCmdRegistry } from "./connection/PluginCmdHandler";
import { ServerFeatures } from "./connection/ServerFeatures";
import { ChannelTree } from "./tree/ChannelTree";
import { LocalClientEntry } from "./tree/Client";
import { ChannelVideoFrame } from "tc-shared/ui/frames/video/Controller";
import { ChannelConversationManager } from "./conversations/ChannelConversationManager";
import { PrivateConversationManager } from "tc-shared/conversations/PrivateConversationManager";
import { SelectedClientInfo } from "./SelectedClientInfo";
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";
export declare enum InputHardwareState {
MISSING = 0,
START_FAILED = 1,
VALID = 2
}
export declare enum DisconnectReason {
HANDLER_DESTROYED = 0,
REQUESTED = 1,
DNS_FAILED = 2,
CONNECT_FAILURE = 3,
CONNECTION_CLOSED = 4,
CONNECTION_FATAL_ERROR = 5,
CONNECTION_PING_TIMEOUT = 6,
CLIENT_KICKED = 7,
CLIENT_BANNED = 8,
HANDSHAKE_FAILED = 9,
HANDSHAKE_TEAMSPEAK_REQUIRED = 10,
HANDSHAKE_BANNED = 11,
SERVER_CLOSED = 12,
SERVER_REQUIRES_PASSWORD = 13,
SERVER_HOSTMESSAGE = 14,
IDENTITY_TOO_LOW = 15,
UNKNOWN = 16
}
export declare enum ConnectionState {
UNCONNECTED = 0,
CONNECTING = 1,
INITIALISING = 2,
AUTHENTICATING = 3,
CONNECTED = 4,
DISCONNECTING = 5
}
export declare namespace ConnectionState {
function socketConnected(state: ConnectionState): boolean;
function fullyConnected(state: ConnectionState): boolean;
}
export declare enum ViewReasonId {
VREASON_USER_ACTION = 0,
VREASON_MOVED = 1,
VREASON_SYSTEM = 2,
VREASON_TIMEOUT = 3,
VREASON_CHANNEL_KICK = 4,
VREASON_SERVER_KICK = 5,
VREASON_BAN = 6,
VREASON_SERVER_STOPPED = 7,
VREASON_SERVER_LEFT = 8,
VREASON_CHANNEL_UPDATED = 9,
VREASON_EDITED = 10,
VREASON_SERVER_SHUTDOWN = 11
}
export interface LocalClientStatus {
input_muted: boolean;
output_muted: boolean;
lastChannelCodecWarned: number;
away: boolean | string;
channel_subscribe_all: boolean;
queries_visible: boolean;
}
export interface ConnectParametersOld {
nickname?: string;
channel?: {
target: string | number;
password?: string;
};
token?: string;
password?: {
password: string;
hashed: boolean;
};
auto_reconnect_attempt?: boolean;
}
export declare class ConnectionHandler {
readonly handlerId: string;
private readonly events_;
channelTree: ChannelTree;
connection_state: ConnectionState;
serverConnection: AbstractServerConnection;
currentConnectId: number;
fileManager: FileManager;
permissions: PermissionManager;
groups: GroupManager;
video_frame: ChannelVideoFrame;
settings: ServerSettings;
sound: SoundManager;
serverFeatures: ServerFeatures;
private sideBar;
private playlistManager;
private channelConversations;
private privateConversations;
private clientInfoManager;
private localClientId;
private localClient;
private autoReconnectTimer;
private autoReconnectAttempt;
private connectAttemptId;
private echoTestRunning;
private pluginCmdRegistry;
private client_status;
private clientStatusSync;
private inputHardwareState;
private listenerRecorderInputDeviceChanged;
log: ServerEventLog;
constructor();
initialize_client_state(source?: ConnectionHandler): void;
events(): Registry<ConnectionEvents>;
startConnectionNew(parameters: ConnectParameters, autoReconnectAttempt: boolean): Promise<void>;
startConnection(addr: string, profile: ConnectionProfile, user_action: boolean, parameters: ConnectParametersOld): Promise<void>;
disconnectFromServer(reason?: string): Promise<void>;
getClient(): LocalClientEntry;
getClientId(): number;
getPrivateConversations(): PrivateConversationManager;
getChannelConversations(): ChannelConversationManager;
getSelectedClientInfo(): SelectedClientInfo;
getSideBar(): SideBarManager;
getPlaylistManager(): PlaylistManager;
initializeLocalClient(clientId: number, acceptedName: string): void;
getServerConnection(): AbstractServerConnection;
private handleConnectionStateChanged;
get connected(): boolean;
private generate_ssl_certificate_accept;
private _certificate_modal;
handleDisconnect(type: DisconnectReason, data?: any): void;
cancelAutoReconnect(log_event: boolean): void;
private on_connection_state_changed;
private updateVoiceStatus;
private lastRecordErrorPopup;
update_voice_status(): void;
sync_status_with_server(): void;
acquireInputHardware(): Promise<void>;
startVoiceRecorder(notifyError: boolean): Promise<{
state: "success" | "no-input";
} | {
state: "error";
message: string;
}>;
getVoiceRecorder(): RecorderProfile | undefined;
reconnect_properties(profile?: ConnectionProfile): ConnectParametersOld;
update_avatar(): void;
private initializeWhisperSession;
destroy(): void;
setMicrophoneMuted(muted: boolean, dontPlaySound?: boolean): void;
toggleMicrophone(): void;
isMicrophoneMuted(): boolean;
isMicrophoneDisabled(): boolean;
setSpeakerMuted(muted: boolean, dontPlaySound?: boolean): void;
toggleSpeakerMuted(): void;
isSpeakerMuted(): boolean;
isSpeakerDisabled(): boolean;
setSubscribeToAllChannels(flag: boolean): void;
isSubscribeToAllChannels(): boolean;
setAway(state: boolean | string): void;
private doSetAway;
toggleAway(): void;
isAway(): boolean;
setQueriesShown(flag: boolean): void;
areQueriesShown(): boolean;
getInputHardwareState(): InputHardwareState;
private setInputHardwareState;
hasOutputHardware(): boolean;
getPluginCmdRegistry(): PluginCmdRegistry;
startEchoTest(): Promise<void>;
stopEchoTest(): void;
getCurrentServerUniqueId(): string;
}
export declare type ConnectionStateUpdateType = "microphone" | "speaker" | "away" | "subscribe" | "query";
export interface ConnectionEvents {
notify_state_updated: {
state: ConnectionStateUpdateType;
};
notify_connection_state_changed: {
oldState: ConnectionState;
newState: ConnectionState;
};
notify_visibility_changed: {
visible: boolean;
};
notify_handler_initialized: {};
}

View File

@ -0,0 +1,35 @@
import { ConnectionHandler } from "./ConnectionHandler";
import { Registry } from "./events";
export interface ConnectionManagerEvents {
notify_handler_created: {
handlerId: string;
handler: ConnectionHandler;
};
notify_active_handler_changed: {
oldHandler: ConnectionHandler | undefined;
newHandler: ConnectionHandler | undefined;
oldHandlerId: string | undefined;
newHandlerId: string | undefined;
};
notify_handler_deleted: {
handlerId: string;
handler: ConnectionHandler;
};
notify_handler_order_changed: {};
}
export declare class ConnectionManager {
private readonly events_;
private connectionHandlers;
private activeConnectionHandler;
constructor();
events(): Registry<ConnectionManagerEvents>;
spawnConnectionHandler(): ConnectionHandler;
destroyConnectionHandler(handler: ConnectionHandler): void;
setActiveConnectionHandler(handler: ConnectionHandler): void;
private doSetActiveConnectionHandler;
swapHandlerOrder(handlerA: ConnectionHandler, handlerB: ConnectionHandler): void;
findConnection(handlerId: string): ConnectionHandler | undefined;
getActiveConnectionHandler(): ConnectionHandler | undefined;
getAllConnectionHandlers(): ConnectionHandler[];
}
export declare let server_connections: ConnectionManager;

18
imports/shared-app/KeyControl.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
import { KeyDescriptor } from "./PPTListener";
export interface KeyControl {
category: string;
description: string;
handler: () => void;
icon: string;
}
export declare const TypeCategories: {
[key: string]: {
name: string;
};
};
export declare const KeyTypes: {
[key: string]: KeyControl;
};
export declare function initializeKeyControl(): void;
export declare function setKey(action: string, key?: KeyDescriptor): void;
export declare function key(action: string): KeyDescriptor | undefined;

View File

@ -0,0 +1 @@
export declare function formatDate(secs: number): string;

147
imports/shared-app/PPTListener.d.ts vendored Normal file
View File

@ -0,0 +1,147 @@
export declare enum KeyCode {
KEY_CANCEL = 3,
KEY_HELP = 6,
KEY_BACK_SPACE = 8,
KEY_TAB = 9,
KEY_CLEAR = 12,
KEY_RETURN = 13,
KEY_ENTER = 14,
KEY_SHIFT = 16,
KEY_CONTROL = 17,
KEY_ALT = 18,
KEY_PAUSE = 19,
KEY_CAPS_LOCK = 20,
KEY_ESCAPE = 27,
KEY_SPACE = 32,
KEY_PAGE_UP = 33,
KEY_PAGE_DOWN = 34,
KEY_END = 35,
KEY_HOME = 36,
KEY_LEFT = 37,
KEY_UP = 38,
KEY_RIGHT = 39,
KEY_DOWN = 40,
KEY_PRINTSCREEN = 44,
KEY_INSERT = 45,
KEY_DELETE = 46,
KEY_0 = 48,
KEY_1 = 49,
KEY_2 = 50,
KEY_3 = 51,
KEY_4 = 52,
KEY_5 = 53,
KEY_6 = 54,
KEY_7 = 55,
KEY_8 = 56,
KEY_9 = 57,
KEY_SEMICOLON = 59,
KEY_EQUALS = 61,
KEY_A = 65,
KEY_B = 66,
KEY_C = 67,
KEY_D = 68,
KEY_E = 69,
KEY_F = 70,
KEY_G = 71,
KEY_H = 72,
KEY_I = 73,
KEY_J = 74,
KEY_K = 75,
KEY_L = 76,
KEY_M = 77,
KEY_N = 78,
KEY_O = 79,
KEY_P = 80,
KEY_Q = 81,
KEY_R = 82,
KEY_S = 83,
KEY_T = 84,
KEY_U = 85,
KEY_V = 86,
KEY_W = 87,
KEY_X = 88,
KEY_Y = 89,
KEY_Z = 90,
KEY_LEFT_CMD = 91,
KEY_RIGHT_CMD = 93,
KEY_CONTEXT_MENU = 93,
KEY_NUMPAD0 = 96,
KEY_NUMPAD1 = 97,
KEY_NUMPAD2 = 98,
KEY_NUMPAD3 = 99,
KEY_NUMPAD4 = 100,
KEY_NUMPAD5 = 101,
KEY_NUMPAD6 = 102,
KEY_NUMPAD7 = 103,
KEY_NUMPAD8 = 104,
KEY_NUMPAD9 = 105,
KEY_MULTIPLY = 106,
KEY_ADD = 107,
KEY_SEPARATOR = 108,
KEY_SUBTRACT = 109,
KEY_DECIMAL = 110,
KEY_DIVIDE = 111,
KEY_F1 = 112,
KEY_F2 = 113,
KEY_F3 = 114,
KEY_F4 = 115,
KEY_F5 = 116,
KEY_F6 = 117,
KEY_F7 = 118,
KEY_F8 = 119,
KEY_F9 = 120,
KEY_F10 = 121,
KEY_F11 = 122,
KEY_F12 = 123,
KEY_F13 = 124,
KEY_F14 = 125,
KEY_F15 = 126,
KEY_F16 = 127,
KEY_F17 = 128,
KEY_F18 = 129,
KEY_F19 = 130,
KEY_F20 = 131,
KEY_F21 = 132,
KEY_F22 = 133,
KEY_F23 = 134,
KEY_F24 = 135,
KEY_NUM_LOCK = 144,
KEY_SCROLL_LOCK = 145,
KEY_COMMA = 188,
KEY_PERIOD = 190,
KEY_SLASH = 191,
KEY_BACK_QUOTE = 192,
KEY_OPEN_BRACKET = 219,
KEY_BACK_SLASH = 220,
KEY_CLOSE_BRACKET = 221,
KEY_QUOTE = 222,
KEY_META = 224
}
export declare enum EventType {
KEY_PRESS = 0,
KEY_RELEASE = 1,
KEY_TYPED = 2
}
export declare enum SpecialKey {
CTRL = 0,
WINDOWS = 1,
SHIFT = 2,
ALT = 3
}
export interface KeyDescriptor {
key_code: string;
key_ctrl: boolean;
key_windows: boolean;
key_shift: boolean;
key_alt: boolean;
}
export interface KeyEvent extends KeyDescriptor {
readonly type: EventType;
readonly key: string;
}
export interface KeyHook extends KeyDescriptor {
cancel: boolean;
callback_press: () => any;
callback_release: () => any;
}
export declare function key_description(key: KeyDescriptor): string;

View File

@ -0,0 +1,56 @@
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { ClientForumInfo, ClientInfoType, ClientStatusInfo, ClientVersionInfo } from "tc-shared/ui/frames/side/ClientInfoDefinitions";
import { ClientEntry } from "tc-shared/tree/Client";
import { Registry } from "tc-shared/events";
export declare type CachedClientInfoCategory = "name" | "description" | "online-state" | "country" | "volume" | "status" | "forum-account" | "group-channel" | "groups-server" | "version";
export declare type CachedClientInfo = {
type: ClientInfoType;
name: string;
uniqueId: string;
databaseId: number;
clientId: number;
description: string;
joinTimestamp: number;
leaveTimestamp: number;
country: {
name: string;
flag: string;
};
volume: {
volume: number;
muted: boolean;
};
status: ClientStatusInfo;
forumAccount: ClientForumInfo | undefined;
channelGroup: number;
serverGroups: number[];
version: ClientVersionInfo;
};
export interface ClientInfoManagerEvents {
notify_client_changed: {
newClient: ClientEntry | undefined;
};
notify_cache_changed: {
category: CachedClientInfoCategory;
};
}
export declare class SelectedClientInfo {
readonly events: Registry<ClientInfoManagerEvents>;
private readonly connection;
private readonly listenerConnection;
private listenerClient;
private currentClient;
private currentClientStatus;
constructor(connection: ConnectionHandler);
destroy(): void;
getInfo(): CachedClientInfo;
setClient(client: ClientEntry | undefined): void;
getClient(): ClientEntry | undefined;
private unregisterClientEvents;
private registerClientEvents;
private updateCachedClientStatus;
private updateCachedCountry;
private updateCachedVolume;
private updateForumAccount;
private initializeClientInfo;
}

24
imports/shared-app/SideBarManager.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
import { SideBarType } from "tc-shared/ui/frames/SideBarDefinitions";
import { Registry } from "tc-shared/events";
import { ClientEntry, MusicClientEntry } from "tc-shared/tree/Client";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
export interface SideBarManagerEvents {
notify_content_type_changed: {
newContent: SideBarType;
};
}
export declare class SideBarManager {
readonly events: Registry<SideBarManagerEvents>;
private readonly connection;
private currentType;
constructor(connection: ConnectionHandler);
destroy(): void;
getSideBarContent(): SideBarType;
setSideBarContent(content: SideBarType): void;
showPrivateConversations(): void;
showChannel(): void;
showServer(): void;
showClientInfo(client: ClientEntry): void;
showMusicPlayer(_client: MusicClientEntry): void;
clearSideBar(): void;
}

5
imports/shared-app/audio/player.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export interface Device {
device_id: string;
driver: string;
name: string;
}

67
imports/shared-app/audio/recorder.d.ts vendored Normal file
View File

@ -0,0 +1,67 @@
import { AbstractInput, LevelMeter } from "../voice/RecorderBase";
import { Registry } from "../events";
export declare type DeviceQueryResult = {};
export interface AudioRecorderBacked {
createInput(): AbstractInput;
createLevelMeter(device: IDevice): Promise<LevelMeter>;
getDeviceList(): DeviceList;
isRnNoiseSupported(): boolean;
toggleRnNoise(target: boolean): any;
}
export interface DeviceListEvents {
notify_list_updated: {
removedDeviceCount: number;
addedDeviceCount: number;
};
notify_state_changed: {
oldState: DeviceListState;
newState: DeviceListState;
};
notify_permissions_changed: {
oldState: PermissionState;
newState: PermissionState;
};
}
export declare type DeviceListState = "healthy" | "uninitialized" | "no-permissions" | "error";
export interface IDevice {
deviceId: string;
driver: string;
name: string;
}
export declare namespace IDevice {
const NoDeviceId = "none";
const DefaultDeviceId = "default";
}
export declare type PermissionState = "granted" | "denied" | "unknown";
export interface DeviceList {
getEvents(): Registry<DeviceListEvents>;
isRefreshAvailable(): boolean;
refresh(): Promise<void>;
requestPermissions(): Promise<PermissionState>;
getPermissionState(): PermissionState;
getStatus(): DeviceListState;
getDevices(): IDevice[];
getDefaultDeviceId(): string;
awaitHealthy(): Promise<void>;
awaitInitialized(): Promise<void>;
}
export declare abstract class AbstractDeviceList implements DeviceList {
protected readonly events: Registry<DeviceListEvents>;
protected listState: DeviceListState;
protected permissionState: PermissionState;
protected constructor();
getStatus(): DeviceListState;
getPermissionState(): PermissionState;
protected setState(state: DeviceListState): void;
protected setPermissionState(state: PermissionState): void;
awaitInitialized(): Promise<void>;
awaitHealthy(): Promise<void>;
abstract getDefaultDeviceId(): string;
abstract getDevices(): IDevice[];
abstract getEvents(): Registry<DeviceListEvents>;
abstract isRefreshAvailable(): boolean;
abstract refresh(): Promise<void>;
abstract requestPermissions(): Promise<PermissionState>;
}
export declare function getRecorderBackend(): AudioRecorderBacked;
export declare function setRecorderBackend(instance: AudioRecorderBacked): void;

View File

@ -0,0 +1,15 @@
export declare type NativeClientVersionInfo = {
version: string;
os_architecture: string;
os_platform: string;
os_platform_version: string;
};
export interface NativeClientBackend {
openChangeLog(): void;
openClientUpdater(): void;
quit(): void;
showDeveloperOptions(): boolean;
openDeveloperTools(): void;
reloadWindow(): void;
getVersionInfo(): NativeClientVersionInfo;
}

View File

@ -0,0 +1,2 @@
export interface WebClientBackend {
}

5
imports/shared-app/backend/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { NativeClientBackend } from "tc-shared/backend/NativeClient";
import { WebClientBackend } from "tc-shared/backend/WebClient";
export declare function getBackend(target: "native"): NativeClientBackend;
export declare function getBackend(target: "web"): WebClientBackend;
export declare function setBackend(instance: NativeClientBackend | WebClientBackend): void;

48
imports/shared-app/bookmarks.d.ts vendored Normal file
View File

@ -0,0 +1,48 @@
import { ConnectionHandler } from "./ConnectionHandler";
import { Registry } from "tc-shared/events";
export interface BookmarkEvents {
notify_bookmarks_updated: {};
}
export declare const bookmarkEvents: Registry<BookmarkEvents>;
export declare const boorkmak_connect: (mark: Bookmark, new_tab?: boolean) => void;
export interface ServerProperties {
server_address: string;
server_port: number;
server_password_hash?: string;
server_password?: string;
}
export declare enum BookmarkType {
ENTRY = 0,
DIRECTORY = 1
}
export interface Bookmark {
type: BookmarkType.ENTRY;
parent: DirectoryBookmark;
server_properties: ServerProperties;
display_name: string;
unique_id: string;
nickname: string;
default_channel?: number | string;
default_channel_password_hash?: string;
default_channel_password?: string;
connect_profile: string;
last_icon_id?: number;
last_icon_server_id?: string;
}
export interface DirectoryBookmark {
type: BookmarkType.DIRECTORY;
parent: DirectoryBookmark;
readonly content: (Bookmark | DirectoryBookmark)[];
unique_id: string;
display_name: string;
}
export declare function bookmarks(): DirectoryBookmark;
export declare function bookmarks_flat(): Bookmark[];
export declare function find_bookmark(uuid: string): Bookmark | DirectoryBookmark | undefined;
export declare function parent_bookmark(bookmark: Bookmark): DirectoryBookmark;
export declare function create_bookmark(display_name: string, directory: DirectoryBookmark, server_properties: ServerProperties, nickname: string): Bookmark;
export declare function create_bookmark_directory(parent: DirectoryBookmark, name: string): DirectoryBookmark;
export declare function change_directory(parent: DirectoryBookmark, bookmark: Bookmark | DirectoryBookmark): void;
export declare function save_bookmark(bookmark?: Bookmark | DirectoryBookmark): void;
export declare function delete_bookmark(bookmark: Bookmark | DirectoryBookmark): void;
export declare function add_server_to_bookmarks(server: ConnectionHandler): void;

View File

@ -0,0 +1,3 @@
import { ClientServiceInvite, ClientServices } from "tc-services";
export declare let clientServices: ClientServices;
export declare let clientServiceInvite: ClientServiceInvite;

View File

@ -0,0 +1,31 @@
import { AbstractServerConnection, ServerCommand, SingleCommandHandler } from "../connection/ConnectionBase";
export declare abstract class AbstractCommandHandler {
readonly connection: AbstractServerConnection;
handler_boss: AbstractCommandHandlerBoss | undefined;
volatile_handler_boss: boolean;
ignore_consumed: boolean;
protected constructor(connection: AbstractServerConnection);
/**
* @return If the command should be consumed
*/
abstract handle_command(command: ServerCommand): boolean;
}
export declare type ExplicitCommandHandler = (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[];
};
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;
handlers(): AbstractCommandHandler[];
invoke_handle(command: ServerCommand): boolean;
}

View File

@ -0,0 +1,50 @@
import { AbstractServerConnection, CommandOptions, ServerCommand } from "../connection/ConnectionBase";
import { CommandResult } from "../connection/ServerConnectionDeclaration";
import { ConnectionHandler } from "../ConnectionHandler";
import { AbstractCommandHandler, AbstractCommandHandlerBoss } from "../connection/AbstractCommandHandler";
export declare class ServerConnectionCommandBoss extends AbstractCommandHandlerBoss {
constructor(connection: AbstractServerConnection);
}
export declare class ConnectionCommandHandler extends AbstractCommandHandler {
readonly connection: AbstractServerConnection;
readonly connection_handler: ConnectionHandler;
constructor(connection: AbstractServerConnection);
private loggable_invoker;
proxy_command_promise(promise: Promise<CommandResult>, options: CommandOptions): Promise<CommandResult>;
handle_command(command: ServerCommand): boolean;
set_handler(command: string, handler: any): void;
unset_handler(command: string, handler?: any): void;
handleCommandResult(json: any): void;
handleCommandServerInit(json: any): void;
handleNotifyServerConnectionInfo(json: any): void;
handleNotifyConnectionInfo(json: any): void;
private createChannelFromJson;
private batchTreeUpdateFinishedTimeout;
handleCommandChannelList(json: any): void;
handleCommandChannelListFinished(): void;
handleCommandChannelCreate(json: any): void;
handleCommandChannelShow(json: any): void;
handleCommandChannelDelete(json: any): void;
handleCommandChannelHide(json: any): void;
handleCommandClientEnterView(json: any): void;
handleCommandClientLeftView(json: any): number;
handleNotifyClientMoved(json: any): number;
handleNotifyChannelMoved(json: any): number;
handleNotifyChannelEdited(json: any): number;
handleNotifyChannelDescriptionChanged(json: any): void;
handleNotifyTextMessage(json: any): void;
notifyClientChatComposing(json: any): void;
handleNotifyClientChatClosed(json: any): void;
handleNotifyClientUpdated(json: any): void;
handleNotifyServerEdited(json: any): void;
handleNotifyServerUpdated(json: any): void;
handleNotifyMusicPlayerInfo(json: any): void;
handleNotifyClientPoke(json: any): void;
handleNotifyServerGroupClientAdd(json: any): void;
handleNotifyServerGroupClientRemove(json: any): void;
handleNotifyClientChannelGroupChanged(json: any): void;
handleNotifyChannelSubscribed(json: any): void;
handleNotifyChannelUnsubscribed(json: any): void;
handleNotifyMusicStatusUpdate(json: any[]): void;
handleMusicPlayerSongChange(json: any[]): void;
}

View File

@ -0,0 +1,28 @@
import { ServerCommand } from "../connection/ConnectionBase";
import { ClientNameInfo, Playlist, PlaylistInfo, PlaylistSong, QueryList, ServerGroupClient } from "../connection/ServerConnectionDeclaration";
import { AbstractCommandHandler } from "../connection/AbstractCommandHandler";
export declare class CommandHelper extends AbstractCommandHandler {
private whoAmIResponse;
private infoByUniqueIdRequest;
private infoByDatabaseIdRequest;
constructor(connection: any);
initialize(): void;
destroy(): void;
handle_command(command: ServerCommand): boolean;
getInfoFromUniqueId(...uniqueIds: string[]): Promise<ClientNameInfo[]>;
private handleNotifyClientGetNameFromDatabaseId;
getInfoFromClientDatabaseId(...clientDatabaseIds: number[]): Promise<ClientNameInfo[]>;
private handleNotifyClientNameFromUniqueId;
requestQueryList(server_id?: number): Promise<QueryList>;
requestPlaylistList(): Promise<Playlist[]>;
requestPlaylistSongs(playlist_id: number, process_result?: boolean): Promise<PlaylistSong[]>;
request_playlist_client_list(playlist_id: number): Promise<number[]>;
requestClientsByServerGroup(group_id: number): Promise<ServerGroupClient[]>;
requestPlaylistInfo(playlist_id: number): Promise<PlaylistInfo>;
/**
* @deprecated
* Its just a workaround for the query management.
* There is no garantee that the whoami trick will work forever
*/
getCurrentVirtualServerId(): Promise<number>;
}

View File

@ -0,0 +1,65 @@
import { CommandHelper } from "../connection/CommandHelper";
import { HandshakeHandler } from "../connection/HandshakeHandler";
import { CommandResult } from "../connection/ServerConnectionDeclaration";
import { ServerAddress } from "../tree/Server";
import { ConnectionHandler, ConnectionState } from "../ConnectionHandler";
import { AbstractCommandHandlerBoss } from "../connection/AbstractCommandHandler";
import { Registry } from "../events";
import { AbstractVoiceConnection } from "../connection/VoiceConnection";
import { VideoConnection } from "tc-shared/connection/VideoConnection";
export interface CommandOptions {
flagset?: string[];
process_result?: boolean;
timeout?: number;
}
export declare const CommandOptionDefaults: CommandOptions;
export declare type ConnectionPing = {
javascript: number | undefined;
native: number;
};
export interface ServerConnectionEvents {
notify_connection_state_changed: {
oldState: ConnectionState;
newState: ConnectionState;
};
notify_ping_updated: {
newPing: ConnectionPing;
};
}
export declare type ConnectionStateListener = (old_state: ConnectionState, new_state: ConnectionState) => any;
export declare type ConnectionStatistics = {
bytesReceived: number;
bytesSend: number;
};
export declare abstract class AbstractServerConnection {
readonly events: Registry<ServerConnectionEvents>;
readonly client: ConnectionHandler;
readonly command_helper: CommandHelper;
protected connectionState: ConnectionState;
protected constructor(client: ConnectionHandler);
abstract connect(address: ServerAddress, handshake: HandshakeHandler, timeout?: number): Promise<void>;
abstract connected(): boolean;
abstract disconnect(reason?: string): Promise<void>;
abstract getServerType(): "teaspeak" | "teamspeak" | "unknown";
abstract getVoiceConnection(): AbstractVoiceConnection;
abstract getVideoConnection(): VideoConnection;
abstract command_handler_boss(): AbstractCommandHandlerBoss;
abstract send_command(command: string, data?: any | any[], options?: CommandOptions): Promise<CommandResult>;
abstract remote_address(): ServerAddress;
connectionProxyAddress(): ServerAddress | undefined;
abstract handshake_handler(): HandshakeHandler;
abstract getControlStatistics(): ConnectionStatistics;
updateConnectionState(state: ConnectionState): void;
getConnectionState(): ConnectionState;
abstract ping(): ConnectionPing;
}
export declare class ServerCommand {
command: string;
arguments: any[];
}
export interface SingleCommandHandler {
name?: string;
command?: string | string[];
timeout?: number;
function: (command: ServerCommand) => boolean;
}

View File

@ -0,0 +1,8 @@
import { AbstractServerConnection } from "../connection/ConnectionBase";
import { ConnectionHandler } from "../ConnectionHandler";
export interface ServerConnectionFactory {
create(client: ConnectionHandler): AbstractServerConnection;
destroy(instance: AbstractServerConnection): any;
}
export declare function setServerConnectionFactory(factory: ServerConnectionFactory): void;
export declare function getServerConnectionFactory(): ServerConnectionFactory;

View File

@ -0,0 +1,32 @@
import { AbstractVoiceConnection, VoiceConnectionStatus, WhisperSessionInitializer } from "../connection/VoiceConnection";
import { RecorderProfile } from "../voice/RecorderProfile";
import { AbstractServerConnection, ConnectionStatistics } from "../connection/ConnectionBase";
import { VoiceClient } from "../voice/VoiceClient";
import { WhisperSession, WhisperTarget } from "../voice/VoiceWhisper";
export declare class DummyVoiceConnection extends AbstractVoiceConnection {
private recorder;
private voiceClients;
constructor(connection: AbstractServerConnection);
acquireVoiceRecorder(recorder: RecorderProfile | undefined): Promise<void>;
availableVoiceClients(): VoiceClient[];
decodingSupported(codec: number): boolean;
encodingSupported(codec: number): boolean;
getConnectionState(): VoiceConnectionStatus;
getEncoderCodec(): number;
registerVoiceClient(clientId: number): VoiceClient;
setEncoderCodec(codec: number): void;
unregisterVoiceClient(client: VoiceClient): Promise<void>;
voiceRecorder(): RecorderProfile;
dropWhisperSession(session: WhisperSession): void;
getWhisperSessionInitializer(): WhisperSessionInitializer | undefined;
getWhisperSessions(): WhisperSession[];
setWhisperSessionInitializer(initializer: WhisperSessionInitializer | undefined): void;
getWhisperTarget(): WhisperTarget | undefined;
startWhisper(target: WhisperTarget): Promise<void>;
stopWhisper(): void;
getFailedMessage(): string;
isReplayingVoice(): boolean;
stopAllVoiceReplays(): void;
getConnectionStats(): Promise<ConnectionStatistics>;
getRetryTimestamp(): number | 0;
}

View File

@ -0,0 +1,161 @@
export declare enum ErrorCode {
OK = 0,
UNDEFINED = 1,
NOT_IMPLEMENTED = 2,
LIB_TIME_LIMIT_REACHED = 5,
COMMAND_NOT_FOUND = 256,
UNABLE_TO_BIND_NETWORK_PORT = 257,
NO_NETWORK_PORT_AVAILABLE = 258,
COMMAND_TIMED_OUT = 272,
COMMAND_ABORTED_CONNECTION_CLOSED = 273,
CLIENT_INVALID_ID = 512,
CLIENT_NICKNAME_INUSE = 513,
INVALID_ERROR_CODE = 514,
CLIENT_PROTOCOL_LIMIT_REACHED = 515,
CLIENT_INVALID_TYPE = 516,
CLIENT_ALREADY_SUBSCRIBED = 517,
CLIENT_NOT_LOGGED_IN = 518,
CLIENT_COULD_NOT_VALIDATE_IDENTITY = 519,
CLIENT_INVALID_PASSWORD = 520,
CLIENT_TOO_MANY_CLONES_CONNECTED = 521,
CLIENT_VERSION_OUTDATED = 522,
CLIENT_IS_ONLINE = 523,
CLIENT_IS_FLOODING = 524,
CLIENT_HACKED = 525,
CLIENT_CANNOT_VERIFY_NOW = 526,
CLIENT_LOGIN_NOT_PERMITTED = 527,
CLIENT_NOT_SUBSCRIBED = 528,
CLIENT_UNKNOWN = 529,
CLIENT_JOIN_RATE_LIMIT_REACHED = 530,
CLIENT_IS_ALREADY_MEMBER_OF_GROUP = 531,
CLIENT_IS_NOT_MEMBER_OF_GROUP = 532,
CLIENT_TYPE_IS_NOT_ALLOWED = 533,
CHANNEL_INVALID_ID = 768,
CHANNEL_PROTOCOL_LIMIT_REACHED = 769,
CHANNEL_ALREADY_IN = 770,
CHANNEL_NAME_INUSE = 771,
CHANNEL_NOT_EMPTY = 772,
CHANNEL_CAN_NOT_DELETE_DEFAULT = 773,
CHANNEL_DEFAULT_REQUIRE_PERMANENT = 774,
CHANNEL_INVALID_FLAGS = 775,
CHANNEL_PARENT_NOT_PERMANENT = 776,
CHANNEL_MAXCLIENTS_REACHED = 777,
CHANNEL_MAXFAMILY_REACHED = 778,
CHANNEL_INVALID_ORDER = 779,
CHANNEL_NO_FILETRANSFER_SUPPORTED = 780,
CHANNEL_INVALID_PASSWORD = 781,
CHANNEL_IS_PRIVATE_CHANNEL = 782,
CHANNEL_INVALID_SECURITY_HASH = 783,
CHANNEL_IS_DELETED = 784,
CHANNEL_NAME_INVALID = 785,
CHANNEL_LIMIT_REACHED = 786,
SERVER_INVALID_ID = 1024,
SERVER_RUNNING = 1025,
SERVER_IS_SHUTTING_DOWN = 1026,
SERVER_MAXCLIENTS_REACHED = 1027,
SERVER_INVALID_PASSWORD = 1028,
SERVER_DEPLOYMENT_ACTIVE = 1029,
SERVER_UNABLE_TO_STOP_OWN_SERVER = 1030,
SERVER_IS_VIRTUAL = 1031,
SERVER_WRONG_MACHINEID = 1032,
SERVER_IS_NOT_RUNNING = 1033,
SERVER_IS_BOOTING = 1034,
SERVER_STATUS_INVALID = 1035,
SERVER_MODAL_QUIT = 1036,
SERVER_VERSION_OUTDATED = 1037,
SERVER_ALREADY_JOINED = 1037,
SERVER_IS_NOT_SHUTTING_DOWN = 1038,
SERVER_MAX_VS_REACHED = 1039,
SERVER_UNBOUND = 1040,
SERVER_JOIN_RATE_LIMIT_REACHED = 1041,
SQL = 1280,
DATABASE_EMPTY_RESULT = 1281,
DATABASE_DUPLICATE_ENTRY = 1282,
DATABASE_NO_MODIFICATIONS = 1283,
DATABASE_CONSTRAINT = 1284,
DATABASE_REINVOKE = 1285,
PARAMETER_QUOTE = 1536,
PARAMETER_INVALID_COUNT = 1537,
PARAMETER_INVALID = 1538,
PARAMETER_NOT_FOUND = 1539,
PARAMETER_CONVERT = 1540,
PARAMETER_INVALID_SIZE = 1541,
PARAMETER_MISSING = 1542,
PARAMETER_CHECKSUM = 1543,
PARAMETER_CONSTRAINT_VIOLATION = 24592,
VS_CRITICAL = 1792,
CONNECTION_LOST = 1793,
NOT_CONNECTED = 1794,
NO_CACHED_CONNECTION_INFO = 1795,
CURRENTLY_NOT_POSSIBLE = 1796,
FAILED_CONNECTION_INITIALISATION = 1797,
COULD_NOT_RESOLVE_HOSTNAME = 1798,
INVALID_SERVER_CONNECTION_HANDLER_ID = 1799,
COULD_NOT_INITIALISE_INPUT_CLIENT = 1800,
CLIENTLIBRARY_NOT_INITIALISED = 1801,
SERVERLIBRARY_NOT_INITIALISED = 1802,
WHISPER_TOO_MANY_TARGETS = 1803,
WHISPER_NO_TARGETS = 1804,
FILE_INVALID_NAME = 2048,
FILE_INVALID_PERMISSIONS = 2049,
FILE_ALREADY_EXISTS = 2050,
FILE_NOT_FOUND = 2051,
FILE_IO_ERROR = 2052,
FILE_INVALID_TRANSFER_ID = 2053,
FILE_INVALID_PATH = 2054,
FILE_NO_FILES_AVAILABLE = 2055,
FILE_OVERWRITE_EXCLUDES_RESUME = 2056,
FILE_INVALID_SIZE = 2057,
FILE_ALREADY_IN_USE = 2058,
FILE_COULD_NOT_OPEN_CONNECTION = 2059,
FILE_NO_SPACE_LEFT_ON_DEVICE = 2060,
FILE_EXCEEDS_FILE_SYSTEM_MAXIMUM_SIZE = 2061,
FILE_TRANSFER_CONNECTION_TIMEOUT = 2062,
FILE_CONNECTION_LOST = 2063,
FILE_EXCEEDS_SUPPLIED_SIZE = 2064,
FILE_TRANSFER_COMPLETE = 2065,
FILE_TRANSFER_CANCELED = 2066,
FILE_TRANSFER_INTERRUPTED = 2067,
FILE_TRANSFER_SERVER_QUOTA_EXCEEDED = 2068,
FILE_TRANSFER_CLIENT_QUOTA_EXCEEDED = 2069,
FILE_TRANSFER_RESET = 2070,
FILE_TRANSFER_LIMIT_REACHED = 2071,
FILE_API_TIMEOUT = 2080,
FILE_VIRTUAL_SERVER_NOT_REGISTERED = 2081,
FILE_SERVER_TRANSFER_LIMIT_REACHED = 2082,
FILE_CLIENT_TRANSFER_LIMIT_REACHED = 2083,
SERVER_INSUFFICIENT_PERMISSIONS = 2568,
ACCOUNTING_SLOT_LIMIT_REACHED = 2817,
SERVER_CONNECT_BANNED = 3329,
BAN_FLOODING = 3331,
TOKEN_INVALID_ID = 3840,
WEB_HANDSHAKE_INVALID = 4096,
WEB_HANDSHAKE_UNSUPPORTED = 4097,
WEB_HANDSHAKE_IDENTITY_UNSUPPORTED = 4098,
WEB_HANDSHAKE_IDENTITY_PROOF_FAILED = 4099,
WEB_HANDSHAKE_IDENTITY_OUTDATED = 4100,
MUSIC_INVALID_ID = 4352,
MUSIC_LIMIT_REACHED = 4353,
MUSIC_CLIENT_LIMIT_REACHED = 4354,
MUSIC_INVALID_PLAYER_STATE = 4355,
MUSIC_INVALID_ACTION = 4356,
MUSIC_NO_PLAYER = 4357,
MUSIC_DISABLED = 4357,
PLAYLIST_INVALID_ID = 8448,
PLAYLIST_INVALID_SONG_ID = 8449,
PLAYLIST_ALREADY_IN_USE = 8450,
PLAYLIST_IS_IN_USE = 8451,
QUERY_NOT_EXISTS = 4608,
QUERY_ALREADY_EXISTS = 4609,
GROUP_INVALID_ID = 4864,
GROUP_NAME_INUSE = 4865,
GROUP_NOT_ASSIGNED_OVER_THIS_SERVER = 4866,
CONVERSATION_INVALID_ID = 8704,
CONVERSATION_MORE_DATA = 8705,
CONVERSATION_IS_PRIVATE = 8706,
CUSTOM_ERROR = 65535,
/** @deprecated Use SERVER_INSUFFICIENT_PERMISSIONS */
PERMISSION_ERROR = 2568,
/** @deprecated Use DATABASE_EMPTY_RESULT */
EMPTY_RESULT = 1281
}

View File

@ -0,0 +1,22 @@
import { AbstractServerConnection } from "../connection/ConnectionBase";
import { ConnectParameters } from "tc-shared/ui/modal/connect/Controller";
export interface HandshakeIdentityHandler {
connection: AbstractServerConnection;
executeHandshake(): any;
registerCallback(callback: (success: boolean, message?: string) => any): any;
fillClientInitData(data: any): any;
}
export declare class HandshakeHandler {
private connection;
private handshakeImpl;
private handshakeFailed;
readonly parameters: ConnectParameters;
constructor(parameters: ConnectParameters);
setConnection(con: AbstractServerConnection): void;
initialize(): void;
get_identity_handler(): HandshakeIdentityHandler;
startHandshake(): void;
on_teamspeak(): void;
private handshake_failed;
private handleHandshakeFinished;
}

View File

@ -0,0 +1,29 @@
import { ConnectionHandler } from "../ConnectionHandler";
import { CommandResult } from "../connection/ServerConnectionDeclaration";
import { AbstractServerConnection } from "../connection/ConnectionBase";
export interface PluginCommandInvoker {
clientId: number;
clientUniqueId: string;
clientName: string;
}
export declare abstract class PluginCmdHandler {
protected readonly channel: string;
protected currentServerConnection: AbstractServerConnection;
protected constructor(channel: string);
handleHandlerUnregistered(): void;
handleHandlerRegistered(): void;
getChannel(): string;
abstract handlePluginCommand(data: string, invoker: PluginCommandInvoker): any;
protected sendPluginCommand(data: string, mode: "server" | "view" | "channel" | "private", clientId?: number): Promise<CommandResult>;
}
export declare class PluginCmdRegistry {
readonly connection: ConnectionHandler;
private readonly handler;
private handlerMap;
constructor(connection: ConnectionHandler);
destroy(): void;
registerHandler(handler: PluginCmdHandler): void;
unregisterHandler(handler: PluginCmdHandler): void;
private handlePluginCommand;
getPluginHandler<T extends PluginCmdHandler>(channel: string): T | undefined;
}

View File

@ -0,0 +1,73 @@
import { LaterPromise } from "../utils/LaterPromise";
export declare class CommandResult {
success: boolean;
id: number;
message: string;
extra_message: string;
json: any;
bulks: any[];
constructor(bulks: any);
getBulks(): CommandResult[];
formattedMessage(): string;
}
export interface ClientNameInfo {
clientUniqueId: string;
clientNickname: string;
clientDatabaseId: number;
}
export interface ClientNameFromUid {
promise: LaterPromise<ClientNameInfo[]>;
keys: string[];
response: ClientNameInfo[];
}
export interface ServerGroupClient {
client_nickname: string;
client_unique_identifier: string;
client_database_id: number;
}
export interface QueryListEntry {
username: string;
unique_id: string;
bounded_server: number;
}
export interface QueryList {
flag_own: boolean;
flag_all: boolean;
queries: QueryListEntry[];
}
export interface Playlist {
playlist_id: number;
playlist_bot_id: number;
playlist_title: string;
playlist_type: number;
playlist_owner_dbid: number;
playlist_owner_name: string;
needed_power_modify: number;
needed_power_permission_modify: number;
needed_power_delete: number;
needed_power_song_add: number;
needed_power_song_move: number;
needed_power_song_remove: number;
}
export interface PlaylistInfo {
playlist_id: number;
playlist_title: string;
playlist_description: string;
playlist_type: number;
playlist_owner_dbid: number;
playlist_owner_name: string;
playlist_flag_delete_played: boolean;
playlist_flag_finished: boolean;
playlist_replay_mode: number;
playlist_current_song_id: number;
playlist_max_songs: number;
}
export interface PlaylistSong {
song_id: number;
song_previous_song_id: number;
song_invoker: string;
song_url: string;
song_url_loader: string;
song_loaded: boolean;
song_metadata: string;
}

View File

@ -0,0 +1,35 @@
import { ConnectionHandler } from "../ConnectionHandler";
import { Registry } from "../events";
export declare type ServerFeatureSupport = "unsupported" | "supported" | "experimental" | "deprecated";
export declare enum ServerFeature {
ERROR_BULKS = "error-bulks",
ADVANCED_CHANNEL_CHAT = "advanced-channel-chat",
LOG_QUERY = "log-query",
WHISPER_ECHO = "whisper-echo",
VIDEO = "video",
SIDEBAR_MODE = "sidebar-mode"
}
export interface ServerFeatureEvents {
notify_state_changed: {
feature: ServerFeature;
version?: number;
support: ServerFeatureSupport;
};
}
export declare class ServerFeatures {
readonly events: Registry<ServerFeatureEvents>;
private readonly connection;
private readonly explicitCommandHandler;
private readonly stateChangeListener;
private featureAwait;
private featureAwaitCallback;
private featuresSet;
private featureStates;
constructor(connection: ConnectionHandler);
destroy(): void;
supportsFeature(feature: ServerFeature, version?: number): boolean;
awaitFeatures(): Promise<boolean>;
listenSupportChange(feature: ServerFeature, listener: (support: boolean) => void, version?: number): () => void;
private disableAllFeatures;
private setFeatureSupport;
}

View File

@ -0,0 +1,153 @@
import { VideoSource } from "tc-shared/video/VideoSource";
import { Registry } from "tc-shared/events";
import { ConnectionStatistics } from "tc-shared/connection/ConnectionBase";
export declare type VideoBroadcastType = "camera" | "screen";
export declare type VideoBroadcastStatistics = {
dimensions: {
width: number;
height: number;
};
frameRate: number;
codec: {
name: string;
payloadType: number;
};
maxBandwidth: number;
bandwidth: number;
qualityLimitation: "cpu" | "bandwidth";
source: {
frameRate: number;
dimensions: {
width: number;
height: number;
};
};
};
export interface VideoConnectionEvent {
notify_status_changed: {
oldState: VideoConnectionStatus;
newState: VideoConnectionStatus;
};
}
export declare enum VideoConnectionStatus {
/** We're currently not connected to the target server */
Disconnected = 0,
/** We're trying to connect to the target server */
Connecting = 1,
/** We're connected */
Connected = 2,
/** The connection has failed for the current server connection */
Failed = 3,
/** Video connection is not supported (the server dosn't support it) */
Unsupported = 4
}
export declare enum VideoBroadcastState {
Stopped = 0,
Available = 1,
Initializing = 2,
Running = 3,
Buffering = 4
}
export interface VideoClientEvents {
notify_broadcast_state_changed: {
broadcastType: VideoBroadcastType;
oldState: VideoBroadcastState;
newState: VideoBroadcastState;
};
notify_dismissed_state_changed: {
broadcastType: VideoBroadcastType;
dismissed: boolean;
};
notify_broadcast_stream_changed: {
broadcastType: VideoBroadcastType;
};
}
export interface VideoClient {
getClientId(): number;
getEvents(): Registry<VideoClientEvents>;
getVideoState(broadcastType: VideoBroadcastType): VideoBroadcastState;
getVideoStream(broadcastType: VideoBroadcastType): MediaStream;
joinBroadcast(broadcastType: VideoBroadcastType): Promise<void>;
leaveBroadcast(broadcastType: VideoBroadcastType): any;
dismissBroadcast(broadcastType: VideoBroadcastType): any;
isBroadcastDismissed(broadcastType: VideoBroadcastType): boolean;
showPip(broadcastType: VideoBroadcastType): Promise<void>;
}
export interface LocalVideoBroadcastEvents {
notify_state_changed: {
oldState: LocalVideoBroadcastState;
newState: LocalVideoBroadcastState;
};
}
export declare type LocalVideoBroadcastState = {
state: "stopped";
} | {
state: "initializing";
} | {
state: "failed";
reason: string;
} | {
state: "broadcasting";
};
export interface VideoBroadcastConfig {
/**
* Ideal and max video width
*/
width: number;
/**
* Ideal and max video height
*/
height: number;
/**
* Dynamically change the video quality related to bandwidth constraints.
*/
dynamicQuality: boolean;
/**
* Max bandwidth which should be used (in bits/second).
* `0` indicates no bandwidth limit.
*/
maxBandwidth: number | 0;
/**
* Interval of enforcing keyframes.
* Zero means that no keyframes will be enforced.
*/
keyframeInterval: number | 0;
/**
* Maximal frame rate for the video.
* This might be ignored by some browsers.
*/
maxFrameRate: number;
/**
* The maximal
*/
dynamicFrameRate: boolean;
}
export interface LocalVideoBroadcast {
getEvents(): Registry<LocalVideoBroadcastEvents>;
getState(): LocalVideoBroadcastState;
getSource(): VideoSource | undefined;
getStatistics(): Promise<VideoBroadcastStatistics | undefined>;
/**
* @param source The source of the broadcast (No ownership will be taken. The voice connection must ref the source by itself!)
* @param constraints
*/
startBroadcasting(source: VideoSource, constraints: VideoBroadcastConfig): Promise<void>;
/**
* @param source The source of the broadcast (No ownership will be taken. The voice connection must ref the source by itself!)
* @param constraints
*/
changeSource(source: VideoSource, constraints: VideoBroadcastConfig): Promise<void>;
getConstraints(): VideoBroadcastConfig | undefined;
stopBroadcasting(): any;
}
export interface VideoConnection {
getEvents(): Registry<VideoConnectionEvent>;
getStatus(): VideoConnectionStatus;
getRetryTimestamp(): number | 0;
getFailedMessage(): string;
getConnectionStats(): Promise<ConnectionStatistics>;
getLocalBroadcast(channel: VideoBroadcastType): LocalVideoBroadcast;
registerVideoClient(clientId: number): any;
registeredVideoClients(): VideoClient[];
unregisterVideoClient(client: VideoClient): any;
}

View File

@ -0,0 +1,71 @@
import { RecorderProfile } from "../voice/RecorderProfile";
import { AbstractServerConnection, ConnectionStatistics } from "../connection/ConnectionBase";
import { Registry } from "../events";
import { VoiceClient } from "../voice/VoiceClient";
import { WhisperSession, WhisperTarget } from "../voice/VoiceWhisper";
export declare enum VoiceConnectionStatus {
ClientUnsupported = 0,
ServerUnsupported = 1,
Connecting = 2,
Connected = 3,
Disconnecting = 4,
Disconnected = 5,
Failed = 6
}
export interface VoiceConnectionEvents {
"notify_connection_status_changed": {
oldStatus: VoiceConnectionStatus;
newStatus: VoiceConnectionStatus;
};
"notify_recorder_changed": {
oldRecorder: RecorderProfile | undefined;
newRecorder: RecorderProfile | undefined;
};
"notify_whisper_created": {
session: WhisperSession;
};
"notify_whisper_initialized": {
session: WhisperSession;
};
"notify_whisper_destroyed": {
session: WhisperSession;
};
"notify_voice_replay_state_change": {
replaying: boolean;
};
}
export declare type WhisperSessionInitializeData = {
clientName: string;
clientUniqueId: string;
sessionTimeout: number;
blocked: boolean;
volume: number;
};
export declare type WhisperSessionInitializer = (session: WhisperSession) => Promise<WhisperSessionInitializeData>;
export declare abstract class AbstractVoiceConnection {
readonly events: Registry<VoiceConnectionEvents>;
readonly connection: AbstractServerConnection;
protected constructor(connection: AbstractServerConnection);
abstract getConnectionState(): VoiceConnectionStatus;
abstract getFailedMessage(): string;
abstract getRetryTimestamp(): number | 0;
abstract getConnectionStats(): Promise<ConnectionStatistics>;
abstract encodingSupported(codec: number): boolean;
abstract decodingSupported(codec: number): boolean;
abstract registerVoiceClient(clientId: number): VoiceClient;
abstract availableVoiceClients(): VoiceClient[];
abstract unregisterVoiceClient(client: VoiceClient): any;
abstract voiceRecorder(): RecorderProfile;
abstract acquireVoiceRecorder(recorder: RecorderProfile | undefined): Promise<void>;
abstract getEncoderCodec(): number;
abstract setEncoderCodec(codec: number): any;
abstract stopAllVoiceReplays(): any;
abstract isReplayingVoice(): boolean;
abstract getWhisperSessions(): WhisperSession[];
abstract dropWhisperSession(session: WhisperSession): any;
abstract setWhisperSessionInitializer(initializer: WhisperSessionInitializer | undefined): any;
abstract getWhisperSessionInitializer(): WhisperSessionInitializer | undefined;
abstract startWhisper(target: WhisperTarget): Promise<void>;
abstract getWhisperTarget(): WhisperTarget | undefined;
abstract stopWhisper(): any;
}

View File

@ -0,0 +1,130 @@
import { AbstractServerConnection } from "tc-shared/connection/ConnectionBase";
import { Registry } from "tc-shared/events";
import { RemoteRTPAudioTrack, RemoteRTPVideoTrack, TrackClientInfo } from "./RemoteTrack";
import { WhisperTarget } from "tc-shared/voice/VoiceWhisper";
import { VideoBroadcastConfig, VideoBroadcastType } from "tc-shared/connection/VideoConnection";
declare global {
interface RTCIceCandidate {
address: string | undefined;
}
interface HTMLCanvasElement {
captureStream(framed: number): MediaStream;
}
}
export declare type RtcVideoBroadcastStatistics = {
dimensions: {
width: number;
height: number;
};
frameRate: number;
codec?: {
name: string;
payloadType: number;
};
bandwidth?: {
currentBps: number;
maxBps: number;
};
qualityLimitation: "cpu" | "bandwidth" | "none";
source: {
frameRate: number;
dimensions: {
width: number;
height: number;
};
};
};
export declare enum RTPConnectionState {
DISCONNECTED = 0,
CONNECTING = 1,
CONNECTED = 2,
FAILED = 3,
NOT_SUPPORTED = 4
}
export declare type RTCSourceTrackType = "audio" | "audio-whisper" | "video" | "video-screen";
export declare type RTCBroadcastableTrackType = Exclude<RTCSourceTrackType, "audio-whisper">;
export declare type RTCConnectionStatistics = {
videoBytesReceived: number;
videoBytesSent: number;
voiceBytesReceived: number;
voiceBytesSent: any;
};
export interface RTCConnectionEvents {
notify_state_changed: {
oldState: RTPConnectionState;
newState: RTPConnectionState;
};
notify_audio_assignment_changed: {
track: RemoteRTPAudioTrack;
info: TrackClientInfo | undefined;
};
notify_video_assignment_changed: {
track: RemoteRTPVideoTrack;
info: TrackClientInfo | undefined;
};
}
export declare class RTCConnection {
static readonly kEnableSdpTrace = true;
private readonly audioSupport;
private readonly events;
private readonly connection;
private readonly commandHandler;
private readonly sdpProcessor;
private connectionState;
private connectTimeout;
private failedReason;
private retryCalculator;
private retryTimestamp;
private retryTimeout;
private peer;
private localCandidateCount;
private peerRemoteDescriptionReceived;
private cachedRemoteIceCandidates;
private cachedRemoteSessionDescription;
private currentTracks;
private currentTransceiver;
private remoteAudioTracks;
private remoteVideoTracks;
private temporaryStreams;
constructor(connection: AbstractServerConnection, audioSupport: boolean);
destroy(): void;
isAudioEnabled(): boolean;
getConnection(): AbstractServerConnection;
getEvents(): Registry<RTCConnectionEvents>;
getConnectionState(): RTPConnectionState;
getFailReason(): string;
getRetryTimestamp(): number | 0;
restartConnection(): void;
reset(updateConnectionState: boolean): void;
setTrackSource(type: RTCSourceTrackType, source: MediaStreamTrack | null): Promise<MediaStreamTrack>;
startVideoBroadcast(type: VideoBroadcastType, config: VideoBroadcastConfig): Promise<void>;
changeVideoBroadcastConfig(type: VideoBroadcastType, config: VideoBroadcastConfig): Promise<void>;
startAudioBroadcast(): Promise<void>;
startWhisper(target: WhisperTarget): Promise<void>;
stopTrackBroadcast(type: RTCBroadcastableTrackType): void;
setNotSupported(): void;
private updateConnectionState;
private handleFatalError;
private static checkBrowserSupport;
doInitialSetup(): void;
private updateTracks;
private doInitialSetup0;
private handleConnectionStateChanged;
private handleLocalIceCandidate;
handleRemoteIceCandidate(candidate: RTCIceCandidate | undefined, mediaLine: number): void;
applyCachedRemoteIceCandidates(): void;
private handleIceCandidateError;
private handleIceConnectionStateChanged;
private handleIceGatheringStateChanged;
private handleSignallingStateChanged;
private handleNegotiationNeeded;
private handlePeerConnectionStateChanged;
private handleDataChannel;
private releaseTemporaryStream;
private handleTrack;
private getOrCreateTempStream;
private doMapStream;
private handleStreamState;
getConnectionStatistics(): Promise<RTCConnectionStatistics>;
getVideoBroadcastStatistics(type: RTCBroadcastableTrackType): Promise<RtcVideoBroadcastStatistics | undefined>;
}

View File

@ -0,0 +1,58 @@
export interface RTCNegotiationMediaMapping {
direction: "sendrecv" | "recvonly" | "sendonly" | "inactive";
ssrc: number;
}
export interface RTCNegotiationIceConfig {
username: string;
password: string;
fingerprint: string;
fingerprint_type: string;
setup: "active" | "passive" | "actpass";
candidates: string[];
}
export interface RTCNegotiationExtension {
id: number;
uri: string;
media?: "audio" | "video";
direction?: "recvonly" | "sendonly";
config?: string;
}
export interface RTCNegotiationCodec {
payload: number;
name: string;
channels?: number;
rate?: number;
fmtp?: string;
feedback?: string[];
}
/** The offer send by the client to the server */
export interface RTCNegotiationOffer {
type: "initial-offer" | "negotiation-offer";
sessionId: number;
ssrcs: number[];
ssrc_types: number[];
ice: RTCNegotiationIceConfig;
extension: RTCNegotiationExtension | undefined;
}
/** The offer send by the server to the client */
export interface RTCNegotiationMessage {
type: "initial-offer" | "negotiation-offer" | "initial-answer" | "negotiation-answer";
sessionId: number;
sessionUsername: string;
ssrc: number[];
ssrc_flags: number[];
ice: RTCNegotiationIceConfig;
extension: RTCNegotiationExtension[] | undefined;
audio_codecs: RTCNegotiationCodec[] | undefined;
video_codecs: RTCNegotiationCodec[] | undefined;
}
export declare class RTCNegotiator {
private readonly peer;
callbackData: (data: string) => void;
callbackFailed: (reason: string) => void;
private sessionCodecs;
private sessionExtensions;
constructor(peer: RTCPeerConnection);
doInitialNegotiation(): void;
handleRemoteData(dataString: string): void;
}

View File

@ -0,0 +1,68 @@
import { Registry } from "tc-shared/events";
export interface TrackClientInfo {
media?: number;
client_id: number;
client_database_id: number;
client_unique_id: string;
client_name: string;
}
export declare enum RemoteRTPTrackState {
/** The track isn't bound to any client */
Unbound = 0,
/** The track is bound to a client, but isn't replaying anything */
Bound = 1,
/** The track is currently replaying something (inherits the Bound characteristics) */
Started = 2,
/** The track has been destroyed */
Destroyed = 3
}
export interface RemoteRTPTrackEvents {
notify_state_changed: {
oldState: RemoteRTPTrackState;
newState: RemoteRTPTrackState;
};
}
declare global {
interface RTCRtpReceiver {
playoutDelayHint: number;
}
}
export declare class RemoteRTPTrack {
protected readonly events: Registry<RemoteRTPTrackEvents>;
private readonly ssrc;
private readonly transceiver;
private currentState;
protected currentAssignment: TrackClientInfo;
constructor(ssrc: number, transceiver: RTCRtpTransceiver);
protected destroy(): void;
getEvents(): Registry<RemoteRTPTrackEvents>;
getState(): RemoteRTPTrackState;
getSsrc(): number;
getTrack(): MediaStreamTrack;
getTransceiver(): RTCRtpTransceiver;
getCurrentAssignment(): TrackClientInfo | undefined;
protected setState(state: RemoteRTPTrackState): void;
}
export declare class RemoteRTPVideoTrack extends RemoteRTPTrack {
protected mediaStream: MediaStream;
constructor(ssrc: number, transceiver: RTCRtpTransceiver);
getMediaStream(): MediaStream;
protected handleTrackEnded(): void;
}
export declare class RemoteRTPAudioTrack extends RemoteRTPTrack {
protected htmlAudioNode: HTMLAudioElement;
protected mediaStream: MediaStream;
protected audioNode: MediaStreamAudioSourceNode;
protected gainNode: GainNode;
protected shouldReplay: boolean;
protected gain: number;
constructor(ssrc: number, transceiver: RTCRtpTransceiver);
protected handleTrackEnded(): void;
getGain(): GainNode | undefined;
setGain(value: number): void;
/**
* Mutes this track until the next setGain(..) call or a new sequence begins (state update)
*/
abortCurrentReplay(): void;
protected updateGainNode(): void;
}

View File

@ -0,0 +1,18 @@
export declare class SdpProcessor {
private static readonly kAudioCodecs;
private static readonly kVideoCodecs;
private rtpRemoteChannelMapping;
private rtpLocalChannelMapping;
constructor();
reset(): void;
getRemoteSsrcFromFromMediaId(mediaId: string): number | undefined;
getLocalSsrcFromFromMediaId(mediaId: string): number | undefined;
processIncomingSdp(sdpString: string, _mode: "offer" | "answer"): string;
processOutgoingSdp(sdpString: string, _mode: "offer" | "answer"): string;
private static generateRtpSSrcMapping;
private static patchLocalCodecs;
}
export declare namespace SdpCompressor {
function decompressSdp(sdp: string, mode: number): string;
function compressSdp(sdp: string, mode: number): string;
}

View File

@ -0,0 +1,28 @@
import { LocalVideoBroadcast, VideoBroadcastType, VideoClient, VideoConnection, VideoConnectionEvent, VideoConnectionStatus } from "tc-shared/connection/VideoConnection";
import { Registry } from "tc-shared/events";
import { RTCConnection } from "../Connection";
import { RtpVideoClient } from "./VideoClient";
import { ConnectionStatistics } from "tc-shared/connection/ConnectionBase";
export declare class RtpVideoConnection implements VideoConnection {
private readonly rtcConnection;
private readonly events;
private readonly listener;
private connectionState;
private broadcasts;
private registeredClients;
constructor(rtcConnection: RTCConnection);
private setConnectionState;
destroy(): void;
getRTCConnection(): RTCConnection;
getEvents(): Registry<VideoConnectionEvent>;
getStatus(): VideoConnectionStatus;
getRetryTimestamp(): number | 0;
getFailedMessage(): string;
registerVideoClient(clientId: number): RtpVideoClient;
registeredVideoClients(): VideoClient[];
unregisterVideoClient(client: VideoClient): void;
private handleRtcConnectionStateChanged;
private handleVideoAssignmentChanged;
getConnectionStats(): Promise<ConnectionStatistics>;
getLocalBroadcast(channel: VideoBroadcastType): LocalVideoBroadcast;
}

View File

@ -0,0 +1,36 @@
import { VideoBroadcastState, VideoBroadcastType, VideoClient, VideoClientEvents } from "tc-shared/connection/VideoConnection";
import { Registry } from "tc-shared/events";
import { RemoteRTPVideoTrack } from "../RemoteTrack";
import { RTCConnection } from "tc-shared/connection/rtc/Connection";
export declare class RtpVideoClient implements VideoClient {
private readonly handle;
private readonly clientId;
private readonly events;
private readonly listenerTrackStateChanged;
private dismissedStates;
private currentTrack;
private trackStates;
private broadcastIds;
private joinedStates;
private pipElement;
private pipBroadcastType;
constructor(handle: RTCConnection, clientId: number);
getClientId(): number;
getEvents(): Registry<VideoClientEvents>;
getVideoStream(broadcastType: VideoBroadcastType): MediaStream;
getVideoState(broadcastType: VideoBroadcastType): VideoBroadcastState;
joinBroadcast(broadcastType: VideoBroadcastType): Promise<void>;
leaveBroadcast(broadcastType: VideoBroadcastType): void;
destroy(): void;
getRtpTrack(type: VideoBroadcastType): RemoteRTPVideoTrack | undefined;
setRtpTrack(type: VideoBroadcastType, track: RemoteRTPVideoTrack | undefined): void;
setBroadcastId(type: VideoBroadcastType, id: number | undefined): void;
private setBroadcastDismissed;
dismissBroadcast(broadcastType: VideoBroadcastType): void;
isBroadcastDismissed(broadcastType: VideoBroadcastType): boolean;
showPip(broadcastType: VideoBroadcastType): Promise<void>;
private stopPip;
private setBroadcastState;
private handleTrackStateChanged;
private updateBroadcastState;
}

View File

@ -0,0 +1,266 @@
import * as React from "react";
import { ServerEventLog } from "tc-shared/connectionlog/ServerEventLog";
import { ViewReasonId } from "tc-shared/ConnectionHandler";
import { PermissionInfo } from "tc-shared/permission/PermissionManager";
export declare enum EventType {
CONNECTION_BEGIN = "connection.begin",
CONNECTION_HOSTNAME_RESOLVE = "connection.hostname.resolve",
CONNECTION_HOSTNAME_RESOLVE_ERROR = "connection.hostname.resolve.error",
CONNECTION_HOSTNAME_RESOLVED = "connection.hostname.resolved",
CONNECTION_LOGIN = "connection.login",
CONNECTION_CONNECTED = "connection.connected",
CONNECTION_FAILED = "connection.failed",
DISCONNECTED = "disconnected",
CONNECTION_VOICE_CONNECT = "connection.voice.connect",
CONNECTION_VOICE_CONNECT_FAILED = "connection.voice.connect.failed",
CONNECTION_VOICE_CONNECT_SUCCEEDED = "connection.voice.connect.succeeded",
CONNECTION_VOICE_DROPPED = "connection.voice.dropped",
CONNECTION_COMMAND_ERROR = "connection.command.error",
GLOBAL_MESSAGE = "global.message",
SERVER_WELCOME_MESSAGE = "server.welcome.message",
SERVER_HOST_MESSAGE = "server.host.message",
SERVER_HOST_MESSAGE_DISCONNECT = "server.host.message.disconnect",
SERVER_CLOSED = "server.closed",
SERVER_BANNED = "server.banned",
SERVER_REQUIRES_PASSWORD = "server.requires.password",
CLIENT_VIEW_ENTER = "client.view.enter",
CLIENT_VIEW_LEAVE = "client.view.leave",
CLIENT_VIEW_MOVE = "client.view.move",
CLIENT_VIEW_ENTER_OWN_CHANNEL = "client.view.enter.own.channel",
CLIENT_VIEW_LEAVE_OWN_CHANNEL = "client.view.leave.own.channel",
CLIENT_VIEW_MOVE_OWN_CHANNEL = "client.view.move.own.channel",
CLIENT_VIEW_MOVE_OWN = "client.view.move.own",
CLIENT_NICKNAME_CHANGED = "client.nickname.changed",
CLIENT_NICKNAME_CHANGED_OWN = "client.nickname.changed.own",
CLIENT_NICKNAME_CHANGE_FAILED = "client.nickname.change.failed",
CLIENT_SERVER_GROUP_ADD = "client.server.group.add",
CLIENT_SERVER_GROUP_REMOVE = "client.server.group.remove",
CLIENT_CHANNEL_GROUP_CHANGE = "client.channel.group.change",
PRIVATE_MESSAGE_RECEIVED = "private.message.received",
PRIVATE_MESSAGE_SEND = "private.message.send",
CHANNEL_CREATE = "channel.create",
CHANNEL_DELETE = "channel.delete",
ERROR_CUSTOM = "error.custom",
ERROR_PERMISSION = "error.permission",
CLIENT_POKE_RECEIVED = "client.poke.received",
CLIENT_POKE_SEND = "client.poke.send",
RECONNECT_SCHEDULED = "reconnect.scheduled",
RECONNECT_EXECUTE = "reconnect.execute",
RECONNECT_CANCELED = "reconnect.canceled",
WEBRTC_FATAL_ERROR = "webrtc.fatal.error"
}
export declare type EventClient = {
client_unique_id: string;
client_name: string;
client_id: number;
};
export declare type EventChannelData = {
channel_id: number;
channel_name: string;
};
export declare type EventServerAddress = {
server_hostname: string;
server_port: number;
};
export declare namespace event {
type EventGlobalMessage = {
isOwnMessage: boolean;
sender: EventClient;
message: string;
};
type EventConnectBegin = {
address: EventServerAddress;
client_nickname: string;
};
type EventErrorCustom = {
message: string;
};
type EventReconnectScheduled = {
timeout: number;
};
type EventReconnectCanceled = {};
type EventReconnectExecute = {};
type EventErrorPermission = {
permission: PermissionInfo;
};
type EventWelcomeMessage = {
message: string;
};
type EventHostMessageDisconnect = {
message: string;
};
type EventClientMove = {
channel_from?: EventChannelData;
channel_from_own: boolean;
channel_to?: EventChannelData;
channel_to_own: boolean;
client: EventClient;
client_own: boolean;
invoker?: EventClient;
message?: string;
reason: ViewReasonId;
};
type EventClientEnter = {
channel_from?: EventChannelData;
channel_to?: EventChannelData;
client: EventClient;
invoker?: EventClient;
message?: string;
reason: ViewReasonId;
ban_time?: number;
};
type EventClientLeave = {
channel_from?: EventChannelData;
channel_to?: EventChannelData;
client: EventClient;
invoker?: EventClient;
message?: string;
reason: ViewReasonId;
ban_time?: number;
};
type EventChannelCreate = {
creator: EventClient;
channel: EventChannelData;
ownAction: boolean;
};
type EventChannelToggle = {
channel: EventChannelData;
};
type EventChannelDelete = {
deleter: EventClient;
channel: EventChannelData;
ownAction: boolean;
};
type EventConnectionConnected = {
serverName: string;
serverAddress: EventServerAddress;
own_client: EventClient;
};
type EventConnectionFailed = {
serverAddress: EventServerAddress;
};
type EventConnectionLogin = {};
type EventConnectionHostnameResolve = {};
type EventConnectionHostnameResolved = {
address: EventServerAddress;
};
type EventConnectionHostnameResolveError = {
message: string;
};
type EventConnectionVoiceConnectFailed = {
reason: string;
reconnect_delay: number;
};
type EventConnectionVoiceConnectSucceeded = {};
type EventConnectionVoiceConnect = {
attemptCount: number;
};
type EventConnectionVoiceDropped = {};
type EventConnectionCommandError = {
error: any;
};
type EventClientNicknameChanged = {
client: EventClient;
old_name: string;
new_name: string;
};
type EventClientNicknameChangeFailed = {
reason: string;
};
type EventServerClosed = {
message: string;
};
type EventServerRequiresPassword = {};
type EventServerBanned = {
message: string;
time: number;
invoker: EventClient;
};
type EventClientPokeReceived = {
sender: EventClient;
message: string;
};
type EventClientPokeSend = {
target: EventClient;
message: string;
};
type EventPrivateMessageSend = {
target: EventClient;
message: string;
};
type EventPrivateMessageReceived = {
sender: EventClient;
message: string;
};
type EventWebrtcFatalError = {
message: string;
retryTimeout: number | 0;
};
}
export declare type LogMessage = {
type: EventType;
uniqueId: string;
timestamp: number;
data: any;
};
export interface TypeInfo {
"connection.begin": event.EventConnectBegin;
"global.message": event.EventGlobalMessage;
"error.custom": event.EventErrorCustom;
"error.permission": event.EventErrorPermission;
"connection.hostname.resolved": event.EventConnectionHostnameResolved;
"connection.hostname.resolve": event.EventConnectionHostnameResolve;
"connection.hostname.resolve.error": event.EventConnectionHostnameResolveError;
"connection.failed": event.EventConnectionFailed;
"connection.login": event.EventConnectionLogin;
"connection.connected": event.EventConnectionConnected;
"connection.voice.dropped": event.EventConnectionVoiceDropped;
"connection.voice.connect": event.EventConnectionVoiceConnect;
"connection.voice.connect.failed": event.EventConnectionVoiceConnectFailed;
"connection.voice.connect.succeeded": event.EventConnectionVoiceConnectSucceeded;
"connection.command.error": event.EventConnectionCommandError;
"reconnect.scheduled": event.EventReconnectScheduled;
"reconnect.canceled": event.EventReconnectCanceled;
"reconnect.execute": event.EventReconnectExecute;
"server.welcome.message": event.EventWelcomeMessage;
"server.host.message": event.EventWelcomeMessage;
"server.host.message.disconnect": event.EventHostMessageDisconnect;
"server.closed": event.EventServerClosed;
"server.requires.password": event.EventServerRequiresPassword;
"server.banned": event.EventServerBanned;
"client.view.enter": event.EventClientEnter;
"client.view.move": event.EventClientMove;
"client.view.leave": event.EventClientLeave;
"client.view.enter.own.channel": event.EventClientEnter;
"client.view.move.own.channel": event.EventClientMove;
"client.view.leave.own.channel": event.EventClientLeave;
"client.view.move.own": event.EventClientMove;
"client.nickname.change.failed": event.EventClientNicknameChangeFailed;
"client.nickname.changed": event.EventClientNicknameChanged;
"client.nickname.changed.own": event.EventClientNicknameChanged;
"channel.create": event.EventChannelCreate;
"channel.show": event.EventChannelToggle;
"channel.hide": event.EventChannelToggle;
"channel.delete": event.EventChannelDelete;
"client.poke.received": event.EventClientPokeReceived;
"client.poke.send": event.EventClientPokeSend;
"private.message.received": event.EventPrivateMessageReceived;
"private.message.send": event.EventPrivateMessageSend;
"webrtc.fatal.error": event.EventWebrtcFatalError;
"disconnected": any;
}
export interface EventDispatcher<EventType extends keyof TypeInfo> {
log(data: TypeInfo[EventType], logger: ServerEventLog): React.ReactNode;
notify(data: TypeInfo[EventType], logger: ServerEventLog): any;
sound(data: TypeInfo[EventType], logger: ServerEventLog): any;
}
export interface ServerLogUIEvents {
"query_log": {};
"notify_log": {
log: LogMessage[];
};
"notify_log_add": {
event: LogMessage;
};
"notify_show": {};
}

View File

@ -0,0 +1,3 @@
import { EventType } from "tc-shared/connectionlog/Definitions";
export declare function requestWindowFocus(): void;
export declare function isFocusRequestEnabled(type: EventType): any;

View File

@ -0,0 +1,5 @@
import { EventType, TypeInfo } from "tc-shared/connectionlog/Definitions";
export declare type DispatcherLog<T extends keyof TypeInfo> = (data: TypeInfo[T], handlerId: string, eventType: T) => void;
export declare function findNotificationDispatcher<T extends keyof TypeInfo>(type: T): DispatcherLog<T>;
export declare function getRegisteredNotificationDispatchers(): TypeInfo[];
export declare function isNotificationEnabled(type: EventType): any;

View File

@ -0,0 +1,72 @@
export declare const kUnknownHistoryServerUniqueId = "unknown";
export declare type ConnectionHistoryEntry = {
id: number;
timestamp: number;
serverUniqueId: string | typeof kUnknownHistoryServerUniqueId;
targetAddress: string;
nickname: string;
hashedPassword: string;
};
export declare type ConnectionHistoryServerEntry = {
firstConnectTimestamp: number;
firstConnectId: number;
lastConnectTimestamp: number;
lastConnectId: number;
};
export declare type ConnectionHistoryServerInfo = {
name: string;
iconId: number;
country: string;
clientsOnline: number | -1;
clientsMax: number | -1;
passwordProtected: boolean;
};
export declare class ConnectionHistory {
private database;
constructor();
initializeDatabase(): Promise<void>;
/**
* Register a new connection attempt.
* @param attempt
* @return Returns a unique connect attempt identifier id which could be later used to set the unique server id.
*/
logConnectionAttempt(attempt: {
targetAddress: string;
nickname: string;
hashedPassword: string;
}): Promise<number>;
private resolveDatabaseServerInfo;
private updateDatabaseServerInfo;
/**
* Update the connection attempts target server id.
* @param connectionAttemptId
* @param serverUniqueId
*/
updateConnectionServerUniqueId(connectionAttemptId: number, serverUniqueId: string): Promise<void>;
/**
* Update the connection attempt server password
* @param connectionAttemptId
* @param passwordHash
*/
updateConnectionServerPassword(connectionAttemptId: number, passwordHash: string): Promise<void>;
/**
* Update the server info of the given server.
* @param serverUniqueId
* @param info
*/
updateServerInfo(serverUniqueId: string, info: ConnectionHistoryServerInfo): Promise<void>;
deleteConnectionAttempts(target: string, targetType: "address" | "server-unique-id"): Promise<void>;
/**
* Query the server info of a given server unique id
* @param serverUniqueId
*/
queryServerInfo(serverUniqueId: string): Promise<(ConnectionHistoryServerInfo & ConnectionHistoryServerEntry) | undefined>;
/**
* Query the last connected addresses/servers.
* @param maxUniqueServers
*/
lastConnectedServers(maxUniqueServers: number): Promise<ConnectionHistoryEntry[]>;
lastConnectInfo(target: string, targetType: "address" | "server-unique-id", onlySucceeded?: boolean): Promise<ConnectionHistoryEntry | undefined>;
countConnectCount(target: string, targetType: "address" | "server-unique-id"): Promise<number>;
}
export declare let connectionHistory: ConnectionHistory;

View File

@ -0,0 +1,18 @@
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { Registry } from "tc-shared/events";
import { LogMessage, TypeInfo } from "tc-shared/connectionlog/Definitions";
export interface ServerEventLogEvents {
notify_log_add: {
event: LogMessage;
};
}
export declare class ServerEventLog {
readonly events: Registry<ServerEventLogEvents>;
private readonly connection;
private maxHistoryLength;
private eventLog;
constructor(connection: ConnectionHandler);
log<T extends keyof TypeInfo>(type: T, data: TypeInfo[T]): void;
getHistory(): LogMessage[];
destroy(): void;
}

View File

@ -0,0 +1,128 @@
import { ChatEvent, ChatEventMessage, ChatMessage, ChatState, ConversationHistoryResponse } from "../ui/frames/side/AbstractConversationDefinitions";
import { Registry } from "tc-shared/events";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { ChannelConversationMode } from "tc-shared/tree/Channel";
export declare const kMaxChatFrameMessageSize = 50;
export interface AbstractConversationEvents {
notify_chat_event: {
triggerUnread: boolean;
event: ChatEvent;
};
notify_unread_timestamp_changed: {
timestamp: number;
};
notify_unread_state_changed: {
unread: boolean;
};
notify_send_toggle: {
enabled: boolean;
};
notify_state_changed: {
oldSTate: ChatState;
newState: ChatState;
};
notify_history_state_changed: {
hasHistory: boolean;
};
notify_conversation_mode_changed: {
newMode: ChannelConversationMode;
};
notify_read_state_changed: {
readable: boolean;
};
}
export declare abstract class AbstractChat<Events extends AbstractConversationEvents> {
readonly events: Registry<Events>;
protected readonly connection: ConnectionHandler;
protected readonly chatId: string;
protected presentMessages: ChatEvent[];
protected presentEvents: Exclude<ChatEvent, ChatEventMessage>[];
private mode;
protected failedPermission: string;
protected errorMessage: string;
private conversationMode;
protected unreadTimestamp: number;
protected unreadState: boolean;
protected messageSendEnabled: boolean;
private conversationReadable;
private history;
protected constructor(connection: ConnectionHandler, chatId: string);
destroy(): void;
getCurrentMode(): ChatState;
protected setCurrentMode(mode: ChatState): void;
registerChatEvent(event: ChatEvent, triggerUnread: boolean): void;
protected registerIncomingMessage(message: ChatMessage, isOwnMessage: boolean, uniqueId: string): void;
protected doSendMessage(message: string, targetMode: number, target: number): Promise<boolean>;
getChatId(): string;
isUnread(): boolean;
getConversationMode(): ChannelConversationMode;
isPrivate(): boolean;
protected setConversationMode(mode: ChannelConversationMode, logChange: boolean): void;
isReadable(): boolean;
protected setReadable(flag: boolean): void;
isSendEnabled(): boolean;
getUnreadTimestamp(): number | undefined;
getPresentMessages(): ChatEvent[];
getPresentEvents(): ChatEvent[];
getErrorMessage(): string | undefined;
getFailedPermission(): string | undefined;
setUnreadTimestamp(timestamp: number): void;
protected updateUnreadState(): void;
hasHistory(): boolean;
protected setHistory(hasHistory: boolean): void;
protected lastEvent(): ChatEvent | undefined;
protected sendMessageSendingEnabled(enabled: boolean): void;
abstract queryHistory(criteria: {
begin?: number;
end?: number;
limit?: number;
}): Promise<ConversationHistoryResponse>;
abstract queryCurrentMessages(): any;
abstract sendMessage(text: string): any;
}
export interface AbstractChatManagerEvents<ConversationType> {
notify_selected_changed: {
oldConversation: ConversationType;
newConversation: ConversationType;
};
notify_conversation_destroyed: {
conversation: ConversationType;
};
notify_conversation_created: {
conversation: ConversationType;
};
notify_unread_count_changed: {
unreadConversations: number;
};
notify_cross_conversation_support_changed: {
crossConversationSupported: boolean;
};
}
export declare abstract class AbstractChatManager<ManagerEvents extends AbstractChatManagerEvents<ConversationType>, ConversationType extends AbstractChat<ConversationEvents>, ConversationEvents extends AbstractConversationEvents> {
readonly events: Registry<ManagerEvents>;
readonly connection: ConnectionHandler;
protected readonly listenerConnection: (() => void)[];
private readonly listenerUnreadTimestamp;
private conversations;
private selectedConversation;
private currentUnreadCount;
private crossConversationSupport;
historyUiStates: {
[id: string]: {
executingUIHistoryQuery: boolean;
historyErrorMessage: string | undefined;
historyRetryTimestamp: number;
};
};
protected constructor(connection: ConnectionHandler);
destroy(): void;
getConversations(): ConversationType[];
getUnreadCount(): number;
hasCrossConversationSupport(): boolean;
getSelectedConversation(): ConversationType;
setSelectedConversation(conversation: ConversationType | undefined): void;
findConversationById(id: string): ConversationType;
protected registerConversation(conversation: ConversationType): void;
protected unregisterConversation(conversation: ConversationType): void;
protected setCrossConversationSupport(supported: boolean): void;
}

View File

@ -0,0 +1,57 @@
import { AbstractChat, AbstractConversationEvents, AbstractChatManager, AbstractChatManagerEvents } from "./AbstractConversion";
import { ChatMessage, ConversationHistoryResponse } from "../ui/frames/side/AbstractConversationDefinitions";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { ChannelConversationMode } from "tc-shared/tree/Channel";
export interface ChannelConversationEvents extends AbstractConversationEvents {
notify_messages_deleted: {
messages: string[];
};
notify_messages_loaded: {};
}
export declare class ChannelConversation extends AbstractChat<ChannelConversationEvents> {
private readonly handle;
readonly conversationId: number;
private conversationVolatile;
private preventUnreadUpdate;
private executingHistoryQueries;
private pendingHistoryQueries;
historyQueryResponse: ChatMessage[];
constructor(handle: ChannelConversationManager, id: number);
destroy(): void;
queryHistory(criteria: {
begin?: number;
end?: number;
limit?: number;
}): Promise<ConversationHistoryResponse>;
queryCurrentMessages(): void;
canClientAccessChat(): boolean;
private executeHistoryQuery;
updateIndexFromServer(info: any): void;
handleIncomingMessage(message: ChatMessage, isOwnMessage: boolean): void;
handleDeleteMessages(criteria: {
begin: number;
end: number;
cldbid: number;
limit: number;
}): void;
deleteMessage(messageUniqueId: string): void;
setUnreadTimestamp(timestamp: number): void;
setConversationMode(mode: ChannelConversationMode, logChange: boolean): void;
localClientSwitchedChannel(type: "join" | "leave"): void;
sendMessage(text: string): void;
updateAccessState(): void;
}
export interface ChannelConversationManagerEvents extends AbstractChatManagerEvents<ChannelConversation> {
}
export declare class ChannelConversationManager extends AbstractChatManager<ChannelConversationManagerEvents, ChannelConversation, ChannelConversationEvents> {
readonly connection: ConnectionHandler;
constructor(connection: ConnectionHandler);
destroy(): void;
findConversation(channelId: number): ChannelConversation;
findOrCreateConversation(channelId: number): ChannelConversation;
destroyConversation(id: number): void;
queryUnreadFlags(): void;
private handleConversationHistory;
private handleConversationIndex;
private handleConversationMessageDelete;
}

View File

@ -0,0 +1,13 @@
import { ChatEvent } from "../ui/frames/side/AbstractConversationDefinitions";
export declare function queryConversationEvents(clientUniqueId: string, query: {
begin: number;
end: number;
direction: "backwards" | "forwards";
limit: number;
}): Promise<{
events: (ChatEvent & {
databaseId: number;
})[];
hasMore: boolean;
}>;
export declare function registerConversationEvent(clientUniqueId: string, event: ChatEvent): Promise<void>;

View File

@ -0,0 +1,67 @@
import { AbstractChat, AbstractConversationEvents, AbstractChatManager, AbstractChatManagerEvents } from "tc-shared/conversations/AbstractConversion";
import { ClientEntry } from "tc-shared/tree/Client";
import { ChatEvent, ChatMessage, ConversationHistoryResponse } from "../ui/frames/side/AbstractConversationDefinitions";
import { ChannelTreeEvents } from "tc-shared/tree/ChannelTree";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
export declare type OutOfViewClient = {
nickname: string;
clientId: number;
uniqueId: string;
};
export interface PrivateConversationEvents extends AbstractConversationEvents {
notify_partner_typing: {};
notify_partner_changed: {
chatId: string;
clientId: number;
name: string;
};
notify_partner_name_changed: {
chatId: string;
name: string;
};
}
export declare class PrivateConversation extends AbstractChat<PrivateConversationEvents> {
readonly clientUniqueId: string;
private activeClientListener;
private activeClient;
private lastClientInfo;
private conversationOpen;
constructor(manager: PrivateConversationManager, client: ClientEntry | OutOfViewClient);
destroy(): void;
getActiveClient(): ClientEntry | OutOfViewClient | undefined;
currentClientId(): number;
getLastClientInfo(): OutOfViewClient;
setActiveClientEntry(client: ClientEntry | OutOfViewClient | undefined): void;
hasUnreadMessages(): boolean;
handleIncomingMessage(client: ClientEntry | OutOfViewClient, isOwnMessage: boolean, message: ChatMessage): void;
handleChatRemotelyClosed(clientId: number): void;
handleClientEnteredView(client: ClientEntry, mode: "server-join" | "local-reconnect" | "appear"): void;
handleRemoteComposing(_clientId: number): void;
sendMessage(text: string): void;
sendChatClose(): void;
handleEventLeftView(event: ChannelTreeEvents["notify_client_leave_view"]): void;
private registerClientEvents;
private unregisterClientEvents;
private updateClientInfo;
setUnreadTimestamp(timestamp: number): void;
canClientAccessChat(): boolean;
handleLocalClientDisconnect(explicitDisconnect: boolean): void;
queryCurrentMessages(): void;
registerChatEvent(event: ChatEvent, triggerUnread: boolean): void;
queryHistory(criteria: {
begin?: number;
end?: number;
limit?: number;
}): Promise<ConversationHistoryResponse>;
}
export interface PrivateConversationManagerEvents extends AbstractChatManagerEvents<PrivateConversation> {
}
export declare class PrivateConversationManager extends AbstractChatManager<PrivateConversationManagerEvents, PrivateConversation, PrivateConversationEvents> {
readonly connection: ConnectionHandler;
private channelTreeInitialized;
constructor(connection: ConnectionHandler);
destroy(): void;
findConversation(client: ClientEntry | string): PrivateConversation;
findOrCreateConversation(client: ClientEntry | OutOfViewClient): PrivateConversation;
closeConversation(...conversations: PrivateConversation[]): void;
}

83
imports/shared-app/crypto/asn1.d.ts vendored Normal file
View File

@ -0,0 +1,83 @@
export declare class Stream {
private static HEX_DIGITS;
private static reTimeS;
private static reTimeL;
position: number;
data: string | ArrayBuffer;
constructor(data: string | Stream | ArrayBuffer, position: number);
length(): number;
get(position?: number): any;
hexByte(byte: number): string;
parseStringISO(start: any, end: any): string;
parseStringUTF(start: any, end: any): string;
parseStringBMP(start: any, end: any): string;
parseTime(start: any, end: any, shortYear: any): string;
parseInteger(start: any, end: any): string;
isASCII(start: number, end: number): boolean;
parseBitString(start: any, end: any, maxLength: any): string;
parseOctetString(start: any, end: any, maxLength: any): any;
parseOID(start: any, end: any, maxLength: any): any;
}
export declare enum TagClass {
UNIVERSAL = 0,
APPLICATION = 1,
CONTEXT = 2,
PRIVATE = 3
}
export declare enum TagType {
EOC = 0,
BOOLEAN = 1,
INTEGER = 2,
BIT_STRING = 3,
OCTET_STRING = 4,
NULL = 5,
OBJECT_IDENTIFIER = 6,
ObjectDescriptor = 7,
EXTERNAL = 8,
REAL = 9,
ENUMERATED = 10,
EMBEDDED_PDV = 11,
UTF8String = 12,
SEQUENCE = 16,
SET = 17,
NumericString = 18,
PrintableString = 19,
TeletextString = 20,
VideotexString = 21,
IA5String = 22,
UTCTime = 23,
GeneralizedTime = 24,
GraphicString = 25,
VisibleString = 26,
GeneralString = 27,
UniversalString = 28,
BMPString = 30
}
declare class ASN1Tag {
tagClass: TagClass;
type: TagType;
tagConstructed: boolean;
tagNumber: number;
constructor(stream: Stream);
isUniversal(): boolean;
isEOC(): boolean;
}
export declare class ASN1 {
stream: Stream;
header: number;
length: number;
tag: ASN1Tag;
children: ASN1[];
constructor(stream: Stream, header: number, length: number, tag: ASN1Tag, children: ASN1[]);
content(max_length?: number, type?: TagType): any;
typeName(): string;
toString(): string;
toPrettyString(indent: any): string;
posStart(): number;
posContent(): number;
posEnd(): number;
static decodeLength(stream: Stream): any;
static encodeLength(buffer: Uint8Array, offset: number, length: number): void;
}
export declare function decode(stream: string | ArrayBuffer): ASN1;
export {};

7
imports/shared-app/crypto/crc32.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export declare class Crc32 {
private static readonly lookup;
private crc;
constructor();
update(data: ArrayBufferLike): void;
digest(radix: number): string;
}

1
imports/shared-app/crypto/hex.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare function encode(buffer: any): string;

1
imports/shared-app/crypto/md5.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare function md5(uint8Array: Uint8Array): string;

2
imports/shared-app/crypto/sha.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export declare function encode_text(buffer: string): ArrayBuffer;
export declare function sha1(message: string | ArrayBuffer): PromiseLike<ArrayBuffer>;

1
imports/shared-app/crypto/uid.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare function guid(): string;

1
imports/shared-app/devel_main.d.ts vendored Normal file
View File

@ -0,0 +1 @@
import "./proto";

15
imports/shared-app/dns.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export interface AddressTarget {
target_ip: string;
target_port?: number;
}
export interface ResolveOptions {
timeout?: number;
allow_cache?: boolean;
max_depth?: number;
allow_srv?: boolean;
allow_cname?: boolean;
allow_any?: boolean;
allow_a?: boolean;
allow_aaaa?: boolean;
}
export declare const default_options: ResolveOptions;

1
imports/shared-app/events.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from "tc-events";

View File

@ -0,0 +1,3 @@
import { Registry } from "../events";
import { ClientGlobalControlEvents } from "../events/GlobalEvents";
export declare function initialize(event_registry: Registry<ClientGlobalControlEvents>): void;

View File

@ -0,0 +1,39 @@
import { ConnectionHandler } from "../ConnectionHandler";
import { Registry } from "../events";
import { VideoBroadcastType } from "tc-shared/connection/VideoConnection";
export declare type PermissionEditorTab = "groups-server" | "groups-channel" | "channel" | "client" | "client-channel";
export interface ClientGlobalControlEvents {
action_open_window: {
window: "settings" | /* use action_open_window_settings! */ "about" | "settings-registry" | "css-variable-editor" | "bookmark-manage" | "query-manage" | "query-create" | "ban-list" | "permissions" | "token-list" | "token-use" | "server-echo-test";
connection?: ConnectionHandler;
};
action_w2g: {
following: number;
handlerId: string;
} | {
videoUrl: string;
handlerId: string;
};
action_toggle_video_broadcasting: {
connection: ConnectionHandler;
broadcastType: VideoBroadcastType;
enabled: boolean;
quickSelect?: boolean;
defaultDevice?: string;
};
action_edit_video_broadcasting: {
connection: ConnectionHandler;
broadcastType: VideoBroadcastType;
};
action_open_window_connect: {
newTab: boolean;
};
action_open_window_settings: {
defaultCategory?: string;
};
action_open_window_permissions: {
connection?: ConnectionHandler;
defaultTab: PermissionEditorTab;
};
}
export declare const global_client_actions: Registry<ClientGlobalControlEvents>;

64
imports/shared-app/file/Avatars.d.ts vendored Normal file
View File

@ -0,0 +1,64 @@
import { Registry } from "../events";
export declare const kIPCAvatarChannel = "avatars";
export declare const kLoadingAvatarImage = "img/loading_image.svg";
export declare const kDefaultAvatarImage = "img/style/avatar.png";
export declare type AvatarState = "unset" | "loading" | "errored" | "loaded";
export interface AvatarStateData {
"unset": {};
"loading": {};
"errored": {
message: string;
};
"loaded": {
url: string;
};
}
interface AvatarEvents {
avatar_changed: {
newAvatarHash: string;
};
avatar_state_changed: {
oldState: AvatarState;
newState: AvatarState;
newStateData: AvatarStateData[keyof AvatarStateData];
};
}
export declare abstract class ClientAvatar {
readonly events: Registry<AvatarEvents>;
readonly clientAvatarId: string;
private currentAvatarHash;
private state;
private stateData;
loadingTimestamp: number;
constructor(clientAvatarId: string);
destroy(): void;
protected setState<T extends AvatarState>(state: T, data: AvatarStateData[T], force?: boolean): void;
getTypedStateData<T extends AvatarState>(state: T): AvatarStateData[T];
setUnset(): void;
setLoading(): void;
setLoaded(data: AvatarStateData["loaded"]): void;
setErrored(data: AvatarStateData["errored"]): void;
awaitLoaded(): Promise<void>;
getState(): AvatarState;
getStateData(): AvatarStateData[AvatarState];
getAvatarHash(): string | "unknown";
getAvatarUrl(): string;
getLoadError(): string;
protected abstract destroyStateData(state: AvatarState, data: AvatarStateData[AvatarState]): any;
}
export declare abstract class AbstractAvatarManager {
abstract resolveAvatar(clientAvatarId: string, avatarHash?: string): ClientAvatar;
abstract resolveClientAvatar(client: {
id?: number;
database_id?: number;
clientUniqueId: string;
}): any;
}
export declare abstract class AbstractAvatarManagerFactory {
abstract hasManager(handlerId: string): boolean;
abstract getManager(handlerId: string): AbstractAvatarManager;
}
export declare function setGlobalAvatarManagerFactory(factory: AbstractAvatarManagerFactory): void;
export declare function getGlobalAvatarManagerFactory(): AbstractAvatarManagerFactory;
export declare function uniqueId2AvatarId(unique_id: string): string;
export {};

View File

@ -0,0 +1,70 @@
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { CommandResult } from "tc-shared/connection/ServerConnectionDeclaration";
import { AvatarManager } from "tc-shared/file/LocalAvatars";
import { FileDownloadTransfer, FileTransfer, FileUploadTransfer, FinishedFileTransfer, TransferSourceSupplier, TransferTargetSupplier } from "tc-shared/file/Transfer";
import { Registry } from "tc-shared/events";
export declare enum FileType {
DIRECTORY = 0,
FILE = 1
}
export interface FileInfo {
name: string;
type: FileType;
datetime: number;
size: number;
empty: boolean;
}
export declare type InitializeUploadOptions = {
path: string;
name: string;
channel?: number;
channelPassword?: string;
source: TransferSourceSupplier;
};
export declare type InitializeDownloadOptions = {
path: string;
name: string;
channel?: number;
channelPassword?: string;
targetSupplier: TransferTargetSupplier;
};
export interface FileManagerEvents {
notify_transfer_registered: {
transfer: FileTransfer;
};
}
export declare class FileManager {
private static readonly MAX_CONCURRENT_TRANSFERS;
readonly connectionHandler: ConnectionHandler;
readonly avatars: AvatarManager;
readonly events: Registry<FileManagerEvents>;
readonly finishedTransfers: FinishedFileTransfer[];
private readonly commandHandler;
private readonly registeredTransfers_;
private clientTransferIdIndex;
private scheduledTransferUpdate;
private transerUpdateIntervalId;
constructor(connection: any);
destroy(): void;
requestFileList(path: string, channelId?: number, channelPassword?: string): Promise<FileInfo[]>;
requestFileInfo(files: {
channelId?: number;
channelPassword?: string;
path: string;
}[]): Promise<(FileInfo | CommandResult)[]>;
deleteFile(props: {
name: string;
path?: string;
cid?: number;
cpw?: string;
}): Promise<void>;
deleteIcon(iconId: number): Promise<void>;
registeredTransfers(): FileTransfer[];
findTransfer(id: number): FileTransfer;
findTransfer(channelId: number, path: string, name: string): FileTransfer;
initializeFileDownload(options: InitializeDownloadOptions): FileDownloadTransfer;
initializeFileUpload(options: InitializeUploadOptions): FileUploadTransfer;
private registerTransfer;
private scheduleTransferUpdate;
private updateRegisteredTransfers;
}

61
imports/shared-app/file/Icons.d.ts vendored Normal file
View File

@ -0,0 +1,61 @@
import { Registry } from "tc-shared/events";
export declare const kIPCIconChannel = "icons";
export declare const kGlobalIconHandlerId = "global";
export interface RemoteIconEvents {
notify_state_changed: {
oldState: RemoteIconState;
newState: RemoteIconState;
};
}
export declare type RemoteIconState = "loading" | "loaded" | "error" | "empty" | "destroyed";
export declare type RemoteIconInfo = {
iconId: number;
serverUniqueId: string;
handlerId?: string;
};
export declare abstract class RemoteIcon {
readonly events: Registry<RemoteIconEvents>;
readonly iconId: number;
readonly serverUniqueId: string;
private state;
protected imageUrl: string;
protected errorMessage: string;
protected constructor(serverUniqueId: string, iconId: number);
destroy(): void;
getState(): RemoteIconState;
protected setState(state: RemoteIconState): void;
hasImageUrl(): boolean;
/**
* Will throw an string if the icon isn't in loaded state
*/
getImageUrl(): string;
protected setImageUrl(url: string): void;
/**
* Will throw an string if the state isn't error
*/
getErrorMessage(): string | undefined;
protected setErrorMessage(message: string): void;
/**
* Waits 'till the icon has been loaded or any other, non loading, state has been reached.
*/
awaitLoaded(): Promise<void>;
/**
* Returns true if the icon isn't loading any more.
* This includes all other states like error, destroy or empty.
*/
isLoaded(): boolean;
}
export declare abstract class AbstractIconManager {
protected static iconUniqueKey(iconId: number, serverUniqueId: string): string;
/**
* @param iconId The requested icon
* @param serverUniqueId The server unique id for the icon
* @param handlerId Hint which connection handler should be used if we're downloading the icon
*/
abstract resolveIcon(iconId: number, serverUniqueId?: string, handlerId?: string): RemoteIcon;
}
export declare function setIconManager(instance: AbstractIconManager): void;
export declare function getIconManager(): AbstractIconManager;
export declare function generateIconJQueryTag(icon: RemoteIcon | undefined, options?: {
animate?: boolean;
}): JQuery<HTMLDivElement>;

35
imports/shared-app/file/ImageCache.d.ts vendored Normal file
View File

@ -0,0 +1,35 @@
export declare enum ImageType {
UNKNOWN = 0,
BITMAP = 1,
PNG = 2,
GIF = 3,
SVG = 4,
JPEG = 5
}
export declare function imageType2MediaType(type: ImageType, file?: boolean): "svg" | "jpeg" | "png" | "bmp" | "gif" | "svg+xml";
export declare function responseImageType(encoded_data: string | ArrayBuffer, base64_encoded?: boolean): ImageType;
export declare type ImageCacheState = {
state: "loaded";
instance: Cache;
} | {
state: "errored";
reason: string;
} | {
state: "unloaded";
};
export declare class ImageCache {
readonly cacheName: string;
private state;
private constructor();
static load(cacheName: string): Promise<ImageCache>;
private initialize;
private getCacheInstance;
isPersistent(): boolean;
reset(): Promise<void>;
cleanup(maxAge: number): Promise<void>;
resolveCached(key: string, maxAge?: number): Promise<Response | undefined>;
putCache(key: string, value: Response, type?: string, headers?: {
[key: string]: string;
}): Promise<void>;
delete(key: string): Promise<void>;
}

View File

@ -0,0 +1,25 @@
import { FileManager } from "../file/FileManager";
import { FileDownloadTransfer } from "../file/Transfer";
import { AbstractAvatarManager, ClientAvatar } from "../file/Avatars";
export declare class AvatarManager extends AbstractAvatarManager {
readonly handle: FileManager;
private cachedAvatars;
constructor(handle: FileManager);
destroy(): void;
create_avatar_download(client_avatar_id: string): FileDownloadTransfer;
private executeAvatarLoad0;
private executeAvatarLoad;
updateCache(clientAvatarId: string, clientAvatarHash: string): Promise<void>;
resolveAvatar(clientAvatarId: string, avatarHash?: string, cacheOnly?: boolean): ClientAvatar;
resolveClientAvatar(client: {
id?: number;
database_id?: number;
clientUniqueId: string;
}): ClientAvatar;
private static generate_default_image;
generate_chat_tag(client: {
id?: number;
database_id?: number;
}, client_unique_id: string, callback_loaded?: (successfully: boolean, error?: any) => any): JQuery;
flush_cache(): void;
}

View File

@ -0,0 +1,2 @@
import { ImageCache } from "tc-shared/file/ImageCache";
export declare let localIconCache: ImageCache;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

199
imports/shared-app/file/Transfer.d.ts vendored Normal file
View File

@ -0,0 +1,199 @@
import { Registry } from "../events";
import { CommandResult } from "../connection/ServerConnectionDeclaration";
import { ErrorCode } from "../connection/ErrorCode";
export declare enum TransferSourceType {
BROWSER_FILE = 0,
BUFFER = 1,
TEXT = 2
}
export declare abstract class TransferSource {
readonly type: TransferSourceType;
protected constructor(type: TransferSourceType);
abstract fileSize(): Promise<number>;
}
export declare abstract class BrowserFileTransferSource extends TransferSource {
protected constructor();
abstract getFile(): File;
}
export declare abstract class BufferTransferSource extends TransferSource {
protected constructor();
abstract getBuffer(): ArrayBuffer;
}
export declare abstract class TextTransferSource extends TransferSource {
protected constructor();
abstract getText(): string;
}
export declare type TransferSourceSupplier = (transfer: FileUploadTransfer) => Promise<TransferSource>;
export declare enum TransferTargetType {
RESPONSE = 0,
DOWNLOAD = 1,
FILE = 2
}
export declare abstract class TransferTarget {
readonly type: TransferTargetType;
protected constructor(type: TransferTargetType);
}
export declare abstract class DownloadTransferTarget extends TransferTarget {
protected constructor();
}
export declare abstract class ResponseTransferTarget extends TransferTarget {
protected constructor();
abstract hasResponse(): boolean;
abstract getResponse(): Response;
}
export declare abstract class FileTransferTarget extends TransferTarget {
protected constructor();
abstract getFilePath(): string;
abstract hasFileName(): boolean;
abstract getFileName(): string;
}
export declare type TransferTargetSupplier = (transfer: FileDownloadTransfer) => Promise<TransferTarget>;
export declare enum FileTransferState {
PENDING = 0,
INITIALIZING = 1,
CONNECTING = 2,
RUNNING = 3,
FINISHED = 4,
ERRORED = 5,
CANCELED = 6
}
export declare enum CancelReason {
USER_ACTION = 0,
SERVER_DISCONNECTED = 1
}
export declare enum FileTransferDirection {
UPLOAD = 0,
DOWNLOAD = 1
}
export interface FileTransferEvents {
"notify_state_updated": {
oldState: FileTransferState;
newState: FileTransferState;
};
"notify_progress": {
progress: TransferProgress;
};
"notify_transfer_canceled": {};
}
export interface TransferProperties {
channel_id: number | 0;
path: string;
name: string;
}
export interface InitializedTransferProperties {
serverTransferId: number;
transferKey: string;
addresses: {
serverAddress: string;
serverPort: number;
}[];
protocol: number;
seekOffset: number;
fileSize?: number;
}
export interface TransferInitializeError {
error: "initialize";
commandResult: string | CommandResult;
}
export interface TransferConnectError {
error: "connection";
reason: "missing-provider" | "provider-initialize-error" | "handle-initialize-error" | "network-error";
extraMessage?: string;
}
export interface TransferIOError {
error: "io";
reason: "unsupported-target" | "failed-to-initialize-target" | "buffer-transfer-failed";
extraMessage?: string;
}
export interface TransferErrorStatus {
error: "status";
status: ErrorCode;
extraMessage: string;
}
export interface TransferErrorTimeout {
error: "timeout";
}
export declare type TransferErrorType = TransferInitializeError | TransferConnectError | TransferIOError | TransferErrorStatus | TransferErrorTimeout;
export interface TransferProgress {
timestamp: number;
file_bytes_transferred: number;
file_current_offset: number;
file_start_offset: number;
file_total_size: number;
network_bytes_received: number;
network_bytes_send: number;
network_current_speed: number;
network_average_speed: number;
}
export interface TransferTimings {
timestampScheduled: number;
timestampExecuted: number;
timestampTransferBegin: number;
timestampEnd: number;
}
export interface FinishedFileTransfer {
readonly clientTransferId: number;
readonly timings: TransferTimings;
readonly properties: TransferProperties;
readonly direction: FileTransferDirection;
readonly state: FileTransferState.CANCELED | FileTransferState.FINISHED | FileTransferState.ERRORED;
readonly transferError?: TransferErrorType;
readonly transferErrorMessage?: string;
readonly bytesTransferred: number;
}
export declare class FileTransfer {
readonly events: Registry<FileTransferEvents>;
readonly clientTransferId: number;
readonly direction: FileTransferDirection;
readonly properties: TransferProperties;
readonly timings: TransferTimings;
lastStateUpdate: number;
private cancelReason;
private transferProperties_;
private transferError_;
private transferErrorMessage_;
private transferState_;
private progress_;
protected constructor(direction: any, clientTransferId: any, properties: any);
destroy(): void;
isRunning(): boolean;
isPending(): boolean;
isFinished(): boolean;
transferState(): FileTransferState;
transferProperties(): InitializedTransferProperties | undefined;
currentError(): TransferErrorType | undefined;
currentErrorMessage(): string | undefined;
lastProgressInfo(): TransferProgress | undefined;
setFailed(error: TransferErrorType, asMessage: string): void;
setProperties(properties: InitializedTransferProperties): void;
requestCancel(reason: CancelReason): void;
setTransferState(newState: FileTransferState): void;
updateProgress(progress: TransferProgress): void;
awaitFinished(): Promise<void>;
}
export declare class FileDownloadTransfer extends FileTransfer {
readonly targetSupplier: TransferTargetSupplier;
target: TransferTarget;
constructor(clientTransferId: any, properties: TransferProperties, targetSupplier: any);
}
export declare class FileUploadTransfer extends FileTransfer {
readonly sourceSupplier: TransferSourceSupplier;
source: TransferSource;
fileSize: number;
constructor(clientTransferId: any, properties: TransferProperties, sourceSupplier: any);
}
export declare abstract class TransferProvider {
private static instance_;
static provider(): TransferProvider;
static setProvider(provider: TransferProvider): void;
abstract executeFileDownload(transfer: FileDownloadTransfer): any;
abstract executeFileUpload(transfer: FileUploadTransfer): any;
abstract targetSupported(type: TransferTargetType): any;
abstract sourceSupported(type: TransferSourceType): any;
createResponseTarget(): Promise<ResponseTransferTarget>;
createDownloadTarget(filename?: string): Promise<DownloadTransferTarget>;
createFileTarget(path?: string, filename?: string): Promise<FileTransferTarget>;
createBufferSource(buffer: ArrayBuffer): Promise<BufferTransferSource>;
createTextSource(text: string): Promise<TextTransferSource>;
createBrowserFileSource(file: File): Promise<BrowserFileTransferSource>;
}

1
imports/shared-app/i18n/country.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare function country_name(alpha_code: string, fallback?: string): string;

76
imports/shared-app/i18n/localize.d.ts vendored Normal file
View File

@ -0,0 +1,76 @@
export interface TranslationKey {
message: string;
line?: number;
character?: number;
filename?: string;
}
export interface Translation {
key: TranslationKey;
translated: string;
flags?: string[];
}
export interface Contributor {
name: string;
email: string;
}
export interface TranslationFile {
path: string;
full_url: string;
translations: Translation[];
}
export interface RepositoryTranslation {
key: string;
path: string;
country_code: string;
name: string;
contributors: Contributor[];
}
export interface TranslationRepository {
unique_id: string;
url: string;
name?: string;
contact?: string;
translations?: RepositoryTranslation[];
load_timestamp?: number;
}
export declare function tr(message: string, key?: string): string;
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<void>;
export declare function load_repository(url: string): Promise<TranslationRepository>;
export declare namespace config {
interface TranslationConfig {
current_repository_url?: string;
current_language?: string;
current_translation_url?: string;
current_translation_path?: string;
}
interface RepositoryConfig {
repositories?: {
url?: string;
repository?: TranslationRepository;
}[];
}
function repository_config(): RepositoryConfig;
function save_repository_config(): void;
function translation_config(): TranslationConfig;
function save_translation_config(): void;
}
export declare function register_repository(repository: TranslationRepository): void;
export declare function registered_repositories(): TranslationRepository[];
export declare function delete_repository(repository: TranslationRepository): void;
export declare function iterate_repositories(callback_entry: (repository: TranslationRepository) => any): Promise<void>;
export declare function select_translation(repository: TranslationRepository, entry: RepositoryTranslation): void;
export declare function initialize(): Promise<void>;
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;
}

49
imports/shared-app/ipc/BrowserIPC.d.ts vendored Normal file
View File

@ -0,0 +1,49 @@
import "broadcastchannel-polyfill";
import { ConnectHandler } from "../ipc/ConnectHandler";
interface IpcRawMessage {
timestampSend: number;
sourcePeerId: string;
targetPeerId: string;
targetChannelId: string;
message: ChannelMessage;
}
export interface ChannelMessage {
type: string;
data: any;
}
export declare abstract class BasicIPCHandler {
protected static readonly BROADCAST_UNIQUE_ID = "00000000-0000-4000-0000-000000000000";
protected readonly applicationChannelId: string;
protected readonly localPeerId: string;
protected registeredChannels: IPCChannel[];
protected constructor(applicationChannelId: string);
setup(): void;
getApplicationChannelId(): string;
getLocalPeerId(): string;
abstract sendMessage(message: IpcRawMessage): any;
protected handleMessage(message: IpcRawMessage): void;
/**
* @param channelId
* @param remotePeerId The peer to receive messages from. If empty messages will be broadcasted
*/
createChannel(channelId: string, remotePeerId?: string): IPCChannel;
/**
* Create a channel which only communicates with the TeaSpeak - Core.
* @param channelId
*/
createCoreControlChannel(channelId: string): IPCChannel;
channels(): IPCChannel[];
deleteChannel(channel: IPCChannel): void;
}
export interface IPCChannel {
/** Channel id */
readonly channelId: string;
/** Target peer id. If set only messages from that process will be processed */
targetPeerId?: string;
messageHandler: (sourcePeerId: string, broadcast: boolean, message: ChannelMessage) => void;
sendMessage(type: string, data: any, remotePeerId?: string): any;
}
export declare function setupIpcHandler(): void;
export declare function getIpcInstance(): BasicIPCHandler;
export declare function getInstanceConnectHandler(): ConnectHandler;
export {};

View File

@ -0,0 +1,39 @@
import { BasicIPCHandler } from "../ipc/BrowserIPC";
export declare type ConnectRequestData = {
address: string;
profile?: string;
username?: string;
password?: {
value: string;
hashed: boolean;
};
};
export interface ConnectOffer {
request_id: string;
data: ConnectRequestData;
}
export interface ConnectOfferAnswer {
request_id: string;
accepted: boolean;
}
export interface ConnectExecute {
request_id: string;
}
export interface ConnectExecuted {
request_id: string;
succeeded: boolean;
message?: string;
}
export declare class ConnectHandler {
private static readonly CHANNEL_NAME;
readonly ipc_handler: BasicIPCHandler;
private ipc_channel;
callback_available: (data: ConnectRequestData) => boolean;
callback_execute: (data: ConnectRequestData) => boolean | string;
private _pending_connect_offers;
private _pending_connects_requests;
constructor(ipc_handler: BasicIPCHandler);
setup(): void;
private onMessage;
post_connect_request(data: ConnectRequestData, callback_avail: () => Promise<boolean>): Promise<void>;
}

64
imports/shared-app/log.d.ts vendored Normal file
View File

@ -0,0 +1,64 @@
export declare enum LogCategory {
CHANNEL = 0,
CHANNEL_PROPERTIES = 1,
CLIENT = 2,
BOOKMARKS = 3,
SERVER = 4,
PERMISSIONS = 5,
GENERAL = 6,
NETWORKING = 7,
VOICE = 8,
CHAT = 9,
AUDIO = 10,
I18N = 11,
IPC = 12,
IDENTITIES = 13,
STATISTICS = 14,
DNS = 15,
FILE_TRANSFER = 16,
EVENT_REGISTRY = 17,
WEBRTC = 18,
VIDEO = 19
}
export declare enum LogType {
TRACE = 0,
DEBUG = 1,
INFO = 2,
WARNING = 3,
ERROR = 4
}
export declare let enabled_mapping: Map<number, boolean>;
export declare let level_mapping: Map<LogType, boolean>;
declare enum GroupMode {
NATIVE = 0,
PREFIX = 1
}
export declare function initialize(defaultLogLevel: LogType): void;
export declare function logTrace(category: LogCategory, message: string, ...optionalParams: any[]): void;
export declare function logDebug(category: LogCategory, message: string, ...optionalParams: any[]): void;
export declare function logInfo(category: LogCategory, message: string, ...optionalParams: any[]): void;
export declare function logWarn(category: LogCategory, message: string, ...optionalParams: any[]): void;
export declare function logError(category: LogCategory, message: string, ...optionalParams: any[]): void;
export declare function group(level: LogType, category: LogCategory, name: string, ...optionalParams: any[]): Group;
export declare function logGroupNative(level: LogType, category: LogCategory, name: string, ...optionalParams: any[]): Group;
export declare function table(level: LogType, category: LogCategory, title: string, args: any): void;
export declare class Group {
readonly mode: GroupMode;
readonly level: LogType;
readonly category: LogCategory;
readonly enabled: boolean;
owner: Group;
private readonly name;
private readonly optionalParams;
private isCollapsed;
private initialized;
private logPrefix;
constructor(mode: GroupMode, level: LogType, category: LogCategory, name: string, optionalParams: any[][], owner?: Group);
group(level: LogType, name: string, ...optionalParams: any[]): Group;
collapsed(flag?: boolean): this;
log(message: string, ...optionalParams: any[]): this;
end(): void;
get prefix(): string;
set prefix(prefix: string);
}
export {};

26
imports/shared-app/main.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
import { UrlParameterParser } from "tc-shared/settings";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { ConnectRequestData } from "tc-shared/ipc/ConnectHandler";
import "svg-sprites/client-icons";
import "../css/load-css";
import "./proto";
import "./video-viewer/Controller";
import "./profiles/ConnectionProfile";
import "./update/UpdaterWeb";
import "./file/LocalIcons";
import "./connection/CommandHandler";
import "./connection/ConnectionBase";
import "./connection/rtc/Connection";
import "./connection/rtc/video/Connection";
import "./video/VideoSource";
import "./media/Video";
import "./ui/AppController";
import "./ui/frames/menu-bar/MainMenu";
import "./ui/modal/connect/Controller";
import "./ui/elements/ContextDivider";
import "./ui/elements/Tab";
import "./clientservice";
import "./text/bbcode/InviteController";
export declare function handleNativeConnectRequest(url: URL): void;
export declare function handleConnectRequest(serverAddress: string, serverUniqueId: string | undefined, parameters: UrlParameterParser): Promise<void>;
export declare function handle_connect_request(properties: ConnectRequestData, _connection: ConnectionHandler): void;

11
imports/shared-app/media/Stream.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { InputStartError } from "tc-shared/voice/RecorderBase";
export declare type MediaStreamType = "audio" | "video";
export declare enum MediaPermissionStatus {
Unknown = 0,
Granted = 1,
Denied = 2
}
export declare function requestMediaStreamWithConstraints(constraints: MediaTrackConstraints, type: MediaStreamType): Promise<InputStartError | MediaStream>;
export declare function requestMediaStream(deviceId: string | undefined, groupId: string | undefined, type: MediaStreamType): Promise<MediaStream | InputStartError>;
export declare function queryMediaPermissions(type: MediaStreamType, changeListener?: (value: PermissionState) => void): Promise<PermissionState>;
export declare function stopMediaStream(stream: MediaStream): void;

39
imports/shared-app/media/Video.d.ts vendored Normal file
View File

@ -0,0 +1,39 @@
import { ScreenCaptureDevice, VideoDevice, VideoDriver, VideoDriverEvents, VideoPermissionStatus, VideoSource, VideoSourceCapabilities, VideoSourceInitialSettings } from "tc-shared/video/VideoSource";
import { Registry } from "tc-shared/events";
declare global {
interface MediaDevices {
getDisplayMedia(options?: any): Promise<MediaStream>;
}
}
export declare class WebVideoDriver implements VideoDriver {
private readonly events;
private currentPermissionStatus;
constructor();
private setPermissionStatus;
private handleSystemPermissionState;
initialize(): Promise<void>;
getDevices(): Promise<VideoDevice[] | false>;
requestPermissions(): Promise<VideoSource | boolean>;
getEvents(): Registry<VideoDriverEvents>;
getPermissionStatus(): VideoPermissionStatus;
createVideoSource(id: string | undefined): Promise<VideoSource>;
screenQueryAvailable(): boolean;
queryScreenCaptureDevices(): Promise<ScreenCaptureDevice[]>;
createScreenSource(_id: string | undefined, _allowFocusLoss: boolean): Promise<VideoSource>;
}
export declare class WebVideoSource implements VideoSource {
private readonly deviceId;
private readonly displayName;
private readonly stream;
private readonly initialSettings;
private referenceCount;
constructor(deviceId: string, displayName: string, stream: MediaStream);
destroy(): void;
getId(): string;
getName(): string;
getStream(): MediaStream;
getInitialSettings(): VideoSourceInitialSettings;
getCapabilities(): VideoSourceCapabilities;
deref(): void;
ref(): this;
}

View File

@ -0,0 +1,95 @@
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
import { Registry } from "tc-shared/events";
export declare type PlaylistEntry = {
type: "song";
id: number;
previousId: number;
url: string;
urlLoader: string;
invokerDatabaseId: number;
metadata: PlaylistSongMetadata;
};
export declare type PlaylistSongMetadata = {
status: "loading";
} | {
status: "unparsed";
metadata: string;
} | {
status: "loaded";
metadata: string;
title: string;
description: string;
thumbnailUrl?: string;
length: number;
};
export interface SubscribedPlaylistEvents {
notify_status_changed: {};
notify_entry_added: {
entry: PlaylistEntry;
};
notify_entry_deleted: {
entry: PlaylistEntry;
};
notify_entry_reordered: {
entry: PlaylistEntry;
oldPreviousId: number;
};
notify_entry_updated: {
entry: PlaylistEntry;
};
}
export declare type SubscribedPlaylistStatus = {
status: "loaded";
songs: PlaylistEntry[];
} | {
status: "loading";
} | {
status: "error";
error: string;
} | {
status: "no-permissions";
failedPermission: string;
} | {
status: "unloaded";
};
export declare abstract class SubscribedPlaylist {
readonly events: Registry<SubscribedPlaylistEvents>;
readonly playlistId: number;
readonly serverUniqueId: string;
protected status: SubscribedPlaylistStatus;
protected refCount: number;
protected constructor(serverUniqueId: string, playlistId: number);
ref(): SubscribedPlaylist;
unref(): void;
destroy(): void;
/**
* Query the playlist songs from the remote server.
* The playlist status will change on a successfully or failed query.
*
* @param forceQuery Forcibly query even we're subscribed and already aware of all songs.
*/
abstract querySongs(forceQuery: boolean): Promise<void>;
abstract addSong(url: string, urlLoader: "any" | "youtube" | "ffmpeg" | "channel", targetSongId: number | 0, mode?: "before" | "after" | "last"): Promise<void>;
abstract deleteEntry(entryId: number): Promise<void>;
abstract reorderEntry(entryId: number, targetEntryId: number, mode: "before" | "after"): Promise<void>;
getStatus(): Readonly<SubscribedPlaylistStatus>;
protected setStatus(status: SubscribedPlaylistStatus): void;
}
export declare class PlaylistManager {
readonly connection: ConnectionHandler;
private listenerConnection;
private playlistEntryListCache;
private subscribedPlaylist;
constructor(connection: ConnectionHandler);
destroy(): void;
queryPlaylistEntries(playlistId: number): Promise<PlaylistEntry[]>;
reorderSong(playlistId: number, songId: number, previousSongId: number): Promise<void>;
addSong(playlistId: number, url: string, urlLoader: "any" | "youtube" | "ffmpeg" | "channel", previousSongId: number | 0): Promise<void>;
removeSong(playlistId: number, entryId: number): Promise<void>;
/**
* @param playlistId
* @return Returns a subscribed playlist.
* Attention: You have to manually destroy the object!
*/
createSubscribedPlaylist(playlistId: number): SubscribedPlaylist;
}

View File

@ -0,0 +1,88 @@
import { LaterPromise } from "../utils/LaterPromise";
import { PermissionValue } from "../permission/PermissionManager";
import { ServerCommand } from "../connection/ConnectionBase";
import { ConnectionHandler } from "../ConnectionHandler";
import { AbstractCommandHandler } from "../connection/AbstractCommandHandler";
import { Registry } from "../events";
export declare enum GroupType {
QUERY = 0,
TEMPLATE = 1,
NORMAL = 2
}
export declare enum GroupTarget {
SERVER = 0,
CHANNEL = 1
}
export declare class GroupProperties {
iconid: number;
sortid: number;
savedb: boolean;
namemode: number;
}
export declare class GroupPermissionRequest {
group_id: number;
promise: LaterPromise<PermissionValue[]>;
}
export declare type GroupUpdate = {
key: GroupProperty;
group: Group;
oldValue: any;
newValue: any;
};
export interface GroupManagerEvents {
notify_reset: {};
notify_groups_created: {
groups: Group[];
cause: "list-update" | "initialize" | "user-action";
};
notify_groups_deleted: {
groups: Group[];
cause: "list-update" | "reset" | "user-action";
};
notify_groups_updated: {
updates: GroupUpdate[];
};
notify_groups_received: {};
}
export declare type GroupProperty = "name" | "icon" | "sort-id" | "save-db" | "name-mode";
export interface GroupEvents {
notify_group_deleted: {};
notify_properties_updated: {
updated_properties: GroupProperty[];
};
notify_needed_powers_updated: {};
}
export declare class Group {
readonly handle: GroupManager;
readonly events: Registry<GroupEvents>;
readonly properties: GroupProperties;
readonly id: number;
readonly target: GroupTarget;
readonly type: GroupType;
name: string;
requiredModifyPower: number;
requiredMemberAddPower: number;
requiredMemberRemovePower: number;
constructor(handle: GroupManager, id: number, target: GroupTarget, type: GroupType, name: string);
updatePropertiesFromGroupList(data: any): GroupUpdate[];
}
export declare class GroupManager extends AbstractCommandHandler {
static sorter(): (a: Group, b: Group) => number;
readonly events: Registry<GroupManagerEvents>;
readonly connectionHandler: ConnectionHandler;
serverGroups: Group[];
channelGroups: Group[];
private allGroupsReceived;
private readonly connectionStateListener;
private groupPermissionRequests;
constructor(client: ConnectionHandler);
destroy(): void;
reset(): void;
handle_command(command: ServerCommand): boolean;
requestGroups(): void;
findServerGroup(id: number): Group | undefined;
findChannelGroup(id: number): Group | undefined;
private handleGroupList;
request_permissions(group: Group): Promise<PermissionValue[]>;
private handleGroupPermissionList;
}

View File

@ -0,0 +1,150 @@
import { PermissionType } from "../permission/PermissionType";
import { LaterPromise } from "../utils/LaterPromise";
import { ServerCommand } from "../connection/ConnectionBase";
import { CommandResult } from "../connection/ServerConnectionDeclaration";
import { ConnectionHandler } from "../ConnectionHandler";
import { AbstractCommandHandler } from "../connection/AbstractCommandHandler";
import { Registry } from "../events";
export declare class PermissionInfo {
name: string;
id: number;
description: string;
is_boolean(): boolean;
id_grant(): number;
}
export declare class PermissionGroup {
begin: number;
end: number;
deep: number;
name: string;
}
export declare class GroupedPermissions {
group: PermissionGroup;
permissions: PermissionInfo[];
children: GroupedPermissions[];
parent: GroupedPermissions;
}
export declare class PermissionValue {
readonly type: PermissionInfo;
value: number | undefined;
flag_skip: boolean;
flag_negate: boolean;
granted_value: number;
constructor(type: any, value?: any);
granted(requiredValue: number, required?: boolean): boolean;
hasValue(): boolean;
hasGrant(): boolean;
valueOr(fallback: number): number;
valueNormalOr(fallback: number): number;
}
export declare class NeededPermissionValue extends PermissionValue {
constructor(type: any, value: any);
}
export declare type PermissionRequestKeys = {
client_id?: number;
channel_id?: number;
playlist_id?: number;
};
export declare type PermissionRequest = PermissionRequestKeys & {
timeout_id: any;
promise: LaterPromise<PermissionValue[]>;
};
export declare namespace find {
type Entry = {
type: "server" | "channel" | "client" | "client_channel" | "channel_group" | "server_group";
value: number;
id: number;
};
type Client = Entry & {
type: "client";
client_id: number;
};
type Channel = Entry & {
type: "channel";
channel_id: number;
};
type Server = Entry & {
type: "server";
};
type ClientChannel = Entry & {
type: "client_channel";
client_id: number;
channel_id: number;
};
type ChannelGroup = Entry & {
type: "channel_group";
group_id: number;
};
type ServerGroup = Entry & {
type: "server_group";
group_id: number;
};
}
export interface PermissionManagerEvents {
client_permissions_changed: {};
}
export declare type RequestLists = "requests_channel_permissions" | "requests_client_permissions" | "requests_client_channel_permissions" | "requests_playlist_permissions" | "requests_playlist_client_permissions";
export declare class PermissionManager extends AbstractCommandHandler {
readonly events: Registry<PermissionManagerEvents>;
readonly handle: ConnectionHandler;
permissionList: PermissionInfo[];
permissionGroups: PermissionGroup[];
neededPermissions: NeededPermissionValue[];
needed_permission_change_listener: {
[permission: string]: ((value?: PermissionValue) => void)[];
};
requests_channel_permissions: PermissionRequest[];
requests_client_permissions: PermissionRequest[];
requests_client_channel_permissions: PermissionRequest[];
requests_playlist_permissions: PermissionRequest[];
requests_playlist_client_permissions: PermissionRequest[];
requests_permfind: {
timeout_id: number;
permission: string;
callback: (status: "success" | "error", data: any) => void;
}[];
initializedListener: ((initialized: boolean) => void)[];
private cacheNeededPermissions;
static readonly group_mapping: {
name: string;
deep: number;
}[];
private _group_mapping;
static parse_permission_bulk(json: any[], manager: PermissionManager): PermissionValue[];
constructor(client: ConnectionHandler);
destroy(): void;
handle_command(command: ServerCommand): boolean;
initialized(): boolean;
requestPermissionList(): void;
private onPermissionList;
private onNeededPermissions;
register_needed_permission(key: PermissionType, listener: () => any): () => void;
unregister_needed_permission(key: PermissionType, listener: () => any): void;
resolveInfo?(key: number | string | PermissionType): PermissionInfo;
private onChannelPermList;
private execute_channel_permission_request;
requestChannelPermissions(channelId: number, processResult?: boolean): Promise<PermissionValue[]>;
private onClientPermList;
private execute_client_permission_request;
requestClientPermissions(client_id: number): Promise<PermissionValue[]>;
private onChannelClientPermList;
private execute_client_channel_permission_request;
requestClientChannelPermissions(client_id: number, channel_id: number): Promise<PermissionValue[]>;
private onPlaylistPermList;
private execute_playlist_permission_request;
requestPlaylistPermissions(playlist_id: number): Promise<PermissionValue[]>;
private onPlaylistClientPermList;
private execute_playlist_client_permission_request;
requestPlaylistClientPermissions(playlist_id: number, client_database_id: number): Promise<PermissionValue[]>;
private readonly criteria_equal;
private execute_permission_request;
private fullfill_permission_request;
find_permission(...permissions: string[]): Promise<find.Entry[]>;
neededPermission(key: number | string | PermissionType | PermissionInfo): NeededPermissionValue;
groupedPermissions(): GroupedPermissions[];
/**
* Generates an enum with all know permission types, used for the enum above
*/
export_permission_types(): string;
getFailedPermission(command: CommandResult, index?: number): any;
}

View File

@ -0,0 +1,363 @@
export declare enum PermissionType {
B_SERVERINSTANCE_HELP_VIEW = "b_serverinstance_help_view",
B_SERVERINSTANCE_VERSION_VIEW = "b_serverinstance_version_view",
B_SERVERINSTANCE_INFO_VIEW = "b_serverinstance_info_view",
B_SERVERINSTANCE_VIRTUALSERVER_LIST = "b_serverinstance_virtualserver_list",
B_SERVERINSTANCE_BINDING_LIST = "b_serverinstance_binding_list",
B_SERVERINSTANCE_PERMISSION_LIST = "b_serverinstance_permission_list",
B_SERVERINSTANCE_PERMISSION_FIND = "b_serverinstance_permission_find",
B_VIRTUALSERVER_CREATE = "b_virtualserver_create",
B_VIRTUALSERVER_DELETE = "b_virtualserver_delete",
B_VIRTUALSERVER_START_ANY = "b_virtualserver_start_any",
B_VIRTUALSERVER_STOP_ANY = "b_virtualserver_stop_any",
B_VIRTUALSERVER_CHANGE_MACHINE_ID = "b_virtualserver_change_machine_id",
B_VIRTUALSERVER_CHANGE_TEMPLATE = "b_virtualserver_change_template",
B_SERVERQUERY_LOGIN = "b_serverquery_login",
B_SERVERINSTANCE_TEXTMESSAGE_SEND = "b_serverinstance_textmessage_send",
B_SERVERINSTANCE_LOG_VIEW = "b_serverinstance_log_view",
B_SERVERINSTANCE_LOG_ADD = "b_serverinstance_log_add",
B_SERVERINSTANCE_STOP = "b_serverinstance_stop",
B_SERVERINSTANCE_MODIFY_SETTINGS = "b_serverinstance_modify_settings",
B_SERVERINSTANCE_MODIFY_QUERYGROUP = "b_serverinstance_modify_querygroup",
B_SERVERINSTANCE_MODIFY_TEMPLATES = "b_serverinstance_modify_templates",
B_VIRTUALSERVER_SELECT = "b_virtualserver_select",
B_VIRTUALSERVER_SELECT_GODMODE = "b_virtualserver_select_godmode",
B_VIRTUALSERVER_INFO_VIEW = "b_virtualserver_info_view",
B_VIRTUALSERVER_CONNECTIONINFO_VIEW = "b_virtualserver_connectioninfo_view",
B_VIRTUALSERVER_CHANNEL_LIST = "b_virtualserver_channel_list",
B_VIRTUALSERVER_CHANNEL_SEARCH = "b_virtualserver_channel_search",
B_VIRTUALSERVER_CLIENT_LIST = "b_virtualserver_client_list",
B_VIRTUALSERVER_CLIENT_SEARCH = "b_virtualserver_client_search",
B_VIRTUALSERVER_CLIENT_DBLIST = "b_virtualserver_client_dblist",
B_VIRTUALSERVER_CLIENT_DBSEARCH = "b_virtualserver_client_dbsearch",
B_VIRTUALSERVER_CLIENT_DBINFO = "b_virtualserver_client_dbinfo",
B_VIRTUALSERVER_PERMISSION_FIND = "b_virtualserver_permission_find",
B_VIRTUALSERVER_CUSTOM_SEARCH = "b_virtualserver_custom_search",
B_VIRTUALSERVER_START = "b_virtualserver_start",
B_VIRTUALSERVER_STOP = "b_virtualserver_stop",
B_VIRTUALSERVER_TOKEN_LIST = "b_virtualserver_token_list",
B_VIRTUALSERVER_TOKEN_ADD = "b_virtualserver_token_add",
B_VIRTUALSERVER_TOKEN_USE = "b_virtualserver_token_use",
B_VIRTUALSERVER_TOKEN_DELETE = "b_virtualserver_token_delete",
B_VIRTUALSERVER_LOG_VIEW = "b_virtualserver_log_view",
B_VIRTUALSERVER_LOG_ADD = "b_virtualserver_log_add",
B_VIRTUALSERVER_JOIN_IGNORE_PASSWORD = "b_virtualserver_join_ignore_password",
B_VIRTUALSERVER_NOTIFY_REGISTER = "b_virtualserver_notify_register",
B_VIRTUALSERVER_NOTIFY_UNREGISTER = "b_virtualserver_notify_unregister",
B_VIRTUALSERVER_SNAPSHOT_CREATE = "b_virtualserver_snapshot_create",
B_VIRTUALSERVER_SNAPSHOT_DEPLOY = "b_virtualserver_snapshot_deploy",
B_VIRTUALSERVER_PERMISSION_RESET = "b_virtualserver_permission_reset",
B_VIRTUALSERVER_MODIFY_NAME = "b_virtualserver_modify_name",
B_VIRTUALSERVER_MODIFY_WELCOMEMESSAGE = "b_virtualserver_modify_welcomemessage",
B_VIRTUALSERVER_MODIFY_MAXCHANNELS = "b_virtualserver_modify_maxchannels",
B_VIRTUALSERVER_MODIFY_MAXCLIENTS = "b_virtualserver_modify_maxclients",
B_VIRTUALSERVER_MODIFY_RESERVED_SLOTS = "b_virtualserver_modify_reserved_slots",
B_VIRTUALSERVER_MODIFY_PASSWORD = "b_virtualserver_modify_password",
B_VIRTUALSERVER_MODIFY_DEFAULT_SERVERGROUP = "b_virtualserver_modify_default_servergroup",
B_VIRTUALSERVER_MODIFY_DEFAULT_MUSICGROUP = "b_virtualserver_modify_default_musicgroup",
B_VIRTUALSERVER_MODIFY_DEFAULT_CHANNELGROUP = "b_virtualserver_modify_default_channelgroup",
B_VIRTUALSERVER_MODIFY_DEFAULT_CHANNELADMINGROUP = "b_virtualserver_modify_default_channeladmingroup",
B_VIRTUALSERVER_MODIFY_CHANNEL_FORCED_SILENCE = "b_virtualserver_modify_channel_forced_silence",
B_VIRTUALSERVER_MODIFY_COMPLAIN = "b_virtualserver_modify_complain",
B_VIRTUALSERVER_MODIFY_ANTIFLOOD = "b_virtualserver_modify_antiflood",
B_VIRTUALSERVER_MODIFY_FT_SETTINGS = "b_virtualserver_modify_ft_settings",
B_VIRTUALSERVER_MODIFY_FT_QUOTAS = "b_virtualserver_modify_ft_quotas",
B_VIRTUALSERVER_MODIFY_HOSTMESSAGE = "b_virtualserver_modify_hostmessage",
B_VIRTUALSERVER_MODIFY_HOSTBANNER = "b_virtualserver_modify_hostbanner",
B_VIRTUALSERVER_MODIFY_HOSTBUTTON = "b_virtualserver_modify_hostbutton",
B_VIRTUALSERVER_MODIFY_PORT = "b_virtualserver_modify_port",
B_VIRTUALSERVER_MODIFY_HOST = "b_virtualserver_modify_host",
B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES = "b_virtualserver_modify_default_messages",
B_VIRTUALSERVER_MODIFY_AUTOSTART = "b_virtualserver_modify_autostart",
B_VIRTUALSERVER_MODIFY_NEEDED_IDENTITY_SECURITY_LEVEL = "b_virtualserver_modify_needed_identity_security_level",
B_VIRTUALSERVER_MODIFY_PRIORITY_SPEAKER_DIMM_MODIFICATOR = "b_virtualserver_modify_priority_speaker_dimm_modificator",
B_VIRTUALSERVER_MODIFY_LOG_SETTINGS = "b_virtualserver_modify_log_settings",
B_VIRTUALSERVER_MODIFY_MIN_CLIENT_VERSION = "b_virtualserver_modify_min_client_version",
B_VIRTUALSERVER_MODIFY_ICON_ID = "b_virtualserver_modify_icon_id",
B_VIRTUALSERVER_MODIFY_WEBLIST = "b_virtualserver_modify_weblist",
B_VIRTUALSERVER_MODIFY_COUNTRY_CODE = "b_virtualserver_modify_country_code",
B_VIRTUALSERVER_MODIFY_CODEC_ENCRYPTION_MODE = "b_virtualserver_modify_codec_encryption_mode",
B_VIRTUALSERVER_MODIFY_TEMPORARY_PASSWORDS = "b_virtualserver_modify_temporary_passwords",
B_VIRTUALSERVER_MODIFY_TEMPORARY_PASSWORDS_OWN = "b_virtualserver_modify_temporary_passwords_own",
B_VIRTUALSERVER_MODIFY_CHANNEL_TEMP_DELETE_DELAY_DEFAULT = "b_virtualserver_modify_channel_temp_delete_delay_default",
B_VIRTUALSERVER_MODIFY_MUSIC_BOT_LIMIT = "b_virtualserver_modify_music_bot_limit",
I_CHANNEL_MIN_DEPTH = "i_channel_min_depth",
I_CHANNEL_MAX_DEPTH = "i_channel_max_depth",
B_CHANNEL_GROUP_INHERITANCE_END = "b_channel_group_inheritance_end",
I_CHANNEL_PERMISSION_MODIFY_POWER = "i_channel_permission_modify_power",
I_CHANNEL_NEEDED_PERMISSION_MODIFY_POWER = "i_channel_needed_permission_modify_power",
B_CHANNEL_INFO_VIEW = "b_channel_info_view",
B_VIRTUALSERVER_CHANNEL_PERMISSION_LIST = "b_virtualserver_channel_permission_list",
B_CHANNEL_CREATE_CHILD = "b_channel_create_child",
B_CHANNEL_CREATE_PERMANENT = "b_channel_create_permanent",
B_CHANNEL_CREATE_SEMI_PERMANENT = "b_channel_create_semi_permanent",
B_CHANNEL_CREATE_TEMPORARY = "b_channel_create_temporary",
B_CHANNEL_CREATE_WITH_TOPIC = "b_channel_create_with_topic",
B_CHANNEL_CREATE_WITH_DESCRIPTION = "b_channel_create_with_description",
B_CHANNEL_CREATE_WITH_PASSWORD = "b_channel_create_with_password",
B_CHANNEL_CREATE_MODIFY_WITH_CODEC_OPUSVOICE = "b_channel_create_modify_with_codec_opusvoice",
B_CHANNEL_CREATE_MODIFY_WITH_CODEC_OPUSMUSIC = "b_channel_create_modify_with_codec_opusmusic",
I_CHANNEL_CREATE_MODIFY_WITH_CODEC_MAXQUALITY = "i_channel_create_modify_with_codec_maxquality",
I_CHANNEL_CREATE_MODIFY_WITH_CODEC_LATENCY_FACTOR_MIN = "i_channel_create_modify_with_codec_latency_factor_min",
B_CHANNEL_CREATE_WITH_MAXCLIENTS = "b_channel_create_with_maxclients",
B_CHANNEL_CREATE_WITH_MAXFAMILYCLIENTS = "b_channel_create_with_maxfamilyclients",
B_CHANNEL_CREATE_WITH_SORTORDER = "b_channel_create_with_sortorder",
B_CHANNEL_CREATE_WITH_DEFAULT = "b_channel_create_with_default",
B_CHANNEL_CREATE_WITH_NEEDED_TALK_POWER = "b_channel_create_with_needed_talk_power",
B_CHANNEL_CREATE_MODIFY_WITH_FORCE_PASSWORD = "b_channel_create_modify_with_force_password",
I_CHANNEL_CREATE_MODIFY_WITH_TEMP_DELETE_DELAY = "i_channel_create_modify_with_temp_delete_delay",
I_CHANNEL_CREATE_MODIFY_CONVERSATION_HISTORY_LENGTH = "i_channel_create_modify_conversation_history_length",
B_CHANNEL_CREATE_MODIFY_CONVERSATION_HISTORY_UNLIMITED = "b_channel_create_modify_conversation_history_unlimited",
B_CHANNEL_CREATE_MODIFY_CONVERSATION_MODE_PRIVATE = "b_channel_create_modify_conversation_mode_private",
B_CHANNEL_CREATE_MODIFY_CONVERSATION_MODE_PUBLIC = "b_channel_create_modify_conversation_mode_public",
B_CHANNEL_CREATE_MODIFY_CONVERSATION_MODE_NONE = "b_channel_create_modify_conversation_mode_none",
B_CHANNEL_CREATE_MODIFY_SIDEBAR_MODE = "b_channel_create_modify_sidebar_mode",
B_CHANNEL_MODIFY_PARENT = "b_channel_modify_parent",
B_CHANNEL_MODIFY_MAKE_DEFAULT = "b_channel_modify_make_default",
B_CHANNEL_MODIFY_MAKE_PERMANENT = "b_channel_modify_make_permanent",
B_CHANNEL_MODIFY_MAKE_SEMI_PERMANENT = "b_channel_modify_make_semi_permanent",
B_CHANNEL_MODIFY_MAKE_TEMPORARY = "b_channel_modify_make_temporary",
B_CHANNEL_MODIFY_NAME = "b_channel_modify_name",
B_CHANNEL_MODIFY_TOPIC = "b_channel_modify_topic",
B_CHANNEL_MODIFY_DESCRIPTION = "b_channel_modify_description",
B_CHANNEL_MODIFY_PASSWORD = "b_channel_modify_password",
B_CHANNEL_MODIFY_CODEC = "b_channel_modify_codec",
B_CHANNEL_MODIFY_CODEC_QUALITY = "b_channel_modify_codec_quality",
B_CHANNEL_MODIFY_CODEC_LATENCY_FACTOR = "b_channel_modify_codec_latency_factor",
B_CHANNEL_MODIFY_MAXCLIENTS = "b_channel_modify_maxclients",
B_CHANNEL_MODIFY_MAXFAMILYCLIENTS = "b_channel_modify_maxfamilyclients",
B_CHANNEL_MODIFY_SORTORDER = "b_channel_modify_sortorder",
B_CHANNEL_MODIFY_NEEDED_TALK_POWER = "b_channel_modify_needed_talk_power",
I_CHANNEL_MODIFY_POWER = "i_channel_modify_power",
I_CHANNEL_NEEDED_MODIFY_POWER = "i_channel_needed_modify_power",
B_CHANNEL_MODIFY_MAKE_CODEC_ENCRYPTED = "b_channel_modify_make_codec_encrypted",
B_CHANNEL_MODIFY_TEMP_DELETE_DELAY = "b_channel_modify_temp_delete_delay",
B_CHANNEL_CONVERSATION_MESSAGE_DELETE = "b_channel_conversation_message_delete",
B_CHANNEL_DELETE_PERMANENT = "b_channel_delete_permanent",
B_CHANNEL_DELETE_SEMI_PERMANENT = "b_channel_delete_semi_permanent",
B_CHANNEL_DELETE_TEMPORARY = "b_channel_delete_temporary",
B_CHANNEL_DELETE_FLAG_FORCE = "b_channel_delete_flag_force",
I_CHANNEL_DELETE_POWER = "i_channel_delete_power",
I_CHANNEL_NEEDED_DELETE_POWER = "i_channel_needed_delete_power",
B_CHANNEL_JOIN_PERMANENT = "b_channel_join_permanent",
B_CHANNEL_JOIN_SEMI_PERMANENT = "b_channel_join_semi_permanent",
B_CHANNEL_JOIN_TEMPORARY = "b_channel_join_temporary",
B_CHANNEL_JOIN_IGNORE_PASSWORD = "b_channel_join_ignore_password",
B_CHANNEL_JOIN_IGNORE_MAXCLIENTS = "b_channel_join_ignore_maxclients",
I_CHANNEL_JOIN_POWER = "i_channel_join_power",
I_CHANNEL_NEEDED_JOIN_POWER = "i_channel_needed_join_power",
B_CHANNEL_IGNORE_JOIN_POWER = "b_channel_ignore_join_power",
I_CHANNEL_VIEW_POWER = "i_channel_view_power",
I_CHANNEL_NEEDED_VIEW_POWER = "i_channel_needed_view_power",
B_CHANNEL_IGNORE_VIEW_POWER = "b_channel_ignore_view_power",
I_CHANNEL_SUBSCRIBE_POWER = "i_channel_subscribe_power",
I_CHANNEL_NEEDED_SUBSCRIBE_POWER = "i_channel_needed_subscribe_power",
B_CHANNEL_IGNORE_SUBSCRIBE_POWER = "b_channel_ignore_subscribe_power",
I_CHANNEL_DESCRIPTION_VIEW_POWER = "i_channel_description_view_power",
I_CHANNEL_NEEDED_DESCRIPTION_VIEW_POWER = "i_channel_needed_description_view_power",
B_CHANNEL_IGNORE_DESCRIPTION_VIEW_POWER = "b_channel_ignore_description_view_power",
I_ICON_ID = "i_icon_id",
I_MAX_ICON_FILESIZE = "i_max_icon_filesize",
I_MAX_PLAYLIST_SIZE = "i_max_playlist_size",
I_MAX_PLAYLISTS = "i_max_playlists",
B_ICON_MANAGE = "b_icon_manage",
B_GROUP_IS_PERMANENT = "b_group_is_permanent",
I_GROUP_AUTO_UPDATE_TYPE = "i_group_auto_update_type",
I_GROUP_AUTO_UPDATE_MAX_VALUE = "i_group_auto_update_max_value",
I_GROUP_SORT_ID = "i_group_sort_id",
I_GROUP_SHOW_NAME_IN_TREE = "i_group_show_name_in_tree",
B_VIRTUALSERVER_SERVERGROUP_LIST = "b_virtualserver_servergroup_list",
B_VIRTUALSERVER_SERVERGROUP_PERMISSION_LIST = "b_virtualserver_servergroup_permission_list",
B_VIRTUALSERVER_SERVERGROUP_CLIENT_LIST = "b_virtualserver_servergroup_client_list",
B_VIRTUALSERVER_CHANNELGROUP_LIST = "b_virtualserver_channelgroup_list",
B_VIRTUALSERVER_CHANNELGROUP_PERMISSION_LIST = "b_virtualserver_channelgroup_permission_list",
B_VIRTUALSERVER_CHANNELGROUP_CLIENT_LIST = "b_virtualserver_channelgroup_client_list",
B_VIRTUALSERVER_SERVERGROUP_CREATE = "b_virtualserver_servergroup_create",
B_VIRTUALSERVER_CHANNELGROUP_CREATE = "b_virtualserver_channelgroup_create",
I_SERVER_GROUP_MODIFY_POWER = "i_server_group_modify_power",
I_SERVER_GROUP_NEEDED_MODIFY_POWER = "i_server_group_needed_modify_power",
I_SERVER_GROUP_MEMBER_ADD_POWER = "i_server_group_member_add_power",
I_SERVER_GROUP_SELF_ADD_POWER = "i_server_group_self_add_power",
I_SERVER_GROUP_NEEDED_MEMBER_ADD_POWER = "i_server_group_needed_member_add_power",
I_SERVER_GROUP_MEMBER_REMOVE_POWER = "i_server_group_member_remove_power",
I_SERVER_GROUP_SELF_REMOVE_POWER = "i_server_group_self_remove_power",
I_SERVER_GROUP_NEEDED_MEMBER_REMOVE_POWER = "i_server_group_needed_member_remove_power",
I_CHANNEL_GROUP_MODIFY_POWER = "i_channel_group_modify_power",
I_CHANNEL_GROUP_NEEDED_MODIFY_POWER = "i_channel_group_needed_modify_power",
I_CHANNEL_GROUP_MEMBER_ADD_POWER = "i_channel_group_member_add_power",
I_CHANNEL_GROUP_SELF_ADD_POWER = "i_channel_group_self_add_power",
I_CHANNEL_GROUP_NEEDED_MEMBER_ADD_POWER = "i_channel_group_needed_member_add_power",
I_CHANNEL_GROUP_MEMBER_REMOVE_POWER = "i_channel_group_member_remove_power",
I_CHANNEL_GROUP_SELF_REMOVE_POWER = "i_channel_group_self_remove_power",
I_CHANNEL_GROUP_NEEDED_MEMBER_REMOVE_POWER = "i_channel_group_needed_member_remove_power",
I_GROUP_MEMBER_ADD_POWER = "i_group_member_add_power",
I_GROUP_NEEDED_MEMBER_ADD_POWER = "i_group_needed_member_add_power",
I_GROUP_MEMBER_REMOVE_POWER = "i_group_member_remove_power",
I_GROUP_NEEDED_MEMBER_REMOVE_POWER = "i_group_needed_member_remove_power",
I_GROUP_MODIFY_POWER = "i_group_modify_power",
I_GROUP_NEEDED_MODIFY_POWER = "i_group_needed_modify_power",
I_PERMISSION_MODIFY_POWER = "i_permission_modify_power",
B_PERMISSION_MODIFY_POWER_IGNORE = "b_permission_modify_power_ignore",
B_VIRTUALSERVER_SERVERGROUP_DELETE = "b_virtualserver_servergroup_delete",
B_VIRTUALSERVER_CHANNELGROUP_DELETE = "b_virtualserver_channelgroup_delete",
I_CLIENT_PERMISSION_MODIFY_POWER = "i_client_permission_modify_power",
I_CLIENT_NEEDED_PERMISSION_MODIFY_POWER = "i_client_needed_permission_modify_power",
I_CLIENT_MAX_CLONES_UID = "i_client_max_clones_uid",
I_CLIENT_MAX_CLONES_IP = "i_client_max_clones_ip",
I_CLIENT_MAX_CLONES_HWID = "i_client_max_clones_hwid",
I_CLIENT_MAX_IDLETIME = "i_client_max_idletime",
I_CLIENT_MAX_AVATAR_FILESIZE = "i_client_max_avatar_filesize",
I_CLIENT_MAX_CHANNEL_SUBSCRIPTIONS = "i_client_max_channel_subscriptions",
I_CLIENT_MAX_CHANNELS = "i_client_max_channels",
I_CLIENT_MAX_TEMPORARY_CHANNELS = "i_client_max_temporary_channels",
I_CLIENT_MAX_SEMI_CHANNELS = "i_client_max_semi_channels",
I_CLIENT_MAX_PERMANENT_CHANNELS = "i_client_max_permanent_channels",
B_CLIENT_USE_PRIORITY_SPEAKER = "b_client_use_priority_speaker",
B_CLIENT_IS_PRIORITY_SPEAKER = "b_client_is_priority_speaker",
B_CLIENT_SKIP_CHANNELGROUP_PERMISSIONS = "b_client_skip_channelgroup_permissions",
B_CLIENT_FORCE_PUSH_TO_TALK = "b_client_force_push_to_talk",
B_CLIENT_IGNORE_BANS = "b_client_ignore_bans",
B_CLIENT_IGNORE_VPN = "b_client_ignore_vpn",
B_CLIENT_IGNORE_ANTIFLOOD = "b_client_ignore_antiflood",
B_CLIENT_ENFORCE_VALID_HWID = "b_client_enforce_valid_hwid",
B_CLIENT_ALLOW_INVALID_PACKET = "b_client_allow_invalid_packet",
B_CLIENT_ALLOW_INVALID_BADGES = "b_client_allow_invalid_badges",
B_CLIENT_ISSUE_CLIENT_QUERY_COMMAND = "b_client_issue_client_query_command",
B_CLIENT_USE_RESERVED_SLOT = "b_client_use_reserved_slot",
B_CLIENT_USE_CHANNEL_COMMANDER = "b_client_use_channel_commander",
B_CLIENT_REQUEST_TALKER = "b_client_request_talker",
B_CLIENT_AVATAR_DELETE_OTHER = "b_client_avatar_delete_other",
B_CLIENT_IS_STICKY = "b_client_is_sticky",
B_CLIENT_IGNORE_STICKY = "b_client_ignore_sticky",
B_CLIENT_MUSIC_CREATE_PERMANENT = "b_client_music_create_permanent",
B_CLIENT_MUSIC_CREATE_SEMI_PERMANENT = "b_client_music_create_semi_permanent",
B_CLIENT_MUSIC_CREATE_TEMPORARY = "b_client_music_create_temporary",
B_CLIENT_MUSIC_MODIFY_PERMANENT = "b_client_music_modify_permanent",
B_CLIENT_MUSIC_MODIFY_SEMI_PERMANENT = "b_client_music_modify_semi_permanent",
B_CLIENT_MUSIC_MODIFY_TEMPORARY = "b_client_music_modify_temporary",
I_CLIENT_MUSIC_CREATE_MODIFY_MAX_VOLUME = "i_client_music_create_modify_max_volume",
I_CLIENT_MUSIC_LIMIT = "i_client_music_limit",
I_CLIENT_MUSIC_NEEDED_DELETE_POWER = "i_client_music_needed_delete_power",
I_CLIENT_MUSIC_DELETE_POWER = "i_client_music_delete_power",
I_CLIENT_MUSIC_PLAY_POWER = "i_client_music_play_power",
I_CLIENT_MUSIC_NEEDED_PLAY_POWER = "i_client_music_needed_play_power",
I_CLIENT_MUSIC_MODIFY_POWER = "i_client_music_modify_power",
I_CLIENT_MUSIC_NEEDED_MODIFY_POWER = "i_client_music_needed_modify_power",
I_CLIENT_MUSIC_RENAME_POWER = "i_client_music_rename_power",
I_CLIENT_MUSIC_NEEDED_RENAME_POWER = "i_client_music_needed_rename_power",
B_VIRTUALSERVER_PLAYLIST_PERMISSION_LIST = "b_virtualserver_playlist_permission_list",
B_PLAYLIST_CREATE = "b_playlist_create",
I_PLAYLIST_VIEW_POWER = "i_playlist_view_power",
I_PLAYLIST_NEEDED_VIEW_POWER = "i_playlist_needed_view_power",
I_PLAYLIST_MODIFY_POWER = "i_playlist_modify_power",
I_PLAYLIST_NEEDED_MODIFY_POWER = "i_playlist_needed_modify_power",
I_PLAYLIST_PERMISSION_MODIFY_POWER = "i_playlist_permission_modify_power",
I_PLAYLIST_NEEDED_PERMISSION_MODIFY_POWER = "i_playlist_needed_permission_modify_power",
I_PLAYLIST_DELETE_POWER = "i_playlist_delete_power",
I_PLAYLIST_NEEDED_DELETE_POWER = "i_playlist_needed_delete_power",
I_PLAYLIST_SONG_ADD_POWER = "i_playlist_song_add_power",
I_PLAYLIST_SONG_NEEDED_ADD_POWER = "i_playlist_song_needed_add_power",
I_PLAYLIST_SONG_REMOVE_POWER = "i_playlist_song_remove_power",
I_PLAYLIST_SONG_NEEDED_REMOVE_POWER = "i_playlist_song_needed_remove_power",
I_PLAYLIST_SONG_MOVE_POWER = "i_playlist_song_move_power",
I_PLAYLIST_SONG_NEEDED_MOVE_POWER = "i_playlist_song_needed_move_power",
B_CLIENT_INFO_VIEW = "b_client_info_view",
B_CLIENT_PERMISSIONOVERVIEW_VIEW = "b_client_permissionoverview_view",
B_CLIENT_PERMISSIONOVERVIEW_OWN = "b_client_permissionoverview_own",
B_CLIENT_REMOTEADDRESS_VIEW = "b_client_remoteaddress_view",
I_CLIENT_SERVERQUERY_VIEW_POWER = "i_client_serverquery_view_power",
I_CLIENT_NEEDED_SERVERQUERY_VIEW_POWER = "i_client_needed_serverquery_view_power",
B_CLIENT_CUSTOM_INFO_VIEW = "b_client_custom_info_view",
B_CLIENT_MUSIC_CHANNEL_LIST = "b_client_music_channel_list",
B_CLIENT_MUSIC_SERVER_LIST = "b_client_music_server_list",
I_CLIENT_MUSIC_INFO = "i_client_music_info",
I_CLIENT_MUSIC_NEEDED_INFO = "i_client_music_needed_info",
B_VIRTUALSERVER_CHANNELCLIENT_PERMISSION_LIST = "b_virtualserver_channelclient_permission_list",
B_VIRTUALSERVER_CLIENT_PERMISSION_LIST = "b_virtualserver_client_permission_list",
I_CLIENT_KICK_FROM_SERVER_POWER = "i_client_kick_from_server_power",
I_CLIENT_NEEDED_KICK_FROM_SERVER_POWER = "i_client_needed_kick_from_server_power",
I_CLIENT_KICK_FROM_CHANNEL_POWER = "i_client_kick_from_channel_power",
I_CLIENT_NEEDED_KICK_FROM_CHANNEL_POWER = "i_client_needed_kick_from_channel_power",
I_CLIENT_BAN_POWER = "i_client_ban_power",
I_CLIENT_NEEDED_BAN_POWER = "i_client_needed_ban_power",
I_CLIENT_MOVE_POWER = "i_client_move_power",
I_CLIENT_NEEDED_MOVE_POWER = "i_client_needed_move_power",
I_CLIENT_COMPLAIN_POWER = "i_client_complain_power",
I_CLIENT_NEEDED_COMPLAIN_POWER = "i_client_needed_complain_power",
B_CLIENT_COMPLAIN_LIST = "b_client_complain_list",
B_CLIENT_COMPLAIN_DELETE_OWN = "b_client_complain_delete_own",
B_CLIENT_COMPLAIN_DELETE = "b_client_complain_delete",
B_CLIENT_BAN_LIST = "b_client_ban_list",
B_CLIENT_BAN_LIST_GLOBAL = "b_client_ban_list_global",
B_CLIENT_BAN_TRIGGER_LIST = "b_client_ban_trigger_list",
B_CLIENT_BAN_CREATE = "b_client_ban_create",
B_CLIENT_BAN_CREATE_GLOBAL = "b_client_ban_create_global",
B_CLIENT_BAN_NAME = "b_client_ban_name",
B_CLIENT_BAN_IP = "b_client_ban_ip",
B_CLIENT_BAN_HWID = "b_client_ban_hwid",
B_CLIENT_BAN_EDIT = "b_client_ban_edit",
B_CLIENT_BAN_EDIT_GLOBAL = "b_client_ban_edit_global",
B_CLIENT_BAN_DELETE_OWN = "b_client_ban_delete_own",
B_CLIENT_BAN_DELETE = "b_client_ban_delete",
B_CLIENT_BAN_DELETE_OWN_GLOBAL = "b_client_ban_delete_own_global",
B_CLIENT_BAN_DELETE_GLOBAL = "b_client_ban_delete_global",
I_CLIENT_BAN_MAX_BANTIME = "i_client_ban_max_bantime",
I_CLIENT_PRIVATE_TEXTMESSAGE_POWER = "i_client_private_textmessage_power",
I_CLIENT_NEEDED_PRIVATE_TEXTMESSAGE_POWER = "i_client_needed_private_textmessage_power",
B_CLIENT_EVEN_TEXTMESSAGE_SEND = "b_client_even_textmessage_send",
B_CLIENT_SERVER_TEXTMESSAGE_SEND = "b_client_server_textmessage_send",
B_CLIENT_CHANNEL_TEXTMESSAGE_SEND = "b_client_channel_textmessage_send",
B_CLIENT_OFFLINE_TEXTMESSAGE_SEND = "b_client_offline_textmessage_send",
I_CLIENT_TALK_POWER = "i_client_talk_power",
I_CLIENT_NEEDED_TALK_POWER = "i_client_needed_talk_power",
I_CLIENT_POKE_POWER = "i_client_poke_power",
I_CLIENT_NEEDED_POKE_POWER = "i_client_needed_poke_power",
I_CLIENT_POKE_MAX_CLIENTS = "i_client_poke_max_clients",
B_CLIENT_SET_FLAG_TALKER = "b_client_set_flag_talker",
I_CLIENT_WHISPER_POWER = "i_client_whisper_power",
I_CLIENT_NEEDED_WHISPER_POWER = "i_client_needed_whisper_power",
B_VIDEO_SCREEN = "b_video_screen",
B_VIDEO_CAMERA = "b_video_camera",
I_VIDEO_MAX_KBPS = "i_video_max_kbps",
I_VIDEO_MAX_STREAMS = "i_video_max_streams",
I_VIDEO_MAX_SCREEN_STREAMS = "i_video_max_screen_streams",
I_VIDEO_MAX_CAMERA_STREAMS = "i_video_max_camera_streams",
B_CLIENT_MODIFY_DESCRIPTION = "b_client_modify_description",
B_CLIENT_MODIFY_OWN_DESCRIPTION = "b_client_modify_own_description",
B_CLIENT_USE_BBCODE_ANY = "b_client_use_bbcode_any",
B_CLIENT_USE_BBCODE_URL = "b_client_use_bbcode_url",
B_CLIENT_USE_BBCODE_IMAGE = "b_client_use_bbcode_image",
B_CLIENT_MODIFY_DBPROPERTIES = "b_client_modify_dbproperties",
B_CLIENT_DELETE_DBPROPERTIES = "b_client_delete_dbproperties",
B_CLIENT_CREATE_MODIFY_SERVERQUERY_LOGIN = "b_client_create_modify_serverquery_login",
B_CLIENT_QUERY_CREATE = "b_client_query_create",
B_CLIENT_QUERY_CREATE_OWN = "b_client_query_create_own",
B_CLIENT_QUERY_LIST = "b_client_query_list",
B_CLIENT_QUERY_LIST_OWN = "b_client_query_list_own",
B_CLIENT_QUERY_RENAME = "b_client_query_rename",
B_CLIENT_QUERY_RENAME_OWN = "b_client_query_rename_own",
B_CLIENT_QUERY_CHANGE_PASSWORD = "b_client_query_change_password",
B_CLIENT_QUERY_CHANGE_OWN_PASSWORD = "b_client_query_change_own_password",
B_CLIENT_QUERY_CHANGE_PASSWORD_GLOBAL = "b_client_query_change_password_global",
B_CLIENT_QUERY_DELETE = "b_client_query_delete",
B_CLIENT_QUERY_DELETE_OWN = "b_client_query_delete_own",
B_FT_IGNORE_PASSWORD = "b_ft_ignore_password",
B_FT_TRANSFER_LIST = "b_ft_transfer_list",
I_FT_FILE_UPLOAD_POWER = "i_ft_file_upload_power",
I_FT_NEEDED_FILE_UPLOAD_POWER = "i_ft_needed_file_upload_power",
I_FT_FILE_DOWNLOAD_POWER = "i_ft_file_download_power",
I_FT_NEEDED_FILE_DOWNLOAD_POWER = "i_ft_needed_file_download_power",
I_FT_FILE_DELETE_POWER = "i_ft_file_delete_power",
I_FT_NEEDED_FILE_DELETE_POWER = "i_ft_needed_file_delete_power",
I_FT_FILE_RENAME_POWER = "i_ft_file_rename_power",
I_FT_NEEDED_FILE_RENAME_POWER = "i_ft_needed_file_rename_power",
I_FT_FILE_BROWSE_POWER = "i_ft_file_browse_power",
I_FT_NEEDED_FILE_BROWSE_POWER = "i_ft_needed_file_browse_power",
I_FT_DIRECTORY_CREATE_POWER = "i_ft_directory_create_power",
I_FT_NEEDED_DIRECTORY_CREATE_POWER = "i_ft_needed_directory_create_power",
I_FT_QUOTA_MB_DOWNLOAD_PER_CLIENT = "i_ft_quota_mb_download_per_client",
I_FT_QUOTA_MB_UPLOAD_PER_CLIENT = "i_ft_quota_mb_upload_per_client",
I_FT_MAX_BANDWIDTH_DOWNLOAD = "i_ft_max_bandwidth_download",
I_FT_MAX_BANDWIDTH_UPLOAD = "i_ft_max_bandwidth_upload"
}
export default PermissionType;

View File

@ -0,0 +1,31 @@
import { IdentitifyType, Identity } from "../profiles/Identity";
import { AbstractServerConnection } from "../connection/ConnectionBase";
import { HandshakeIdentityHandler } from "../connection/HandshakeHandler";
export declare class ConnectionProfile {
id: string;
profileName: string;
defaultUsername: string;
defaultPassword: string;
selectedIdentityType: string;
identities: {
[key: string]: Identity;
};
constructor(id: string);
connectUsername(): string;
selectedIdentity(current_type?: IdentitifyType): Identity;
selectedType(): IdentitifyType | undefined;
setIdentity(type: IdentitifyType, identity: Identity): void;
spawnIdentityHandshakeHandler(connection: AbstractServerConnection): HandshakeIdentityHandler | undefined;
encode(): string;
valid(): boolean;
}
export declare function createConnectProfile(name: string, id?: string): ConnectionProfile;
export declare function save(): void;
export declare function mark_need_save(): void;
export declare function requires_save(): boolean;
export declare function availableConnectProfiles(): ConnectionProfile[];
export declare function findConnectProfile(id: string): ConnectionProfile | undefined;
export declare function find_profile_by_name(name: string): ConnectionProfile | undefined;
export declare function defaultConnectProfile(): ConnectionProfile;
export declare function set_default_profile(profile: ConnectionProfile): ConnectionProfile;
export declare function delete_profile(profile: ConnectionProfile): void;

View File

@ -0,0 +1,34 @@
import { AbstractServerConnection, ServerCommand } from "../connection/ConnectionBase";
import { HandshakeIdentityHandler } from "../connection/HandshakeHandler";
import { AbstractCommandHandler } from "../connection/AbstractCommandHandler";
export declare enum IdentitifyType {
TEAFORO = 0,
TEAMSPEAK = 1,
NICKNAME = 2
}
export interface Identity {
fallback_name(): string | undefined;
uid(): string;
type(): IdentitifyType;
valid(): boolean;
encode?(): string;
decode(data: string): Promise<void>;
spawn_identity_handshake_handler(connection: AbstractServerConnection): HandshakeIdentityHandler;
}
export declare function decode_identity(type: IdentitifyType, data: string): Promise<Identity>;
export declare function create_identity(type: IdentitifyType): Identity;
export declare class HandshakeCommandHandler<T extends AbstractHandshakeIdentityHandler> extends AbstractCommandHandler {
readonly handle: T;
constructor(connection: AbstractServerConnection, handle: T);
handle_command(command: ServerCommand): boolean;
}
export declare abstract class AbstractHandshakeIdentityHandler implements HandshakeIdentityHandler {
connection: AbstractServerConnection;
protected callbacks: ((success: boolean, message?: string) => any)[];
protected constructor(connection: AbstractServerConnection);
registerCallback(callback: (success: boolean, message?: string) => any): void;
fillClientInitData(data: any): void;
abstract executeHandshake(): any;
protected trigger_success(): void;
protected trigger_fail(message: string): void;
}

View File

@ -0,0 +1,16 @@
import { IdentitifyType, Identity } from "../../profiles/Identity";
import { AbstractServerConnection } from "../../connection/ConnectionBase";
import { HandshakeIdentityHandler } from "../../connection/HandshakeHandler";
export declare class NameIdentity implements Identity {
private _name;
constructor(name?: string);
set_name(name: string): void;
name(): string;
fallback_name(): string | undefined;
uid(): string;
type(): IdentitifyType;
valid(): boolean;
decode(data: any): Promise<void>;
encode?(): string;
spawn_identity_handshake_handler(connection: AbstractServerConnection): HandshakeIdentityHandler;
}

View File

@ -0,0 +1,21 @@
import { IdentitifyType, Identity } from "../../profiles/Identity";
import { AbstractServerConnection } from "../../connection/ConnectionBase";
import { HandshakeIdentityHandler } from "../../connection/HandshakeHandler";
import * as forum from "./teaspeak-forum";
export declare class TeaForumIdentity implements Identity {
private readonly identity_data;
valid(): boolean;
constructor(data: forum.Data);
data(): forum.Data;
decode(data: any): Promise<void>;
encode(): string;
spawn_identity_handshake_handler(connection: AbstractServerConnection): HandshakeIdentityHandler;
fallback_name(): string | undefined;
type(): IdentitifyType;
uid(): string;
static identity(): TeaForumIdentity;
}
export declare function set_static_identity(identity: TeaForumIdentity): void;
export declare function update_forum(): void;
export declare function valid_static_forum_identity(): boolean;
export declare function static_forum_identity(): TeaForumIdentity | undefined;

View File

@ -0,0 +1,67 @@
import { AbstractHandshakeIdentityHandler, HandshakeCommandHandler, IdentitifyType, Identity } from "../../profiles/Identity";
import { AbstractServerConnection } from "../../connection/ConnectionBase";
import { HandshakeIdentityHandler } from "../../connection/HandshakeHandler";
export declare namespace CryptoHelper {
function base64UrlEncode(str: any): any;
function base64UrlDecode(str: string, pad?: boolean): string;
function arraybufferToString(buf: any): string;
function export_ecc_key(crypto_key: CryptoKey, public_key: boolean): Promise<string>;
function decryptTeaSpeakIdentity(buffer: Uint8Array): Promise<string>;
function encryptTeaSpeakIdentity(buffer: Uint8Array): Promise<string>;
/**
* @param buffer base64 encoded ASN.1 string
*/
function decodeTomCryptKey(buffer: string): {
crv: string;
d: any;
x: any;
y: any;
ext: boolean;
key_ops: string[];
kty: string;
};
}
export declare class TeaSpeakHandshakeHandler extends AbstractHandshakeIdentityHandler {
identity: TeaSpeakIdentity;
handler: HandshakeCommandHandler<TeaSpeakHandshakeHandler>;
constructor(connection: AbstractServerConnection, identity: TeaSpeakIdentity);
executeHandshake(): void;
private handle_proof;
protected trigger_fail(message: string): void;
protected trigger_success(): void;
fillClientInitData(data: any): void;
}
export declare class TeaSpeakIdentity implements Identity {
static generateNew(): Promise<TeaSpeakIdentity>;
static import_ts(ts_string: string, ini?: boolean): Promise<TeaSpeakIdentity>;
hash_number: string;
private_key: string;
_name: string;
publicKey: string;
private _initialized;
private _crypto_key;
private _crypto_key_sign;
private _unique_id;
constructor(private_key?: string, hash?: string, name?: string, initialize?: boolean);
fallback_name(): string | undefined;
uid(): string;
type(): IdentitifyType;
valid(): boolean;
decode(data: string): Promise<void>;
encode?(): string;
level(): Promise<number>;
private static calculateLevel;
/**
* @param {string} a
* @param {string} b
* @description b must be smaller (in bytes) then a
*/
private static string_add;
improve_level_for(time: number, threads: number): Promise<Boolean>;
improveLevelNative(target: number, threads: number, active_callback: () => boolean, callback_level?: (current: number) => any, callback_status?: (hash_rate: number) => any): Promise<Boolean>;
improveLevelJavascript(target: number, activeCallback: () => boolean): Promise<number>;
private initialize;
export_ts(ini?: boolean): Promise<string>;
sign_message(message: string, hash?: string): Promise<string>;
spawn_identity_handshake_handler(connection: AbstractServerConnection): HandshakeIdentityHandler;
}

View File

@ -0,0 +1,59 @@
declare global {
interface Window {
grecaptcha: GReCaptcha;
}
}
interface GReCaptcha {
render(container: string | HTMLElement, parameters: {
sitekey: string;
theme?: "dark" | "light";
size?: "compact" | "normal";
tabindex?: number;
callback?: (token: string) => any;
"expired-callback"?: () => any;
"error-callback"?: (error: any) => any;
}): string;
reset(widget_id?: string): any;
}
export declare namespace gcaptcha {
function initialize(): Promise<void>;
function spawn(container: JQuery, key: string, callback_data: (token: string) => any): Promise<void>;
}
export declare class Data {
readonly auth_key: string;
readonly raw: string;
readonly sign: string;
parsed: {
user_id: number;
user_name: string;
data_age: number;
user_group_id: number;
is_staff: boolean;
user_groups: number[];
};
constructor(auth: string, raw: string, sign: string);
data_json(): string;
data_sign(): string;
name(): string;
user_id(): number;
user_group(): number;
is_stuff(): boolean;
is_premium(): boolean;
data_age(): Date;
is_expired(): boolean;
should_renew(): boolean;
}
export declare function logged_in(): boolean;
export declare function data(): Data;
export interface LoginResult {
status: "success" | "captcha" | "error";
error_message?: string;
captcha?: {
type: "gre-captcha" | "unknown";
data: any;
};
}
export declare function login(username: string, password: string, captcha?: any): Promise<LoginResult>;
export declare function renew_data(): Promise<"success" | "login-required">;
export declare function logout(): Promise<void>;
export {};

51
imports/shared-app/proto.d.ts vendored Normal file
View File

@ -0,0 +1,51 @@
/// <reference types="node" />
import "jsrender";
declare global {
function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
interface Array<T> {
remove(elem?: T): boolean;
last?(): T;
pop_front(): T | undefined;
toggle(entry: T): boolean;
}
interface JSON {
map_to<T>(object: T, json: any, variables?: string | string[], validator?: (map_field: string, map_value: string) => boolean, variable_direction?: number): number;
map_field_to<T>(object: T, value: any, field: string): boolean;
}
type JQueryScrollType = "height" | "width";
interface JQuery<TElement = HTMLElement> {
renderTag(values?: any): JQuery<TElement>;
hasScrollBar(direction?: JQueryScrollType): boolean;
visible_height(): number;
visible_width(): number;
firstParent(selector: string): JQuery;
}
interface JQueryStatic<TElement extends Node = HTMLElement> {
spawn<K extends keyof HTMLElementTagNameMap>(tagName: K): JQuery<HTMLElementTagNameMap[K]>;
}
interface Window {
__REACT_DEVTOOLS_GLOBAL_HOOK__: any;
readonly webkitAudioContext: typeof AudioContext;
readonly AudioContext: typeof OfflineAudioContext;
readonly OfflineAudioContext: typeof OfflineAudioContext;
readonly webkitOfflineAudioContext: typeof OfflineAudioContext;
readonly RTCPeerConnection: typeof RTCPeerConnection;
readonly Pointer_stringify: any;
readonly require: typeof require;
}
const __non_webpack_require__: typeof require;
interface Navigator {
browserSpecs: {
name: string;
version: string;
};
mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
}
interface ObjectConstructor {
isSimilar(a: any, b: any): boolean;
}
}
declare const _default: {};
export = _default;

184
imports/shared-app/settings.d.ts vendored Normal file
View File

@ -0,0 +1,184 @@
import { Registry } from "./events";
export declare type RegistryValueType = boolean | number | string | object;
export declare type RegistryValueTypeNames = "boolean" | "number" | "string" | "object";
export declare type RegistryValueTypeMapping<T> = T extends boolean ? "boolean" : T extends number ? "number" : T extends string ? "string" : T extends object ? "object" : never;
export interface RegistryKey<ValueType extends RegistryValueType> {
key: string;
valueType: RegistryValueTypeMapping<ValueType>;
fallbackKeys?: string | string[];
fallbackImports?: {
[key: string]: (value: string) => ValueType;
};
description?: string;
requireRestart?: boolean;
}
export interface ValuedRegistryKey<ValueType extends RegistryValueType> extends RegistryKey<ValueType> {
defaultValue: ValueType;
}
export declare class UrlParameterParser {
private readonly url;
constructor(url: URL);
private getParameter;
getValue<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV): V | DV;
getValue<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V): V;
}
export declare class UrlParameterBuilder {
private parameters;
setValue<V extends RegistryValueType>(key: RegistryKey<V>, value: V): void;
build(): string;
}
/**
* Switched appended to the application via the URL.
* TODO: Passing native client switches
*/
export declare namespace AppParameters {
const Instance: UrlParameterParser;
function getValue<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV): V | DV;
function getValue<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V): V;
}
export declare namespace AppParameters {
const KEY_CONNECT_ADDRESS: RegistryKey<string>;
const KEY_CONNECT_INVITE_REFERENCE: RegistryKey<string>;
const KEY_CONNECT_NO_SINGLE_INSTANCE: ValuedRegistryKey<boolean>;
const KEY_CONNECT_TYPE: ValuedRegistryKey<number>;
const KEY_CONNECT_NICKNAME: RegistryKey<string>;
const KEY_CONNECT_TOKEN: RegistryKey<string>;
const KEY_CONNECT_PROFILE: RegistryKey<string>;
const KEY_CONNECT_SERVER_PASSWORD: RegistryKey<string>;
const KEY_CONNECT_PASSWORDS_HASHED: ValuedRegistryKey<boolean>;
const KEY_CONNECT_CHANNEL: RegistryKey<string>;
const KEY_CONNECT_CHANNEL_PASSWORD: RegistryKey<string>;
const KEY_IPC_APP_ADDRESS: RegistryKey<string>;
const KEY_IPC_CORE_PEER_ADDRESS: RegistryKey<string>;
const KEY_MODAL_IDENTITY_CODE: RegistryKey<string>;
const KEY_MODAL_TARGET: RegistryKey<string>;
const KEY_LOAD_DUMMY_ERROR: ValuedRegistryKey<boolean>;
}
export declare class StaticSettings {
private static _instance;
static get instance(): StaticSettings;
protected staticValues: {};
protected constructor(_reserved?: any);
static<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV): V | DV;
static<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V): V;
}
export interface SettingsEvents {
notify_setting_changed: {
setting: string;
mode: "global" | "server";
oldValue: string;
newValue: string;
newCastedValue: any;
};
}
export declare class Settings {
static readonly KEY_USER_IS_NEW: ValuedRegistryKey<boolean>;
static readonly KEY_LOG_LEVEL: RegistryKey<number>;
static readonly KEY_DISABLE_COSMETIC_SLOWDOWN: ValuedRegistryKey<boolean>;
static readonly KEY_DISABLE_CONTEXT_MENU: ValuedRegistryKey<boolean>;
static readonly KEY_DISABLE_GLOBAL_CONTEXT_MENU: ValuedRegistryKey<boolean>;
static readonly KEY_DISABLE_UNLOAD_DIALOG: ValuedRegistryKey<boolean>;
static readonly KEY_DISABLE_VOICE: ValuedRegistryKey<boolean>;
static readonly KEY_DISABLE_MULTI_SESSION: ValuedRegistryKey<boolean>;
static readonly KEY_I18N_DEFAULT_REPOSITORY: ValuedRegistryKey<string>;
static readonly KEY_CLIENT_STATE_MICROPHONE_MUTED: ValuedRegistryKey<boolean>;
static readonly KEY_CLIENT_STATE_SPEAKER_MUTED: ValuedRegistryKey<boolean>;
static readonly KEY_CLIENT_STATE_QUERY_SHOWN: ValuedRegistryKey<boolean>;
static readonly KEY_CLIENT_STATE_SUBSCRIBE_ALL_CHANNELS: ValuedRegistryKey<boolean>;
static readonly KEY_CLIENT_STATE_AWAY: ValuedRegistryKey<boolean>;
static readonly KEY_CLIENT_AWAY_MESSAGE: ValuedRegistryKey<string>;
static readonly KEY_FLAG_CONNECT_DEFAULT: ValuedRegistryKey<boolean>;
static readonly KEY_CONNECT_ADDRESS: ValuedRegistryKey<string>;
static readonly KEY_CONNECT_PROFILE: ValuedRegistryKey<string>;
static readonly KEY_CONNECT_USERNAME: ValuedRegistryKey<string>;
static readonly KEY_CONNECT_PASSWORD: ValuedRegistryKey<string>;
static readonly KEY_FLAG_CONNECT_PASSWORD: ValuedRegistryKey<boolean>;
static readonly KEY_CONNECT_HISTORY: ValuedRegistryKey<string>;
static readonly KEY_CONNECT_SHOW_HISTORY: ValuedRegistryKey<boolean>;
static readonly KEY_CONNECT_NO_DNSPROXY: ValuedRegistryKey<boolean>;
static readonly KEY_CERTIFICATE_CALLBACK: ValuedRegistryKey<string>;
static readonly KEY_SOUND_MASTER: ValuedRegistryKey<number>;
static readonly KEY_SOUND_MASTER_SOUNDS: ValuedRegistryKey<number>;
static readonly KEY_SOUND_VOLUMES: RegistryKey<string>;
static readonly KEY_CHAT_FIXED_TIMESTAMPS: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_COLLOQUIAL_TIMESTAMPS: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_COLORED_EMOJIES: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_HIGHLIGHT_CODE: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_TAG_URLS: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_ENABLE_MARKDOWN: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_ENABLE_BBCODE: ValuedRegistryKey<boolean>;
static readonly KEY_CHAT_IMAGE_WHITELIST_REGEX: ValuedRegistryKey<string>;
static readonly KEY_CHAT_LAST_USED_EMOJI: ValuedRegistryKey<string>;
static readonly KEY_SWITCH_INSTANT_CHAT: ValuedRegistryKey<boolean>;
static readonly KEY_SWITCH_INSTANT_CLIENT: ValuedRegistryKey<boolean>;
static readonly KEY_HOSTBANNER_BACKGROUND: ValuedRegistryKey<boolean>;
static readonly KEY_CHANNEL_EDIT_ADVANCED: ValuedRegistryKey<boolean>;
static readonly KEY_PERMISSIONS_SHOW_ALL: ValuedRegistryKey<boolean>;
static readonly KEY_TEAFORO_URL: ValuedRegistryKey<string>;
static readonly KEY_FONT_SIZE: ValuedRegistryKey<number>;
static readonly KEY_ICON_SIZE: ValuedRegistryKey<number>;
static readonly KEY_KEYCONTROL_DATA: ValuedRegistryKey<string>;
static readonly KEY_LAST_INVITE_LINK_TYPE: ValuedRegistryKey<string>;
static readonly KEY_TRANSFERS_SHOW_FINISHED: ValuedRegistryKey<boolean>;
static readonly KEY_TRANSFER_DOWNLOAD_FOLDER: RegistryKey<string>;
static readonly KEY_IPC_REMOTE_ADDRESS: RegistryKey<string>;
static readonly KEY_W2G_SIDEBAR_COLLAPSED: ValuedRegistryKey<boolean>;
static readonly KEY_VOICE_ECHO_TEST_ENABLED: ValuedRegistryKey<boolean>;
static readonly KEY_RTC_EXTRA_VIDEO_CHANNELS: ValuedRegistryKey<number>;
static readonly KEY_RTC_EXTRA_AUDIO_CHANNELS: ValuedRegistryKey<number>;
static readonly KEY_RNNOISE_FILTER: ValuedRegistryKey<boolean>;
static readonly KEY_LOADER_ANIMATION_ABORT: ValuedRegistryKey<boolean>;
static readonly KEY_STOP_VIDEO_ON_SWITCH: ValuedRegistryKey<boolean>;
static readonly KEY_VIDEO_SHOW_ALL_CLIENTS: ValuedRegistryKey<boolean>;
static readonly KEY_VIDEO_FORCE_SHOW_OWN_VIDEO: ValuedRegistryKey<boolean>;
static readonly KEY_VIDEO_AUTO_SUBSCRIBE_MODE: ValuedRegistryKey<number>;
static readonly KEY_VIDEO_DEFAULT_MAX_WIDTH: ValuedRegistryKey<number>;
static readonly KEY_VIDEO_DEFAULT_MAX_HEIGHT: ValuedRegistryKey<number>;
static readonly KEY_VIDEO_DEFAULT_MAX_BANDWIDTH: ValuedRegistryKey<number>;
static readonly KEY_VIDEO_DEFAULT_KEYFRAME_INTERVAL: ValuedRegistryKey<number>;
static readonly KEY_VIDEO_DYNAMIC_QUALITY: ValuedRegistryKey<boolean>;
static readonly KEY_VIDEO_DYNAMIC_FRAME_RATE: ValuedRegistryKey<boolean>;
static readonly KEY_VIDEO_QUICK_SETUP: ValuedRegistryKey<boolean>;
static readonly KEY_INVITE_SHORT_URL: ValuedRegistryKey<boolean>;
static readonly KEY_INVITE_ADVANCED_ENABLED: ValuedRegistryKey<boolean>;
static readonly FN_LOG_ENABLED: (category: string) => RegistryKey<boolean>;
static readonly FN_SEPARATOR_STATE: (separator: string) => RegistryKey<string>;
static readonly FN_LOG_LEVEL_ENABLED: (category: string) => RegistryKey<boolean>;
static readonly FN_INVITE_LINK_SETTING: (name: string) => RegistryKey<string>;
static readonly FN_SERVER_CHANNEL_SUBSCRIBE_MODE: (channel_id: number) => RegistryKey<number>;
static readonly FN_SERVER_CHANNEL_COLLAPSED: (channel_id: number) => ValuedRegistryKey<boolean>;
static readonly FN_PROFILE_RECORD: (name: string) => RegistryKey<object>;
static readonly FN_CHANNEL_CHAT_READ: (id: number) => RegistryKey<number>;
static readonly FN_CLIENT_MUTED: (clientUniqueId: string) => RegistryKey<boolean>;
static readonly FN_CLIENT_VOLUME: (clientUniqueId: string) => RegistryKey<number>;
static readonly FN_EVENTS_NOTIFICATION_ENABLED: (event: string) => RegistryKey<boolean>;
static readonly FN_EVENTS_LOG_ENABLED: (event: string) => RegistryKey<boolean>;
static readonly FN_EVENTS_FOCUS_ENABLED: (event: string) => RegistryKey<boolean>;
static readonly KEYS: any[];
static initialize(): void;
readonly events: Registry<SettingsEvents>;
private readonly cacheGlobal;
private saveWorker;
private updated;
constructor();
getValue<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV): V | DV;
getValue<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V): V;
setValue<T extends RegistryValueType>(key: RegistryKey<T>, value?: T): void;
globalChangeListener<T extends RegistryValueType>(key: RegistryKey<T>, listener: (newValue: T) => void): () => void;
save(): void;
}
export declare class ServerSettings {
private cacheServer;
private serverUniqueId;
private serverSaveWorker;
private serverSettingsUpdated;
private _destroyed;
constructor();
destroy(): void;
getValue<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV): V | DV;
getValue<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V): V;
setValue<T extends RegistryValueType>(key: RegistryKey<T>, value?: T): void;
setServer(server_unique_id: string): void;
save(): void;
}
export declare let settings: Settings;

82
imports/shared-app/sound/Sounds.d.ts vendored Normal file
View File

@ -0,0 +1,82 @@
import { ConnectionHandler } from "../ConnectionHandler";
export declare enum Sound {
SOUND_TEST = "sound.test",
SOUND_EGG = "sound.egg",
AWAY_ACTIVATED = "away_activated",
AWAY_DEACTIVATED = "away_deactivated",
MICROPHONE_MUTED = "microphone.muted",
MICROPHONE_ACTIVATED = "microphone.activated",
SOUND_MUTED = "sound.muted",
SOUND_ACTIVATED = "sound.activated",
CONNECTION_CONNECTED = "connection.connected",
CONNECTION_DISCONNECTED = "connection.disconnected",
CONNECTION_BANNED = "connection.banned",
CONNECTION_DISCONNECTED_TIMEOUT = "connection.disconnected.timeout",
CONNECTION_REFUSED = "connection.refused",
SERVER_EDITED = "server.edited",
SERVER_EDITED_SELF = "server.edited.self",
SERVER_KICKED = "server.kicked",
CHANNEL_CREATED = "channel.created",
CHANNEL_MOVED = "channel.moved",
CHANNEL_EDITED = "channel.edited",
CHANNEL_EDITED_SELF = "channel.edited.self",
CHANNEL_DELETED = "channel.deleted",
CHANNEL_JOINED = "channel.joined",
CHANNEL_KICKED = "channel.kicked",
USER_MOVED = "user.moved",
USER_MOVED_SELF = "user.moved.self",
USER_POKED_SELF = "user.poked.self",
USER_BANNED = "user.banned",
USER_ENTERED = "user.joined",
USER_ENTERED_MOVED = "user.joined.moved",
USER_ENTERED_KICKED = "user.joined.kicked",
USER_ENTERED_CONNECT = "user.joined.connect",
USER_LEFT = "user.left",
USER_LEFT_MOVED = "user.left.moved",
USER_LEFT_KICKED_CHANNEL = "user.left.kicked.server",
USER_LEFT_KICKED_SERVER = "user.left.kicked.channel",
USER_LEFT_DISCONNECT = "user.left.disconnect",
USER_LEFT_BANNED = "user.left.banned",
USER_LEFT_TIMEOUT = "user.left.timeout",
ERROR_INSUFFICIENT_PERMISSIONS = "error.insufficient_permissions",
MESSAGE_SEND = "message.send",
MESSAGE_RECEIVED = "message.received",
GROUP_SERVER_ASSIGNED = "group.server.assigned",
GROUP_SERVER_REVOKED = "group.server.revoked",
GROUP_CHANNEL_CHANGED = "group.channel.changed",
GROUP_SERVER_ASSIGNED_SELF = "group.server.assigned.self",
GROUP_SERVER_REVOKED_SELF = "group.server.revoked.self",
GROUP_CHANNEL_CHANGED_SELF = "group.channel.changed.self"
}
export interface SoundHandle {
key: string;
filename: string;
}
export interface SoundFile {
path: string;
volume?: number;
}
export declare function get_sound_volume(sound: Sound, default_volume?: number): number;
export declare function set_sound_volume(sound: Sound, volume: number): void;
export declare function get_master_volume(): number;
export declare function set_master_volume(volume: number): void;
export declare function overlap_activated(): boolean;
export declare function set_overlap_activated(flag: boolean): void;
export declare function ignore_output_muted(): boolean;
export declare function set_ignore_output_muted(flag: boolean): void;
export declare function save(): void;
export declare function initialize(): Promise<void>;
export interface PlaybackOptions {
ignore_muted?: boolean;
ignore_overlap?: boolean;
default_volume?: number;
callback?: (flag: boolean) => any;
}
export declare function resolve_sound(sound: Sound): Promise<SoundHandle>;
export declare let manager: SoundManager;
export declare class SoundManager {
private readonly _handle;
private _playing_sounds;
constructor(handle: ConnectionHandler);
play(_sound: Sound, options?: PlaybackOptions): void;
}

14
imports/shared-app/text/bbcode.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
/// <reference types="react" />
import "./bbcode.scss";
export declare const escapeBBCode: (text: string) => string;
export declare const allowedBBCodes: string[];
export interface BBCodeRenderOptions {
convertSingleUrls: boolean;
}
export declare const BBCodeRenderer: (props: {
message: string;
settings: BBCodeRenderOptions;
handlerId?: string;
}) => JSX.Element;
export declare function renderBBCodeAsJQuery(message: string, settings: BBCodeRenderOptions): JQuery[];
export declare function renderBBCodeAsText(message: string): string;

View File

@ -0,0 +1 @@
export declare function getTwenmojiHashFromNativeEmoji(emoji: string): string;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,18 @@
export declare type IpcInviteInfoLoaded = {
linkId: string;
serverAddress: string;
serverUniqueId: string;
serverName: string;
connectParameters: string;
channelId?: number;
channelName?: string;
expireTimestamp: number | 0;
};
export declare type IpcInviteInfo = ({
status: "success";
} & IpcInviteInfoLoaded) | {
status: "error";
message: string;
} | {
status: "not-found" | "expired";
};

View File

@ -0,0 +1,6 @@
/// <reference types="react" />
export declare function isInviteLink(url: string): boolean;
export declare const InviteLinkRenderer: (props: {
url: string;
handlerId: string;
}) => JSX.Element;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
import '!style-loader!css-loader!highlight.js/styles/darcula.css';

View File

@ -0,0 +1,2 @@
export declare const regexImage: RegExp;
export declare function fixupJQueryImageTags(container: JQuery): void;

View File

@ -0,0 +1,13 @@
import { Context } from "react";
import TextRenderer from "vendor/xbbcode/renderer/text";
import ReactRenderer from "vendor/xbbcode/renderer/react";
import HTMLRenderer from "vendor/xbbcode/renderer/html";
import "./emoji";
import "./highlight";
import "./youtube";
import "./url";
import "./image";
export declare let BBCodeHandlerContext: Context<string>;
export declare const rendererText: TextRenderer;
export declare const rendererReact: ReactRenderer;
export declare const rendererHTML: HTMLRenderer;

View File

@ -0,0 +1,6 @@
/// <reference types="react" />
export declare const SimpleUrlRenderer: (props: {
target: string;
children: any;
}) => JSX.Element;
export declare function fixupJQueryUrlTags(container: JQuery): void;

View File

@ -0,0 +1,6 @@
import * as React from "react";
export declare const isYoutubeLink: (text: string) => boolean;
export declare const YoutubeRenderer: (props: {
children?: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)> | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>[];
url: string;
}) => JSX.Element;

1
imports/shared-app/text/chat.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare function preprocessChatMessageForSend(message: string): string;

11
imports/shared-app/text/markdown.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { Env, Options, Token } from "remarkable/lib";
export declare class MD2BBCodeRenderer {
private static renderers;
private _options;
currentLineCount: number;
reset(): void;
render(tokens: Token[], options: Options, env: Env): string;
private renderToken;
options(): any;
}
export declare function renderMarkdownAsBBCode(message: string, textProcessor: (text: string) => string): string;

152
imports/shared-app/tree/Channel.d.ts vendored Normal file
View File

@ -0,0 +1,152 @@
import { ChannelTree } from "./ChannelTree";
import { ClientEntry } from "./Client";
import { PermissionType } from "../permission/PermissionType";
import { Registry } from "../events";
import { ChannelTreeEntry, ChannelTreeEntryEvents } from "./ChannelTreeEntry";
import { ClientIcon } from "svg-sprites/client-icons";
import { EventChannelData } from "tc-shared/connectionlog/Definitions";
export declare enum ChannelType {
PERMANENT = 0,
SEMI_PERMANENT = 1,
TEMPORARY = 2
}
export declare namespace ChannelType {
function normalize(mode: ChannelType): string;
}
export declare enum ChannelSubscribeMode {
SUBSCRIBED = 0,
UNSUBSCRIBED = 1,
INHERITED = 2
}
export declare enum ChannelConversationMode {
Public = 0,
Private = 1,
None = 2
}
export declare enum ChannelSidebarMode {
Conversation = 0,
Description = 1,
FileTransfer = 2,
Unknown = 255
}
export declare class ChannelProperties {
channel_order: number;
channel_name: string;
channel_name_phonetic: string;
channel_topic: string;
channel_password: string;
channel_codec: number;
channel_codec_quality: number;
channel_codec_is_unencrypted: boolean;
channel_maxclients: number;
channel_maxfamilyclients: number;
channel_needed_talk_power: number;
channel_flag_permanent: boolean;
channel_flag_semi_permanent: boolean;
channel_flag_default: boolean;
channel_flag_password: boolean;
channel_flag_maxclients_unlimited: boolean;
channel_flag_maxfamilyclients_inherited: boolean;
channel_flag_maxfamilyclients_unlimited: boolean;
channel_icon_id: number;
channel_delete_delay: number;
channel_description: string;
channel_conversation_mode: ChannelConversationMode;
channel_conversation_history_length: number;
channel_sidebar_mode: ChannelSidebarMode;
}
export interface ChannelEvents extends ChannelTreeEntryEvents {
notify_properties_updated: {
updated_properties: {
[Key in keyof ChannelProperties]: ChannelProperties[Key];
};
channel_properties: ChannelProperties;
};
notify_cached_password_updated: {
reason: "channel-password-changed" | "password-miss-match" | "password-entered";
new_hash?: string;
};
notify_subscribe_state_changed: {
channel_subscribed: boolean;
};
notify_collapsed_state_changed: {
collapsed: boolean;
};
notify_description_changed: {};
}
export declare type ChannelNameAlignment = "center" | "right" | "left" | "normal" | "repetitive";
export declare class ChannelNameParser {
readonly originalName: string;
alignment: ChannelNameAlignment;
text: string;
uniqueId: string;
constructor(name: string, hasParentChannel: boolean);
private parse;
}
export declare class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
channelTree: ChannelTree;
channelId: number;
parent?: ChannelEntry;
properties: ChannelProperties;
channel_previous?: ChannelEntry;
channel_next?: ChannelEntry;
child_channel_head?: ChannelEntry;
readonly events: Registry<ChannelEvents>;
parsed_channel_name: ChannelNameParser;
private _family_index;
private _destroyed;
private cachedPasswordHash;
private channelDescriptionCached;
private channelDescriptionCallback;
private channelDescriptionPromise;
private collapsed;
private subscribed;
private subscriptionMode;
private client_list;
private readonly clientPropertyChangedListener;
constructor(channelTree: ChannelTree, channelId: number, channelName: string);
destroy(): void;
channelName(): string;
channelDepth(): number;
formattedChannelName(): string;
getChannelDescription(): Promise<string>;
isDescriptionCached(): boolean;
private doGetChannelDescription;
registerClient(client: ClientEntry): void;
unregisterClient(client: ClientEntry, noEvent?: boolean): void;
private reorderClientList;
parent_channel(): ChannelEntry;
hasParent(): boolean;
getChannelId(): number;
children(deep?: boolean): ChannelEntry[];
clients(deep?: boolean): ClientEntry[];
channelClientsOrdered(): ClientEntry[];
calculate_family_index(enforce_recalculate?: boolean): number;
showContextMenu(x: number, y: number, on_close?: () => void): void;
updateVariables(...variables: {
key: string;
value: string;
}[]): void;
generate_bbcode(): string;
generate_tag(braces?: boolean): JQuery;
channelType(): ChannelType;
joinChannel(ignorePasswordFlag?: boolean): Promise<boolean>;
requestChannelPassword(ignorePermission: PermissionType): Promise<{
hash: string;
} | undefined>;
invalidateCachedPassword(): void;
setCachedHashedPassword(passwordHash: string): void;
getCachedPasswordHash(): string;
updateSubscribeMode(): Promise<void>;
subscribe(): Promise<void>;
unsubscribe(inherited_subscription_mode?: boolean): Promise<void>;
isCollapsed(): boolean;
setCollapsed(flag: boolean): void;
isSubscribed(): boolean;
setSubscribed(flag: boolean): void;
getSubscriptionMode(): ChannelSubscribeMode;
setSubscriptionMode(mode: ChannelSubscribeMode, dontSyncSubscribeMode?: boolean): void;
log_data(): EventChannelData;
getStatusIcon(): ClientIcon | undefined;
handleDescriptionChanged(): void;
}

123
imports/shared-app/tree/ChannelTree.d.ts vendored Normal file
View File

@ -0,0 +1,123 @@
import { Group } from "tc-shared/permission/GroupManager";
import { ServerAddress, ServerEntry } from "./Server";
import { ChannelEntry, ChannelProperties } from "./Channel";
import { ClientEntry } from "./Client";
import { ChannelTreeEntry } from "./ChannelTreeEntry";
import { ConnectionHandler, ViewReasonId } from "tc-shared/ConnectionHandler";
import { Registry } from "tc-shared/events";
import { ChannelTreePopoutController } from "tc-shared/ui/tree/popout/Controller";
import "./EntryTagsHandler";
import { ChannelTreeUIEvents } from "tc-shared/ui/tree/Definitions";
export interface ChannelTreeEvents {
notify_tree_reset: {};
notify_query_view_state_changed: {
queries_shown: boolean;
};
notify_popout_state_changed: {
popoutShown: boolean;
};
notify_entry_move_begin: {};
notify_entry_move_end: {};
notify_channel_created: {
channel: ChannelEntry;
};
notify_channel_moved: {
channel: ChannelEntry;
previousParent: ChannelEntry | undefined;
previousOrder: ChannelEntry | undefined;
};
notify_channel_deleted: {
channel: ChannelEntry;
};
notify_channel_client_order_changed: {
channel: ChannelEntry;
};
notify_channel_updated: {
channel: ChannelEntry;
channelProperties: ChannelProperties;
updatedProperties: ChannelProperties;
};
notify_channel_list_received: {};
notify_client_enter_view: {
client: ClientEntry;
reason: ViewReasonId;
isServerJoin: boolean;
targetChannel: ChannelEntry;
};
notify_client_moved: {
client: ClientEntry;
oldChannel: ChannelEntry | undefined;
newChannel: ChannelEntry;
};
notify_client_leave_view: {
client: ClientEntry;
reason: ViewReasonId;
message?: string;
isServerLeave: boolean;
sourceChannel: ChannelEntry;
};
notify_selected_entry_changed: {
oldEntry: ChannelTreeEntry<any> | undefined;
newEntry: ChannelTreeEntry<any> | undefined;
};
}
export declare class ChannelTree {
readonly events: Registry<ChannelTreeEvents>;
client: ConnectionHandler;
server: ServerEntry;
channels: ChannelEntry[];
clients: ClientEntry[];
channelsInitialized: boolean;
readonly popoutController: ChannelTreePopoutController;
mainTreeUiEvents: Registry<ChannelTreeUIEvents>;
private selectedEntry;
private showQueries;
private channelLast?;
private channelFirst?;
constructor(client: ConnectionHandler);
channelsOrdered(): ChannelEntry[];
findEntryId(entryId: number): ServerEntry | ChannelEntry | ClientEntry;
getSelectedEntry(): ChannelTreeEntry<any> | undefined;
setSelectedEntry(entry: ChannelTreeEntry<any> | undefined): void;
destroy(): void;
initialiseHead(serverName: string, address: ServerAddress): void;
rootChannel(): ChannelEntry[];
deleteChannel(channel: ChannelEntry): void;
handleChannelCreated(previous: ChannelEntry, parent: ChannelEntry, channelId: number, channelName: string): ChannelEntry;
findChannel(channelId: number): ChannelEntry | undefined;
/**
* Resolve a channel by its path
*/
resolveChannelPath(target: string): ChannelEntry | undefined;
find_channel_by_name(name: string, parent?: ChannelEntry, force_parent?: boolean): ChannelEntry | undefined;
private unregisterChannelFromTree;
moveChannel(channel: ChannelEntry, channelPrevious: ChannelEntry, parent: ChannelEntry, isInsertMove: boolean): void;
deleteClient(client: ClientEntry, reason: {
reason: ViewReasonId;
message?: string;
serverLeave: boolean;
}): void;
registerClient(client: ClientEntry): void;
unregisterClient(client: ClientEntry): void;
insertClient(client: ClientEntry, channel: ChannelEntry, reason: {
reason: ViewReasonId;
isServerJoin: boolean;
}): ClientEntry;
moveClient(client: ClientEntry, targetChannel: ChannelEntry): void;
findClient?(clientId: number): ClientEntry;
find_client_by_dbid?(client_dbid: number): ClientEntry;
find_client_by_unique_id?(unique_id: string): ClientEntry;
showContextMenu(x: number, y: number, on_close?: () => void): void;
showMultiSelectContextMenu(entries: ChannelTreeEntry<any>[], x: number, y: number): void;
clientsByGroup(group: Group): ClientEntry[];
clientsByChannel(channel: ChannelEntry): ClientEntry[];
reset(): void;
spawnCreateChannel(parent?: ChannelEntry): void;
toggle_server_queries(flag: boolean): void;
areServerQueriesShown(): boolean;
get_first_channel?(): ChannelEntry;
unsubscribe_all_channels(): void;
subscribe_all_channels(): void;
expand_channels(root?: ChannelEntry): void;
collapse_channels(root?: ChannelEntry): void;
}

View File

@ -0,0 +1,16 @@
import { Registry } from "../events";
export interface ChannelTreeEntryEvents {
notify_unread_state_change: {
unread: boolean;
};
}
export declare abstract class ChannelTreeEntry<Events extends ChannelTreeEntryEvents> {
readonly events: Registry<Events>;
readonly uniqueEntryId: number;
protected selected_: boolean;
protected unread_: boolean;
protected constructor();
setUnread(flag: boolean): void;
isUnread(): boolean;
abstract showContextMenu(pageX: number, pageY: number, on_close?: any): any;
}

Some files were not shown because too many files have changed in this diff Show More