Resolved all tc-shared imports into relative imports

This commit is contained in:
WolverinDEV 2020-09-12 15:49:20 +02:00
parent 391205cb34
commit 4a4cbdf38e
153 changed files with 3851 additions and 3090 deletions

View file

@ -1,18 +1,78 @@
import * as ts from "tsd/libraries/typescript";
import {SourceFile, SyntaxKind, TransformerFactory} from "tsd/libraries/typescript";
import * as path from "path"; import * as path from "path";
import * as fs from "fs-extra"; import * as fs from "fs-extra";
type ImportReplacement = { index: number, length: number, replacement: string };
let importReplacements: ImportReplacement[] = [];
async function processFile(file: string) { const ImportTransformerFactory: (depth: number) => TransformerFactory<SourceFile> = fileDepth => context => source => {
const visit = (node: ts.Node, depth: number) => {
if(node.kind === SyntaxKind.ImportDeclaration) {
const decl = node as ts.ImportDeclaration;
if(decl.moduleSpecifier?.kind === SyntaxKind.StringLiteral) {
const module = decl.moduleSpecifier as ts.StringLiteral;
if(module.text.startsWith("tc-shared")) {
const rootPath = [...new Array(fileDepth)].map(() => "..").join("/");
const newPath = (rootPath || ".") + module.text.substr(9);
console.error("Import: %o -> %o", module.text, newPath);
importReplacements.push({
index: module.getStart(source, false) + 1,
length: module.getWidth(source) - 2,
replacement: newPath
});
}
}
} }
async function processDirectory(directory: string) { if(depth > 5) {
/* no import decl possible */
return node;
}
return ts.visitEachChild(node, n => visit(n, depth + 1), context);
};
return ts.visitNode(source, n => visit(n, fileDepth));
}
async function processFile(file: string, fileDepth: number) {
if(path.extname(file) !== ".ts") {
return;
}
let sourceData = (await fs.readFile(file)).toString();
let source = ts.createSourceFile(
file,
sourceData,
ts.ScriptTarget.ES2015,
true
);
console.log("Transforming %s", file);
importReplacements = [];
ts.transform(source, [ImportTransformerFactory(fileDepth)]);
importReplacements.sort((a, b) => b.index - a.index);
importReplacements.forEach(replacement => {
sourceData = sourceData.substring(0, replacement.index) + replacement.replacement + sourceData.substring(replacement.index + replacement.length);
});
await fs.writeFile(file, sourceData);
}
async function processDirectory(directory: string, depth: number) {
const files = await fs.readdir(directory); const files = await fs.readdir(directory);
for(const file of files) { for(const file of files) {
console.log(file); let filePath = path.join(directory, file);
if((await fs.stat(filePath)).isDirectory()) {
await processDirectory(filePath, depth + 1);
} else {
await processFile(filePath, depth);
}
} }
} }
processDirectory(path.join(__dirname, "js")).catch(error => { processDirectory(path.join(__dirname, "js"), 0).catch(error => {
console.error(error); console.error(error);
}); });

View file

