Using tr as imported function and changed the shared app declaration build mechanism

canary
WolverinDEV 2020-11-29 14:42:02 +01:00
parent b64e4b4dee
commit 1759fb1756
117 changed files with 265 additions and 146 deletions

View File

@ -280,7 +280,7 @@ namespace server {
options = options_;
files = _files;
if(process.env["ssl_enabled"] || use_https) {
if(process.env["ssl_enabled"] === "1" || use_https) {
//openssl req -nodes -new -x509 -keyout files_key.pem -out files_cert.pem
const key_file = process.env["ssl_key"] || path.join(__dirname, "files_key.pem");
const cert_file = process.env["ssl_cert"] || path.join(__dirname, "files_cert.pem");

View File

@ -13,8 +13,8 @@ declare global {
StaticSettings: any;
}
const tr: typeof window.tr;
const tra: typeof window.tra;
//const tr: typeof window.tr;
//const tra: typeof window.tra;
}
export interface ApplicationLoader {

View File

@ -33,15 +33,15 @@ loader.register_task(Stage.SETUP, {
priority: 1000
});
if(__build.target === "web") {
loader.register_task(Stage.SETUP, {
name: "outdated browser checker",
name: __build.target === "web" ? "outdated browser checker" : "outdated renderer tester",
function: async () => {
const browser = detectBrowser();
navigator.browserSpecs = browser;
if(!browser)
if(!browser) {
return;
}
console.log("Resolved browser manufacturer to \"%s\" version \"%s\" on %s", browser.name, browser.version, browser.os);
if(browser.type !== "browser") {
@ -62,7 +62,6 @@ if(__build.target === "web") {
},
priority: 50
});
}
/* directly disable all context menus */
if(!location.search.match(/(.*[?&]|^)disableGlobalContextMenu=0($|&.*)/)) {

View File

@ -13,3 +13,5 @@ export function set_device(device_id: string) : Promise<void>;
export function current_device() : Device;
export function initializeFromGesture();
export function globalAudioContext() : AudioContext;

View File

@ -1,5 +1,5 @@
import {AddressTarget, ResolveOptions} from "tc-shared/dns";
import {ServerAddress} from "tc-shared/ui/server";
import {ServerAddress} from "tc-shared/tree/Server";
export function supported();
export function resolve_address(address: ServerAddress, options?: ResolveOptions) : Promise<AddressTarget>;

22
shared/declaration_fix.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
declare global {
interface Window {
tr(message: string) : string;
tra(message: string, ...args: (string | number | boolean)[]) : string;
tra(message: string, ...args: any[]) : JQuery[];
log: any;
StaticSettings: any;
detectedBrowser: any;
__native_client_init_shared: any;
}
const tr: typeof window.tr;
const tra: typeof window.tra;
/* webpack compiler variable */
const __build;
const __webpack_require__;
}
export {};

View File

@ -22,7 +22,7 @@ import * as dns from "tc-backend/dns";
import {EventHandler, Registry} from "./events";
import {FileManager} from "./file/FileManager";
import {FileTransferState, TransferProvider} from "./file/Transfer";
import {traj} from "./i18n/localize";
import {traj, tr} from "./i18n/localize";
import {md5} from "./crypto/md5";
import {guid} from "./crypto/uid";
import {ServerEventLog} from "./ui/frames/log/ServerEventLog";

View File

@ -4,6 +4,7 @@ import {Settings, settings} from "./settings";
import * as log from "./log";
import {LogCategory} from "./log";
import {server_connections} from "tc-shared/ConnectionManager";
import { tr } from "./i18n/localize";
export interface KeyControl {
category: string;

View File

@ -1,3 +1,5 @@
import { tr } from "./i18n/localize";
export enum KeyCode {
KEY_CANCEL = 3,
KEY_HELP = 6,

View File

@ -8,6 +8,7 @@ import {VoiceClient} from "../voice/VoiceClient";
import {VoicePlayerEvents, VoicePlayerLatencySettings, VoicePlayerState} from "../voice/VoicePlayer";
import {WhisperSession, WhisperTarget} from "../voice/VoiceWhisper";
import {Registry} from "../events";
import { tr } from "tc-shared/i18n/localize";
class DummyVoiceClient implements VoiceClient {
readonly events: Registry<VoicePlayerEvents>;

View File

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

View File

@ -4,6 +4,7 @@ import {CommandResult} from "../connection/ServerConnectionDeclaration";
import {ErrorCode} from "../connection/ErrorCode";
import {LogCategory, logDebug, logTrace, logWarn} from "../log";
import {ExplicitCommandHandler} from "../connection/AbstractCommandHandler";
import { tr } from "tc-shared/i18n/localize";
export type ServerFeatureSupport = "unsupported" | "supported" | "experimental" | "deprecated";

View File

@ -1,17 +1,16 @@
import {ServerConnection} from "tc-backend/web/connection/ServerConnection";
import {AbstractServerConnection, ServerCommand, ServerConnectionEvents} from "tc-shared/connection/ConnectionBase";
import {ConnectionState} from "tc-shared/ConnectionHandler";
import * as log from "tc-shared/log";
import {LogCategory, logDebug, logError, logTrace, logWarn} from "tc-shared/log";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {tr} from "tc-shared/i18n/localize";
import {tr, tra} from "tc-shared/i18n/localize";
import {Registry} from "tc-shared/events";
import {RemoteRTPAudioTrack, RemoteRTPTrackState, RemoteRTPVideoTrack, TrackClientInfo} from "./RemoteTrack";
import {SdpCompressor, SdpProcessor} from "./SdpUtils";
import {context} from "tc-backend/web/audio/player";
import {ErrorCode} from "tc-shared/connection/ErrorCode";
import {WhisperTarget} from "tc-shared/voice/VoiceWhisper";
import {globalAudioContext} from "tc-backend/audio/player";
const kSdpCompressionMode = 1;
@ -145,7 +144,7 @@ function getIdleTrack(kind: "video" | "audio") : MediaStreamTrack | null {
return dummyVideoTrack;
} else if(kind === "audio") {
if(!dummyAudioTrack) {
const dest = context().createMediaStreamDestination();
const dest = globalAudioContext().createMediaStreamDestination();
dummyAudioTrack = dest.stream.getAudioTracks()[0];
}
@ -459,7 +458,7 @@ export class RTCConnection {
private readonly audioSupport: boolean;
private readonly events: Registry<RTCConnectionEvents>;
private readonly connection: ServerConnection;
private readonly connection: AbstractServerConnection;
private readonly commandHandler: CommandHandler;
private readonly sdpProcessor: SdpProcessor;
@ -489,7 +488,7 @@ export class RTCConnection {
private remoteVideoTracks: {[key: number]: InternalRemoteRTPVideoTrack};
private temporaryStreams: {[key: number]: TemporaryRtpStream} = {};
constructor(connection: ServerConnection, audioSupport: boolean) {
constructor(connection: AbstractServerConnection, audioSupport: boolean) {
this.events = new Registry<RTCConnectionEvents>();
this.connection = connection;
this.sdpProcessor = new SdpProcessor();
@ -511,7 +510,7 @@ export class RTCConnection {
return this.audioSupport;
}
getConnection() : ServerConnection {
getConnection() : AbstractServerConnection {
return this.connection;
}

View File

@ -1,5 +1,6 @@
import {SessionDescription} from "sdp-transform";
import * as sdpTransform from "sdp-transform";
import { tr, tra } from "tc-shared/i18n/localize";
export interface RTCNegotiationMediaMapping {
direction: "sendrecv" | "recvonly" | "sendonly" | "inactive",

View File

@ -1,7 +1,7 @@
import {Registry} from "tc-shared/events";
import {LogCategory, logWarn} from "tc-shared/log";
import {tr} from "tc-shared/i18n/localize";
import * as aplayer from "tc-backend/web/audio/player";
import {globalAudioContext, on_ready} from "tc-backend/audio/player";
export interface TrackClientInfo {
media?: number,
@ -157,13 +157,13 @@ export class RemoteRTPAudioTrack extends RemoteRTPTrack {
}
*/
aplayer.on_ready(() => {
on_ready(() => {
if(!this.mediaStream) {
/* we've already been destroyed */
return;
}
const audioContext = aplayer.context();
const audioContext = globalAudioContext();
this.audioNode = audioContext.createMediaStreamSource(this.mediaStream);
this.gainNode = audioContext.createGain();

View File

@ -1,5 +1,6 @@
import * as sdpTransform from "sdp-transform";
import {MediaDescription} from "sdp-transform";
import { tr } from "tc-shared/i18n/localize";
interface SdpCodec {
payload: number;

View File

@ -7,6 +7,7 @@ import {
import {Registry} from "tc-shared/events";
import {RemoteRTPTrackState, RemoteRTPVideoTrack} from "../RemoteTrack";
import {LogCategory, logWarn} from "tc-shared/log";
import { tr } from "tc-shared/i18n/localize";
export class RtpVideoClient implements VideoClient {
private readonly clientId: number;

View File

@ -4,6 +4,7 @@ import {guid} from "./crypto/uid";
import * as React from "react";
import {useEffect} from "react";
import {unstable_batchedUpdates} from "react-dom";
import { tr } from "./i18n/localize";
export interface Event<Events, T = keyof Events> {
readonly type: T;

View File

@ -11,7 +11,7 @@ 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";
import {tr, tra} from "../i18n/localize";
import {spawnGlobalSettingsEditor} from "tc-shared/ui/modal/global-settings-editor/Controller";
import {spawnModalCssVariableEditor} from "tc-shared/ui/modal/css-editor/Controller";
import {server_connections} from "tc-shared/ConnectionManager";

View File

@ -1,4 +1,5 @@
import {Registry} from "tc-shared/events";
import { tr, tra } from "tc-shared/i18n/localize";
export const kIPCIconChannel = "icons";
export const kGlobalIconHandlerId = "global";

View File

@ -12,6 +12,7 @@ import {IPCChannel} from "../ipc/BrowserIPC";
import {Settings} from "../settings";
import {ChannelMessage} from "../ipc/BrowserIPC";
import {guid} from "../crypto/uid";
import { tr } from "tc-shared/i18n/localize";
function isEquivalent(a, b) {
// Create arrays of property names

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import {Settings, settings} from "./settings";
import * as loader from "tc-loader";
import { tr } from "./i18n/localize";
export enum LogCategory {
CHANNEL,

View File

@ -43,6 +43,10 @@ import "./profiles/ConnectionProfile";
import "./update/UpdaterWeb";
import "./file/LocalIcons";
import "./ui/frames/menu-bar/MainMenu";
import "./connection/rtc/Connection";
import "./connection/rtc/video/Connection";
import "./video/VideoSource";
import "./media/Video";
import {defaultConnectProfile, findConnectProfile} from "tc-shared/profiles/ConnectionProfile";
import {server_connections} from "tc-shared/ConnectionManager";
@ -52,8 +56,6 @@ import {Registry} from "tc-shared/events";
import {ControlBarEvents} from "tc-shared/ui/frames/control-bar/Definitions";
import {ControlBar2} from "tc-shared/ui/frames/control-bar/Renderer";
import {initializeControlBarController} from "tc-shared/ui/frames/control-bar/Controller";
import {spawnVideoSourceSelectModal} from "tc-shared/ui/modal/video-source/Controller";
import {getVideoDriver} from "tc-shared/video/VideoSource";
let preventWelcomeUI = false;
async function initialize() {

View File

@ -1,8 +1,7 @@
import {MediaStreamRequestResult} from "tc-shared/voice/RecorderBase";
import * as log from "tc-shared/log";
import {LogCategory, logWarn} from "tc-shared/log";
import {inputDeviceList} from "tc-backend/web/audio/RecorderDeviceList";
import {Registry} from "tc-shared/events";
import { tr } from "tc-shared/i18n/localize";
export type MediaStreamType = "audio" | "video";
@ -12,11 +11,13 @@ export enum MediaPermissionStatus {
Denied
}
/*
export interface MediaStreamEvents {
notify_permissions_changed: { type: MediaStreamType, newState: MediaPermissionStatus },
}
export const mediaStreamEvents = new Registry<MediaStreamEvents>();
*/
async function requestMediaStream0(constraints: MediaTrackConstraints, type: MediaStreamType, updateDeviceList: boolean) : Promise<MediaStreamRequestResult | MediaStream> {
const beginTimestamp = Date.now();
@ -24,10 +25,6 @@ async function requestMediaStream0(constraints: MediaTrackConstraints, type: Med
log.info(LogCategory.AUDIO, tr("Requesting a %s stream for device %s in group %s"), type, constraints.deviceId, constraints.groupId);
const stream = await navigator.mediaDevices.getUserMedia(type === "audio" ? { audio: constraints } : { video: constraints });
if(updateDeviceList && inputDeviceList.getStatus() === "no-permissions") {
inputDeviceList.refresh().then(() => {}); /* added the then body to avoid a inspection warning... */
}
return stream;
} catch(error) {
if('name' in error) {
@ -107,6 +104,6 @@ export function stopMediaStream(stream: MediaStream) {
stream.getVideoTracks().forEach(track => track.stop());
stream.getAudioTracks().forEach(track => track.stop());
if('stop' in stream) {
stream.stop();
(stream as any).stop();
}
}

View File

@ -6,9 +6,10 @@ import {
VideoSource
} from "tc-shared/video/VideoSource";
import {Registry} from "tc-shared/events";
import {queryMediaPermissions, requestMediaStream, stopMediaStream} from "tc-backend/web/media/Stream";
import {MediaStreamRequestResult} from "tc-shared/voice/RecorderBase";
import {LogCategory, logDebug, logError, logWarn} from "tc-shared/log";
import {queryMediaPermissions, requestMediaStream, stopMediaStream} from "tc-shared/media/Stream";
import { tr } from "tc-shared/i18n/localize";
declare global {
interface MediaDevices {
@ -221,9 +222,14 @@ export class WebVideoDriver implements VideoDriver {
return new WebVideoSource(videoTrack.getSettings().deviceId, tr("Screen"), source);
} catch (error) {
logWarn(LogCategory.VIDEO, tr("Failed to create a screen source: %o"), error);
if(error instanceof Error) {
throw error.message;
} else if(typeof error === "string") {
throw error;
} else {
throw tr("Failed to create screen source");
}
}
return undefined;
}
}

View File

@ -9,6 +9,7 @@ import {formatMessage} from "../ui/frames/chat";
import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import {LogCategory, logDebug, logError} from "tc-shared/log";
import { tr } from "tc-shared/i18n/localize";
export class ConnectionProfile {
id: string;

View File

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

View File

@ -9,6 +9,7 @@ import {LogCategory} from "../../log";
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
import { tr } from "tc-shared/i18n/localize";
class NameHandshakeHandler extends AbstractHandshakeIdentityHandler {
readonly identity: NameIdentity;

View File

@ -10,6 +10,7 @@ import {CommandResult} from "../../connection/ServerConnectionDeclaration";
import {AbstractServerConnection} from "../../connection/ConnectionBase";
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
import * as forum from "./teaspeak-forum";
import { tr } from "tc-shared/i18n/localize";
class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler {
readonly identity: TeaForumIdentity;

View File

@ -3,6 +3,7 @@ import * as loader from "tc-loader";
import * as fidentity from "./TeaForumIdentity";
import * as log from "../../log";
import {LogCategory} from "../../log";
import { tr } from "tc-shared/i18n/localize";
declare global {
interface Window {

View File

@ -1,5 +1,6 @@
/* setup jsrenderer */
import "jsrender";
import { tr } from "./i18n/localize";
if(__build.target === "web") {
(window as any).$ = require("jquery");

View File

@ -3,6 +3,7 @@ import {LogCategory, logTrace} from "./log";
import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import {Registry} from "./events";
import { tr } from "./i18n/localize";
export type ConfigValueTypes = boolean | number | string | object;
export type ConfigValueTypeNames = "boolean" | "number" | "string" | "object";

View File

@ -3,6 +3,7 @@ import {LogCategory} from "../log";
import {Settings, settings} from "../settings";
import {ConnectionHandler} from "../ConnectionHandler";
import * as sbackend from "tc-backend/audio/sounds";
import { tr } from "tc-shared/i18n/localize";
export enum Sound {
SOUND_TEST = "sound.test",

View File

@ -1,5 +1,6 @@
import {LogCategory} from "./log";
import * as log from "./log";
import { tr } from "./i18n/localize";
enum CloseCodes {
UNSET = 3000,

View File

@ -5,6 +5,7 @@ import {LogCategory} from "../log";
import {Settings, settings} from "../settings";
import {renderMarkdownAsBBCode} from "../text/markdown";
import {escapeBBCode} from "../text/bbcode";
import { tr } from "tc-shared/i18n/localize";
const URL_REGEX = /^(([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]{2,63})(?:\/((?:[^\s?]+)?)(?:\?(\S+))?)?$/gm;
function process_urls(message: string) : string {

View File

@ -11,6 +11,7 @@ import {
Token
} from "remarkable/lib";
import {escapeBBCode} from "../text/bbcode";
import { tr } from "tc-shared/i18n/localize";
const { Remarkable } = require("remarkable");
export class MD2BBCodeRenderer {

View File

@ -22,6 +22,7 @@ import {ViewReasonId} from "../ConnectionHandler";
import {EventChannelData} from "../ui/frames/log/Definitions";
import {ErrorCode} from "../connection/ErrorCode";
import {ClientIcon} from "svg-sprites/client-icons";
import { tr } from "tc-shared/i18n/localize";
export enum ChannelType {
PERMANENT,

View File

@ -30,6 +30,7 @@ import {VoiceClient} from "../voice/VoiceClient";
import {VoicePlayerEvents, VoicePlayerState} from "../voice/VoicePlayer";
import {ChannelTreeUIEvents} from "tc-shared/ui/tree/Definitions";
import {VideoClient} from "tc-shared/connection/VideoConnection";
import { tr } from "tc-shared/i18n/localize";
export enum ClientType {
CLIENT_VOICE,

View File

@ -13,6 +13,7 @@ import {spawnAvatarList} from "../ui/modal/ModalAvatarList";
import {connection_log} from "../ui/modal/ModalConnect";
import {Registry} from "../events";
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
import { tr } from "tc-shared/i18n/localize";
export class ServerProperties {
virtualserver_host: string = "";

View File

@ -1,5 +1,6 @@
import {RemoteIcon} from "tc-shared/file/Icons";
import {ClientIcon} from "svg-sprites/client-icons";
import { tr } from "tc-shared/i18n/localize";
export type MenuEntryLabel = {
text: string,

View File

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

View File

@ -2,6 +2,7 @@ import {LogCategory} from "../../log";
import {settings, Settings} from "../../settings";
import * as log from "../../log";
import * as loader from "tc-loader";
import { tr } from "tc-shared/i18n/localize";
export enum ChatType {
GENERAL,

View File

@ -10,6 +10,7 @@ import {MusicInfo} from "../../ui/frames/side/music_info";
import {ConversationManager} from "../../ui/frames/side/ConversationManager";
import {PrivateConversationManager} from "../../ui/frames/side/PrivateConversationManager";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
export enum InfoFrameMode {
NONE = "none",

View File

@ -6,6 +6,7 @@ import {ConnectionHandlerList} from "tc-shared/ui/frames/connection-handler-list
import {server_connections} from "tc-shared/ConnectionManager";
import {LogCategory, logWarn} from "tc-shared/log";
import {ConnectionState} from "tc-shared/ConnectionHandler";
import { tr } from "tc-shared/i18n/localize";
export function initializeConnectionUIList() {
const container = document.getElementById("connection-handler-list");

View File

@ -23,6 +23,7 @@ import {
import {LogCategory, logWarn} from "tc-shared/log";
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
import {VideoBroadcastState, VideoBroadcastType, VideoConnectionStatus} from "tc-shared/connection/VideoConnection";
import { tr } from "tc-shared/i18n/localize";
class InfoController {
private readonly mode: ControlBarMode;

View File

@ -4,6 +4,7 @@ import {Registry} from "tc-shared/events";
import {VoiceConnectionStatus} from "tc-shared/connection/VoiceConnection";
import {VideoConnectionStatus} from "tc-shared/connection/VideoConnection";
import {LogCategory, logError} from "tc-shared/log";
import { tr } from "tc-shared/i18n/localize";
enum StatusNotifyState {
/* no notify has been scheduled */

View File

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

View File

@ -11,6 +11,7 @@ import {formatDate} from "../../../MessageFormatter";
import {Settings, settings} from "../../../settings";
import {server_connections} from "tc-shared/ConnectionManager";
import {getIconManager} from "tc-shared/file/Icons";
import { tra, tr } from "tc-shared/i18n/localize";
export type DispatcherLog<T extends keyof TypeInfo> = (data: TypeInfo[T], handlerId: string, eventType: T) => void;

View File

@ -15,6 +15,7 @@ import {
DirectoryBookmark
} from "tc-shared/bookmarks";
import {getBackend} from "tc-shared/backend";
import { tr } from "tc-shared/i18n/localize";
function renderConnectionItems() {
const items: MenuBarEntry[] = [];

View File

@ -10,7 +10,7 @@ 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 {tra, tr} 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

@ -6,7 +6,7 @@ import {LogCategory} from "../../../log";
import {CommandResult} from "../../../connection/ServerConnectionDeclaration";
import {ServerCommand} from "../../../connection/ConnectionBase";
import {Settings} from "../../../settings";
import {traj} from "../../../i18n/localize";
import {traj, tr} from "../../../i18n/localize";
import {createErrorModal} from "../../../ui/elements/Modal";
import ReactDOM = require("react-dom");
import {

View File

@ -3,6 +3,7 @@ import {Stage} from "tc-loader";
import * as log from "../../../log";
import {LogCategory} from "../../../log";
import {ChatEvent} from "../../../ui/frames/side/ConversationDefinitions";
import { tr } from "tc-shared/i18n/localize";
const clientUniqueId2StoreName = uniqueId => "conversation-" + uniqueId;

View File

@ -19,6 +19,7 @@ import {LogCategory} from "../../../log";
import {queryConversationEvents, registerConversationEvent} from "../../../ui/frames/side/PrivateConversationHistory";
import {AbstractChat, AbstractChatManager} from "../../../ui/frames/side/AbstractConversion";
import {ChannelTreeEvents} from "tc-shared/tree/ChannelTree";
import { tr } from "tc-shared/i18n/localize";
export type OutOfViewClient = {
nickname: string,

View File

@ -7,6 +7,7 @@ import * as i18nc from "../../../i18n/country";
import {ClientEntry, LocalClientEntry} from "../../../tree/Client";
import {format_online_time} from "../../../utils/TimeUtils";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
export class ClientInfo {
readonly handle: Frame;

View File

@ -7,6 +7,7 @@ import * as image_preview from "../image_preview";
import {Registry} from "../../../events";
import {ErrorCode} from "../../../connection/ErrorCode";
import {ClientEvents, MusicClientEntry, SongInfo} from "../../../tree/Client";
import { tr } from "tc-shared/i18n/localize";
export interface MusicSidebarEvents {
"open": {}, /* triggers when frame should be shown */

View File

@ -7,6 +7,7 @@ import {ChannelVideoEvents, kLocalVideoId} from "tc-shared/ui/frames/video/Defin
import {VideoBroadcastState, VideoBroadcastType, VideoConnection} from "tc-shared/connection/VideoConnection";
import {ClientEntry, ClientType, LocalClientEntry, MusicClientEntry} from "tc-shared/tree/Client";
import {LogCategory, logWarn} from "tc-shared/log";
import { tr } from "tc-shared/i18n/localize";
const cssStyle = require("./Renderer.scss");

View File

@ -5,6 +5,7 @@ import {ClientEntry} from "../tree/Client";
import {htmlEscape} from "../ui/frames/chat";
import {guid} from "../crypto/uid";
import {server_connections} from "tc-shared/ConnectionManager";
import { tr } from "tc-shared/i18n/localize";
let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0};

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import {base64_encode_ab} from "../../utils/buffers";
import {spawnYesNo} from "../../ui/modal/ModalYesNo";
import {ClientEntry} from "../../tree/Client";
import * as moment from "moment";
import { tr } from "tc-shared/i18n/localize";
const avatar_to_uid = (id: string) => {
const buffer = new Uint8Array(id.length / 2);

View File

@ -3,6 +3,7 @@ import {ConnectionHandler} from "../../ConnectionHandler";
import {createModal} from "../../ui/elements/Modal";
import {duration_data} from "../../ui/modal/ModalBanList";
import * as tooltip from "../../ui/elements/Tooltip";
import { tr } from "tc-shared/i18n/localize";
export type BanEntry = {
name?: string;

View File

@ -10,6 +10,7 @@ import * as htmltags from "../../ui/htmltags";
import {format_time, formatMessage} from "../../ui/frames/chat";
import * as moment from "moment";
import {ErrorCode} from "../../connection/ErrorCode";
import { tr } from "tc-shared/i18n/localize";
export function openBanList(client: ConnectionHandler) {
let modal: Modal;

View File

@ -19,6 +19,7 @@ import {LogCategory} from "../../log";
import * as i18nc from "../../i18n/country";
import {formatMessage} from "../../ui/frames/chat";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
export function spawnBookmarkModal() {
let modal: Modal;

View File

@ -227,6 +227,26 @@ class VolumeChangeModal extends React.Component<{ clientName: string, maxVolume?
}
}
class VolumeChange extends InternalModal {
private readonly events: Registry<VolumeChangeEvents>;
private readonly client: ClientEntry;
constructor(events: Registry<VolumeChangeEvents>, client: ClientEntry) {
super();
this.events = events;
this.client = client;
}
renderBody() {
return <VolumeChangeModal remote={false} clientName={this.client.clientNickName()} events={this.events} />;
}
title() {
return <Translatable>Change local volume</Translatable>;
}
}
export function spawnClientVolumeChange(client: ClientEntry) {
const events = new Registry<VolumeChangeEvents>();
@ -239,23 +259,33 @@ export function spawnClientVolumeChange(client: ClientEntry) {
client.setAudioVolume(event.newValue);
});
const modal = spawnReactModal(class extends InternalModal {
constructor() {
const modal = spawnReactModal(VolumeChange, events, client);
events.on("close-modal", () => modal.destroy());
modal.show();
return modal;
}
class VolumeChangeBot extends InternalModal {
private readonly events: Registry<VolumeChangeEvents>;
private readonly client: ClientEntry;
private readonly maxValue: number;
constructor(client: ClientEntry, events: Registry<VolumeChangeEvents>, maxValue: number) {
super();
this.maxValue = maxValue;
this.events = events;
this.client = client;
}
renderBody() {
return <VolumeChangeModal remote={false} clientName={client.clientNickName()} events={events} />;
return <VolumeChangeModal remote={true} clientName={this.client.clientNickName()} maxVolume={this.maxValue} events={this.events} />;
}
title() {
return <Translatable>Change local volume</Translatable>;
return <Translatable>Change remote volume</Translatable>;
}
});
events.on("close-modal", event => modal.destroy());
modal.show();
return modal;
}
export function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: number) {
@ -278,19 +308,7 @@ export function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: nu
});
});
const modal = spawnReactModal(class extends InternalModal {
constructor() {
super();
}
renderBody() {
return <VolumeChangeModal remote={true} clientName={client.clientNickName()} maxVolume={maxValue} events={events} />;
}
title() {
return <Translatable>Change remote volume</Translatable>;
}
});
const modal = spawnReactModal(VolumeChangeBot, client, events, maxValue);
events.on("close-modal", event => modal.destroy());
modal.show();

View File

@ -4,6 +4,7 @@ import {copy_to_clipboard} from "../../utils/helpers";
import * as tooltip from "../../ui/elements/Tooltip";
import {formatMessage} from "../../ui/frames/chat";
import {renderBBCodeAsJQuery} from "tc-shared/text/bbcode";
import { tr } from "tc-shared/i18n/localize";
export function openChannelInfo(channel: ChannelEntry) {
let modal: Modal;

View File

@ -7,6 +7,7 @@ import * as tooltip from "../../ui/elements/Tooltip";
import * as moment from "moment";
import {format_number, network} from "../../ui/frames/chat";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
type InfoUpdateCallback = (info: ClientConnectionInfo) => any;

View File

@ -9,6 +9,7 @@ import * as i18nc from "../../i18n/country";
import {spawnSettingsModal} from "../../ui/modal/ModalSettings";
import {server_connections} from "tc-shared/ConnectionManager";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
//FIXME: Move this shit out of this file!
export namespace connection_log {

View File

@ -11,6 +11,7 @@ import {spawnIconSelect} from "../../ui/modal/ModalIconSelect";
import {hashPassword} from "../../utils/helpers";
import {sliderfy} from "../../ui/elements/Slider";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
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

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

View File

@ -2,6 +2,7 @@ import {settings, Settings} from "../../settings";
import {createModal, Modal} from "../../ui/elements/Modal";
import {ConnectionHandler} from "../../ConnectionHandler";
import {ServerAddress} from "../../tree/Server";
import { tr } from "tc-shared/i18n/localize";
type URLGeneratorSettings = {
flag_direct: boolean,
@ -36,7 +37,7 @@ const url_generators: { [key: string]: URLGenerator } = {
"tea-web": {
generate: properties => {
const address = properties.resolved_address ? properties.resolved_address : properties.address;
const address_str = address.host + (address.port === 9987 ? "" : address.port);
const address_str = address.host + (address.port === 9987 ? "" : ":" + address.port);
const parameter = "connect_default=" + (properties.flag_direct ? 1 : 0) + "&connect_address=" + encodeURIComponent(address_str);
let pathbase = "";

View File

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

View File

@ -5,7 +5,7 @@ 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 {tra, tr} from "../../i18n/localize";
import * as tooltip from "../../ui/elements/Tooltip";
import * as i18nc from "../../i18n/country";
import {find} from "../../permission/PermissionManager";
@ -20,7 +20,7 @@ export function openMusicManage(client: ConnectionHandler, bot: MusicClientEntry
permission_controller(ev_registry, bot, client);
let modal = createModal({
header: tr(tr("Playlist Manage")),
header: tr("Playlist Manage"),
body: () => build_modal(ev_registry),
footer: null,

View File

@ -3,6 +3,7 @@ import {createModal, Modal} from "../../ui/elements/Modal";
import * as htmltags from "../../ui/htmltags";
import * as moment from "moment";
import {renderBBCodeAsJQuery} from "../../text/bbcode";
import { tr } from "tc-shared/i18n/localize";
let global_modal: PokeModal;

View File

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

View File

@ -169,6 +169,7 @@ import {ConnectionHandler} from "../../ConnectionHandler";
import {spawnQueryCreate, spawnQueryCreated} from "../../ui/modal/ModalQuery";
import {formatMessage} from "../../ui/frames/chat";
import {ErrorCode} from "../../connection/ErrorCode";
import { tr } from "tc-shared/i18n/localize";
export function spawnQueryManage(client: ConnectionHandler) {
let modal: Modal;

View File

@ -7,6 +7,7 @@ import * as tooltip from "../../ui/elements/Tooltip";
import {spawnIconSelect} from "../../ui/modal/ModalIconSelect";
import {network} from "../../ui/frames/chat";
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
import { tr } from "tc-shared/i18n/localize";
export function createServerModal(server: ServerEntry, callback: (properties?: ServerProperties) => Promise<void>) {
const properties = Object.assign({}, server.properties);

View File

@ -14,6 +14,7 @@ import {format_time, formatMessage} from "../../ui/frames/chat";
import {Hostbanner} from "../../ui/frames/hostbanner";
import * as moment from "moment";
import {ErrorCode} from "../../connection/ErrorCode";
import { tr } from "tc-shared/i18n/localize";
export function openServerInfo(server: ServerEntry) {
let modal: Modal;

View File

@ -5,6 +5,7 @@ import {Graph} from "../../ui/elements/NetGraph";
import * as tooltip from "../../ui/elements/Tooltip";
import {network} from "../../ui/frames/chat";
import {ErrorCode} from "../../connection/ErrorCode";
import { tr } from "tc-shared/i18n/localize";
export enum RequestInfoStatus {
SUCCESS,

View File

@ -4,6 +4,7 @@ import {CssEditorEvents, CssVariable} from "../../../ui/modal/css-editor/Definit
import {spawnExternalModal} from "../../../ui/react-elements/external-modal";
import {Registry} from "../../../events";
import {LogCategory, logWarn} from "../../../log";
import { tr } from "tc-shared/i18n/localize";
interface CustomVariable {
name: string;

View File

@ -9,7 +9,7 @@ import {Entry, MenuEntry, MenuEntryType, spawn_context_menu} from "../../../ui/e
import * as ppt from "tc-backend/ppt";
import {SpecialKey} from "../../../PPTListener";
import {spawnYesNo} from "../../../ui/modal/ModalYesNo";
import {tra, traj} from "../../../i18n/localize";
import {tra, traj, tr} from "../../../i18n/localize";
import {
FileTransfer,
FileTransferState,

View File

@ -232,7 +232,7 @@ function initializeController(events: Registry<ModalVideoSourceEvents>, currentS
fallbackCurrentSourceName = tr("loading...");
driver.createScreenSource().then(stream => {
setCurrentSource(stream);
fallbackCurrentSourceName = stream.getName();
fallbackCurrentSourceName = stream?.getName() || tr("No stream");
}).catch(error => {
fallbackCurrentSourceName = "screen capture failed";
if(typeof error === "string") {

View File

@ -3,6 +3,7 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import {AbstractModal, ModalController, ModalEvents, ModalOptions, ModalState} from "../../../ui/react-elements/ModalDefinitions";
import {InternalModalRenderer} from "../../../ui/react-elements/internal-modal/Renderer";
import { tr } from "tc-shared/i18n/localize";
export class InternalModalController<InstanceType extends InternalModal = InternalModal> implements ModalController {
readonly events: Registry<ModalEvents>;

View File

@ -10,6 +10,7 @@ import {ChannelTree} from "tc-shared/tree/ChannelTree";
import {ModalController} from "tc-shared/ui/react-elements/ModalDefinitions";
import {ChannelTreePopoutEvents} from "tc-shared/ui/tree/popout/Definitions";
import {ConnectionState} from "tc-shared/ConnectionHandler";
import { tr, tra } from "tc-shared/i18n/localize";
export class ChannelTreePopoutController {
readonly channelTree: ChannelTree;

View File

@ -1,6 +1,7 @@
import {Updater} from "./Updater";
import {ChangeLog} from "../update/ChangeLog";
import {spawnUpdatedModal} from "../ui/modal/whats-new/Controller";
import { tr } from "tc-shared/i18n/localize";
const kIsNewUserKey = "updater-set";
let updaterUi: Updater;

View File

@ -1,4 +1,5 @@
import {Settings, settings} from "../settings";
import { tr } from "tc-shared/i18n/localize";
export enum ColloquialFormat {
YESTERDAY,

View File

@ -1,3 +1,5 @@
import { tr } from "tc-shared/i18n/localize";
export function format_online_time(secs: number) : string {
let years = Math.floor(secs / (60 * 60 * 24 * 365));
let days = Math.floor(secs / (60 * 60 * 24)) % 365;

View File

@ -1,4 +1,5 @@
import * as sha1 from "../crypto/sha";
import { tr } from "tc-shared/i18n/localize";
export function hashPassword(password: string) : Promise<string> {
return new Promise<string>((resolve, reject) => {

View File

@ -10,6 +10,7 @@ import {global_client_actions} from "../events/GlobalEvents";
import {createErrorModal} from "../ui/elements/Modal";
import {ModalController} from "../ui/react-elements/ModalDefinitions";
import {server_connections} from "tc-shared/ConnectionManager";
import { tr, tra } from "tc-shared/i18n/localize";
const parseWatcherId = (id: string): { clientId: number, clientUniqueId: string} => {
const [ clientIdString, clientUniqueId ] = id.split(" - ");

View File

@ -1,6 +1,7 @@
import {PluginCmdHandler, PluginCommandInvoker} from "../connection/PluginCmdHandler";
import {Event, Registry} from "../events";
import {PlayerStatus} from "../video-viewer/Definitions";
import { tr } from "tc-shared/i18n/localize";
export interface W2GEvents {
notify_watcher_add: { watcher: W2GWatcher },

View File

@ -1,4 +1,5 @@
import {Registry} from "tc-shared/events";
import { tr } from "tc-shared/i18n/localize";
export interface VideoSource {
getId() : string;

View File

@ -8,6 +8,7 @@ import * as aplayer from "tc-backend/audio/player";
import * as ppt from "tc-backend/ppt";
import {getRecorderBackend, IDevice} from "../audio/recorder";
import {FilterType, StateFilter, ThresholdFilter} from "../voice/Filter";
import { tr } from "tc-shared/i18n/localize";
export type VadType = "threshold" | "push_to_talk" | "active";
export interface RecorderProfileConfig {

View File

@ -1,12 +0,0 @@
{
"source_files": [
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"workers/**/*.ts"
],
"base_directory": "shared/js/",
"target_directory": "../../declarations/shared-app",
"modular": true
}

View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"jsx": "react",
"experimentalDecorators": true,
"declarationDir": "../../declarations/shared-app/",
"declaration": true,
"emitDeclarationOnly": true,
"baseUrl": "../../",
"paths": {
"tc-shared/*": ["shared/js/*"],
// "tc-backend/web/*": ["web/app/*"], /* specific web part */
"tc-backend/*": ["shared/backend.d/*"],
"tc-loader": ["loader/exports/loader.d.ts"],
"svg-sprites/*": ["shared/svg-sprites/*"],
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"]
}
},
"exclude": [
"../js/workers"
],
"include": [
"../declaration_fix.d.ts",
"../backend.d",
"../js/**/*.ts"
]
}

View File

@ -1,30 +0,0 @@
/*
config for generating one single file
Note: loader declarations have to be generated first
*/
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es6",
"module": "none",
"outFile": "../generated/shared.js",
"plugins": [ /* ttypescript */
{
"transform": "../../tools/trgen/ttsc_transformer.js",
"type": "program",
"target_file": "../generated/messages_script.json",
"verbose": true
}
]
},
"exclude": [
"../js/workers"
],
"include": [
"../types",
"../declarations/imports_*.d.ts",
"../declarations/exports_loader_app.d.ts",
"../js/**/*.ts",
"../backend"
]
}

View File

@ -10,14 +10,13 @@
"jsx": "react",
"baseUrl": ".",
"paths": {
"*": ["shared/declarations/*"],
"tc-shared/*": ["shared/js/*"],
"tc-backend/audio-lib/*": ["web/audio-lib/pkg/*"], /* specific web part */
"tc-backend/web/*": ["web/app/*"], /* specific web part */
"tc-backend/*": ["shared/backend.d/*"],
"tc-loader": ["loader/exports/loader.d.ts"],
"svg-sprites/*": ["shared/svg-sprites/*"],
"svg-sprites/*": ["shared/svg-sprites/*"],
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"]
}
},

View File

@ -5,6 +5,7 @@ import {ChannelMessage} from "tc-shared/ipc/BrowserIPC";
import {LogCategory, logDebug, logWarn} from "tc-shared/log";
import {Popout2ControllerMessages, PopoutIPCMessage} from "tc-shared/ui/react-elements/external-modal/IPCMessage";
import {RegistryMap} from "tc-shared/events";
import {tr, tra} from "tc-shared/i18n/localize";
export class ExternalModalController extends AbstractExternalModalController {
private readonly uniqueModalId: string;

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