Resolved all tc-shared imports into relative imports

canary
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 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);
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);
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import {Registry} from "tc-shared/events";
import * as hex from "tc-shared/crypto/hex";
import {Registry} from "../events";
import * as hex from "../crypto/hex";
export const kIPCAvatarChannel = "avatars";
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 {
UNKNOWN,

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import {guid} from "tc-shared/crypto/uid";
import {Settings, StaticSettings} from "tc-shared/settings";
import * as log from "../log";
import {LogCategory} from "../log";
import {guid} from "../crypto/uid";
import {Settings, StaticSettings} from "../settings";
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 {
message: string;

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "tc-shared/ipc/BrowserIPC";
import {guid} from "tc-shared/crypto/uid";
import * as log from "../log";
import {LogCategory} from "../log";
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "../ipc/BrowserIPC";
import {guid} from "../crypto/uid";
export interface MethodProxyInvokeData {
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";
export enum LogCategory {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,18 +1,18 @@
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import * as asn1 from "tc-shared/crypto/asn1";
import * as sha from "tc-shared/crypto/sha";
import * as log from "../../log";
import {LogCategory} from "../../log";
import * as asn1 from "../../crypto/asn1";
import * as sha from "../../crypto/sha";
import {
AbstractHandshakeIdentityHandler,
HandshakeCommandHandler,
IdentitifyType,
Identity
} from "tc-shared/profiles/Identity";
import {arrayBufferBase64, base64_encode_ab, str2ab8} from "tc-shared/utils/buffers";
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {HandshakeIdentityHandler} from "tc-shared/connection/HandshakeHandler";
} from "../../profiles/Identity";
import {arrayBufferBase64, base64_encode_ab, str2ab8} from "../../utils/buffers";
import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
export namespace CryptoHelper {
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 fidentity from "./TeaForumIdentity";
import * as log from "../../log";

View File

@ -1,8 +1,8 @@
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import * as log from "./log";
import {LogCategory} from "./log";
import * as loader 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 ConfigValueTypeNames = "boolean" | "number" | "string" | "object";

View File

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

View File

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

View File

@ -1,10 +1,10 @@
//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;
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import {Settings, settings} from "tc-shared/settings";
import {renderMarkdownAsBBCode} from "tc-shared/text/markdown";
import {escapeBBCode} from "tc-shared/text/bbcode";
import * as log from "../log";
import {LogCategory} from "../log";
import {Settings, settings} from "../settings";
import {renderMarkdownAsBBCode} from "../text/markdown";
import {escapeBBCode} from "../text/bbcode";
const URL_REGEX = /^(([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/((?:[^\s?]+)?)(?:\?(\S+))?)?$/gm;
function process_urls(message: string) : string {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,22 +1,22 @@
import {ChannelTree} from "./ChannelTree";
import {Settings, settings} from "tc-shared/settings";
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
import * as log from "tc-shared/log";
import {LogCategory, LogType} from "tc-shared/log";
import {Sound} from "tc-shared/sound/Sounds";
import * as bookmarks from "tc-shared/bookmarks";
import {spawnInviteEditor} from "tc-shared/ui/modal/ModalInvite";
import {openServerInfo} from "tc-shared/ui/modal/ModalServerInfo";
import {createServerModal} from "tc-shared/ui/modal/ModalServerEdit";
import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect";
import {spawnAvatarList} from "tc-shared/ui/modal/ModalAvatarList";
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {connection_log} from "tc-shared/ui/modal/ModalConnect";
import {Settings, settings} from "../settings";
import * as contextmenu from "../ui/elements/ContextMenu";
import * as log from "../log";
import {LogCategory, LogType} from "../log";
import {Sound} from "../sound/Sounds";
import * as bookmarks from "../bookmarks";
import {spawnInviteEditor} from "../ui/modal/ModalInvite";
import {openServerInfo} from "../ui/modal/ModalServerInfo";
import {createServerModal} from "../ui/modal/ModalServerEdit";
import {spawnIconSelect} from "../ui/modal/ModalIconSelect";
import {spawnAvatarList} from "../ui/modal/ModalAvatarList";
import {server_connections} from "../ui/frames/connection_handlers";
import {connection_log} from "../ui/modal/ModalConnect";
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 * as React from "react";
import {Registry} from "tc-shared/events";
import {Registry} from "../events";
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
export class ServerProperties {

View File

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

View File

@ -1,6 +1,6 @@
import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import {KeyCode} from "tc-shared/PPTListener";
import {KeyCode} from "../../PPTListener";
import * as $ from "jquery";
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 {
min_value?: number;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,14 +2,14 @@ import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import * as log from "../../../log";
import {LogCategory} from "../../../log";
import {EventClient, EventServerAddress, EventType, TypeInfo} from "tc-shared/ui/frames/log/Definitions";
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {renderBBCodeAsText} from "tc-shared/text/bbcode";
import {format_time} from "tc-shared/ui/frames/chat";
import {ViewReasonId} from "tc-shared/ConnectionHandler";
import {findLogDispatcher} from "tc-shared/ui/frames/log/DispatcherLog";
import {formatDate} from "tc-shared/MessageFormatter";
import {Settings, settings} from "tc-shared/settings";
import {EventClient, EventServerAddress, EventType, TypeInfo} from "../../../ui/frames/log/Definitions";
import {server_connections} from "../../../ui/frames/connection_handlers";
import {renderBBCodeAsText} from "../../../text/bbcode";
import {format_time} from "../../../ui/frames/chat";
import {ViewReasonId} from "../../../ConnectionHandler";
import {findLogDispatcher} from "../../../ui/frames/log/DispatcherLog";
import {formatDate} from "../../../MessageFormatter";
import {Settings, settings} from "../../../settings";
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,
ChatState, ConversationHistoryResponse,
ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions";
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {EventHandler, Registry} from "tc-shared/events";
import {preprocessChatMessageForSend} from "tc-shared/text/chat";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import {tra} from "tc-shared/i18n/localize";
import {ErrorCode} from "tc-shared/connection/ErrorCode";
} from "../../../ui/frames/side/ConversationDefinitions";
import {ConnectionHandler} from "../../../ConnectionHandler";
import {EventHandler, Registry} from "../../../events";
import {preprocessChatMessageForSend} from "../../../text/chat";
import {CommandResult} from "../../../connection/ServerConnectionDeclaration";
import * as log from "../../../log";
import {LogCategory} from "../../../log";
import {tra} from "../../../i18n/localize";
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 */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import {ChannelEntry} from "tc-shared/tree/Channel";
import {ClientEntry} from "tc-shared/tree/Client";
import {htmlEscape} from "tc-shared/ui/frames/chat";
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {guid} from "tc-shared/crypto/uid";
import * as log from "../log";
import {LogCategory} from "../log";
import {ChannelEntry} from "../tree/Channel";
import {ClientEntry} from "../tree/Client";
import {htmlEscape} from "../ui/frames/chat";
import {server_connections} from "../ui/frames/connection_handlers";
import {guid} from "../crypto/uid";
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 moment from "moment";
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import * as log from "../log";
import {LogCategory} from "../log";
export function setupJSRender() : boolean {
if(!$.views) {

View File

@ -1,6 +1,6 @@
import {createModal} from "tc-shared/ui/elements/Modal";
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
import {createModal} from "../../ui/elements/Modal";
import * as log from "../../log";
import {LogCategory} from "../../log";
function format_date(date: number) {
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.
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal";
import {tra} from "tc-shared/i18n/localize";
import {arrayBufferBase64} from "tc-shared/utils/buffers";
import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {tra} from "../../i18n/localize";
import {arrayBufferBase64} from "../../utils/buffers";
export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined | null) => any) {
const modal = createModal({

View File

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

View File

@ -1,13 +1,14 @@
import PermissionType from "tc-shared/permission/PermissionType";
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {createModal} from "tc-shared/ui/elements/Modal";
import {duration_data} from "tc-shared/ui/modal/ModalBanList";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import PermissionType from "../../permission/PermissionType";
import {ConnectionHandler} from "../../ConnectionHandler";
import {createModal} from "../../ui/elements/Modal";
import {duration_data} from "../../ui/modal/ModalBanList";
import * as tooltip from "../../ui/elements/Tooltip";
export type BanEntry = {
name?: string;
unique_id: string;
}
export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | BanEntry[], callback: (data: {
length: number,
reason: string,
@ -88,7 +89,9 @@ export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | Ba
};
/* 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;
if (unlimited || typeof (max_time) === "undefined") max_time = 0;

View File

@ -1,15 +1,15 @@
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {createErrorModal, createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
import {SingleCommandHandler} from "tc-shared/connection/ConnectionBase";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import PermissionType from "tc-shared/permission/PermissionType";
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import * as htmltags from "tc-shared/ui/htmltags";
import {format_time, formatMessage} from "tc-shared/ui/frames/chat";
import {ConnectionHandler} from "../../ConnectionHandler";
import {createErrorModal, createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {SingleCommandHandler} from "../../connection/ConnectionBase";
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import PermissionType from "../../permission/PermissionType";
import * as log from "../../log";
import {LogCategory} from "../../log";
import * as tooltip from "../../ui/elements/Tooltip";
import * as htmltags from "../../ui/htmltags";
import {format_time, formatMessage} from "../../ui/frames/chat";
import * as moment from "moment";
import {ErrorCode} from "tc-shared/connection/ErrorCode";
import {ErrorCode} from "../../connection/ErrorCode";
export function openBanList(client: ConnectionHandler) {
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 (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> {
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> {
const data = {
@ -173,7 +177,9 @@ export function openBanList(client: ConnectionHandler) {
if (typeof (server_id) === "number")
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 {
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>;
max_bantime(): Promise<number>;
permission_edit(): Promise<boolean[]>;
permission_add(): Promise<boolean[]>;
add_ban(entry: BanEntry): Promise<void>;
edit_ban(data: any): 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 */
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;
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 {
Bookmark,
bookmarks,
@ -9,18 +9,18 @@ import {
delete_bookmark,
DirectoryBookmark,
save_bookmark
} from "tc-shared/bookmarks";
import {connection_log, Regex} from "tc-shared/ui/modal/ModalConnect";
import {profiles} from "tc-shared/profiles/ConnectionProfile";
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
import {Settings, settings} from "tc-shared/settings";
import * as log from "tc-shared/log";
import {LogCategory} from "tc-shared/log";
import * as i18nc from "tc-shared/i18n/country";
import {formatMessage} from "tc-shared/ui/frames/chat";
} from "../../bookmarks";
import {connection_log, Regex} from "../../ui/modal/ModalConnect";
import {profiles} from "../../profiles/ConnectionProfile";
import {spawnYesNo} from "../../ui/modal/ModalYesNo";
import {Settings, settings} from "../../settings";
import * as log from "../../log";
import {LogCategory} from "../../log";
import * as i18nc from "../../i18n/country";
import {formatMessage} from "../../ui/frames/chat";
import * as top_menu from "../frames/MenuBar";
import {control_bar_instance} from "tc-shared/ui/frames/control-bar";
import {icon_cache_loader, IconManager} from "tc-shared/file/Icons";
import {control_bar_instance} from "../../ui/frames/control-bar";
import {icon_cache_loader, IconManager} from "../../file/Icons";
export function spawnBookmarkModal() {
let modal: Modal;

View File

@ -1,8 +1,8 @@
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
import {ClientEntry} from "tc-shared/tree/Client";
import {Slider, sliderfy} from "tc-shared/ui/elements/Slider";
import * as htmltags from "tc-shared/ui/htmltags";
import {VoicePlayerLatencySettings} from "tc-shared/voice/VoicePlayer";
import {createModal, Modal} from "../../ui/elements/Modal";
import {ClientEntry} from "../../tree/Client";
import {Slider, sliderfy} from "../../ui/elements/Slider";
import * as htmltags from "../../ui/htmltags";
import {VoicePlayerLatencySettings} from "../../voice/VoicePlayer";
let modalInstance: Modal;
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!
import {sliderfy} from "tc-shared/ui/elements/Slider";
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
import {ClientEntry} from "tc-shared/tree/Client";
import * as htmltags from "tc-shared/ui/htmltags";
import {sliderfy} from "../../ui/elements/Slider";
import {createModal, Modal} from "../../ui/elements/Modal";
import {ClientEntry} from "../../tree/Client";
import * as htmltags from "../../ui/htmltags";
let modal: Modal;
export function spawnChangeVolume(client: ClientEntry, local: boolean, current: number, max: number | undefined, callback: (number) => void) {
if (modal) modal.close();

View File

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

View File

@ -1,13 +1,14 @@
import {ClientConnectionInfo, ClientEntry} from "tc-shared/tree/Client";
import PermissionType from "tc-shared/permission/PermissionType";
import {createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
import {copy_to_clipboard} from "tc-shared/utils/helpers";
import * as i18nc from "tc-shared/i18n/country";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import {ClientConnectionInfo, ClientEntry} from "../../tree/Client";
import PermissionType from "../../permission/PermissionType";
import {createInfoModal, createModal, Modal} from "../../ui/elements/Modal";
import {copy_to_clipboard} from "../../utils/helpers";
import * as i18nc from "../../i18n/country";
import * as tooltip from "../../ui/elements/Tooltip";
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;
export function openClientInfo(client: ClientEntry) {
let modal: Modal;
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[]) {
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(

View File

@ -1,14 +1,14 @@
import {Settings, settings} from "tc-shared/settings";
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
import {Settings, settings} from "../../settings";
import * as log from "../../log";
import {LogCategory} from "../../log";
import * as loader from "tc-loader";
import {createModal} from "tc-shared/ui/elements/Modal";
import {ConnectionProfile, default_profile, find_profile, profiles} from "tc-shared/profiles/ConnectionProfile";
import {KeyCode} from "tc-shared/PPTListener";
import * as i18nc from "tc-shared/i18n/country";
import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings";
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {icon_cache_loader, IconManager} from "tc-shared/file/Icons";
import {createModal} from "../../ui/elements/Modal";
import {ConnectionProfile, default_profile, find_profile, profiles} from "../../profiles/ConnectionProfile";
import {KeyCode} from "../../PPTListener";
import * as i18nc from "../../i18n/country";
import {spawnSettingsModal} from "../../ui/modal/ModalSettings";
import {server_connections} from "../../ui/frames/connection_handlers";
import {icon_cache_loader, IconManager} from "../../file/Icons";
//FIXME: Move this shit out of this file!
export namespace connection_log {
@ -36,6 +36,7 @@ export namespace connection_log {
}
let _history: ConnectionEntry[] = [];
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);
if (!entry) {
@ -106,9 +107,13 @@ export namespace connection_log {
}
declare const native_client;
export function spawnConnectModal(options: {
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;
const random_id = (() => {
@ -253,7 +258,10 @@ export function spawnConnectModal(options: {
true,
{
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 {
@ -271,7 +279,10 @@ export function spawnConnectModal(options: {
true,
{
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 {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {ChannelEntry, ChannelProperties} from "tc-shared/tree/Channel";
import {PermissionManager, PermissionValue} from "tc-shared/permission/PermissionManager";
import {LogCategory} from "tc-shared/log";
import {createModal} from "tc-shared/ui/elements/Modal";
import * as log from "tc-shared/log";
import {Settings, settings} from "tc-shared/settings";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect";
import {hashPassword} from "tc-shared/utils/helpers";
import {sliderfy} from "tc-shared/ui/elements/Slider";
import PermissionType from "../../permission/PermissionType";
import {ConnectionHandler} from "../../ConnectionHandler";
import {ChannelEntry, ChannelProperties} from "../../tree/Channel";
import {PermissionManager, PermissionValue} from "../../permission/PermissionManager";
import {LogCategory} from "../../log";
import {createModal} from "../../ui/elements/Modal";
import * as log from "../../log";
import {Settings, settings} from "../../settings";
import * as tooltip from "../../ui/elements/Tooltip";
import {spawnIconSelect} from "../../ui/modal/ModalIconSelect";
import {hashPassword} from "../../utils/helpers";
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) {
let properties: ChannelProperties = { } as ChannelProperties; //The changes properties

View File

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

View File

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

View File

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

View File

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

View File

@ -1,18 +1,17 @@
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal";
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {MusicClientEntry} from "tc-shared/tree/Client";
import {Registry} from "tc-shared/events";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
import {tra} from "tc-shared/i18n/localize";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import { modal } from "tc-shared/events";
import * as i18nc from "tc-shared/i18n/country";
import {find} from "tc-shared/permission/PermissionManager";
import {createErrorModal, createModal} from "../../ui/elements/Modal";
import {ConnectionHandler} from "../../ConnectionHandler";
import {MusicClientEntry} from "../../tree/Client";
import {modal, Registry} from "../../events";
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import * as log from "../../log";
import {LogCategory} from "../../log";
import {tra} from "../../i18n/localize";
import * as tooltip from "../../ui/elements/Tooltip";
import * as i18nc from "../../i18n/country";
import {find} from "../../permission/PermissionManager";
import * as htmltags from "../../ui/htmltags";
import {ErrorCode} from "../../connection/ErrorCode";
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) {
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;
try {
is_uuid = atob(text).length === 32;
} catch(e) {}
} catch (e) {
}
if (is_uuid) {
return client.serverConnection.command_helper.getInfoFromUniqueId(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 {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 {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
import {initialize_audio_microphone_controller, MicrophoneSettingsEvents} from "tc-shared/ui/modal/settings/Microphone";
import {MicrophoneSettings} from "tc-shared/ui/modal/settings/MicrophoneRenderer";
import * as React from "react";
import * as ReactDOM from "react-dom";
import { modal as emodal } from "tc-shared/events";
export interface EventModalNewcomer {
"show_step": {
@ -160,7 +159,10 @@ function initializeStepIdentity(tag: JQuery, event_registry: Registry<EventModal
let stepShown = false;
let help_animation_done = false;
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());
event_registry.on("show_step", e => {

View File

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

View File

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

View File

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

View File

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

View File

@ -2,18 +2,18 @@ import {
openServerInfoBandwidth,
RequestInfoStatus,
ServerBandwidthInfoUpdateCallback
} from "tc-shared/ui/modal/ModalServerInfoBandwidth";
import {ServerEntry} from "tc-shared/tree/Server";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {createErrorModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
import * as tooltip from "tc-shared/ui/elements/Tooltip";
import * as i18nc from "tc-shared/i18n/country";
import {format_time, formatMessage} from "tc-shared/ui/frames/chat";
import {Hostbanner} from "tc-shared/ui/frames/hostbanner";
} from "../../ui/modal/ModalServerInfoBandwidth";
import {ServerEntry} from "../../tree/Server";
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {createErrorModal, createModal, Modal} from "../../ui/elements/Modal";
import * as log from "../../log";
import {LogCategory} from "../../log";
import * as tooltip from "../../ui/elements/Tooltip";
import * as i18nc from "../../i18n/country";
import {format_time, formatMessage} from "../../ui/frames/chat";
import {Hostbanner} from "../../ui/frames/hostbanner";
import * as moment from "moment";
import {ErrorCode} from "tc-shared/connection/ErrorCode";
import {ErrorCode} from "../../connection/ErrorCode";
export function openServerInfo(server: ServerEntry) {
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-show-bandwidth").on('click', event => {
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);
openServerInfoBandwidth(server, custom_callbacks).close_listener.push(() => {

View File

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

View File

@ -1,7 +1,9 @@
import {createErrorModal, createInfoModal, createInputModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
import {sliderfy} from "tc-shared/ui/elements/Slider";
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 * as profiles from "tc-shared/profiles/ConnectionProfile";
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile";
import {IdentitifyType} from "tc-shared/profiles/Identity";
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 * as log 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 * as events from "tc-shared/events";
import {Registry} from "tc-shared/events";
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 {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 {formatMessage, set_icon_size} from "tc-shared/ui/frames/chat";
import {spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove} from "tc-shared/ui/modal/ModalIdentity";
@ -693,8 +693,13 @@ export namespace modal_settings {
export interface ProfileViewSettings {
forum_setuppable: boolean
}
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 => {
const profile = profiles.create_new_profile(event.name);
profiles.mark_need_save();
@ -742,7 +747,10 @@ export namespace modal_settings {
}
};
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 => {
@ -753,7 +761,11 @@ export namespace modal_settings {
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 => {
@ -765,7 +777,11 @@ export namespace modal_settings {
}
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 => {
@ -778,7 +794,11 @@ export namespace modal_settings {
profile.profile_name = event.name;
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 => {
@ -791,7 +811,11 @@ export namespace modal_settings {
profile.default_username = event.name;
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 => {
@ -808,7 +832,11 @@ export namespace modal_settings {
identity.set_name(event.name);
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 => {
@ -819,7 +847,11 @@ export namespace modal_settings {
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 => {
@ -832,12 +864,20 @@ export namespace modal_settings {
const ts = profile.selected_identity(IdentitifyType.TEAMSPEAK) as TeaSpeakIdentity;
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;
}
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 => {
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();
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 => {
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) {
/* profile list */
{
@ -1328,7 +1372,10 @@ export namespace modal_settings {
if (event.profile_id !== current_profile) return;
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
show_message(error_text(event), false);
});
@ -1337,7 +1384,10 @@ export namespace modal_settings {
const type = (select_identity_type.val() as string).toLowerCase();
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 => {
createInputModal(tr("File name"), tr("Please enter the file name"), text => !!text, 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();
});
}
@ -1627,7 +1680,10 @@ export namespace modal_settings {
event_registry.on("set-default-profile", event => {
clearTimeout(timeouts[event.profile_id]);
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);
});

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?: {
text_yes?: string,

View File

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

View File

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

View File

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

View File

@ -91,12 +91,14 @@ const TestStateOverlay = () => {
{state.error}
</VariadicTranslatable>
<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>;
break;
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;
}
@ -125,43 +127,51 @@ const TroubleshootingSoundOverlay = () => {
<ol>
<li>
<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>
</Button>
</h2>
<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>
</p>
</li>
<li>
<h2><Translatable>Are any addons blocking the microphone access?</Translatable></h2>
<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>
</li>
<li>
<h2><Translatable>Has WebRTC been enabled?</Translatable></h2>
<p>
<VariadicTranslatable 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
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>
</p>
</li>
<li>
<h2><Translatable>Reload the site</Translatable></h2>
<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>
</li>
<li>
<h2><Translatable>Nothing worked? Submit an issue</Translatable></h2>
<p>
<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 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>
</p>
</li>
@ -169,11 +179,13 @@ const TroubleshootingSoundOverlay = () => {
</div>
</div>
<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>
</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>
</Button>
</div>
@ -211,13 +223,15 @@ export const EchoTestModal = () => {
</h1>
<div className={cssStyle.buttons}>
<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}/>
</div>
<a><Translatable>Yes</Translatable></a>
</div>
<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}/>
</div>
<a><Translatable>No</Translatable></a>
@ -228,7 +242,8 @@ export const EchoTestModal = () => {
</div>
<div className={cssStyle.footer}>
<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>
<TroubleshootingSoundOverlay/>
</div>

View File

@ -37,7 +37,13 @@ import {ErrorCode} from "tc-shared/connection/ErrorCode";
const cssStyle = require("./ModalPermissionEditor.scss");
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 } } = {
"groups-server": {name: "Server Groups", translated: tr("Server Groups")},
"groups-channel": {name: "Channel Groups", translated: tr("Channel Groups")},
@ -233,6 +239,7 @@ export interface PermissionModalEvents {
notify_destroy: {}
}
const ActiveTabInfo = (props: { events: Registry<PermissionModalEvents> }) => {
const [activeTab, setActiveTab] = useState<PermissionEditorTab>("groups-server");
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));
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}>
<Translatable trIgnore={true}>{PermissionTabName[props.entry].translated}</Translatable>
</a>
@ -269,6 +277,7 @@ const TabSelector = (props: { events: Registry<PermissionModalEvents> }) => {
};
export type DefaultTabValues = { groupId?: number, channelId?: number, clientDatabaseId?: number };
class PermissionEditorModal extends InternalModal {
readonly modalEvents = new Registry<PermissionModalEvents>();
readonly editorEvents = new Registry<PermissionEditorEvents>();
@ -316,7 +325,8 @@ class PermissionEditorModal extends InternalModal {
<ContextDivider id={"permission-editor"} defaultValue={25} direction={"horizontal"}>
<div className={cssStyle.contextContainer + " " + cssStyle.left}>
<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 className={cssStyle.contextContainer + " " + cssStyle.right}>
<TabSelector events={this.modalEvents}/>
@ -337,6 +347,7 @@ export function spawnPermissionEditorModal(connection: ConnectionHandler, defaul
const modal = spawnReactModal(PermissionEditorModal, connection, defaultTab, values);
modal.show();
}
const spawn = () => spawnPermissionEditorModal(server_connections.active_connection());
(window as any).spawn_permissions = spawn;
@ -403,7 +414,8 @@ const stringifyError = error => {
function initializePermissionModalController(connection: ConnectionHandler, events: Registry<PermissionModalEvents>) {
events.on("query_groups", event => {
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 {
id: group.id,
name: group.name,
@ -417,7 +429,8 @@ function initializePermissionModalController(connection: ConnectionHandler, even
needed_member_remove: group.requiredMemberRemovePower,
needed_modify_power: group.requiredModifyPower
} as GroupProperties
})});
})
});
});
/* group update listener */
@ -447,7 +460,11 @@ function initializePermissionModalController(connection: ConnectionHandler, even
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 = () => {
@ -529,7 +546,12 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.fire("action_rename_group_result", {id: groupId, status: "success", target: event.target});
}).catch(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});
}).catch(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 => {
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 {
name: e.client_nickname,
uniqueId: e.client_unique_identifier,
databaseId: e.client_database_id
};
})});
})
});
}).catch(error => {
if (error instanceof CommandResult && error.id === ErrorCode.SERVER_INSUFFICIENT_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,
cldbid: clientDatabaseId
})).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 => {
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;
}
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,
cldbid: event.client
}).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 => {
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 => {
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)
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", () => {
@ -682,7 +740,11 @@ function initializePermissionModalController(connection: ConnectionHandler, even
events.fire("query_client_info_result", {
client: event.client,
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 => {
if (error instanceof CommandResult) {
@ -823,7 +885,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
return {
groupId: group.group.name + " - " + group.group.begin.toString(),
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)
};
};
@ -889,18 +953,23 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
}
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 {
value: e.value,
name: e.type.name,
granted: e.granted_value,
flagNegate: e.flag_negate,
flagSkip: e.flag_skip
}})
}
})
});
}).catch(error => {
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;
}
@ -978,7 +1047,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
break;
}
promise.then(result => { throw result; }).catch(error => {
promise.then(result => {
throw result;
}).catch(error => {
if (error instanceof CommandResult) {
if (error.getBulks().length === event.permissions.length) {
events.fire("action_set_permissions_result", {
@ -1078,7 +1149,9 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
break;
}
promise.then(result => { throw result; }).catch(error => {
promise.then(result => {
throw result;
}).catch(error => {
if (error instanceof CommandResult) {
if (error.getBulks().length === event.permissions.length) {
events.fire("action_remove_permissions_result", {
@ -1109,7 +1182,15 @@ function initializePermissionEditor(connection: ConnectionHandler, modalEvents:
events.on("action_open_icon_select", event => {
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);
});
}

View File

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

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