@ -1,43 +1,43 @@
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "./connection/ConnectionBase";
import {PermissionManager} from "tc-shared/permission/PermissionManager"; import {PermissionManager} from "./permission/PermissionManager";
import {GroupManager} from "tc-shared/permission/GroupManager"; import {GroupManager} from "./permission/GroupManager";
import {ServerSettings, Settings, settings, StaticSettings} from "tc-shared/settings"; import {ServerSettings, Settings, settings, StaticSettings} from "./settings";
import {Sound, SoundManager} from "tc-shared/sound/Sounds"; import {Sound, SoundManager} from "./sound/Sounds";
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile"; import {ConnectionProfile} from "./profiles/ConnectionProfile";
import * as log from "tc-shared/log"; import * as log from "./log";
import {LogCategory, logError, logInfo, logWarn} from "tc-shared/log"; import {LogCategory, logError, logInfo, logWarn} from "./log";
import {createErrorModal, createInfoModal, createInputModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal, Modal} from "./ui/elements/Modal";
import {hashPassword} from "tc-shared/utils/helpers"; import {hashPassword} from "./utils/helpers";
import {HandshakeHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeHandler} from "./connection/HandshakeHandler";
import * as htmltags from "./ui/htmltags"; import * as htmltags from "./ui/htmltags";
import {FilterMode, InputStartResult, InputState} from "tc-shared/voice/RecorderBase"; import {FilterMode, InputStartResult, InputState} from "./voice/RecorderBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "./connection/ServerConnectionDeclaration";
import {defaultRecorder, RecorderProfile} from "tc-shared/voice/RecorderProfile"; import {defaultRecorder, RecorderProfile} from "./voice/RecorderProfile";
import {Frame} from "tc-shared/ui/frames/chat_frame"; import {Frame} from "./ui/frames/chat_frame";
import {Hostbanner} from "tc-shared/ui/frames/hostbanner"; import {Hostbanner} from "./ui/frames/hostbanner";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "./ui/frames/connection_handlers";
import {connection_log, Regex} from "tc-shared/ui/modal/ModalConnect"; import {connection_log, Regex} from "./ui/modal/ModalConnect";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "./ui/frames/chat";
import {spawnAvatarUpload} from "tc-shared/ui/modal/ModalAvatar"; import {spawnAvatarUpload} from "./ui/modal/ModalAvatar";
import * as dns from "tc-backend/dns"; import * as dns from "tc-backend/dns";
import {EventHandler, Registry} from "tc-shared/events"; import {EventHandler, Registry} from "./events";
import {FileManager} from "tc-shared/file/FileManager"; import {FileManager} from "./file/FileManager";
import {FileTransferState, TransferProvider} from "tc-shared/file/Transfer"; import {FileTransferState, TransferProvider} from "./file/Transfer";
import {traj} from "tc-shared/i18n/localize"; import {traj} from "./i18n/localize";
import {md5} from "tc-shared/crypto/md5"; import {md5} from "./crypto/md5";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "./crypto/uid";
import {ServerEventLog} from "tc-shared/ui/frames/log/ServerEventLog"; import {ServerEventLog} from "./ui/frames/log/ServerEventLog";
import {EventType} from "tc-shared/ui/frames/log/Definitions"; import {EventType} from "./ui/frames/log/Definitions";
import {PluginCmdRegistry} from "tc-shared/connection/PluginCmdHandler"; import {PluginCmdRegistry} from "./connection/PluginCmdHandler";
import {W2GPluginCmdHandler} from "tc-shared/video-viewer/W2GPlugin"; import {W2GPluginCmdHandler} from "./video-viewer/W2GPlugin";
import {VoiceConnectionStatus, WhisperSessionInitializeData} from "tc-shared/connection/VoiceConnection"; import {VoiceConnectionStatus, WhisperSessionInitializeData} from "./connection/VoiceConnection";
import {getServerConnectionFactory} from "tc-shared/connection/ConnectionFactory"; import {getServerConnectionFactory} from "./connection/ConnectionFactory";
import {WhisperSession} from "tc-shared/voice/VoiceWhisper"; import {WhisperSession} from "./voice/VoiceWhisper";
import {spawnEchoTestModal} from "tc-shared/ui/modal/echo-test/Controller"; import {spawnEchoTestModal} from "./ui/modal/echo-test/Controller";
import {ServerFeature, ServerFeatures} from "tc-shared/connection/ServerFeatures"; import {ServerFeature, ServerFeatures} from "./connection/ServerFeatures";
import {ChannelTree} from "tc-shared/tree/ChannelTree"; import {ChannelTree} from "./tree/ChannelTree";
import {LocalClientEntry} from "tc-shared/tree/Client"; import {LocalClientEntry} from "./tree/Client";
import {ServerAddress} from "tc-shared/tree/Server"; import {ServerAddress} from "./tree/Server";
export enum InputHardwareState { export enum InputHardwareState {
MISSING, MISSING,

View file

@ -1,9 +1,9 @@
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "./ui/frames/connection_handlers";
import {EventType, KeyDescriptor, KeyEvent, KeyHook} from "tc-shared/PPTListener"; import {EventType, KeyDescriptor, KeyEvent, KeyHook} from "./PPTListener";
import * as ppt from "tc-backend/ppt"; import * as ppt from "tc-backend/ppt";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "./settings";
import * as log from "tc-shared/log"; import * as log from "./log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "./log";
export interface KeyControl { export interface KeyControl {
category: string; category: string;

View file

@ -1,5 +1,5 @@
import {AbstractInput, LevelMeter} from "tc-shared/voice/RecorderBase"; import {AbstractInput, LevelMeter} from "../voice/RecorderBase";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
export type DeviceQueryResult = {} export type DeviceQueryResult = {}

View file

@ -1,13 +1,13 @@
import * as log from "tc-shared/log"; import * as log from "./log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "./log";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "./crypto/uid";
import {createErrorModal, createInfoModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal} from "./ui/elements/Modal";
import {default_profile, find_profile} from "tc-shared/profiles/ConnectionProfile"; import {default_profile, find_profile} from "./profiles/ConnectionProfile";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "./ui/frames/connection_handlers";
import {spawnConnectModal} from "tc-shared/ui/modal/ModalConnect"; import {spawnConnectModal} from "./ui/modal/ModalConnect";
import * as top_menu from "./ui/frames/MenuBar"; import * as top_menu from "./ui/frames/MenuBar";
import {control_bar_instance} from "tc-shared/ui/frames/control-bar"; import {control_bar_instance} from "./ui/frames/control-bar";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "./ConnectionHandler";
export const boorkmak_connect = (mark: Bookmark, new_tab?: boolean) => { export const boorkmak_connect = (mark: Bookmark, new_tab?: boolean) => {
const profile = find_profile(mark.connect_profile) || default_profile(); const profile = find_profile(mark.connect_profile) || default_profile();

View file

@ -2,8 +2,8 @@ import {
AbstractServerConnection, AbstractServerConnection,
ServerCommand, ServerCommand,
SingleCommandHandler SingleCommandHandler
} from "tc-shared/connection/ConnectionBase"; } from "../connection/ConnectionBase";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
export abstract class AbstractCommandHandler { export abstract class AbstractCommandHandler {
readonly connection: AbstractServerConnection; readonly connection: AbstractServerConnection;

View file

@ -1,9 +1,9 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {AbstractServerConnection, CommandOptions, ServerCommand} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection, CommandOptions, ServerCommand} from "../connection/ConnectionBase";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../sound/Sounds";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {createErrorModal, createInfoModal, createInputModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal, createModal} from "../ui/elements/Modal";
import { import {
ClientConnectionInfo, ClientConnectionInfo,
ClientEntry, ClientEntry,
@ -11,19 +11,19 @@ import {
LocalClientEntry, LocalClientEntry,
MusicClientEntry, MusicClientEntry,
SongInfo SongInfo
} from "tc-shared/tree/Client"; } from "../tree/Client";
import {ChannelEntry} from "tc-shared/tree/Channel"; import {ChannelEntry} from "../tree/Channel";
import {ConnectionHandler, ConnectionState, DisconnectReason, ViewReasonId} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, ConnectionState, DisconnectReason, ViewReasonId} from "../ConnectionHandler";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../ui/frames/chat";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../ui/frames/connection_handlers";
import {spawnPoke} from "tc-shared/ui/modal/ModalPoke"; import {spawnPoke} from "../ui/modal/ModalPoke";
import {AbstractCommandHandler, AbstractCommandHandlerBoss} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler, AbstractCommandHandlerBoss} from "../connection/AbstractCommandHandler";
import {batch_updates, BatchUpdateType, flush_batched_updates} from "tc-shared/ui/react-elements/ReactComponentBase"; import {batch_updates, BatchUpdateType, flush_batched_updates} from "../ui/react-elements/ReactComponentBase";
import {OutOfViewClient} from "tc-shared/ui/frames/side/PrivateConversationManager"; import {OutOfViewClient} from "../ui/frames/side/PrivateConversationManager";
import {renderBBCodeAsJQuery} from "tc-shared/text/bbcode"; import {renderBBCodeAsJQuery} from "../text/bbcode";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
import {EventClient, EventType} from "tc-shared/ui/frames/log/Definitions"; import {EventClient, EventType} from "../ui/frames/log/Definitions";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
export class ServerConnectionCommandBoss extends AbstractCommandHandlerBoss { export class ServerConnectionCommandBoss extends AbstractCommandHandlerBoss {
constructor(connection: AbstractServerConnection) { constructor(connection: AbstractServerConnection) {

View file

@ -1,16 +1,16 @@
import {ServerCommand, SingleCommandHandler} from "tc-shared/connection/ConnectionBase"; import {ServerCommand, SingleCommandHandler} from "../connection/ConnectionBase";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import { import {
ClientNameInfo, ClientNameInfo,
CommandResult, CommandResult,
Playlist, PlaylistInfo, PlaylistSong, Playlist, PlaylistInfo, PlaylistSong,
QueryList, QueryList,
QueryListEntry, ServerGroupClient QueryListEntry, ServerGroupClient
} from "tc-shared/connection/ServerConnectionDeclaration"; } from "../connection/ServerConnectionDeclaration";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
export class CommandHelper extends AbstractCommandHandler { export class CommandHelper extends AbstractCommandHandler {
private whoAmIResponse: any; private whoAmIResponse: any;

View file

@ -1,11 +1,11 @@
import {CommandHelper} from "tc-shared/connection/CommandHelper"; import {CommandHelper} from "../connection/CommandHelper";
import {HandshakeHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeHandler} from "../connection/HandshakeHandler";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {ServerAddress} from "tc-shared/tree/Server"; import {ServerAddress} from "../tree/Server";
import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, ConnectionState} from "../ConnectionHandler";
import {AbstractCommandHandlerBoss} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandlerBoss} from "../connection/AbstractCommandHandler";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {AbstractVoiceConnection} from "tc-shared/connection/VoiceConnection"; import {AbstractVoiceConnection} from "../connection/VoiceConnection";
export interface CommandOptions { export interface CommandOptions {
flagset?: string[]; /* default: [] */ flagset?: string[]; /* default: [] */

View file

@ -1,5 +1,5 @@
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../connection/ConnectionBase";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
export interface ServerConnectionFactory { export interface ServerConnectionFactory {
create(client: ConnectionHandler) : AbstractServerConnection; create(client: ConnectionHandler) : AbstractServerConnection;

View file

@ -1,13 +1,13 @@
import { import {
AbstractVoiceConnection, AbstractVoiceConnection,
VoiceConnectionStatus, WhisperSessionInitializer VoiceConnectionStatus, WhisperSessionInitializer
} from "tc-shared/connection/VoiceConnection"; } from "../connection/VoiceConnection";
import {RecorderProfile} from "tc-shared/voice/RecorderProfile"; import {RecorderProfile} from "../voice/RecorderProfile";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../connection/ConnectionBase";
import {VoiceClient} from "tc-shared/voice/VoiceClient"; import {VoiceClient} from "../voice/VoiceClient";
import {VoicePlayerEvents, VoicePlayerLatencySettings, VoicePlayerState} from "tc-shared/voice/VoicePlayer"; import {VoicePlayerEvents, VoicePlayerLatencySettings, VoicePlayerState} from "../voice/VoicePlayer";
import {WhisperSession, WhisperTarget} from "tc-shared/voice/VoiceWhisper"; import {WhisperSession, WhisperTarget} from "../voice/VoiceWhisper";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
class DummyVoiceClient implements VoiceClient { class DummyVoiceClient implements VoiceClient {
readonly events: Registry<VoicePlayerEvents>; readonly events: Registry<VoicePlayerEvents>;

View file

@ -1,11 +1,11 @@
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {IdentitifyType} from "tc-shared/profiles/Identity"; import {IdentitifyType} from "../profiles/Identity";
import {TeaSpeakIdentity} from "tc-shared/profiles/identities/TeamSpeakIdentity"; import {TeaSpeakIdentity} from "../profiles/identities/TeamSpeakIdentity";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../connection/ConnectionBase";
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile"; import {ConnectionProfile} from "../profiles/ConnectionProfile";
import {settings} from "tc-shared/settings"; import {settings} from "../settings";
import {ConnectParameters, DisconnectReason} from "tc-shared/ConnectionHandler"; import {ConnectParameters, DisconnectReason} from "../ConnectionHandler";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
export interface HandshakeIdentityHandler { export interface HandshakeIdentityHandler {
connection: AbstractServerConnection; connection: AbstractServerConnection;

View file

@ -1,7 +1,7 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
import {AbstractServerConnection, ServerCommand} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection, ServerCommand} from "../connection/ConnectionBase";
export interface PluginCommandInvoker { export interface PluginCommandInvoker {
clientId: number; clientId: number;

View file

@ -1,4 +1,4 @@
import {LaterPromise} from "tc-shared/utils/LaterPromise"; import {LaterPromise} from "../utils/LaterPromise";
export class CommandResult { export class CommandResult {
success: boolean; success: boolean;

View file

@ -1,9 +1,9 @@
import {ConnectionEvents, ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ConnectionEvents, ConnectionHandler, ConnectionState} from "../ConnectionHandler";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
import {LogCategory, logDebug, logTrace, logWarn} from "tc-shared/log"; import {LogCategory, logDebug, logTrace, logWarn} from "../log";
import {ExplicitCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {ExplicitCommandHandler} from "../connection/AbstractCommandHandler";
export type ServerFeatureSupport = "unsupported" | "supported" | "experimental" | "deprecated"; export type ServerFeatureSupport = "unsupported" | "supported" | "experimental" | "deprecated";

View file

@ -1,8 +1,8 @@
import {RecorderProfile} from "tc-shared/voice/RecorderProfile"; import {RecorderProfile} from "../voice/RecorderProfile";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../connection/ConnectionBase";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {VoiceClient} from "tc-shared/voice/VoiceClient"; import {VoiceClient} from "../voice/VoiceClient";
import {WhisperSession, WhisperTarget} from "tc-shared/voice/VoiceWhisper"; import {WhisperSession, WhisperTarget} from "../voice/VoiceWhisper";
export enum VoiceConnectionStatus { export enum VoiceConnectionStatus {
ClientUnsupported, ClientUnsupported,

View file

@ -1,6 +1,6 @@
import * as log from "./log"; import * as log from "./log";
import {LogCategory} from "./log"; import {LogCategory} from "./log";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "./crypto/uid";
import * as React from "react"; import * as React from "react";
import {useEffect} from "react"; import {useEffect} from "react";

View file

@ -1,19 +1,19 @@
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {ClientGlobalControlEvents} from "tc-shared/events/GlobalEvents"; import {ClientGlobalControlEvents} from "../events/GlobalEvents";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../sound/Sounds";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../ui/frames/connection_handlers";
import {createErrorModal, createInfoModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal} from "../ui/elements/Modal";
import {settings} from "tc-shared/settings"; import {settings} from "../settings";
import {spawnConnectModal} from "tc-shared/ui/modal/ModalConnect"; import {spawnConnectModal} from "../ui/modal/ModalConnect";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../permission/PermissionType";
import {spawnQueryCreate} from "tc-shared/ui/modal/ModalQuery"; import {spawnQueryCreate} from "../ui/modal/ModalQuery";
import {openBanList} from "tc-shared/ui/modal/ModalBanList"; import {openBanList} from "../ui/modal/ModalBanList";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../ui/frames/chat";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings"; import {spawnSettingsModal} from "../ui/modal/ModalSettings";
import {spawnPermissionEditorModal} from "tc-shared/ui/modal/permission/ModalPermissionEditor"; import {spawnPermissionEditorModal} from "../ui/modal/permission/ModalPermissionEditor";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
/* /*
function initialize_sounds(event_registry: Registry<ClientGlobalControlEvents>) { function initialize_sounds(event_registry: Registry<ClientGlobalControlEvents>) {

View file

@ -1,5 +1,5 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
export interface ClientGlobalControlEvents { export interface ClientGlobalControlEvents {
/* open a basic window */ /* open a basic window */

View file

@ -1,5 +1,5 @@
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import * as hex from "tc-shared/crypto/hex"; import * as hex from "../crypto/hex";
export const kIPCAvatarChannel = "avatars"; export const kIPCAvatarChannel = "avatars";
export const kLoadingAvatarImage = "img/loading_image.svg"; export const kLoadingAvatarImage = "img/loading_image.svg";

View file

@ -1,4 +1,4 @@
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
export enum ImageType { export enum ImageType {
UNKNOWN, UNKNOWN,

View file

@ -1,22 +1,22 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import * as ipc from "../ipc/BrowserIPC"; import * as ipc from "../ipc/BrowserIPC";
import {ChannelMessage} from "../ipc/BrowserIPC"; import {ChannelMessage} from "../ipc/BrowserIPC";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import {image_type, ImageCache, media_image_type} from "tc-shared/file/ImageCache"; import {image_type, ImageCache, media_image_type} from "../file/ImageCache";
import {FileManager} from "tc-shared/file/FileManager"; import {FileManager} from "../file/FileManager";
import { import {
FileDownloadTransfer, FileDownloadTransfer,
FileTransferState, FileTransferState,
ResponseTransferTarget, ResponseTransferTarget,
TransferProvider, TransferProvider,
TransferTargetType TransferTargetType
} from "tc-shared/file/Transfer"; } from "../file/Transfer";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../ui/frames/connection_handlers";
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../tree/Client";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
import { import {
AbstractAvatarManager, AbstractAvatarManager,
AbstractAvatarManagerFactory, AbstractAvatarManagerFactory,
@ -26,10 +26,10 @@ import {
kIPCAvatarChannel, kIPCAvatarChannel,
setGlobalAvatarManagerFactory, setGlobalAvatarManagerFactory,
uniqueId2AvatarId uniqueId2AvatarId
} from "tc-shared/file/Avatars"; } from "../file/Avatars";
import {IPCChannel} from "tc-shared/ipc/BrowserIPC"; import {IPCChannel} from "../ipc/BrowserIPC";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
/* FIXME: Retry avatar download after some time! */ /* FIXME: Retry avatar download after some time! */

View file

@ -7,11 +7,11 @@ import {
AbstractAvatarManagerFactory, AvatarState, AvatarStateData, ClientAvatar, AbstractAvatarManagerFactory, AvatarState, AvatarStateData, ClientAvatar,
kIPCAvatarChannel, kIPCAvatarChannel,
setGlobalAvatarManagerFactory, uniqueId2AvatarId setGlobalAvatarManagerFactory, uniqueId2AvatarId
} from "tc-shared/file/Avatars"; } from "../file/Avatars";
import {IPCChannel} from "tc-shared/ipc/BrowserIPC"; import {IPCChannel} from "../ipc/BrowserIPC";
import {Settings} from "tc-shared/settings"; import {Settings} from "../settings";
import {ChannelMessage} from "../ipc/BrowserIPC"; import {ChannelMessage} from "../ipc/BrowserIPC";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
function isEquivalent(a, b) { function isEquivalent(a, b) {
// Create arrays of property names // Create arrays of property names

View file

@ -1,7 +1,7 @@
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
/* Transfer source types */ /* Transfer source types */
export enum TransferSourceType { export enum TransferSourceType {

View file

@ -1,4 +1,4 @@
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
interface CountryInfo { interface CountryInfo {
name: string; name: string;

View file

@ -1,9 +1,9 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
import {Settings, StaticSettings} from "tc-shared/settings"; import {Settings, StaticSettings} from "../settings";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {formatMessage, formatMessageString} from "tc-shared/ui/frames/chat"; import {formatMessage, formatMessageString} from "../ui/frames/chat";
export interface TranslationKey { export interface TranslationKey {
message: string; message: string;

View file

@ -1,7 +1,7 @@
import "broadcastchannel-polyfill"; import "broadcastchannel-polyfill";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {ConnectHandler} from "tc-shared/ipc/ConnectHandler"; import {ConnectHandler} from "../ipc/ConnectHandler";
export interface BroadcastMessage { export interface BroadcastMessage {
timestamp: number; timestamp: number;

View file

@ -1,7 +1,7 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "tc-shared/ipc/BrowserIPC"; import {BasicIPCHandler, IPCChannel, ChannelMessage} from "../ipc/BrowserIPC";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
export type ConnectRequestData = { export type ConnectRequestData = {
address: string; address: string;

View file

@ -1,7 +1,7 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "tc-shared/ipc/BrowserIPC"; import {BasicIPCHandler, IPCChannel, ChannelMessage} from "../ipc/BrowserIPC";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
export interface MethodProxyInvokeData { export interface MethodProxyInvokeData {
method_name: string; method_name: string;

View file

@ -1,4 +1,4 @@
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "./settings";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
export enum LogCategory { export enum LogCategory {

View file

@ -1,13 +1,13 @@
import {LaterPromise} from "tc-shared/utils/LaterPromise"; import {LaterPromise} from "../utils/LaterPromise";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {PermissionManager, PermissionValue} from "tc-shared/permission/PermissionManager"; import {PermissionManager, PermissionValue} from "../permission/PermissionManager";
import {ServerCommand} from "tc-shared/connection/ConnectionBase"; import {ServerCommand} from "../connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {ConnectionEvents, ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ConnectionEvents, ConnectionHandler, ConnectionState} from "../ConnectionHandler";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
export enum GroupType { export enum GroupType {
QUERY, QUERY,

View file

@ -1,14 +1,14 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory, LogType} from "tc-shared/log"; import {LogCategory, LogType} from "../log";
import {PermissionType} from "tc-shared/permission/PermissionType"; import {PermissionType} from "../permission/PermissionType";
import {LaterPromise} from "tc-shared/utils/LaterPromise"; import {LaterPromise} from "../utils/LaterPromise";
import {ServerCommand} from "tc-shared/connection/ConnectionBase"; import {ServerCommand} from "../connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {tr} from "tc-shared/i18n/localize"; import {tr} from "../i18n/localize";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
export class PermissionInfo { export class PermissionInfo {
name: string; name: string;

View file

@ -1,11 +1,11 @@
import {decode_identity, IdentitifyType, Identity} from "tc-shared/profiles/Identity"; import {decode_identity, IdentitifyType, Identity} from "../profiles/Identity";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
import {TeaForumIdentity} from "tc-shared/profiles/identities/TeaForumIdentity"; import {TeaForumIdentity} from "../profiles/identities/TeaForumIdentity";
import {TeaSpeakIdentity} from "tc-shared/profiles/identities/TeamSpeakIdentity"; import {TeaSpeakIdentity} from "../profiles/identities/TeamSpeakIdentity";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeIdentityHandler} from "../connection/HandshakeHandler";
import {createErrorModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal} from "../ui/elements/Modal";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../ui/frames/chat";
export class ConnectionProfile { export class ConnectionProfile {
id: string; id: string;

View file

@ -1,6 +1,6 @@
import {AbstractServerConnection, ServerCommand} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection, ServerCommand} from "../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeIdentityHandler} from "../connection/HandshakeHandler";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler"; import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
export enum IdentitifyType { export enum IdentitifyType {
TEAFORO, TEAFORO,

View file

@ -3,12 +3,12 @@ import {
HandshakeCommandHandler, HandshakeCommandHandler,
IdentitifyType, IdentitifyType,
Identity Identity
} from "tc-shared/profiles/Identity"; } from "../../profiles/Identity";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
class NameHandshakeHandler extends AbstractHandshakeIdentityHandler { class NameHandshakeHandler extends AbstractHandshakeIdentityHandler {
readonly identity: NameIdentity; readonly identity: NameIdentity;

View file

@ -3,12 +3,12 @@ import {
HandshakeCommandHandler, HandshakeCommandHandler,
IdentitifyType, IdentitifyType,
Identity Identity
} from "tc-shared/profiles/Identity"; } from "../../profiles/Identity";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
import * as forum from "./teaspeak-forum"; import * as forum from "./teaspeak-forum";
class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler { class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler {

View file

@ -1,18 +1,18 @@
import * as log from "tc-shared/log"; import * as log from "../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import * as asn1 from "tc-shared/crypto/asn1"; import * as asn1 from "../../crypto/asn1";
import * as sha from "tc-shared/crypto/sha"; import * as sha from "../../crypto/sha";
import { import {
AbstractHandshakeIdentityHandler, AbstractHandshakeIdentityHandler,
HandshakeCommandHandler, HandshakeCommandHandler,
IdentitifyType, IdentitifyType,
Identity Identity
} from "tc-shared/profiles/Identity"; } from "../../profiles/Identity";
import {arrayBufferBase64, base64_encode_ab, str2ab8} from "tc-shared/utils/buffers"; import {arrayBufferBase64, base64_encode_ab, str2ab8} from "../../utils/buffers";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase"; import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler"; import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
export namespace CryptoHelper { export namespace CryptoHelper {
export function base64_url_encode(str){ export function base64_url_encode(str){

View file

@ -1,4 +1,4 @@
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "../../settings";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import * as fidentity from "./TeaForumIdentity"; import * as fidentity from "./TeaForumIdentity";
import * as log from "../../log"; import * as log from "../../log";

View file

@ -1,8 +1,8 @@
import * as log from "tc-shared/log"; import * as log from "./log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "./log";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import {Registry} from "tc-shared/events"; import {Registry} from "./events";
type ConfigValueTypes = boolean | number | string | object; type ConfigValueTypes = boolean | number | string | object;
type ConfigValueTypeNames = "boolean" | "number" | "string" | "object"; type ConfigValueTypeNames = "boolean" | "number" | "string" | "object";

View file

@ -1,7 +1,7 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../settings";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../ConnectionHandler";
import * as sbackend from "tc-backend/audio/sounds"; import * as sbackend from "tc-backend/audio/sounds";
export enum Sound { export enum Sound {

View file

@ -1,5 +1,5 @@
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "./log";
import * as log from "tc-shared/log"; import * as log from "./log";
enum CloseCodes { enum CloseCodes {
UNSET = 3000, UNSET = 3000,

View file

@ -1,10 +1,10 @@
//https://regex101.com/r/YQbfcX/2 //https://regex101.com/r/YQbfcX/2
//static readonly URL_REGEX = /^(?<hostname>([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/(?<path>(?:[^\s?]+)?)(?:\?(?<query>\S+))?)?$/gm; //static readonly URL_REGEX = /^(?<hostname>([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/(?<path>(?:[^\s?]+)?)(?:\?(?<query>\S+))?)?$/gm;
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../settings";
import {renderMarkdownAsBBCode} from "tc-shared/text/markdown"; import {renderMarkdownAsBBCode} from "../text/markdown";
import {escapeBBCode} from "tc-shared/text/bbcode"; import {escapeBBCode} from "../text/bbcode";
const URL_REGEX = /^(([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/((?:[^\s?]+)?)(?:\?(\S+))?)?$/gm; const URL_REGEX = /^(([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/((?:[^\s?]+)?)(?:\?(\S+))?)?$/gm;
function process_urls(message: string) : string { function process_urls(message: string) : string {

View file

@ -1,5 +1,5 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import { import {
CodeToken, Env, FenceToken, HeadingOpenToken, CodeToken, Env, FenceToken, HeadingOpenToken,
ImageToken, ImageToken,
@ -10,7 +10,7 @@ import {
TextToken, TextToken,
Token Token
} from "remarkable/lib"; } from "remarkable/lib";
import {escapeBBCode} from "tc-shared/text/bbcode"; import {escapeBBCode} from "../text/bbcode";
const { Remarkable } = require("remarkable"); const { Remarkable } = require("remarkable");
export class MD2BBCodeRenderer { export class MD2BBCodeRenderer {

View file

@ -1,28 +1,28 @@
import {ChannelTree} from "./ChannelTree"; import {ChannelTree} from "./ChannelTree";
import {ClientEntry, ClientEvents} from "./Client"; import {ClientEntry, ClientEvents} from "./Client";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory, LogType} from "tc-shared/log"; import {LogCategory, LogType} from "../log";
import {PermissionType} from "tc-shared/permission/PermissionType"; import {PermissionType} from "../permission/PermissionType";
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "../settings";
import * as contextmenu from "tc-shared/ui/elements/ContextMenu"; import * as contextmenu from "../ui/elements/ContextMenu";
import {MenuEntryType} from "tc-shared/ui/elements/ContextMenu"; import {MenuEntryType} from "../ui/elements/ContextMenu";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../sound/Sounds";
import {createErrorModal, createInfoModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal} from "../ui/elements/Modal";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../connection/ServerConnectionDeclaration";
import * as htmltags from "../ui/htmltags"; import * as htmltags from "../ui/htmltags";
import {hashPassword} from "tc-shared/utils/helpers"; import {hashPassword} from "../utils/helpers";
import {openChannelInfo} from "tc-shared/ui/modal/ModalChannelInfo"; import {openChannelInfo} from "../ui/modal/ModalChannelInfo";
import {createChannelModal} from "tc-shared/ui/modal/ModalCreateChannel"; import {createChannelModal} from "../ui/modal/ModalCreateChannel";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../ui/frames/chat";
import * as React from "react"; import * as React from "react";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry"; import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
import {ChannelEntryView as ChannelEntryView} from "../ui/tree/Channel"; import {ChannelEntryView as ChannelEntryView} from "../ui/tree/Channel";
import {spawnFileTransferModal} from "tc-shared/ui/modal/transfer/ModalFileTransfer"; import {spawnFileTransferModal} from "../ui/modal/transfer/ModalFileTransfer";
import {ViewReasonId} from "tc-shared/ConnectionHandler"; import {ViewReasonId} from "../ConnectionHandler";
import {EventChannelData} from "tc-shared/ui/frames/log/Definitions"; import {EventChannelData} from "../ui/frames/log/Definitions";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../connection/ErrorCode";
export enum ChannelType { export enum ChannelType {
PERMANENT, PERMANENT,

View file

@ -1,4 +1,4 @@
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
export interface ChannelTreeEntryEvents { export interface ChannelTreeEntryEvents {
notify_select_state_change: { selected: boolean }, notify_select_state_change: { selected: boolean },

View file

@ -1,35 +1,35 @@
import * as contextmenu from "tc-shared/ui/elements/ContextMenu"; import * as contextmenu from "../ui/elements/ContextMenu";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {ChannelTree} from "./ChannelTree"; import {ChannelTree} from "./ChannelTree";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory, logInfo, LogType} from "tc-shared/log"; import {LogCategory, logInfo, LogType} from "../log";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../settings";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../sound/Sounds";
import {Group, GroupManager, GroupTarget, GroupType} from "tc-shared/permission/GroupManager"; import {Group, GroupManager, GroupTarget, GroupType} from "../permission/GroupManager";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../permission/PermissionType";
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInputModal} from "../ui/elements/Modal";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../ui/htmltags";
import {CommandResult, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult, PlaylistSong} from "../connection/ServerConnectionDeclaration";
import {ChannelEntry} from "./Channel"; import {ChannelEntry} from "./Channel";
import {ConnectionHandler, ViewReasonId} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, ViewReasonId} from "../ConnectionHandler";
import {createServerGroupAssignmentModal} from "tc-shared/ui/modal/ModalGroupAssignment"; import {createServerGroupAssignmentModal} from "../ui/modal/ModalGroupAssignment";
import {openClientInfo} from "tc-shared/ui/modal/ModalClientInfo"; import {openClientInfo} from "../ui/modal/ModalClientInfo";
import {spawnBanClient} from "tc-shared/ui/modal/ModalBanClient"; import {spawnBanClient} from "../ui/modal/ModalBanClient";
import {spawnChangeLatency} from "tc-shared/ui/modal/ModalChangeLatency"; import {spawnChangeLatency} from "../ui/modal/ModalChangeLatency";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../ui/frames/chat";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {spawnYesNo} from "../ui/modal/ModalYesNo";
import * as hex from "tc-shared/crypto/hex"; import * as hex from "../crypto/hex";
import {ClientEntry as ClientEntryView} from "../ui/tree/Client"; import {ClientEntry as ClientEntryView} from "../ui/tree/Client";
import * as React from "react"; import * as React from "react";
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry"; import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
import {spawnClientVolumeChange, spawnMusicBotVolumeChange} from "tc-shared/ui/modal/ModalChangeVolumeNew"; import {spawnClientVolumeChange, spawnMusicBotVolumeChange} from "../ui/modal/ModalChangeVolumeNew";
import {spawnPermissionEditorModal} from "tc-shared/ui/modal/permission/ModalPermissionEditor"; import {spawnPermissionEditorModal} from "../ui/modal/permission/ModalPermissionEditor";
import {EventClient, EventType} from "tc-shared/ui/frames/log/Definitions"; import {EventClient, EventType} from "../ui/frames/log/Definitions";
import {W2GPluginCmdHandler} from "tc-shared/video-viewer/W2GPlugin"; import {W2GPluginCmdHandler} from "../video-viewer/W2GPlugin";
import {global_client_actions} from "tc-shared/events/GlobalEvents"; import {global_client_actions} from "../events/GlobalEvents";
import {ClientIcon} from "svg-sprites/client-icons"; import {ClientIcon} from "svg-sprites/client-icons";
import {VoiceClient} from "tc-shared/voice/VoiceClient"; import {VoiceClient} from "../voice/VoiceClient";
import {VoicePlayerEvents, VoicePlayerState} from "tc-shared/voice/VoicePlayer"; import {VoicePlayerEvents, VoicePlayerState} from "../voice/VoicePlayer";
export enum ClientType { export enum ClientType {
CLIENT_VOICE, CLIENT_VOICE,

View file

@ -1,22 +1,22 @@
import {ChannelTree} from "./ChannelTree"; import {ChannelTree} from "./ChannelTree";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../settings";
import * as contextmenu from "tc-shared/ui/elements/ContextMenu"; import * as contextmenu from "../ui/elements/ContextMenu";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory, LogType} from "tc-shared/log"; import {LogCategory, LogType} from "../log";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../sound/Sounds";
import * as bookmarks from "tc-shared/bookmarks"; import * as bookmarks from "../bookmarks";
import {spawnInviteEditor} from "tc-shared/ui/modal/ModalInvite"; import {spawnInviteEditor} from "../ui/modal/ModalInvite";
import {openServerInfo} from "tc-shared/ui/modal/ModalServerInfo"; import {openServerInfo} from "../ui/modal/ModalServerInfo";
import {createServerModal} from "tc-shared/ui/modal/ModalServerEdit"; import {createServerModal} from "../ui/modal/ModalServerEdit";
import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect"; import {spawnIconSelect} from "../ui/modal/ModalIconSelect";
import {spawnAvatarList} from "tc-shared/ui/modal/ModalAvatarList"; import {spawnAvatarList} from "../ui/modal/ModalAvatarList";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../ui/frames/connection_handlers";
import {connection_log} from "tc-shared/ui/modal/ModalConnect"; import {connection_log} from "../ui/modal/ModalConnect";
import * as top_menu from "../ui/frames/MenuBar"; import * as top_menu from "../ui/frames/MenuBar";
import {control_bar_instance} from "tc-shared/ui/frames/control-bar"; import {control_bar_instance} from "../ui/frames/control-bar";
import { ServerEntry as ServerEntryView } from "../ui/tree/Server"; import { ServerEntry as ServerEntryView } from "../ui/tree/Server";
import * as React from "react"; import * as React from "react";
import {Registry} from "tc-shared/events"; import {Registry} from "../events";
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry"; import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
export class ServerProperties { export class ServerProperties {

View file

@ -1,6 +1,6 @@
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../settings";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import * as log from "tc-shared/log"; import * as log from "../../log";
declare global { declare global {
interface JQuery<TElement = HTMLElement> { interface JQuery<TElement = HTMLElement> {

View file

@ -1,6 +1,6 @@
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import {KeyCode} from "tc-shared/PPTListener"; import {KeyCode} from "../../PPTListener";
import * as $ from "jquery"; import * as $ from "jquery";
export enum ElementType { export enum ElementType {

View file

@ -1,4 +1,4 @@
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
export interface SliderOptions { export interface SliderOptions {
min_value?: number; min_value?: number;

View file

@ -1,4 +1,4 @@
import {spawnBookmarkModal} from "tc-shared/ui/modal/ModalBookmarks"; import {spawnBookmarkModal} from "../../ui/modal/ModalBookmarks";
import { import {
add_server_to_bookmarks, add_server_to_bookmarks,
Bookmark, Bookmark,
@ -6,25 +6,25 @@ import {
BookmarkType, BookmarkType,
boorkmak_connect, boorkmak_connect,
DirectoryBookmark DirectoryBookmark
} from "tc-shared/bookmarks"; } from "../../bookmarks";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {Sound} from "tc-shared/sound/Sounds"; import {Sound} from "../../sound/Sounds";
import {spawnConnectModal} from "tc-shared/ui/modal/ModalConnect"; import {spawnConnectModal} from "../../ui/modal/ModalConnect";
import {createErrorModal, createInfoModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal} from "../../ui/elements/Modal";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {PermissionType} from "tc-shared/permission/PermissionType"; import {PermissionType} from "../../permission/PermissionType";
import {openBanList} from "tc-shared/ui/modal/ModalBanList"; import {openBanList} from "../../ui/modal/ModalBanList";
import {spawnQueryManage} from "tc-shared/ui/modal/ModalQueryManage"; import {spawnQueryManage} from "../../ui/modal/ModalQueryManage";
import {spawnQueryCreate} from "tc-shared/ui/modal/ModalQuery"; import {spawnQueryCreate} from "../../ui/modal/ModalQuery";
import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings"; import {spawnSettingsModal} from "../../ui/modal/ModalSettings";
import {spawnAbout} from "tc-shared/ui/modal/ModalAbout"; import {spawnAbout} from "../../ui/modal/ModalAbout";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../../ui/frames/connection_handlers";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
import {control_bar_instance} from "tc-shared/ui/frames/control-bar"; import {control_bar_instance} from "../../ui/frames/control-bar";
import {icon_cache_loader, IconManager, LocalIcon} from "tc-shared/file/Icons"; import {icon_cache_loader, IconManager, LocalIcon} from "../../file/Icons";
import {spawnPermissionEditorModal} from "tc-shared/ui/modal/permission/ModalPermissionEditor"; import {spawnPermissionEditorModal} from "../../ui/modal/permission/ModalPermissionEditor";
import {spawnModalCssVariableEditor} from "tc-shared/ui/modal/css-editor/Controller"; import {spawnModalCssVariableEditor} from "../../ui/modal/css-editor/Controller";
export interface HRItem { } export interface HRItem { }

View file

@ -1,6 +1,6 @@
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "../../settings";
import * as log from "tc-shared/log"; import * as log from "../../log";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
export enum ChatType { export enum ChatType {

View file

@ -1,14 +1,14 @@
/* the bar on the right with the chats (Channel & Client) */ /* the bar on the right with the chats (Channel & Client) */
import {ClientEntry, MusicClientEntry} from "tc-shared/tree/Client"; import {ClientEntry, MusicClientEntry} from "../../tree/Client";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {ChannelEntry} from "tc-shared/tree/Channel"; import {ChannelEntry} from "../../tree/Channel";
import {ServerEntry} from "tc-shared/tree/Server"; import {ServerEntry} from "../../tree/Server";
import {openMusicManage} from "tc-shared/ui/modal/ModalMusicManage"; import {openMusicManage} from "../../ui/modal/ModalMusicManage";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
import {ClientInfo} from "tc-shared/ui/frames/side/client_info"; import {ClientInfo} from "../../ui/frames/side/client_info";
import {MusicInfo} from "tc-shared/ui/frames/side/music_info"; import {MusicInfo} from "../../ui/frames/side/music_info";
import {ConversationManager} from "tc-shared/ui/frames/side/ConversationManager"; import {ConversationManager} from "../../ui/frames/side/ConversationManager";
import {PrivateConversationManager} from "tc-shared/ui/frames/side/PrivateConversationManager"; import {PrivateConversationManager} from "../../ui/frames/side/PrivateConversationManager";
export enum InfoFrameMode { export enum InfoFrameMode {
NONE = "none", NONE = "none",

View file

@ -1,7 +1,7 @@
import {ConnectionHandler, DisconnectReason} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, DisconnectReason} from "../../ConnectionHandler";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../settings";
import * as top_menu from "./MenuBar"; import * as top_menu from "./MenuBar";
import {Registry} from "tc-shared/events"; import {Registry} from "../../events";
export let server_connections: ConnectionManager; export let server_connections: ConnectionManager;
export function initialize() { export function initialize() {

View file

@ -1,7 +1,7 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "../../settings";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import * as log from "tc-shared/log"; import * as log from "../../log";
export class Hostbanner { export class Hostbanner {
readonly html_tag: JQuery<HTMLElement>; readonly html_tag: JQuery<HTMLElement>;

View file

@ -1,7 +1,7 @@
import {PermissionInfo} from "tc-shared/permission/PermissionManager"; import {PermissionInfo} from "../../../permission/PermissionManager";
import {ViewReasonId} from "tc-shared/ConnectionHandler"; import {ViewReasonId} from "../../../ConnectionHandler";
import * as React from "react"; import * as React from "react";
import {ServerEventLog} from "tc-shared/ui/frames/log/ServerEventLog"; import {ServerEventLog} from "../../../ui/frames/log/ServerEventLog";
export enum EventType { export enum EventType {
CONNECTION_BEGIN = "connection.begin", CONNECTION_BEGIN = "connection.begin",

View file

@ -1,5 +1,5 @@
import {EventType} from "tc-shared/ui/frames/log/Definitions"; import {EventType} from "../../../ui/frames/log/Definitions";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../../settings";
const focusDefaultStatus = {}; const focusDefaultStatus = {};
focusDefaultStatus[EventType.CLIENT_POKE_RECEIVED] = true; focusDefaultStatus[EventType.CLIENT_POKE_RECEIVED] = true;

View file

@ -2,14 +2,14 @@ import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import * as log from "../../../log"; import * as log from "../../../log";
import {LogCategory} from "../../../log"; import {LogCategory} from "../../../log";
import {EventClient, EventServerAddress, EventType, TypeInfo} from "tc-shared/ui/frames/log/Definitions"; import {EventClient, EventServerAddress, EventType, TypeInfo} from "../../../ui/frames/log/Definitions";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../../../ui/frames/connection_handlers";
import {renderBBCodeAsText} from "tc-shared/text/bbcode"; import {renderBBCodeAsText} from "../../../text/bbcode";
import {format_time} from "tc-shared/ui/frames/chat"; import {format_time} from "../../../ui/frames/chat";
import {ViewReasonId} from "tc-shared/ConnectionHandler"; import {ViewReasonId} from "../../../ConnectionHandler";
import {findLogDispatcher} from "tc-shared/ui/frames/log/DispatcherLog"; import {findLogDispatcher} from "../../../ui/frames/log/DispatcherLog";
import {formatDate} from "tc-shared/MessageFormatter"; import {formatDate} from "../../../MessageFormatter";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../../settings";
export type DispatcherLog<T extends keyof TypeInfo> = (data: TypeInfo[T], handlerId: string, eventType: T) => void; export type DispatcherLog<T extends keyof TypeInfo> = (data: TypeInfo[T], handlerId: string, eventType: T) => void;

View file

@ -3,15 +3,15 @@ import {
ChatEventMessage, ChatHistoryState, ChatMessage, ChatEventMessage, ChatHistoryState, ChatMessage,
ChatState, ConversationHistoryResponse, ChatState, ConversationHistoryResponse,
ConversationUIEvents ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions"; } from "../../../ui/frames/side/ConversationDefinitions";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../../ConnectionHandler";
import {EventHandler, Registry} from "tc-shared/events"; import {EventHandler, Registry} from "../../../events";
import {preprocessChatMessageForSend} from "tc-shared/text/chat"; import {preprocessChatMessageForSend} from "../../../text/chat";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../../connection/ServerConnectionDeclaration";
import * as log from "tc-shared/log"; import * as log from "../../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../../log";
import {tra} from "tc-shared/i18n/localize"; import {tra} from "../../../i18n/localize";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../../connection/ErrorCode";
export const kMaxChatFrameMessageSize = 50; /* max 100 messages, since the server does not support more than 100 messages queried at once */ export const kMaxChatFrameMessageSize = 50; /* max 100 messages, since the server does not support more than 100 messages queried at once */

View file

@ -1,21 +1,21 @@
import * as React from "react"; import * as React from "react";
import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, ConnectionState} from "../../../ConnectionHandler";
import {EventHandler, Registry} from "tc-shared/events"; import {EventHandler, Registry} from "../../../events";
import * as log from "tc-shared/log"; import * as log from "../../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../../log";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../../connection/ServerConnectionDeclaration";
import {ServerCommand} from "tc-shared/connection/ConnectionBase"; import {ServerCommand} from "../../../connection/ConnectionBase";
import {Settings} from "tc-shared/settings"; import {Settings} from "../../../settings";
import {traj} from "tc-shared/i18n/localize"; import {traj} from "../../../i18n/localize";
import {createErrorModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal} from "../../../ui/elements/Modal";
import ReactDOM = require("react-dom"); import ReactDOM = require("react-dom");
import { import {
ChatMessage, ConversationHistoryResponse, ChatMessage, ConversationHistoryResponse,
ConversationUIEvents ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions"; } from "../../../ui/frames/side/ConversationDefinitions";
import {ConversationPanel} from "tc-shared/ui/frames/side/ConversationUI"; import {ConversationPanel} from "../../../ui/frames/side/ConversationUI";
import {AbstractChat, AbstractChatManager, kMaxChatFrameMessageSize} from "./AbstractConversion"; import {AbstractChat, AbstractChatManager, kMaxChatFrameMessageSize} from "./AbstractConversion";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../../connection/ErrorCode";
const kSuccessQueryThrottle = 5 * 1000; const kSuccessQueryThrottle = 5 * 1000;
const kErrorQueryThrottle = 30 * 1000; const kErrorQueryThrottle = 30 * 1000;

View file

@ -1,4 +1,4 @@
import {ConversationUIEvents} from "tc-shared/ui/frames/side/ConversationDefinitions"; import {ConversationUIEvents} from "../../../ui/frames/side/ConversationDefinitions";
export type PrivateConversationInfo = { export type PrivateConversationInfo = {
nickname: string; nickname: string;

View file

@ -1,8 +1,8 @@
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import * as log from "tc-shared/log"; import * as log from "../../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../../log";
import {ChatEvent} from "tc-shared/ui/frames/side/ConversationDefinitions"; import {ChatEvent} from "../../../ui/frames/side/ConversationDefinitions";
const clientUniqueId2StoreName = uniqueId => "conversation-" + uniqueId; const clientUniqueId2StoreName = uniqueId => "conversation-" + uniqueId;

View file

@ -1,23 +1,23 @@
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../../../tree/Client";
import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ConnectionHandler, ConnectionState} from "../../../ConnectionHandler";
import {EventHandler, Registry} from "tc-shared/events"; import {EventHandler, Registry} from "../../../events";
import { import {
PrivateConversationInfo, PrivateConversationInfo,
PrivateConversationUIEvents PrivateConversationUIEvents
} from "tc-shared/ui/frames/side/PrivateConversationDefinitions"; } from "../../../ui/frames/side/PrivateConversationDefinitions";
import * as ReactDOM from "react-dom"; import * as ReactDOM from "react-dom";
import * as React from "react"; import * as React from "react";
import {PrivateConversationsPanel} from "tc-shared/ui/frames/side/PrivateConversationUI"; import {PrivateConversationsPanel} from "../../../ui/frames/side/PrivateConversationUI";
import { import {
ChatEvent, ChatEvent,
ChatMessage, ChatMessage,
ConversationHistoryResponse, ConversationHistoryResponse,
ConversationUIEvents ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions"; } from "../../../ui/frames/side/ConversationDefinitions";
import * as log from "tc-shared/log"; import * as log from "../../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../../log";
import {queryConversationEvents, registerConversationEvent} from "tc-shared/ui/frames/side/PrivateConversationHistory"; import {queryConversationEvents, registerConversationEvent} from "../../../ui/frames/side/PrivateConversationHistory";
import {AbstractChat, AbstractChatManager} from "tc-shared/ui/frames/side/AbstractConversion"; import {AbstractChat, AbstractChatManager} from "../../../ui/frames/side/AbstractConversion";
export type OutOfViewClient = { export type OutOfViewClient = {
nickname: string, nickname: string,

View file

@ -1,11 +1,11 @@
import {GroupManager} from "tc-shared/permission/GroupManager"; import {GroupManager} from "../../../permission/GroupManager";
import {Frame, FrameContent} from "tc-shared/ui/frames/chat_frame"; import {Frame, FrameContent} from "../../../ui/frames/chat_frame";
import {openClientInfo} from "tc-shared/ui/modal/ModalClientInfo"; import {openClientInfo} from "../../../ui/modal/ModalClientInfo";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../../../ui/htmltags";
import * as image_preview from "../image_preview"; import * as image_preview from "../image_preview";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "../../../i18n/country";
import {ClientEntry, LocalClientEntry} from "tc-shared/tree/Client"; import {ClientEntry, LocalClientEntry} from "../../../tree/Client";
import {format_online_time} from "tc-shared/utils/TimeUtils"; import {format_online_time} from "../../../utils/TimeUtils";
export class ClientInfo { export class ClientInfo {
readonly handle: Frame; readonly handle: Frame;

View file

@ -1,12 +1,12 @@
import {Frame, FrameContent} from "tc-shared/ui/frames/chat_frame"; import {Frame, FrameContent} from "../../../ui/frames/chat_frame";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../../log";
import {CommandResult, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult, PlaylistSong} from "../../../connection/ServerConnectionDeclaration";
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInputModal} from "../../../ui/elements/Modal";
import * as log from "tc-shared/log"; import * as log from "../../../log";
import * as image_preview from "../image_preview"; import * as image_preview from "../image_preview";
import {Registry} from "tc-shared/events"; import {Registry} from "../../../events";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../../connection/ErrorCode";
import {ClientEvents, MusicClientEntry, SongInfo} from "tc-shared/tree/Client"; import {ClientEvents, MusicClientEntry, SongInfo} from "../../../tree/Client";
export interface MusicSidebarEvents { export interface MusicSidebarEvents {
"open": {}, /* triggers when frame should be shown */ "open": {}, /* triggers when frame should be shown */

View file

@ -1,10 +1,10 @@
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
import {ChannelEntry} from "tc-shared/tree/Channel"; import {ChannelEntry} from "../tree/Channel";
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../tree/Client";
import {htmlEscape} from "tc-shared/ui/frames/chat"; import {htmlEscape} from "../ui/frames/chat";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../ui/frames/connection_handlers";
import {guid} from "tc-shared/crypto/uid"; import {guid} from "../crypto/uid";
let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0}; let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0};

View file

@ -1,7 +1,7 @@
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import * as moment from "moment"; import * as moment from "moment";
import * as log from "tc-shared/log"; import * as log from "../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../log";
export function setupJSRender() : boolean { export function setupJSRender() : boolean {
if(!$.views) { if(!$.views) {

View file

@ -1,6 +1,6 @@
import {createModal} from "tc-shared/ui/elements/Modal"; import {createModal} from "../../ui/elements/Modal";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import * as log from "tc-shared/log"; import {LogCategory} from "../../log";
function format_date(date: number) { function format_date(date: number) {
const d = new Date(date); const d = new Date(date);

View file

@ -1,7 +1,7 @@
//TODO: Test if we could render this image and not only the browser by knowing the type. //TODO: Test if we could render this image and not only the browser by knowing the type.
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {tra} from "tc-shared/i18n/localize"; import {tra} from "../../i18n/localize";
import {arrayBufferBase64} from "tc-shared/utils/buffers"; import {arrayBufferBase64} from "../../utils/buffers";
export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined | null) => any) { export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined | null) => any) {
const modal = createModal({ const modal = createModal({

View file

@ -1,10 +1,10 @@
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {LogCategory} from "../../log";
import {base64_encode_ab} from "tc-shared/utils/buffers"; import {ConnectionHandler} from "../../ConnectionHandler";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {base64_encode_ab} from "../../utils/buffers";
import {ClientEntry} from "tc-shared/tree/Client"; import {spawnYesNo} from "../../ui/modal/ModalYesNo";
import * as log from "tc-shared/log"; import {ClientEntry} from "../../tree/Client";
import * as moment from "moment"; import * as moment from "moment";
const avatar_to_uid = (id: string) => { const avatar_to_uid = (id: string) => {
@ -160,8 +160,10 @@ export function spawnAvatarList(client: ConnectionHandler) {
}); });
}; };
button_download.on('click', () => (callback_download || (() => {}))()); button_download.on('click', () => (callback_download || (() => {
button_delete.on('click', () => (callback_delete || (() => {}))()); }))());
button_delete.on('click', () => (callback_delete || (() => {
}))());
setTimeout(() => update_avatar_list(), 250); setTimeout(() => update_avatar_list(), 250);
modal.open(); modal.open();
} }

View file

@ -1,13 +1,14 @@
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {createModal} from "tc-shared/ui/elements/Modal"; import {createModal} from "../../ui/elements/Modal";
import {duration_data} from "tc-shared/ui/modal/ModalBanList"; import {duration_data} from "../../ui/modal/ModalBanList";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
export type BanEntry = { export type BanEntry = {
name?: string; name?: string;
unique_id: string; unique_id: string;
} }
export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | BanEntry[], callback: (data: { export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | BanEntry[], callback: (data: {
length: number, length: number,
reason: string, reason: string,
@ -88,7 +89,9 @@ export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | Ba
}; };
/* initialize ban time */ /* initialize ban time */
Promise.resolve(max_ban_time).catch(error => { /* TODO: Error handling? */ return 0; }).then(max_time => { Promise.resolve(max_ban_time).catch(error => { /* TODO: Error handling? */
return 0;
}).then(max_time => {
let unlimited = max_time == 0 || max_time == -1; let unlimited = max_time == 0 || max_time == -1;
if (unlimited || typeof (max_time) === "undefined") max_time = 0; if (unlimited || typeof (max_time) === "undefined") max_time = 0;

View file

@ -1,15 +1,15 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {createErrorModal, createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase"; import {SingleCommandHandler} from "../../connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import * as log from "tc-shared/log"; import {LogCategory} from "../../log";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../../ui/htmltags";
import {format_time, formatMessage} from "tc-shared/ui/frames/chat"; import {format_time, formatMessage} from "../../ui/frames/chat";
import * as moment from "moment"; import * as moment from "moment";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../connection/ErrorCode";
export function openBanList(client: ConnectionHandler) { export function openBanList(client: ConnectionHandler) {
let modal: Modal; let modal: Modal;
@ -161,10 +161,14 @@ export function openBanList(client: ConnectionHandler) {
if (entry.timestamp_expire) data["time"] = Math.floor((entry.timestamp_expire - entry.timestamp_created) / 1000); if (entry.timestamp_expire) data["time"] = Math.floor((entry.timestamp_expire - entry.timestamp_created) / 1000);
if (typeof (entry.server_id) === "number") data["sid"] = entry.server_id; if (typeof (entry.server_id) === "number") data["sid"] = entry.server_id;
return client.serverConnection.send_command("banadd", data).then(e => { if(!e.success) throw e; }); return client.serverConnection.send_command("banadd", data).then(e => {
if (!e.success) throw e;
});
}, },
edit_ban(data: any): Promise<void> { edit_ban(data: any): Promise<void> {
return client.serverConnection.send_command("banedit", data).then(e => { if(!e.success) throw e; }); return client.serverConnection.send_command("banedit", data).then(e => {
if (!e.success) throw e;
});
}, },
delete_ban(entry_id, server_id): Promise<void> { delete_ban(entry_id, server_id): Promise<void> {
const data = { const data = {
@ -173,7 +177,9 @@ export function openBanList(client: ConnectionHandler) {
if (typeof (server_id) === "number") if (typeof (server_id) === "number")
data["sid"] = server_id; data["sid"] = server_id;
return client.serverConnection.send_command("bandel", data).then(e => { if(!e.success) throw e; }); return client.serverConnection.send_command("bandel", data).then(e => {
if (!e.success) throw e;
});
} }
}; };
@ -233,14 +239,19 @@ interface TriggerEntry {
interface BanListController { interface BanListController {
request_list(callback_bans: (entries: BanEntry[]) => any): Promise<void>; request_list(callback_bans: (entries: BanEntry[]) => any): Promise<void>;
request_trigger_list(ban: { ban_id: number, server_id: number | undefined }, callback_triggers: (entries: TriggerEntry[]) => any): Promise<void>; request_trigger_list(ban: { ban_id: number, server_id: number | undefined }, callback_triggers: (entries: TriggerEntry[]) => any): Promise<void>;
max_bantime(): Promise<number>; max_bantime(): Promise<number>;
permission_edit(): Promise<boolean[]>; permission_edit(): Promise<boolean[]>;
permission_add(): Promise<boolean[]>; permission_add(): Promise<boolean[]>;
add_ban(entry: BanEntry): Promise<void>; add_ban(entry: BanEntry): Promise<void>;
edit_ban(data: any): Promise<void>; edit_ban(data: any): Promise<void>;
delete_ban(entry_id: number, server_id: number | undefined): Promise<void>; delete_ban(entry_id: number, server_id: number | undefined): Promise<void>;
} }
@ -656,7 +667,9 @@ function generate_dom(controller: BanListController) : JQuery {
}; };
/* initialize ban time */ /* initialize ban time */
controller.max_bantime().catch(error => { /* TODO: Error handling? */ return 0; }).then(max_time => { controller.max_bantime().catch(error => { /* TODO: Error handling? */
return 0;
}).then(max_time => {
let unlimited = max_time == 0 || max_time == -1; let unlimited = max_time == 0 || max_time == -1;
if (unlimited) max_time = 0; if (unlimited) max_time = 0;

View file

@ -1,4 +1,4 @@
import {createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createInputModal, createModal, Modal} from "../../ui/elements/Modal";
import { import {
Bookmark, Bookmark,
bookmarks, bookmarks,
@ -9,18 +9,18 @@ import {
delete_bookmark, delete_bookmark,
DirectoryBookmark, DirectoryBookmark,
save_bookmark save_bookmark
} from "tc-shared/bookmarks"; } from "../../bookmarks";
import {connection_log, Regex} from "tc-shared/ui/modal/ModalConnect"; import {connection_log, Regex} from "../../ui/modal/ModalConnect";
import {profiles} from "tc-shared/profiles/ConnectionProfile"; import {profiles} from "../../profiles/ConnectionProfile";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {spawnYesNo} from "../../ui/modal/ModalYesNo";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../settings";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "../../i18n/country";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
import * as top_menu from "../frames/MenuBar"; import * as top_menu from "../frames/MenuBar";
import {control_bar_instance} from "tc-shared/ui/frames/control-bar"; import {control_bar_instance} from "../../ui/frames/control-bar";
import {icon_cache_loader, IconManager} from "tc-shared/file/Icons"; import {icon_cache_loader, IconManager} from "../../file/Icons";
export function spawnBookmarkModal() { export function spawnBookmarkModal() {
let modal: Modal; let modal: Modal;

View file

@ -1,8 +1,8 @@
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../../tree/Client";
import {Slider, sliderfy} from "tc-shared/ui/elements/Slider"; import {Slider, sliderfy} from "../../ui/elements/Slider";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../../ui/htmltags";
import {VoicePlayerLatencySettings} from "tc-shared/voice/VoicePlayer"; import {VoicePlayerLatencySettings} from "../../voice/VoicePlayer";
let modalInstance: Modal; let modalInstance: Modal;
export function spawnChangeLatency(client: ClientEntry, current: VoicePlayerLatencySettings, reset: () => VoicePlayerLatencySettings, apply: (settings: VoicePlayerLatencySettings) => void, callback_flush?: () => any) { export function spawnChangeLatency(client: ClientEntry, current: VoicePlayerLatencySettings, reset: () => VoicePlayerLatencySettings, apply: (settings: VoicePlayerLatencySettings) => void, callback_flush?: () => any) {

View file

@ -1,11 +1,12 @@
//TODO: Use the max limit! //TODO: Use the max limit!
import {sliderfy} from "tc-shared/ui/elements/Slider"; import {sliderfy} from "../../ui/elements/Slider";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../../tree/Client";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../../ui/htmltags";
let modal: Modal; let modal: Modal;
export function spawnChangeVolume(client: ClientEntry, local: boolean, current: number, max: number | undefined, callback: (number) => void) { export function spawnChangeVolume(client: ClientEntry, local: boolean, current: number, max: number | undefined, callback: (number) => void) {
if (modal) modal.close(); if (modal) modal.close();

View file

@ -1,8 +1,8 @@
import {createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {ChannelEntry} from "tc-shared/tree/Channel"; import {ChannelEntry} from "../../tree/Channel";
import {copy_to_clipboard} from "tc-shared/utils/helpers"; import {copy_to_clipboard} from "../../utils/helpers";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
export function openChannelInfo(channel: ChannelEntry) { export function openChannelInfo(channel: ChannelEntry) {
let modal: Modal; let modal: Modal;
@ -39,6 +39,7 @@ export function openChannelInfo(channel: ChannelEntry) {
} }
declare const xbbcode; declare const xbbcode;
function apply_channel_description(container: JQuery, channel: ChannelEntry) { function apply_channel_description(container: JQuery, channel: ChannelEntry) {
const container_value = container.find(".value"); const container_value = container.find(".value");
const container_no_value = container.find(".no-value"); const container_no_value = container.find(".no-value");

View file

@ -1,13 +1,14 @@
import {ClientConnectionInfo, ClientEntry} from "tc-shared/tree/Client"; import {ClientConnectionInfo, ClientEntry} from "../../tree/Client";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {copy_to_clipboard} from "tc-shared/utils/helpers"; import {copy_to_clipboard} from "../../utils/helpers";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "../../i18n/country";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import * as moment from "moment"; import * as moment from "moment";
import {format_number, network} from "tc-shared/ui/frames/chat"; import {format_number, network} from "../../ui/frames/chat";
type InfoUpdateCallback = (info: ClientConnectionInfo) => any; type InfoUpdateCallback = (info: ClientConnectionInfo) => any;
export function openClientInfo(client: ClientEntry) { export function openClientInfo(client: ClientEntry) {
let modal: Modal; let modal: Modal;
let update_callbacks: InfoUpdateCallback[] = []; let update_callbacks: InfoUpdateCallback[] = [];
@ -99,7 +100,10 @@ function format_time(time: number, default_value: string) {
function apply_static_info(client: ClientEntry, tag: JQuery, modal: Modal, callbacks: InfoUpdateCallback[]) { function apply_static_info(client: ClientEntry, tag: JQuery, modal: Modal, callbacks: InfoUpdateCallback[]) {
tag.find(".container-avatar").append( tag.find(".container-avatar").append(
client.channelTree.client.fileManager.avatars.generate_chat_tag({database_id: client.properties.client_database_id, id: client.clientId()}, client.properties.client_unique_identifier) client.channelTree.client.fileManager.avatars.generate_chat_tag({
database_id: client.properties.client_database_id,
id: client.clientId()
}, client.properties.client_unique_identifier)
); );
tag.find(".container-name").append( tag.find(".container-name").append(

View file

@ -1,14 +1,14 @@
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../settings";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import * as log from "tc-shared/log"; import {LogCategory} from "../../log";
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {createModal} from "tc-shared/ui/elements/Modal"; import {createModal} from "../../ui/elements/Modal";
import {ConnectionProfile, default_profile, find_profile, profiles} from "tc-shared/profiles/ConnectionProfile"; import {ConnectionProfile, default_profile, find_profile, profiles} from "../../profiles/ConnectionProfile";
import {KeyCode} from "tc-shared/PPTListener"; import {KeyCode} from "../../PPTListener";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "../../i18n/country";
import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings"; import {spawnSettingsModal} from "../../ui/modal/ModalSettings";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "../../ui/frames/connection_handlers";
import {icon_cache_loader, IconManager} from "tc-shared/file/Icons"; import {icon_cache_loader, IconManager} from "../../file/Icons";
//FIXME: Move this shit out of this file! //FIXME: Move this shit out of this file!
export namespace connection_log { export namespace connection_log {
@ -36,6 +36,7 @@ export namespace connection_log {
} }
let _history: ConnectionEntry[] = []; let _history: ConnectionEntry[] = [];
export function log_connect(address: { hostname: string; port: number }) { export function log_connect(address: { hostname: string; port: number }) {
let entry = _history.find(e => e.address.hostname.toLowerCase() == address.hostname.toLowerCase() && e.address.port == address.port); let entry = _history.find(e => e.address.hostname.toLowerCase() == address.hostname.toLowerCase() && e.address.port == address.port);
if (!entry) { if (!entry) {
@ -106,9 +107,13 @@ export namespace connection_log {
} }
declare const native_client; declare const native_client;
export function spawnConnectModal(options: { export function spawnConnectModal(options: {
default_connect_new_tab?: boolean /* default false */ default_connect_new_tab?: boolean /* default false */
}, defaultHost: { url: string, enforce: boolean} = { url: "ts.TeaSpeak.de", enforce: false}, connect_profile?: { profile: ConnectionProfile, enforce: boolean}) { }, defaultHost: { url: string, enforce: boolean } = {
url: "ts.TeaSpeak.de",
enforce: false
}, connect_profile?: { profile: ConnectionProfile, enforce: boolean }) {
let selected_profile: ConnectionProfile; let selected_profile: ConnectionProfile;
const random_id = (() => { const random_id = (() => {
@ -253,7 +258,10 @@ export function spawnConnectModal(options: {
true, true,
{ {
nickname: input_nickname.val().toString() || input_nickname.attr("placeholder"), nickname: input_nickname.val().toString() || input_nickname.attr("placeholder"),
password: (current_connect_data && current_connect_data.password_hash) ? {password: current_connect_data.password_hash, hashed: true} : {password: input_password.val().toString(), hashed: false} password: (current_connect_data && current_connect_data.password_hash) ? {
password: current_connect_data.password_hash,
hashed: true
} : {password: input_password.val().toString(), hashed: false}
} }
); );
} else { } else {
@ -271,7 +279,10 @@ export function spawnConnectModal(options: {
true, true,
{ {
nickname: input_nickname.val().toString() || input_nickname.attr("placeholder"), nickname: input_nickname.val().toString() || input_nickname.attr("placeholder"),
password: (current_connect_data && current_connect_data.password_hash) ? {password: current_connect_data.password_hash, hashed: true} : {password: input_password.val().toString(), hashed: false} password: (current_connect_data && current_connect_data.password_hash) ? {
password: current_connect_data.password_hash,
hashed: true
} : {password: input_password.val().toString(), hashed: false}
} }
); );
}); });

View file

@ -1,15 +1,15 @@
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {ChannelEntry, ChannelProperties} from "tc-shared/tree/Channel"; import {ChannelEntry, ChannelProperties} from "../../tree/Channel";
import {PermissionManager, PermissionValue} from "tc-shared/permission/PermissionManager"; import {PermissionManager, PermissionValue} from "../../permission/PermissionManager";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {createModal} from "tc-shared/ui/elements/Modal"; import {createModal} from "../../ui/elements/Modal";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {Settings, settings} from "tc-shared/settings"; import {Settings, settings} from "../../settings";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect"; import {spawnIconSelect} from "../../ui/modal/ModalIconSelect";
import {hashPassword} from "tc-shared/utils/helpers"; import {hashPassword} from "../../utils/helpers";
import {sliderfy} from "tc-shared/ui/elements/Slider"; import {sliderfy} from "../../ui/elements/Slider";
export function createChannelModal(connection: ConnectionHandler, channel: ChannelEntry | undefined, parent: ChannelEntry | undefined, permissions: PermissionManager, callback: (properties?: ChannelProperties, permissions?: PermissionValue[]) => any) { export function createChannelModal(connection: ConnectionHandler, channel: ChannelEntry | undefined, parent: ChannelEntry | undefined, permissions: PermissionManager, callback: (properties?: ChannelProperties, permissions?: PermissionValue[]) => any) {
let properties: ChannelProperties = { } as ChannelProperties; //The changes properties let properties: ChannelProperties = { } as ChannelProperties; //The changes properties

View file

@ -1,9 +1,9 @@
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {ClientEntry} from "tc-shared/tree/Client"; import {ClientEntry} from "../../tree/Client";
import {GroupManager, GroupType} from "tc-shared/permission/GroupManager"; import {GroupManager, GroupType} from "../../permission/GroupManager";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
let current_modal: Modal; let current_modal: Modal;
export function createServerGroupAssignmentModal(client: ClientEntry, callback: (groups: number[], flag: boolean) => Promise<boolean>) { export function createServerGroupAssignmentModal(client: ClientEntry, callback: (groups: number[], flag: boolean) => Promise<boolean>) {

View file

@ -1,15 +1,15 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal} from "../../ui/elements/Modal";
import * as log from "tc-shared/log"; import * as log from "../../log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "../../log";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {tra, traj} from "tc-shared/i18n/localize"; import {tra, traj} from "../../i18n/localize";
import {arrayBufferBase64} from "tc-shared/utils/buffers"; import {arrayBufferBase64} from "../../utils/buffers";
import * as crc32 from "tc-shared/crypto/crc32"; import * as crc32 from "../../crypto/crc32";
import {FileInfo} from "tc-shared/file/FileManager"; import {FileInfo} from "../../file/FileManager";
import {FileTransferState, TransferProvider} from "tc-shared/file/Transfer"; import {FileTransferState, TransferProvider} from "../../file/Transfer";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../connection/ErrorCode";
export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id: number) => any, selected_icon?: number) { export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id: number) => any, selected_icon?: number) {
selected_icon = selected_icon || 0; selected_icon = selected_icon || 0;

View file

@ -1,7 +1,7 @@
import {createErrorModal, createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {TeaSpeakIdentity} from "tc-shared/profiles/identities/TeamSpeakIdentity"; import {TeaSpeakIdentity} from "../../profiles/identities/TeamSpeakIdentity";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name: string): Modal { export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name: string): Modal {
let modal: Modal; let modal: Modal;

View file

@ -1,7 +1,7 @@
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "../../settings";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {ServerAddress} from "tc-shared/tree/Server"; import {ServerAddress} from "../../tree/Server";
type URLGeneratorSettings = { type URLGeneratorSettings = {
flag_direct: boolean, flag_direct: boolean,

View file

@ -1,5 +1,5 @@
import {createModal} from "tc-shared/ui/elements/Modal"; import {createModal} from "../../ui/elements/Modal";
import {EventType, key_description, KeyEvent} from "tc-shared/PPTListener"; import {EventType, key_description, KeyEvent} from "../../PPTListener";
import * as ppt from "tc-backend/ppt"; import * as ppt from "tc-backend/ppt";
export function spawnKeySelect(callback: (key?: KeyEvent) => void) { export function spawnKeySelect(callback: (key?: KeyEvent) => void) {

View file

@ -1,18 +1,17 @@
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {MusicClientEntry} from "tc-shared/tree/Client"; import {MusicClientEntry} from "../../tree/Client";
import {Registry} from "tc-shared/events"; import {modal, Registry} from "../../events";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import * as log from "tc-shared/log"; import {LogCategory} from "../../log";
import {tra} from "tc-shared/i18n/localize"; import {tra} from "../../i18n/localize";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import { modal } from "tc-shared/events"; import * as i18nc from "../../i18n/country";
import * as i18nc from "tc-shared/i18n/country"; import {find} from "../../permission/PermissionManager";
import {find} from "tc-shared/permission/PermissionManager"; import * as htmltags from "../../ui/htmltags";
import {ErrorCode} from "../../connection/ErrorCode";
import ServerGroup = find.ServerGroup; import ServerGroup = find.ServerGroup;
import * as htmltags from "tc-shared/ui/htmltags";
import {ErrorCode} from "tc-shared/connection/ErrorCode";
export function openMusicManage(client: ConnectionHandler, bot: MusicClientEntry) { export function openMusicManage(client: ConnectionHandler, bot: MusicClientEntry) {
const ev_registry = new Registry<modal.music_manage>(); const ev_registry = new Registry<modal.music_manage>();
@ -314,7 +313,8 @@ function permission_controller(event_registry: Registry<modal.music_manage>, bot
let is_uuid = false; let is_uuid = false;
try { try {
is_uuid = atob(text).length === 32; is_uuid = atob(text).length === 32;
} catch(e) {} } catch (e) {
}
if (is_uuid) { if (is_uuid) {
return client.serverConnection.command_helper.getInfoFromUniqueId(text); return client.serverConnection.command_helper.getInfoFromUniqueId(text);
} else if (text.match(/^[0-9]{1,7}$/) && !isNaN(parseInt(text))) { } else if (text.match(/^[0-9]{1,7}$/) && !isNaN(parseInt(text))) {

View file

@ -1,13 +1,12 @@
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "tc-shared/ui/elements/Modal";
import {tra} from "tc-shared/i18n/localize"; import {tra} from "tc-shared/i18n/localize";
import {Registry} from "tc-shared/events"; import {modal as emodal, Registry} from "tc-shared/events";
import {modal_settings} from "tc-shared/ui/modal/ModalSettings"; import {modal_settings} from "tc-shared/ui/modal/ModalSettings";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
import {initialize_audio_microphone_controller, MicrophoneSettingsEvents} from "tc-shared/ui/modal/settings/Microphone"; import {initialize_audio_microphone_controller, MicrophoneSettingsEvents} from "tc-shared/ui/modal/settings/Microphone";
import {MicrophoneSettings} from "tc-shared/ui/modal/settings/MicrophoneRenderer"; import {MicrophoneSettings} from "tc-shared/ui/modal/settings/MicrophoneRenderer";
import * as React from "react"; import * as React from "react";
import * as ReactDOM from "react-dom"; import * as ReactDOM from "react-dom";
import { modal as emodal } from "tc-shared/events";
export interface EventModalNewcomer { export interface EventModalNewcomer {
"show_step": { "show_step": {
@ -160,7 +159,10 @@ function initializeStepIdentity(tag: JQuery, event_registry: Registry<EventModal
let stepShown = false; let stepShown = false;
let help_animation_done = false; let help_animation_done = false;
const update_step_status = () => { const update_step_status = () => {
event_registry.fire_async("step-status", { allowNextStep: help_animation_done, allowPreviousStep: help_animation_done }); event_registry.fire_async("step-status", {
allowNextStep: help_animation_done,
allowPreviousStep: help_animation_done
});
}; };
profile_events.on("query-profile-validity-result", event => stepShown && event.status === "success" && event.valid && update_step_status()); profile_events.on("query-profile-validity-result", event => stepShown && event.status === "success" && event.valid && update_step_status());
event_registry.on("show_step", e => { event_registry.on("show_step", e => {

View file

@ -1,13 +1,14 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import * as htmltags from "tc-shared/ui/htmltags"; import * as htmltags from "../../ui/htmltags";
import * as moment from "moment"; import * as moment from "moment";
import {renderBBCodeAsJQuery} from "tc-shared/text/bbcode"; import {renderBBCodeAsJQuery} from "../../text/bbcode";
let global_modal: PokeModal; let global_modal: PokeModal;
export interface ServerEntry { export interface ServerEntry {
source: ConnectionHandler; source: ConnectionHandler;
add_message(invoker: PokeInvoker, message: string); add_message(invoker: PokeInvoker, message: string);
} }
@ -29,7 +30,10 @@ class PokeModal {
this._handle.close_listener.push(() => this._handle_close()); this._handle.close_listener.push(() => this._handle_close());
} }
modal() { return this._handle; } modal() {
return this._handle;
}
add_poke(source: ConnectionHandler, invoker: PokeInvoker, message: string) { add_poke(source: ConnectionHandler, invoker: PokeInvoker, message: string) {
let handler: ServerEntry; let handler: ServerEntry;
for (const entry of this.source_map) for (const entry of this.source_map)

View file

@ -1,7 +1,7 @@
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import {ConnectionHandler} from "../../ConnectionHandler";
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase"; import {SingleCommandHandler} from "../../connection/ConnectionBase";
export function spawnQueryCreate(connection: ConnectionHandler, callback_created?: (user, pass) => any) { export function spawnQueryCreate(connection: ConnectionHandler, callback_created?: (user, pass) => any) {
let modal; let modal;

View file

@ -157,18 +157,18 @@ export function spawnQueryManage(client: ConnectionHandler) {
*/ */
//tmpl_query_manager //tmpl_query_manager
import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "../../ui/elements/Modal";
import {CommandResult, QueryListEntry} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult, QueryListEntry} from "../../connection/ServerConnectionDeclaration";
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase"; import {SingleCommandHandler} from "../../connection/ConnectionBase";
import {copy_to_clipboard} from "tc-shared/utils/helpers"; import {copy_to_clipboard} from "../../utils/helpers";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {spawnYesNo} from "../../ui/modal/ModalYesNo";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import PermissionType from "tc-shared/permission/PermissionType"; import {LogCategory} from "../../log";
import {ConnectionHandler} from "tc-shared/ConnectionHandler"; import PermissionType from "../../permission/PermissionType";
import * as log from "tc-shared/log"; import {ConnectionHandler} from "../../ConnectionHandler";
import {spawnQueryCreate, spawnQueryCreated} from "tc-shared/ui/modal/ModalQuery"; import {spawnQueryCreate, spawnQueryCreated} from "../../ui/modal/ModalQuery";
import {formatMessage} from "tc-shared/ui/frames/chat"; import {formatMessage} from "../../ui/frames/chat";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../connection/ErrorCode";
export function spawnQueryManage(client: ConnectionHandler) { export function spawnQueryManage(client: ConnectionHandler) {
let modal: Modal; let modal: Modal;

View file

@ -1,11 +1,11 @@
import {ServerEntry, ServerProperties} from "tc-shared/tree/Server"; import {ServerEntry, ServerProperties} from "../../tree/Server";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import PermissionType from "tc-shared/permission/PermissionType"; import PermissionType from "../../permission/PermissionType";
import {GroupManager} from "tc-shared/permission/GroupManager"; import {GroupManager} from "../../permission/GroupManager";
import {hashPassword} from "tc-shared/utils/helpers"; import {hashPassword} from "../../utils/helpers";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect"; import {spawnIconSelect} from "../../ui/modal/ModalIconSelect";
import {network} from "tc-shared/ui/frames/chat"; import {network} from "../../ui/frames/chat";
export function createServerModal(server: ServerEntry, callback: (properties?: ServerProperties) => Promise<void>) { export function createServerModal(server: ServerEntry, callback: (properties?: ServerProperties) => Promise<void>) {
const properties = Object.assign({}, server.properties); const properties = Object.assign({}, server.properties);

View file

@ -2,18 +2,18 @@ import {
openServerInfoBandwidth, openServerInfoBandwidth,
RequestInfoStatus, RequestInfoStatus,
ServerBandwidthInfoUpdateCallback ServerBandwidthInfoUpdateCallback
} from "tc-shared/ui/modal/ModalServerInfoBandwidth"; } from "../../ui/modal/ModalServerInfoBandwidth";
import {ServerEntry} from "tc-shared/tree/Server"; import {ServerEntry} from "../../tree/Server";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {createErrorModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createModal, Modal} from "../../ui/elements/Modal";
import {LogCategory} from "tc-shared/log"; import * as log from "../../log";
import * as log from "tc-shared/log"; import {LogCategory} from "../../log";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "../../i18n/country";
import {format_time, formatMessage} from "tc-shared/ui/frames/chat"; import {format_time, formatMessage} from "../../ui/frames/chat";
import {Hostbanner} from "tc-shared/ui/frames/hostbanner"; import {Hostbanner} from "../../ui/frames/hostbanner";
import * as moment from "moment"; import * as moment from "moment";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../connection/ErrorCode";
export function openServerInfo(server: ServerEntry) { export function openServerInfo(server: ServerEntry) {
let modal: Modal; let modal: Modal;
@ -71,7 +71,9 @@ export function openServerInfo(server: ServerEntry) {
modal.htmlTag.find(".button-close").on('click', event => modal.close()); modal.htmlTag.find(".button-close").on('click', event => modal.close());
modal.htmlTag.find(".button-show-bandwidth").on('click', event => { modal.htmlTag.find(".button-show-bandwidth").on('click', event => {
const custom_callbacks = []; const custom_callbacks = [];
const custom_callback_caller = (status, info) => { custom_callbacks.forEach(e => e(status, info)); }; const custom_callback_caller = (status, info) => {
custom_callbacks.forEach(e => e(status, info));
};
update_callbacks.push(custom_callback_caller); update_callbacks.push(custom_callback_caller);
openServerInfoBandwidth(server, custom_callbacks).close_listener.push(() => { openServerInfoBandwidth(server, custom_callbacks).close_listener.push(() => {

View file

@ -1,10 +1,10 @@
import {ServerConnectionInfo, ServerEntry} from "tc-shared/tree/Server"; import {ServerConnectionInfo, ServerEntry} from "../../tree/Server";
import {createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createModal, Modal} from "../../ui/elements/Modal";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {Graph} from "tc-shared/ui/elements/NetGraph"; import {Graph} from "../../ui/elements/NetGraph";
import * as tooltip from "tc-shared/ui/elements/Tooltip"; import * as tooltip from "../../ui/elements/Tooltip";
import {network} from "tc-shared/ui/frames/chat"; import {network} from "../../ui/frames/chat";
import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {ErrorCode} from "../../connection/ErrorCode";
export enum RequestInfoStatus { export enum RequestInfoStatus {
SUCCESS, SUCCESS,

View file

@ -1,7 +1,9 @@
import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal"; import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
import {sliderfy} from "tc-shared/ui/elements/Slider"; import {sliderfy} from "tc-shared/ui/elements/Slider";
import {settings, Settings} from "tc-shared/settings"; import {settings, Settings} from "tc-shared/settings";
import * as sound from "tc-shared/sound/Sounds";
import {manager, set_master_volume, Sound} from "tc-shared/sound/Sounds"; import {manager, set_master_volume, Sound} from "tc-shared/sound/Sounds";
import * as profiles from "tc-shared/profiles/ConnectionProfile";
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile"; import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile";
import {IdentitifyType} from "tc-shared/profiles/Identity"; import {IdentitifyType} from "tc-shared/profiles/Identity";
import {TeaForumIdentity} from "tc-shared/profiles/identities/TeaForumIdentity"; import {TeaForumIdentity} from "tc-shared/profiles/identities/TeaForumIdentity";
@ -9,15 +11,13 @@ import {TeaSpeakIdentity} from "tc-shared/profiles/identities/TeamSpeakIdentity"
import {NameIdentity} from "tc-shared/profiles/identities/NameIdentity"; import {NameIdentity} from "tc-shared/profiles/identities/NameIdentity";
import * as log from "tc-shared/log"; import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log"; import {LogCategory} from "tc-shared/log";
import * as profiles from "tc-shared/profiles/ConnectionProfile"; import * as i18n from "tc-shared/i18n/localize";
import {RepositoryTranslation, TranslationRepository} from "tc-shared/i18n/localize"; import {RepositoryTranslation, TranslationRepository} from "tc-shared/i18n/localize";
import * as events from "tc-shared/events";
import {Registry} from "tc-shared/events"; import {Registry} from "tc-shared/events";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo"; import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
import * as i18n from "tc-shared/i18n/localize";
import * as i18nc from "tc-shared/i18n/country"; import * as i18nc from "tc-shared/i18n/country";
import {server_connections} from "tc-shared/ui/frames/connection_handlers"; import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import * as events from "tc-shared/events";
import * as sound from "tc-shared/sound/Sounds";
import * as forum from "tc-shared/profiles/identities/teaspeak-forum"; import * as forum from "tc-shared/profiles/identities/teaspeak-forum";
import {formatMessage, set_icon_size} from "tc-shared/ui/frames/chat"; import {formatMessage, set_icon_size} from "tc-shared/ui/frames/chat";
import {spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove} from "tc-shared/ui/modal/ModalIdentity"; import {spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove} from "tc-shared/ui/modal/ModalIdentity";
@ -693,8 +693,13 @@ export namespace modal_settings {
export interface ProfileViewSettings { export interface ProfileViewSettings {
forum_setuppable: boolean forum_setuppable: boolean
} }
export function initialize_identity_profiles_controller(event_registry: Registry<events.modal.settings.profiles>) { export function initialize_identity_profiles_controller(event_registry: Registry<events.modal.settings.profiles>) {
const send_error = (event, profile, text) => event_registry.fire_async(event, { status: "error", profile_id: profile, error: text }); const send_error = (event, profile, text) => event_registry.fire_async(event, {
status: "error",
profile_id: profile,
error: text
});
event_registry.on("create-profile", event => { event_registry.on("create-profile", event => {
const profile = profiles.create_new_profile(event.name); const profile = profiles.create_new_profile(event.name);
profiles.mark_need_save(); profiles.mark_need_save();
@ -742,7 +747,10 @@ export namespace modal_settings {
} }
}; };
event_registry.on("query-profile-list", event => { event_registry.on("query-profile-list", event => {
event_registry.fire_async("query-profile-list-result", { status: "success", profiles: profiles.profiles().map(e => build_profile_info(e)) }); event_registry.fire_async("query-profile-list-result", {
status: "success",
profiles: profiles.profiles().map(e => build_profile_info(e))
});
}); });
event_registry.on("query-profile", event => { event_registry.on("query-profile", event => {
@ -753,7 +761,11 @@ export namespace modal_settings {
return; return;
} }
event_registry.fire_async("query-profile-result", { status: "success", profile_id: event.profile_id, info: build_profile_info(profile)}); event_registry.fire_async("query-profile-result", {
status: "success",
profile_id: event.profile_id,
info: build_profile_info(profile)
});
}); });
event_registry.on("set-default-profile", event => { event_registry.on("set-default-profile", event => {
@ -765,7 +777,11 @@ export namespace modal_settings {
} }
const old = profiles.set_default_profile(profile); const old = profiles.set_default_profile(profile);
event_registry.fire_async("set-default-profile-result", { status: "success", old_profile_id: event.profile_id, new_profile_id: old.id }); event_registry.fire_async("set-default-profile-result", {
status: "success",
old_profile_id: event.profile_id,
new_profile_id: old.id
});
}); });
event_registry.on("set-profile-name", event => { event_registry.on("set-profile-name", event => {
@ -778,7 +794,11 @@ export namespace modal_settings {
profile.profile_name = event.name; profile.profile_name = event.name;
profiles.mark_need_save(); profiles.mark_need_save();
event_registry.fire_async("set-profile-name-result", { name: event.name, profile_id: event.profile_id, status: "success" }); event_registry.fire_async("set-profile-name-result", {
name: event.name,
profile_id: event.profile_id,
status: "success"
});
}); });
event_registry.on("set-default-name", event => { event_registry.on("set-default-name", event => {
@ -791,7 +811,11 @@ export namespace modal_settings {
profile.default_username = event.name; profile.default_username = event.name;
profiles.mark_need_save(); profiles.mark_need_save();
event_registry.fire_async("set-default-name-result", { name: event.name, profile_id: event.profile_id, status: "success" }); event_registry.fire_async("set-default-name-result", {
name: event.name,
profile_id: event.profile_id,
status: "success"
});
}); });
event_registry.on("set-identity-name-name", event => { event_registry.on("set-identity-name-name", event => {
@ -808,7 +832,11 @@ export namespace modal_settings {
identity.set_name(event.name); identity.set_name(event.name);
profiles.mark_need_save(); profiles.mark_need_save();
event_registry.fire_async("set-identity-name-name-result", { name: event.name, profile_id: event.profile_id, status: "success" }); event_registry.fire_async("set-identity-name-name-result", {
name: event.name,
profile_id: event.profile_id,
status: "success"
});
}); });
event_registry.on("query-profile-validity", event => { event_registry.on("query-profile-validity", event => {
@ -819,7 +847,11 @@ export namespace modal_settings {
return; return;
} }
event_registry.fire_async("query-profile-validity-result", { status: "success", profile_id: event.profile_id, valid: profile.valid() }); event_registry.fire_async("query-profile-validity-result", {
status: "success",
profile_id: event.profile_id,
valid: profile.valid()
});
}); });
event_registry.on("query-identity-teamspeak", event => { event_registry.on("query-identity-teamspeak", event => {
@ -832,12 +864,20 @@ export namespace modal_settings {
const ts = profile.selected_identity(IdentitifyType.TEAMSPEAK) as TeaSpeakIdentity; const ts = profile.selected_identity(IdentitifyType.TEAMSPEAK) as TeaSpeakIdentity;
if (!ts) { if (!ts) {
event_registry.fire_async("query-identity-teamspeak-result", { status: "error", profile_id: event.profile_id, error: tr("Missing identity") }); event_registry.fire_async("query-identity-teamspeak-result", {
status: "error",
profile_id: event.profile_id,
error: tr("Missing identity")
});
return; return;
} }
ts.level().then(level => { ts.level().then(level => {
event_registry.fire_async("query-identity-teamspeak-result", { status: "success", level: level, profile_id: event.profile_id }); event_registry.fire_async("query-identity-teamspeak-result", {
status: "success",
level: level,
profile_id: event.profile_id
});
}).catch(error => { }).catch(error => {
send_error("query-identity-teamspeak-result", event.profile_id, tr("failed to calculate level")); send_error("query-identity-teamspeak-result", event.profile_id, tr("failed to calculate level"));
}) })
@ -921,7 +961,10 @@ export namespace modal_settings {
profiles.mark_need_save(); profiles.mark_need_save();
identity.level().then(level => { identity.level().then(level => {
event_registry.fire_async("improve-identity-teamspeak-level-update", { profile_id: event.profile_id, new_level: level }); event_registry.fire_async("improve-identity-teamspeak-level-update", {
profile_id: event.profile_id,
new_level: level
});
}).catch(error => { }).catch(error => {
log.error(LogCategory.CLIENT, tr("Failed to calculate identity level after improvement (%o)"), error); log.error(LogCategory.CLIENT, tr("Failed to calculate identity level after improvement (%o)"), error);
}); });
@ -953,6 +996,7 @@ export namespace modal_settings {
}); });
}); });
} }
export function initialize_identity_profiles_view(container: JQuery, event_registry: Registry<events.modal.settings.profiles>, settings: ProfileViewSettings) { export function initialize_identity_profiles_view(container: JQuery, event_registry: Registry<events.modal.settings.profiles>, settings: ProfileViewSettings) {
/* profile list */ /* profile list */
{ {
@ -1328,7 +1372,10 @@ export namespace modal_settings {
if (event.profile_id !== current_profile) return; if (event.profile_id !== current_profile) return;
if (event.status === "success") if (event.status === "success")
event_registry.fire("select-identity-type", { profile_id: event.profile_id, identity_type: event.info.identity_type }); event_registry.fire("select-identity-type", {
profile_id: event.profile_id,
identity_type: event.info.identity_type
});
else else
show_message(error_text(event), false); show_message(error_text(event), false);
}); });
@ -1337,7 +1384,10 @@ export namespace modal_settings {
const type = (select_identity_type.val() as string).toLowerCase(); const type = (select_identity_type.val() as string).toLowerCase();
if (type === "error" || type == "unset") return; if (type === "error" || type == "unset") return;
event_registry.fire("select-identity-type", { profile_id: current_profile, identity_type: type as any }); event_registry.fire("select-identity-type", {
profile_id: current_profile,
identity_type: type as any
});
}); });
} }
@ -1489,7 +1539,10 @@ export namespace modal_settings {
button_export.on('click', event => { button_export.on('click', event => {
createInputModal(tr("File name"), tr("Please enter the file name"), text => !!text, name => { createInputModal(tr("File name"), tr("Please enter the file name"), text => !!text, name => {
if (name) if (name)
event_registry.fire("export-identity-teamspeak", { profile_id: current_profile, filename: name as string }); event_registry.fire("export-identity-teamspeak", {
profile_id: current_profile,
filename: name as string
});
}).open(); }).open();
}); });
} }
@ -1627,7 +1680,10 @@ export namespace modal_settings {
event_registry.on("set-default-profile", event => { event_registry.on("set-default-profile", event => {
clearTimeout(timeouts[event.profile_id]); clearTimeout(timeouts[event.profile_id]);
timeouts[event.profile_id] = setTimeout(() => { timeouts[event.profile_id] = setTimeout(() => {
event_registry.fire("set-default-profile-result", { old_profile_id: event.profile_id, status: "timeout" }); event_registry.fire("set-default-profile-result", {
old_profile_id: event.profile_id,
status: "timeout"
});
}, 5000); }, 5000);
}); });

View file

@ -1,4 +1,4 @@
import {BodyCreator, createModal, ModalFunctions} from "tc-shared/ui/elements/Modal"; import {BodyCreator, createModal, ModalFunctions} from "../../ui/elements/Modal";
export function spawnYesNo(header: BodyCreator, body: BodyCreator, callback: (_: boolean) => any, properties?: { export function spawnYesNo(header: BodyCreator, body: BodyCreator, callback: (_: boolean) => any, properties?: {
text_yes?: string, text_yes?: string,

View file

@ -1,9 +1,9 @@
import * as loader from "tc-loader"; import * as loader from "tc-loader";
import {Stage} from "tc-loader"; import {Stage} from "tc-loader";
import {CssEditorEvents, CssVariable} from "tc-shared/ui/modal/css-editor/Definitions"; import {CssEditorEvents, CssVariable} from "../../../ui/modal/css-editor/Definitions";
import {spawnExternalModal} from "tc-shared/ui/react-elements/external-modal"; import {spawnExternalModal} from "../../../ui/react-elements/external-modal";
import {Registry} from "tc-shared/events"; import {Registry} from "../../../events";
import {LogCategory, logWarn} from "tc-shared/log"; import {LogCategory, logWarn} from "../../../log";
interface CustomVariable { interface CustomVariable {
name: string; name: string;
@ -74,7 +74,11 @@ class CssVariableManager {
} }
setVariable(name: string, value: string) { setVariable(name: string, value: string) {
const customVariable = this.customVariables[name] || (this.customVariables[name] = { name: name, value: undefined, enabled: false }); const customVariable = this.customVariables[name] || (this.customVariables[name] = {
name: name,
value: undefined,
enabled: false
});
customVariable.enabled = true; customVariable.enabled = true;
customVariable.value = value; customVariable.value = value;
this.updateCustomVariables(true); this.updateCustomVariables(true);
@ -160,6 +164,7 @@ class CssVariableManager {
} }
} }
} }
let cssVariableManager: CssVariableManager; let cssVariableManager: CssVariableManager;
export function spawnModalCssVariableEditor() { export function spawnModalCssVariableEditor() {

View file

@ -1,9 +1,9 @@
import * as React from "react"; import * as React from "react";
import {useState} from "react";
import {CssEditorEvents, CssEditorUserData, CssVariable} from "tc-shared/ui/modal/css-editor/Definitions"; import {CssEditorEvents, CssEditorUserData, CssVariable} from "tc-shared/ui/modal/css-editor/Definitions";
import {Registry} from "tc-shared/events"; import {Registry} from "tc-shared/events";
import {Translatable} from "tc-shared/ui/react-elements/i18n"; import {Translatable} from "tc-shared/ui/react-elements/i18n";
import {BoxedInputField, FlatInputField} from "tc-shared/ui/react-elements/InputField"; import {BoxedInputField, FlatInputField} from "tc-shared/ui/react-elements/InputField";
import {useState} from "react";
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots"; import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
import {Checkbox} from "tc-shared/ui/react-elements/Checkbox"; import {Checkbox} from "tc-shared/ui/react-elements/Checkbox";
import {Button} from "tc-shared/ui/react-elements/Button"; import {Button} from "tc-shared/ui/react-elements/Button";
@ -251,7 +251,10 @@ const OverrideVariableInfo = (props: { events: Registry<CssEditorEvents> }) => {
value={overwriteValue || " "} value={overwriteValue || " "}
onInput={text => { onInput={text => {
selectedVariable.customValue = text; selectedVariable.customValue = text;
props.events.fire("action_change_override_value", { value: text, variableName: selectedVariable.name }); props.events.fire("action_change_override_value", {
value: text,
variableName: selectedVariable.name
});
}} }}
/> />
<CssVariableColorPicker events={props.events} selectedVariable={selectedVariable}/> <CssVariableColorPicker events={props.events} selectedVariable={selectedVariable}/>
@ -296,7 +299,10 @@ const CssVariableColorPicker = (props: { events: Registry<CssEditorEvents>, sele
inputTimeout = setTimeout(() => { inputTimeout = setTimeout(() => {
inputTimeout = undefined; inputTimeout = undefined;
props.events.fire("action_change_override_value", { value: currentInput, variableName: props.selectedVariable.name }); props.events.fire("action_change_override_value", {
value: currentInput,
variableName: props.selectedVariable.name
});
}, 150); }, 150);
}} }}
/> />

View file

@ -1,5 +1,12 @@
export type VoiceConnectionState = "connecting" | "connected" | "disconnected" | "unsupported-client" | "unsupported-server"; export type VoiceConnectionState =
export type TestState = { state: "initializing" | "running" | "stopped" | "microphone-invalid" | "unsupported" } | { state: "start-failed", error: string }; "connecting"
| "connected"
| "disconnected"
| "unsupported-client"
| "unsupported-server";
export type TestState =
{ state: "initializing" | "running" | "stopped" | "microphone-invalid" | "unsupported" }
| { state: "start-failed", error: string };
export interface EchoTestEvents { export interface EchoTestEvents {
action_troubleshooting_finished: { status: "test-again" | "aborted" } action_troubleshooting_finished: { status: "test-again" | "aborted" }

View file

@ -91,12 +91,14 @@ const TestStateOverlay = () => {
{state.error} {state.error}
</VariadicTranslatable> </VariadicTranslatable>
<br/> <br/>
<Button type={"small"} color={"green"} onClick={() => events.fire("action_start_test")}><Translatable>Try again</Translatable></Button> <Button type={"small"} color={"green"} onClick={() => events.fire("action_start_test")}><Translatable>Try
again</Translatable></Button>
</a>; </a>;
break; break;
case "unsupported": case "unsupported":
inner = <a key={"initializing"}><Translatable>Echo testing hasn't been supported by the server.</Translatable></a>; inner = <a key={"initializing"}><Translatable>Echo testing hasn't been supported by the
server.</Translatable></a>;
break; break;
} }
@ -125,43 +127,51 @@ const TroubleshootingSoundOverlay = () => {
<ol> <ol>
<li> <li>
<h2><Translatable>Correct microphone selected?</Translatable> <h2><Translatable>Correct microphone selected?</Translatable>
<Button type={"extra-small"} onClick={() => events.fire("action_open_microphone_settings")}> <Button type={"extra-small"}
onClick={() => events.fire("action_open_microphone_settings")}>
<Translatable>Open Microphone settings</Translatable> <Translatable>Open Microphone settings</Translatable>
</Button> </Button>
</h2> </h2>
<p> <p>
<Translatable>Check within the settings, if the right microphone has been selected.</Translatable> <Translatable>Check within the settings, if the right microphone has been
selected.</Translatable>
<Translatable>The indicators will show you any voice activity.</Translatable> <Translatable>The indicators will show you any voice activity.</Translatable>
</p> </p>
</li> </li>
<li> <li>
<h2><Translatable>Are any addons blocking the microphone access?</Translatable></h2> <h2><Translatable>Are any addons blocking the microphone access?</Translatable></h2>
<p> <p>
<Translatable>Some addons might block the access to your microphone. Try to disable all addons and reload the site.</Translatable> <Translatable>Some addons might block the access to your microphone. Try to disable all
addons and reload the site.</Translatable>
</p> </p>
</li> </li>
<li> <li>
<h2><Translatable>Has WebRTC been enabled?</Translatable></h2> <h2><Translatable>Has WebRTC been enabled?</Translatable></h2>
<p> <p>
<VariadicTranslatable text={"In some cases, WebRTC has been disabled. Click {0} to troubleshoot any WebRTC related issues."}> <VariadicTranslatable
<a href={"https://test.webrtc.org"} hrefLang={"en"} target={"_blank"}><Translatable>here</Translatable></a> text={"In some cases, WebRTC has been disabled. Click {0} to troubleshoot any WebRTC related issues."}>
<a href={"https://test.webrtc.org"} hrefLang={"en"}
target={"_blank"}><Translatable>here</Translatable></a>
</VariadicTranslatable> </VariadicTranslatable>
</p> </p>
</li> </li>
<li> <li>
<h2><Translatable>Reload the site</Translatable></h2> <h2><Translatable>Reload the site</Translatable></h2>
<p> <p>
<Translatable>In some cases, reloading the site will already solve the issue for you.</Translatable> <Translatable>In some cases, reloading the site will already solve the issue for
you.</Translatable>
</p> </p>
</li> </li>
<li> <li>
<h2><Translatable>Nothing worked? Submit an issue</Translatable></h2> <h2><Translatable>Nothing worked? Submit an issue</Translatable></h2>
<p> <p>
<VariadicTranslatable text={"If still nothing worked, try to seek help in our {0}."}> <VariadicTranslatable text={"If still nothing worked, try to seek help in our {0}."}>
<a href={"https://forum.teaspeak.de"} hrefLang={"en"} target={"_blank"}><Translatable>forum</Translatable></a> <a href={"https://forum.teaspeak.de"} hrefLang={"en"}
target={"_blank"}><Translatable>forum</Translatable></a>
</VariadicTranslatable> </VariadicTranslatable>
<VariadicTranslatable text={"You can also create a new issue/bug report {0}."}> <VariadicTranslatable text={"You can also create a new issue/bug report {0}."}>
<a href={"https://github.com/TeaSpeak/TeaWeb/issues"} hrefLang={"en"} target={"_blank"}><Translatable>here</Translatable></a> <a href={"https://github.com/TeaSpeak/TeaWeb/issues"} hrefLang={"en"}
target={"_blank"}><Translatable>here</Translatable></a>
</VariadicTranslatable> </VariadicTranslatable>
</p> </p>
</li> </li>
@ -169,11 +179,13 @@ const TroubleshootingSoundOverlay = () => {
</div> </div>
</div> </div>
<div className={cssStyle.buttons}> <div className={cssStyle.buttons}>
<Button type={"small"} color={"red"} onClick={() => events.fire("action_troubleshooting_finished", { status: "aborted" })}> <Button type={"small"} color={"red"}
onClick={() => events.fire("action_troubleshooting_finished", {status: "aborted"})}>
<Translatable>Abort test</Translatable> <Translatable>Abort test</Translatable>
</Button> </Button>
<Button type={"small"} color={"green"} onClick={() => events.fire("action_troubleshooting_finished", { status: "test-again" })}> <Button type={"small"} color={"green"}
onClick={() => events.fire("action_troubleshooting_finished", {status: "test-again"})}>
<Translatable>Test again</Translatable> <Translatable>Test again</Translatable>
</Button> </Button>
</div> </div>
@ -211,13 +223,15 @@ export const EchoTestModal = () => {
</h1> </h1>
<div className={cssStyle.buttons}> <div className={cssStyle.buttons}>
<div className={cssStyle.buttonContainer}> <div className={cssStyle.buttonContainer}>
<div className={cssStyle.button + " " + cssStyle.success} title={tr("Yes")} onClick={() => events.fire("action_test_result", { status: "success" })}> <div className={cssStyle.button + " " + cssStyle.success} title={tr("Yes")}
onClick={() => events.fire("action_test_result", {status: "success"})}>
<ClientIconRenderer icon={ClientIcon.Apply} className={cssStyle.icon}/> <ClientIconRenderer icon={ClientIcon.Apply} className={cssStyle.icon}/>
</div> </div>
<a><Translatable>Yes</Translatable></a> <a><Translatable>Yes</Translatable></a>
</div> </div>
<div className={cssStyle.buttonContainer}> <div className={cssStyle.buttonContainer}>
<div className={cssStyle.button + " " + cssStyle.fail} title={tr("No")} onClick={() => events.fire("action_test_result", { status: "fail" })}> <div className={cssStyle.button + " " + cssStyle.fail} title={tr("No")}
onClick={() => events.fire("action_test_result", {status: "fail"})}>
<ClientIconRenderer icon={ClientIcon.Delete} className={cssStyle.icon}/> <ClientIconRenderer icon={ClientIcon.Delete} className={cssStyle.icon}/>
</div> </div>
<a><Translatable>No</Translatable></a> <a><Translatable>No</Translatable></a>
@ -228,7 +242,8 @@ export const EchoTestModal = () => {
</div> </div>
<div className={cssStyle.footer}> <div className={cssStyle.footer}>
<TestToggle/> <TestToggle/>
<Button color={"red"} type={"small"} onClick={() => events.fire("action_close")}><Translatable>Close</Translatable></Button> <Button color={"red"} type={"small"}
onClick={() => events.fire("action_close")}><Translatable>Close</Translatable></Button>
</div> </div>
<TroubleshootingSoundOverlay/> <TroubleshootingSoundOverlay/>
</div> </div>

View file

@ -37,7 +37,13 @@ import {ErrorCode} from "tc-shared/connection/ErrorCode";
const cssStyle = require("./ModalPermissionEditor.scss"); const cssStyle = require("./ModalPermissionEditor.scss");
export type PermissionEditorTab = "groups-server" | "groups-channel" | "channel" | "client" | "client-channel"; export type PermissionEditorTab = "groups-server" | "groups-channel" | "channel" | "client" | "client-channel";
export type PermissionEditorSubject = "groups-server" | "groups-channel" | "channel" | "client" | "client-channel" | "none"; export type PermissionEditorSubject =
"groups-server"
| "groups-channel"
| "channel"
| "client"
| "client-channel"
| "none";
export const PermissionTabName: { [T in PermissionEditorTab]: { name: string, translated: string } } = { export const PermissionTabName: { [T in PermissionEditorTab]: { name: string, translated: string } } = {
"groups-server": {name: "Server Groups", translated: tr("Server Groups")}, "groups-server": {name: "Server Groups", translated: tr("Server Groups")},
"groups-channel": {name: "Channel Groups", translated: tr("Channel Groups")}, "groups-channel": {name: "Channel Groups", translated: tr("Channel Groups")},
@ -233,6 +239,7 @@ export interface PermissionModalEvents {
notify_destroy: {} notify_destroy: {}
} }
const ActiveTabInfo = (props: { events: Registry<PermissionModalEvents> }) => { const ActiveTabInfo = (props: { events: Registry<PermissionModalEvents> }) => {
const [activeTab, setActiveTab] = useState<PermissionEditorTab>("groups-server"); const [activeTab, setActiveTab] = useState<PermissionEditorTab>("groups-server");
props.events.reactUse("action_activate_tab", event => setActiveTab(event.tab)); props.events.reactUse("action_activate_tab", event => setActiveTab(event.tab));
@ -251,7 +258,8 @@ const TabSelectorEntry = (props: { events: Registry<PermissionModalEvents>, entr
props.events.reactUse("action_activate_tab", event => setActive(event.tab === props.entry)); props.events.reactUse("action_activate_tab", event => setActive(event.tab === props.entry));
return <div className={cssStyle.entry + " " + (active ? cssStyle.selected : "")} onClick={() => !active && props.events.fire("action_activate_tab", { tab: props.entry })}> return <div className={cssStyle.entry + " " + (active ? cssStyle.selected : "")}
onClick={() => !active && props.events.fire("action_activate_tab", {tab: props.entry})}>
<a title={PermissionTabName[props.entry].translated}> <a title={PermissionTabName[props.entry].translated}>
<Translatable trIgnore={true}>{PermissionTabName[props.entry].translated}</Translatable> <Translatable trIgnore={true}>{PermissionTabName[props.entry].translated}</Translatable>
</a> </a>
@ -269,6 +277,7 @@ const TabSelector = (props: { events: Registry<PermissionModalEvents> }) => {
}; };
export type DefaultTabValues = { groupId?: number, channelId?: number, clientDatabaseId?: number }; export type DefaultTabValues = { groupId?: number, channelId?: number, clientDatabaseId?: number };
class PermissionEditorModal extends InternalModal { class PermissionEditorModal extends InternalModal {
readonly modalEvents = new Registry<PermissionModalEvents>(); readonly modalEvents = new Registry<PermissionModalEvents>();
readonly editorEvents = new Registry<PermissionEditorEvents>(); readonly editorEvents = new Registry<PermissionEditorEvents>();
@ -316,7 +325,8 @@ class PermissionEditorModal extends InternalModal {
<ContextDivider id={"permission-editor"} defaultValue={25} direction={"horizontal"}> <ContextDivider id={"permission-editor"} defaultValue={25} direction={"horizontal"}>
<div className={cssStyle.contextContainer + " " + cssStyle.left}> <div className={cssStyle.contextContainer + " " + cssStyle.left}>
<ActiveTabInfo events={this.modalEvents}/> <ActiveTabInfo events={this.modalEvents}/>
<SideBar modalEvents={this.modalEvents} editorEvents={this.editorEvents} connection={this.connection} /> <SideBar modalEvents={this.modalEvents} editorEvents={this.editorEvents}
connection={this.connection}/>
</div> </div>
<div className={cssStyle.contextContainer + " " + cssStyle.right}> <div className={cssStyle.contextContainer + " " + cssStyle.right}>
<TabSelector events={this.modalEvents}/> <TabSelector events={this.modalEvents}/>
@ -337,6 +347,7 @@ export function spawnPermissionEditorModal(connection: ConnectionHandler, defaul
const modal = spawnReactModal(PermissionEditorModal, connection, defaultTab, values); const modal = spawnReactModal(PermissionEditorModal, connection, defaultTab, values);
modal.show(); modal.show();
} }
const spawn = () => spawnPermissionEditorModal(server_connections.active_connection()); const spawn = () => spawnPermissionEditorModal(server_connections.active_connection());
(window as any).spawn_permissions = spawn; (window as any).spawn_permissions = spawn;
@ -403,7 +414,8 @@ const stringifyError = error => {
function initializePermissionModalController(connection: ConnectionHandler, events: Registry<PermissionModalEvents>) { function initializePermissionModalController(connection: ConnectionHandler, events: Registry<PermissionModalEvents>) {
events.on("query_groups", event => { events.on("query_groups", event => {
const groups = event.target === "server" ? connection.groups.serverGroups : connection.groups.channelGroups; const groups = event.target === "server" ? connection.groups.serverGroups : connection.groups.channelGroups;
events.fire_async("query_groups_result", { target: event.target, groups: groups.map(group => { events.fire_async("query_groups_result", {
target: event.target, groups: groups.map(group => {
return { return {
id: group.id, id: group.id,
name: group.name, name: group.name,
@ -417,7 +429,8 @@ function initializePermissionModalController(connection: ConnectionHandler, even
needed_member_remove: group.requiredMemberRemovePower, needed_member_remove: group.requiredMemberRemovePower,
needed_modify_power: group.requiredModifyPower needed_modify_power: group.requiredModifyPower
} as GroupProperties } as GroupProperties
})}); })
});
}); });
/* group update listener */ /* group update listener */
@ -447,7 +460,11 @@ function initializePermissionModalController(connection: ConnectionHandler, even
break; break;
} }
} }
events.fire("notify_group_updated", { target: group.target === GroupTarget.SERVER ? "server" : "channel", id: group.id, properties: updates }); events.fire("notify_group_updated", {
target: group.target === GroupTarget.SERVER ? "server" : "channel",
id: group.id,
properties: updates
});
}); });
const doUnregister = () => { const doUnregister = () => {
@ -529,7 +546,12 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.fire("action_rename_group_result", {id: groupId, status: "success", target: event.target}); events.fire("action_rename_group_result", {id: groupId, status: "success", target: event.target});
}).catch(error => { }).catch(error => {
console.warn(tr("Failed to rename group: %o"), error); console.warn(tr("Failed to rename group: %o"), error);
events.fire("action_rename_group_result", { id: groupId, status: "error", target: event.target, error: stringifyError(error) }); events.fire("action_rename_group_result", {
id: groupId,
status: "error",
target: event.target,
error: stringifyError(error)
});
}); });
}); });
@ -551,7 +573,12 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.fire("action_delete_group_result", {id: groupId, status: "success", target: event.target}); events.fire("action_delete_group_result", {id: groupId, status: "success", target: event.target});
}).catch(error => { }).catch(error => {
console.warn(tr("Failed to delete group: %o"), error); console.warn(tr("Failed to delete group: %o"), error);
events.fire("action_delete_group_result", { id: groupId, status: "error", target: event.target, error: stringifyError(error) }); events.fire("action_delete_group_result", {
id: groupId,
status: "error",
target: event.target,
error: stringifyError(error)
});
}); });
}); });
@ -591,13 +618,15 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.on("query_group_clients", event => { events.on("query_group_clients", event => {
connection.serverConnection.command_helper.requestClientsByServerGroup(event.id).then(clients => { connection.serverConnection.command_helper.requestClientsByServerGroup(event.id).then(clients => {
events.fire("query_group_clients_result", { id: event.id, status: "success", clients: clients.map(e => { events.fire("query_group_clients_result", {
id: event.id, status: "success", clients: clients.map(e => {
return { return {
name: e.client_nickname, name: e.client_nickname,
uniqueId: e.client_unique_identifier, uniqueId: e.client_unique_identifier,
databaseId: e.client_database_id databaseId: e.client_database_id
}; };
})}); })
});
}).catch(error => { }).catch(error => {
if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) { if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
events.fire("query_group_clients_result", {id: event.id, status: "no-permissions"}); events.fire("query_group_clients_result", {id: event.id, status: "no-permissions"});
@ -619,15 +648,28 @@ function initializePermissionModalController(connection: ConnectionHandler, even
sgid: event.id, sgid: event.id,
cldbid: clientDatabaseId cldbid: clientDatabaseId
})).then(() => { })).then(() => {
events.fire("action_server_group_add_client_result", { id: event.id, client: event.client, status: "success" }); events.fire("action_server_group_add_client_result", {
id: event.id,
client: event.client,
status: "success"
});
}).catch(error => { }).catch(error => {
if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) { if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
events.fire("action_server_group_add_client_result", { id: event.id, client: event.client, status: "no-permissions" }); events.fire("action_server_group_add_client_result", {
id: event.id,
client: event.client,
status: "no-permissions"
});
return; return;
} }
console.warn(tr("Failed to add client %s to server group %d: %o"), event.client.toString(), event.id, error); console.warn(tr("Failed to add client %s to server group %d: %o"), event.client.toString(), event.id, error);
events.fire("action_server_group_add_client_result", { id: event.id, client: event.client, status: "error", error: stringifyError(error) }); events.fire("action_server_group_add_client_result", {
id: event.id,
client: event.client,
status: "error",
error: stringifyError(error)
});
}) })
}); });
@ -636,19 +678,35 @@ function initializePermissionModalController(connection: ConnectionHandler, even
sgid: event.id, sgid: event.id,
cldbid: event.client cldbid: event.client
}).then(() => { }).then(() => {
events.fire("action_server_group_remove_client_result", { id: event.id, client: event.client, status: "success" }); events.fire("action_server_group_remove_client_result", {
id: event.id,
client: event.client,
status: "success"
});
}).catch(error => { }).catch(error => {
console.log(tr("Failed to delete client %d from server group %d: %o"), event.client, event.id, error); console.log(tr("Failed to delete client %d from server group %d: %o"), event.client, event.id, error);
events.fire("action_server_group_remove_client_result", { id: event.id, client: event.client, status: "success" }); events.fire("action_server_group_remove_client_result", {
id: event.id,
client: event.client,
status: "success"
});
}); });
}); });
events.on("notify_destroy", connection.channelTree.events.on("notify_channel_updated", event => { events.on("notify_destroy", connection.channelTree.events.on("notify_channel_updated", event => {
if ('channel_icon_id' in event.updatedProperties) if ('channel_icon_id' in event.updatedProperties)
events.fire("notify_channel_updated", { id: event.channel.channelId, property: "icon", value: event.updatedProperties.channel_icon_id }); events.fire("notify_channel_updated", {
id: event.channel.channelId,
property: "icon",
value: event.updatedProperties.channel_icon_id
});
if ('channel_name' in event.updatedProperties) if ('channel_name' in event.updatedProperties)
events.fire("notify_channel_updated", { id: event.channel.channelId, property: "name", value: event.updatedProperties.channel_name }); events.fire("notify_channel_updated", {
id: event.channel.channelId,
property: "name",
value: event.updatedProperties.channel_name
});
})); }));
events.on("query_channels", () => { events.on("query_channels", () => {
@ -682,7 +740,11 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.fire("query_client_info_result", { events.fire("query_client_info_result", {
client: event.client, client: event.client,
state: "success", state: "success",
info: { name: result[0].clientNickname, databaseId: result[0].clientDatabaseId, uniqueId: result[0].clientUniqueId } info: {
name: result[0].clientNickname,
databaseId: result[0].clientDatabaseId,
uniqueId: result[0].clientUniqueId
}
}); });
}).catch(error => { }).catch(error => {
if (error instanceof CommandResult) { if (error instanceof CommandResult) {
@ -823,7 +885,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
return { return {
groupId: group.group.name + " - " + group.group.begin.toString(), groupId: group.group.name + " - " + group.group.begin.toString(),
groupName: group.group.name, groupName: group.group.name,
permissions: group.permissions.map(e => { return { id: e.id, name: e.name, description: e.description }}), permissions: group.permissions.map(e => {
return {id: e.id, name: e.name, description: e.description}
}),
children: (group.children || []).map(visitGroup) children: (group.children || []).map(visitGroup)
}; };
}; };
@ -889,18 +953,23 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
} }
promise.then(permissions => { promise.then(permissions => {
events.fire("query_permission_values_result", { status: "success", permissions: permissions.map(e => { events.fire("query_permission_values_result", {
status: "success", permissions: permissions.map(e => {
return { return {
value: e.value, value: e.value,
name: e.type.name, name: e.type.name,
granted: e.granted_value, granted: e.granted_value,
flagNegate: e.flag_negate, flagNegate: e.flag_negate,
flagSkip: e.flag_skip flagSkip: e.flag_skip
}}) }
})
}); });
}).catch(error => { }).catch(error => {
if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) { if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
events.fire("action_set_mode", { mode: "no-permissions", failedPermission: connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon") }); events.fire("action_set_mode", {
mode: "no-permissions",
failedPermission: connection.permissions.resolveInfo(parseInt(error.json["failed_permid"]))?.name || tr("unknwon")
});
return; return;
} }
@ -978,7 +1047,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
break; break;
} }
promise.then(result => { throw result; }).catch(error => { promise.then(result => {
throw result;
}).catch(error => {
if (error instanceof CommandResult) { if (error instanceof CommandResult) {
if (error.getBulks().length === event.permissions.length) { if (error.getBulks().length === event.permissions.length) {
events.fire("action_set_permissions_result", { events.fire("action_set_permissions_result", {
@ -1078,7 +1149,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
break; break;
} }
promise.then(result => { throw result; }).catch(error => { promise.then(result => {
throw result;
}).catch(error => {
if (error instanceof CommandResult) { if (error instanceof CommandResult) {
if (error.getBulks().length === event.permissions.length) { if (error.getBulks().length === event.permissions.length) {
events.fire("action_remove_permissions_result", { events.fire("action_remove_permissions_result", {
@ -1109,7 +1182,15 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
events.on("action_open_icon_select", event => { events.on("action_open_icon_select", event => {
spawnIconSelect(connection, spawnIconSelect(connection,
id => events.fire("action_set_permissions", { permissions: [{ mode: "value", name: PermissionType.I_ICON_ID, flagSkip: false, flagNegate: false, value: id }] }), id => events.fire("action_set_permissions", {
permissions: [{
mode: "value",
name: PermissionType.I_ICON_ID,
flagSkip: false,
flagNegate: false,
value: id
}]
}),
event.iconId); event.iconId);
}); });
} }

View file

@ -160,6 +160,7 @@ html:root {
&:hover { &:hover {
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
.dropdown { .dropdown {
display: flex; display: flex;
} }
@ -276,7 +277,8 @@ html:root {
} }
} }
&.permission {} &.permission {
}
} }
.header { .header {
@ -420,7 +422,9 @@ html:root {
display: none; display: none;
} }
&.unset {} &.unset {
}
&.noPermissions { &.noPermissions {
justify-content: flex-start; justify-content: flex-start;
padding-top: 2em; padding-top: 2em;

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