diff --git a/file.ts b/file.ts index 5c36d422..a2867ad6 100644 --- a/file.ts +++ b/file.ts @@ -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"); diff --git a/loader/app/loader/loader.ts b/loader/app/loader/loader.ts index 3755d38a..d4a00b4a 100644 --- a/loader/app/loader/loader.ts +++ b/loader/app/loader/loader.ts @@ -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 { diff --git a/loader/app/targets/shared.ts b/loader/app/targets/shared.ts index 19bced8e..5a6a1892 100644 --- a/loader/app/targets/shared.ts +++ b/loader/app/targets/shared.ts @@ -33,36 +33,35 @@ loader.register_task(Stage.SETUP, { priority: 1000 }); -if(__build.target === "web") { - loader.register_task(Stage.SETUP, { - name: "outdated browser checker", - function: async () => { - const browser = detectBrowser(); - navigator.browserSpecs = browser; +loader.register_task(Stage.SETUP, { + name: __build.target === "web" ? "outdated browser checker" : "outdated renderer tester", + function: async () => { + const browser = detectBrowser(); + navigator.browserSpecs = browser; - if(!browser) - return; + if(!browser) { + return; + } - console.log("Resolved browser manufacturer to \"%s\" version \"%s\" on %s", browser.name, browser.version, browser.os); - if(browser.type !== "browser") { - loader.critical_error("Your device isn't supported.", "User agent type " + browser.type + " isn't supported."); - throw "unsupported user type"; - } + console.log("Resolved browser manufacturer to \"%s\" version \"%s\" on %s", browser.name, browser.version, browser.os); + if(browser.type !== "browser") { + loader.critical_error("Your device isn't supported.", "User agent type " + browser.type + " isn't supported."); + throw "unsupported user type"; + } - window.detectedBrowser = browser; + window.detectedBrowser = browser; - switch (browser?.name) { - case "aol": - case "crios": - case "ie": - loader.critical_error("Browser not supported", "We're sorry, but your browser isn't supported."); - throw "unsupported browser"; + switch (browser?.name) { + case "aol": + case "crios": + case "ie": + loader.critical_error("Browser not supported", "We're sorry, but your browser isn't supported."); + throw "unsupported browser"; - } - }, - priority: 50 - }); -} + } + }, + priority: 50 +}); /* directly disable all context menus */ if(!location.search.match(/(.*[?&]|^)disableGlobalContextMenu=0($|&.*)/)) { diff --git a/shared/backend.d/audio/player.d.ts b/shared/backend.d/audio/player.d.ts index 13bf0c60..cb66d161 100644 --- a/shared/backend.d/audio/player.d.ts +++ b/shared/backend.d/audio/player.d.ts @@ -12,4 +12,6 @@ export function available_devices() : Promise; export function set_device(device_id: string) : Promise; export function current_device() : Device; -export function initializeFromGesture(); \ No newline at end of file +export function initializeFromGesture(); + +export function globalAudioContext() : AudioContext; \ No newline at end of file diff --git a/shared/backend.d/dns.d.ts b/shared/backend.d/dns.d.ts index 8e71a1f1..66f8678e 100644 --- a/shared/backend.d/dns.d.ts +++ b/shared/backend.d/dns.d.ts @@ -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; diff --git a/shared/declaration_fix.d.ts b/shared/declaration_fix.d.ts new file mode 100644 index 00000000..3d8ab5d0 --- /dev/null +++ b/shared/declaration_fix.d.ts @@ -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 {}; \ No newline at end of file diff --git a/shared/js/ConnectionHandler.ts b/shared/js/ConnectionHandler.ts index 3b6da401..eb587ba4 100644 --- a/shared/js/ConnectionHandler.ts +++ b/shared/js/ConnectionHandler.ts @@ -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"; diff --git a/shared/js/KeyControl.ts b/shared/js/KeyControl.ts index 08819685..2c0afad2 100644 --- a/shared/js/KeyControl.ts +++ b/shared/js/KeyControl.ts @@ -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; diff --git a/shared/js/PPTListener.ts b/shared/js/PPTListener.ts index c98973ea..706af184 100644 --- a/shared/js/PPTListener.ts +++ b/shared/js/PPTListener.ts @@ -1,3 +1,5 @@ +import { tr } from "./i18n/localize"; + export enum KeyCode { KEY_CANCEL = 3, KEY_HELP = 6, diff --git a/shared/js/connection/DummyVoiceConnection.ts b/shared/js/connection/DummyVoiceConnection.ts index d54518d7..ca915ea5 100644 --- a/shared/js/connection/DummyVoiceConnection.ts +++ b/shared/js/connection/DummyVoiceConnection.ts @@ -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; diff --git a/shared/js/connection/PluginCmdHandler.ts b/shared/js/connection/PluginCmdHandler.ts index 48bbafa2..df5193f8 100644 --- a/shared/js/connection/PluginCmdHandler.ts +++ b/shared/js/connection/PluginCmdHandler.ts @@ -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; diff --git a/shared/js/connection/ServerFeatures.ts b/shared/js/connection/ServerFeatures.ts index e9059360..051cefb3 100644 --- a/shared/js/connection/ServerFeatures.ts +++ b/shared/js/connection/ServerFeatures.ts @@ -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"; diff --git a/shared/js/connection/rtc/Connection.ts b/shared/js/connection/rtc/Connection.ts index 3ef6a30f..cd1cad83 100644 --- a/shared/js/connection/rtc/Connection.ts +++ b/shared/js/connection/rtc/Connection.ts @@ -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; - 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(); this.connection = connection; this.sdpProcessor = new SdpProcessor(); @@ -511,7 +510,7 @@ export class RTCConnection { return this.audioSupport; } - getConnection() : ServerConnection { + getConnection() : AbstractServerConnection { return this.connection; } diff --git a/shared/js/connection/rtc/Negotiation.ts b/shared/js/connection/rtc/Negotiation.ts index dc695381..dcad7be3 100644 --- a/shared/js/connection/rtc/Negotiation.ts +++ b/shared/js/connection/rtc/Negotiation.ts @@ -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", diff --git a/shared/js/connection/rtc/RemoteTrack.ts b/shared/js/connection/rtc/RemoteTrack.ts index a10db124..38500fe0 100644 --- a/shared/js/connection/rtc/RemoteTrack.ts +++ b/shared/js/connection/rtc/RemoteTrack.ts @@ -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(); diff --git a/shared/js/connection/rtc/SdpUtils.ts b/shared/js/connection/rtc/SdpUtils.ts index 5d7dc38f..e9bc3f15 100644 --- a/shared/js/connection/rtc/SdpUtils.ts +++ b/shared/js/connection/rtc/SdpUtils.ts @@ -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; diff --git a/shared/js/connection/rtc/video/VideoClient.ts b/shared/js/connection/rtc/video/VideoClient.ts index d1fde868..4c7bccd1 100644 --- a/shared/js/connection/rtc/video/VideoClient.ts +++ b/shared/js/connection/rtc/video/VideoClient.ts @@ -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; diff --git a/shared/js/events.ts b/shared/js/events.ts index dac74ebc..8d2350fc 100644 --- a/shared/js/events.ts +++ b/shared/js/events.ts @@ -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 { readonly type: T; diff --git a/shared/js/events/ClientGlobalControlHandler.ts b/shared/js/events/ClientGlobalControlHandler.ts index b64fdd16..1215d85b 100644 --- a/shared/js/events/ClientGlobalControlHandler.ts +++ b/shared/js/events/ClientGlobalControlHandler.ts @@ -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"; diff --git a/shared/js/file/Icons.ts b/shared/js/file/Icons.ts index 67d2f722..347e62d8 100644 --- a/shared/js/file/Icons.ts +++ b/shared/js/file/Icons.ts @@ -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"; diff --git a/shared/js/file/RemoteAvatars.ts b/shared/js/file/RemoteAvatars.ts index 4e20fef2..e319735f 100644 --- a/shared/js/file/RemoteAvatars.ts +++ b/shared/js/file/RemoteAvatars.ts @@ -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 diff --git a/shared/js/ipc/BrowserIPC.ts b/shared/js/ipc/BrowserIPC.ts index 60fe70c1..cc192f6d 100644 --- a/shared/js/ipc/BrowserIPC.ts +++ b/shared/js/ipc/BrowserIPC.ts @@ -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; diff --git a/shared/js/ipc/ConnectHandler.ts b/shared/js/ipc/ConnectHandler.ts index 3bab182b..f1616766 100644 --- a/shared/js/ipc/ConnectHandler.ts +++ b/shared/js/ipc/ConnectHandler.ts @@ -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; diff --git a/shared/js/ipc/MethodProxy.ts b/shared/js/ipc/MethodProxy.ts index fb780d77..dc6811d5 100644 --- a/shared/js/ipc/MethodProxy.ts +++ b/shared/js/ipc/MethodProxy.ts @@ -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; diff --git a/shared/js/log.ts b/shared/js/log.ts index 3744c00f..91c9aa09 100644 --- a/shared/js/log.ts +++ b/shared/js/log.ts @@ -1,5 +1,6 @@ import {Settings, settings} from "./settings"; import * as loader from "tc-loader"; +import { tr } from "./i18n/localize"; export enum LogCategory { CHANNEL, diff --git a/shared/js/main.tsx b/shared/js/main.tsx index 616dde21..49427e6b 100644 --- a/shared/js/main.tsx +++ b/shared/js/main.tsx @@ -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() { diff --git a/web/app/media/Stream.ts b/shared/js/media/Stream.ts similarity index 92% rename from web/app/media/Stream.ts rename to shared/js/media/Stream.ts index b5e71d61..1275836a 100644 --- a/web/app/media/Stream.ts +++ b/shared/js/media/Stream.ts @@ -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(); +*/ async function requestMediaStream0(constraints: MediaTrackConstraints, type: MediaStreamType, updateDeviceList: boolean) : Promise { 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(); } } \ No newline at end of file diff --git a/web/app/media/Video.ts b/shared/js/media/Video.ts similarity index 96% rename from web/app/media/Video.ts rename to shared/js/media/Video.ts index 57004aea..7b622063 100644 --- a/web/app/media/Video.ts +++ b/shared/js/media/Video.ts @@ -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; } } diff --git a/shared/js/profiles/ConnectionProfile.ts b/shared/js/profiles/ConnectionProfile.ts index 8d332079..f1b5b864 100644 --- a/shared/js/profiles/ConnectionProfile.ts +++ b/shared/js/profiles/ConnectionProfile.ts @@ -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; diff --git a/shared/js/profiles/Identity.ts b/shared/js/profiles/Identity.ts index e4d39134..2e155fc8 100644 --- a/shared/js/profiles/Identity.ts +++ b/shared/js/profiles/Identity.ts @@ -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, diff --git a/shared/js/profiles/identities/NameIdentity.ts b/shared/js/profiles/identities/NameIdentity.ts index 9f6a5acf..1a083c95 100644 --- a/shared/js/profiles/identities/NameIdentity.ts +++ b/shared/js/profiles/identities/NameIdentity.ts @@ -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; diff --git a/shared/js/profiles/identities/TeaForumIdentity.ts b/shared/js/profiles/identities/TeaForumIdentity.ts index 5cd6feca..1776b35b 100644 --- a/shared/js/profiles/identities/TeaForumIdentity.ts +++ b/shared/js/profiles/identities/TeaForumIdentity.ts @@ -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; diff --git a/shared/js/profiles/identities/teaspeak-forum.ts b/shared/js/profiles/identities/teaspeak-forum.ts index cf56450f..469efb4b 100644 --- a/shared/js/profiles/identities/teaspeak-forum.ts +++ b/shared/js/profiles/identities/teaspeak-forum.ts @@ -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 { diff --git a/shared/js/proto.ts b/shared/js/proto.ts index a3691ab4..4e5e9022 100644 --- a/shared/js/proto.ts +++ b/shared/js/proto.ts @@ -1,5 +1,6 @@ /* setup jsrenderer */ import "jsrender"; +import { tr } from "./i18n/localize"; if(__build.target === "web") { (window as any).$ = require("jquery"); diff --git a/shared/js/settings.ts b/shared/js/settings.ts index 916e857c..238a94db 100644 --- a/shared/js/settings.ts +++ b/shared/js/settings.ts @@ -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"; diff --git a/shared/js/sound/Sounds.ts b/shared/js/sound/Sounds.ts index c9e9398c..e4ca3cec 100644 --- a/shared/js/sound/Sounds.ts +++ b/shared/js/sound/Sounds.ts @@ -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", diff --git a/shared/js/stats.ts b/shared/js/stats.ts index 23881e19..b0147876 100644 --- a/shared/js/stats.ts +++ b/shared/js/stats.ts @@ -1,5 +1,6 @@ import {LogCategory} from "./log"; import * as log from "./log"; +import { tr } from "./i18n/localize"; enum CloseCodes { UNSET = 3000, diff --git a/shared/js/text/chat.ts b/shared/js/text/chat.ts index 49c7b77b..6cfc2cf3 100644 --- a/shared/js/text/chat.ts +++ b/shared/js/text/chat.ts @@ -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 { diff --git a/shared/js/text/markdown.ts b/shared/js/text/markdown.ts index 529c88b2..57dd1a47 100644 --- a/shared/js/text/markdown.ts +++ b/shared/js/text/markdown.ts @@ -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 { diff --git a/shared/js/tree/Channel.ts b/shared/js/tree/Channel.ts index 2a6111d2..b4edd318 100644 --- a/shared/js/tree/Channel.ts +++ b/shared/js/tree/Channel.ts @@ -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, diff --git a/shared/js/tree/Client.ts b/shared/js/tree/Client.ts index 5b96729d..c51b3291 100644 --- a/shared/js/tree/Client.ts +++ b/shared/js/tree/Client.ts @@ -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, diff --git a/shared/js/tree/Server.ts b/shared/js/tree/Server.ts index 9690e5d8..02322ba4 100644 --- a/shared/js/tree/Server.ts +++ b/shared/js/tree/Server.ts @@ -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 = ""; diff --git a/shared/js/ui/ContextMenu.ts b/shared/js/ui/ContextMenu.ts index 2fdade76..2c1c69f9 100644 --- a/shared/js/ui/ContextMenu.ts +++ b/shared/js/ui/ContextMenu.ts @@ -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, diff --git a/shared/js/ui/elements/ContextDivider.ts b/shared/js/ui/elements/ContextDivider.ts index f6b50813..f421db0f 100644 --- a/shared/js/ui/elements/ContextDivider.ts +++ b/shared/js/ui/elements/ContextDivider.ts @@ -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 { diff --git a/shared/js/ui/frames/chat.ts b/shared/js/ui/frames/chat.ts index 8488567d..c99a5622 100644 --- a/shared/js/ui/frames/chat.ts +++ b/shared/js/ui/frames/chat.ts @@ -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, diff --git a/shared/js/ui/frames/chat_frame.ts b/shared/js/ui/frames/chat_frame.ts index c6d7e629..9d7944db 100644 --- a/shared/js/ui/frames/chat_frame.ts +++ b/shared/js/ui/frames/chat_frame.ts @@ -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", diff --git a/shared/js/ui/frames/connection-handler-list/Controller.ts b/shared/js/ui/frames/connection-handler-list/Controller.ts index e83d26e3..de7fc7d6 100644 --- a/shared/js/ui/frames/connection-handler-list/Controller.ts +++ b/shared/js/ui/frames/connection-handler-list/Controller.ts @@ -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"); diff --git a/shared/js/ui/frames/control-bar/Controller.ts b/shared/js/ui/frames/control-bar/Controller.ts index 64358fb4..bedc5c77 100644 --- a/shared/js/ui/frames/control-bar/Controller.ts +++ b/shared/js/ui/frames/control-bar/Controller.ts @@ -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; diff --git a/shared/js/ui/frames/footer/StatusController.ts b/shared/js/ui/frames/footer/StatusController.ts index 7487c9b3..76da3893 100644 --- a/shared/js/ui/frames/footer/StatusController.ts +++ b/shared/js/ui/frames/footer/StatusController.ts @@ -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 */ diff --git a/shared/js/ui/frames/hostbanner.ts b/shared/js/ui/frames/hostbanner.ts index 552778de..9c3a6bac 100644 --- a/shared/js/ui/frames/hostbanner.ts +++ b/shared/js/ui/frames/hostbanner.ts @@ -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; diff --git a/shared/js/ui/frames/log/DispatcherNotifications.ts b/shared/js/ui/frames/log/DispatcherNotifications.ts index 534a87b6..6ad0bd20 100644 --- a/shared/js/ui/frames/log/DispatcherNotifications.ts +++ b/shared/js/ui/frames/log/DispatcherNotifications.ts @@ -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 = (data: TypeInfo[T], handlerId: string, eventType: T) => void; diff --git a/shared/js/ui/frames/menu-bar/MainMenu.ts b/shared/js/ui/frames/menu-bar/MainMenu.ts index 18095df4..37e0855e 100644 --- a/shared/js/ui/frames/menu-bar/MainMenu.ts +++ b/shared/js/ui/frames/menu-bar/MainMenu.ts @@ -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[] = []; diff --git a/shared/js/ui/frames/side/AbstractConversion.ts b/shared/js/ui/frames/side/AbstractConversion.ts index cc58efc5..8ce0280b 100644 --- a/shared/js/ui/frames/side/AbstractConversion.ts +++ b/shared/js/ui/frames/side/AbstractConversion.ts @@ -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 */ diff --git a/shared/js/ui/frames/side/ConversationManager.ts b/shared/js/ui/frames/side/ConversationManager.ts index 1fd971af..406d6820 100644 --- a/shared/js/ui/frames/side/ConversationManager.ts +++ b/shared/js/ui/frames/side/ConversationManager.ts @@ -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 { diff --git a/shared/js/ui/frames/side/PrivateConversationHistory.ts b/shared/js/ui/frames/side/PrivateConversationHistory.ts index 1b804c03..4054f148 100644 --- a/shared/js/ui/frames/side/PrivateConversationHistory.ts +++ b/shared/js/ui/frames/side/PrivateConversationHistory.ts @@ -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; diff --git a/shared/js/ui/frames/side/PrivateConversationManager.ts b/shared/js/ui/frames/side/PrivateConversationManager.ts index 79280861..e6f62714 100644 --- a/shared/js/ui/frames/side/PrivateConversationManager.ts +++ b/shared/js/ui/frames/side/PrivateConversationManager.ts @@ -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, diff --git a/shared/js/ui/frames/side/client_info.ts b/shared/js/ui/frames/side/client_info.ts index 1628141a..76537f9c 100644 --- a/shared/js/ui/frames/side/client_info.ts +++ b/shared/js/ui/frames/side/client_info.ts @@ -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; diff --git a/shared/js/ui/frames/side/music_info.ts b/shared/js/ui/frames/side/music_info.ts index 5c58a47d..0b895cf4 100644 --- a/shared/js/ui/frames/side/music_info.ts +++ b/shared/js/ui/frames/side/music_info.ts @@ -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 */ diff --git a/shared/js/ui/frames/video/Controller.ts b/shared/js/ui/frames/video/Controller.ts index b9eb0b3c..20b4a804 100644 --- a/shared/js/ui/frames/video/Controller.ts +++ b/shared/js/ui/frames/video/Controller.ts @@ -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"); diff --git a/shared/js/ui/htmltags.ts b/shared/js/ui/htmltags.ts index fb5cd88f..17f6d005 100644 --- a/shared/js/ui/htmltags.ts +++ b/shared/js/ui/htmltags.ts @@ -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}; diff --git a/shared/js/ui/jsrender.ts b/shared/js/ui/jsrender.ts index f52426e8..82a27e9b 100644 --- a/shared/js/ui/jsrender.ts +++ b/shared/js/ui/jsrender.ts @@ -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) { diff --git a/shared/js/ui/modal/ModalAbout.ts b/shared/js/ui/modal/ModalAbout.ts index 36255ec3..5f3c9377 100644 --- a/shared/js/ui/modal/ModalAbout.ts +++ b/shared/js/ui/modal/ModalAbout.ts @@ -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); diff --git a/shared/js/ui/modal/ModalAvatar.ts b/shared/js/ui/modal/ModalAvatar.ts index 789a0644..cb55b4b9 100644 --- a/shared/js/ui/modal/ModalAvatar.ts +++ b/shared/js/ui/modal/ModalAvatar.ts @@ -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) { diff --git a/shared/js/ui/modal/ModalAvatarList.ts b/shared/js/ui/modal/ModalAvatarList.ts index 85c18e81..531b0a79 100644 --- a/shared/js/ui/modal/ModalAvatarList.ts +++ b/shared/js/ui/modal/ModalAvatarList.ts @@ -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); diff --git a/shared/js/ui/modal/ModalBanClient.ts b/shared/js/ui/modal/ModalBanClient.ts index 2fab80e2..70817829 100644 --- a/shared/js/ui/modal/ModalBanClient.ts +++ b/shared/js/ui/modal/ModalBanClient.ts @@ -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; diff --git a/shared/js/ui/modal/ModalBanList.ts b/shared/js/ui/modal/ModalBanList.ts index d1a89942..9067dd6e 100644 --- a/shared/js/ui/modal/ModalBanList.ts +++ b/shared/js/ui/modal/ModalBanList.ts @@ -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; diff --git a/shared/js/ui/modal/ModalBookmarks.ts b/shared/js/ui/modal/ModalBookmarks.ts index d269befc..ac440bfd 100644 --- a/shared/js/ui/modal/ModalBookmarks.ts +++ b/shared/js/ui/modal/ModalBookmarks.ts @@ -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; diff --git a/shared/js/ui/modal/ModalChangeVolumeNew.tsx b/shared/js/ui/modal/ModalChangeVolumeNew.tsx index 83da6fa7..2c6689b8 100644 --- a/shared/js/ui/modal/ModalChangeVolumeNew.tsx +++ b/shared/js/ui/modal/ModalChangeVolumeNew.tsx @@ -227,6 +227,26 @@ class VolumeChangeModal extends React.Component<{ clientName: string, maxVolume? } } +class VolumeChange extends InternalModal { + private readonly events: Registry; + private readonly client: ClientEntry; + + constructor(events: Registry, client: ClientEntry) { + super(); + + this.events = events; + this.client = client; + } + + renderBody() { + return ; + } + + title() { + return Change local volume; + } +} + export function spawnClientVolumeChange(client: ClientEntry) { const events = new Registry(); @@ -239,25 +259,35 @@ export function spawnClientVolumeChange(client: ClientEntry) { client.setAudioVolume(event.newValue); }); - const modal = spawnReactModal(class extends InternalModal { - constructor() { - super(); - } + const modal = spawnReactModal(VolumeChange, events, client); - renderBody() { - return ; - } - - title() { - return Change local volume; - } - }); - - events.on("close-modal", event => modal.destroy()); + events.on("close-modal", () => modal.destroy()); modal.show(); return modal; } +class VolumeChangeBot extends InternalModal { + private readonly events: Registry; + private readonly client: ClientEntry; + private readonly maxValue: number; + + constructor(client: ClientEntry, events: Registry, maxValue: number) { + super(); + + this.maxValue = maxValue; + this.events = events; + this.client = client; + } + + renderBody() { + return ; + } + + title() { + return Change remote volume; + } +} + export function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: number) { //FIXME: Max value! const events = new Registry(); @@ -278,19 +308,7 @@ export function spawnMusicBotVolumeChange(client: MusicClientEntry, maxValue: nu }); }); - const modal = spawnReactModal(class extends InternalModal { - constructor() { - super(); - } - - renderBody() { - return ; - } - - title() { - return Change remote volume; - } - }); + const modal = spawnReactModal(VolumeChangeBot, client, events, maxValue); events.on("close-modal", event => modal.destroy()); modal.show(); diff --git a/shared/js/ui/modal/ModalChannelInfo.ts b/shared/js/ui/modal/ModalChannelInfo.ts index 040066c7..71bfdbe7 100644 --- a/shared/js/ui/modal/ModalChannelInfo.ts +++ b/shared/js/ui/modal/ModalChannelInfo.ts @@ -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; diff --git a/shared/js/ui/modal/ModalClientInfo.ts b/shared/js/ui/modal/ModalClientInfo.ts index e00c86a0..b8fa0697 100644 --- a/shared/js/ui/modal/ModalClientInfo.ts +++ b/shared/js/ui/modal/ModalClientInfo.ts @@ -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; diff --git a/shared/js/ui/modal/ModalConnect.ts b/shared/js/ui/modal/ModalConnect.ts index 29217aef..bce7cf18 100644 --- a/shared/js/ui/modal/ModalConnect.ts +++ b/shared/js/ui/modal/ModalConnect.ts @@ -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 { diff --git a/shared/js/ui/modal/ModalCreateChannel.ts b/shared/js/ui/modal/ModalCreateChannel.ts index e7ddfd1e..5c3c8822 100644 --- a/shared/js/ui/modal/ModalCreateChannel.ts +++ b/shared/js/ui/modal/ModalCreateChannel.ts @@ -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 diff --git a/shared/js/ui/modal/ModalIdentity.ts b/shared/js/ui/modal/ModalIdentity.ts index 0c2f4f7e..52d57787 100644 --- a/shared/js/ui/modal/ModalIdentity.ts +++ b/shared/js/ui/modal/ModalIdentity.ts @@ -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; diff --git a/shared/js/ui/modal/ModalInvite.ts b/shared/js/ui/modal/ModalInvite.ts index 86a800fb..9c75751e 100644 --- a/shared/js/ui/modal/ModalInvite.ts +++ b/shared/js/ui/modal/ModalInvite.ts @@ -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 = ""; diff --git a/shared/js/ui/modal/ModalKeySelect.ts b/shared/js/ui/modal/ModalKeySelect.ts index 18eab310..f91e34ef 100644 --- a/shared/js/ui/modal/ModalKeySelect.ts +++ b/shared/js/ui/modal/ModalKeySelect.ts @@ -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({ diff --git a/shared/js/ui/modal/ModalMusicManage.ts b/shared/js/ui/modal/ModalMusicManage.ts index bfda46df..292e44ad 100644 --- a/shared/js/ui/modal/ModalMusicManage.ts +++ b/shared/js/ui/modal/ModalMusicManage.ts @@ -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, diff --git a/shared/js/ui/modal/ModalPoke.ts b/shared/js/ui/modal/ModalPoke.ts index c828dfbb..317a0d46 100644 --- a/shared/js/ui/modal/ModalPoke.ts +++ b/shared/js/ui/modal/ModalPoke.ts @@ -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; diff --git a/shared/js/ui/modal/ModalQuery.ts b/shared/js/ui/modal/ModalQuery.ts index 0a68195a..6d06f72f 100644 --- a/shared/js/ui/modal/ModalQuery.ts +++ b/shared/js/ui/modal/ModalQuery.ts @@ -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; diff --git a/shared/js/ui/modal/ModalQueryManage.ts b/shared/js/ui/modal/ModalQueryManage.ts index e0c07007..7540476c 100644 --- a/shared/js/ui/modal/ModalQueryManage.ts +++ b/shared/js/ui/modal/ModalQueryManage.ts @@ -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; diff --git a/shared/js/ui/modal/ModalServerEdit.ts b/shared/js/ui/modal/ModalServerEdit.ts index 8ab00c45..6d92c0f2 100644 --- a/shared/js/ui/modal/ModalServerEdit.ts +++ b/shared/js/ui/modal/ModalServerEdit.ts @@ -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) { const properties = Object.assign({}, server.properties); diff --git a/shared/js/ui/modal/ModalServerInfo.ts b/shared/js/ui/modal/ModalServerInfo.ts index 31ec6fed..442fc8ce 100644 --- a/shared/js/ui/modal/ModalServerInfo.ts +++ b/shared/js/ui/modal/ModalServerInfo.ts @@ -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; diff --git a/shared/js/ui/modal/ModalServerInfoBandwidth.ts b/shared/js/ui/modal/ModalServerInfoBandwidth.ts index 2d33ea3c..be800cbb 100644 --- a/shared/js/ui/modal/ModalServerInfoBandwidth.ts +++ b/shared/js/ui/modal/ModalServerInfoBandwidth.ts @@ -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, diff --git a/shared/js/ui/modal/css-editor/Controller.ts b/shared/js/ui/modal/css-editor/Controller.ts index e44a3492..4ae51d24 100644 --- a/shared/js/ui/modal/css-editor/Controller.ts +++ b/shared/js/ui/modal/css-editor/Controller.ts @@ -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; diff --git a/shared/js/ui/modal/transfer/RemoteFileBrowserController.ts b/shared/js/ui/modal/transfer/RemoteFileBrowserController.ts index d52f1292..b94b2767 100644 --- a/shared/js/ui/modal/transfer/RemoteFileBrowserController.ts +++ b/shared/js/ui/modal/transfer/RemoteFileBrowserController.ts @@ -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, diff --git a/shared/js/ui/modal/video-source/Controller.tsx b/shared/js/ui/modal/video-source/Controller.tsx index 935b73a5..a5675976 100644 --- a/shared/js/ui/modal/video-source/Controller.tsx +++ b/shared/js/ui/modal/video-source/Controller.tsx @@ -232,7 +232,7 @@ function initializeController(events: Registry, 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") { diff --git a/shared/js/ui/react-elements/internal-modal/Controller.ts b/shared/js/ui/react-elements/internal-modal/Controller.ts index e94e9292..6c6d294d 100644 --- a/shared/js/ui/react-elements/internal-modal/Controller.ts +++ b/shared/js/ui/react-elements/internal-modal/Controller.ts @@ -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 implements ModalController { readonly events: Registry; diff --git a/shared/js/ui/tree/popout/Controller.ts b/shared/js/ui/tree/popout/Controller.ts index 196a5c6b..c802ae2d 100644 --- a/shared/js/ui/tree/popout/Controller.ts +++ b/shared/js/ui/tree/popout/Controller.ts @@ -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; diff --git a/shared/js/update/index.ts b/shared/js/update/index.ts index 9c1c09ee..ffd14c45 100644 --- a/shared/js/update/index.ts +++ b/shared/js/update/index.ts @@ -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; diff --git a/shared/js/utils/DateUtils.ts b/shared/js/utils/DateUtils.ts index 295c3688..57c2c455 100644 --- a/shared/js/utils/DateUtils.ts +++ b/shared/js/utils/DateUtils.ts @@ -1,4 +1,5 @@ import {Settings, settings} from "../settings"; +import { tr } from "tc-shared/i18n/localize"; export enum ColloquialFormat { YESTERDAY, diff --git a/shared/js/utils/TimeUtils.ts b/shared/js/utils/TimeUtils.ts index eac81a00..f6d0d7e7 100644 --- a/shared/js/utils/TimeUtils.ts +++ b/shared/js/utils/TimeUtils.ts @@ -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; diff --git a/shared/js/utils/helpers.ts b/shared/js/utils/helpers.ts index 35e9f0db..2f1eee95 100644 --- a/shared/js/utils/helpers.ts +++ b/shared/js/utils/helpers.ts @@ -1,4 +1,5 @@ import * as sha1 from "../crypto/sha"; +import { tr } from "tc-shared/i18n/localize"; export function hashPassword(password: string) : Promise { return new Promise((resolve, reject) => { diff --git a/shared/js/video-viewer/Controller.ts b/shared/js/video-viewer/Controller.ts index a448f097..40b943a9 100644 --- a/shared/js/video-viewer/Controller.ts +++ b/shared/js/video-viewer/Controller.ts @@ -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(" - "); diff --git a/shared/js/video-viewer/W2GPlugin.ts b/shared/js/video-viewer/W2GPlugin.ts index 0b27a969..f60c7037 100644 --- a/shared/js/video-viewer/W2GPlugin.ts +++ b/shared/js/video-viewer/W2GPlugin.ts @@ -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 }, diff --git a/shared/js/video/VideoSource.ts b/shared/js/video/VideoSource.ts index 09d92eb9..d4b0a809 100644 --- a/shared/js/video/VideoSource.ts +++ b/shared/js/video/VideoSource.ts @@ -1,4 +1,5 @@ import {Registry} from "tc-shared/events"; +import { tr } from "tc-shared/i18n/localize"; export interface VideoSource { getId() : string; diff --git a/shared/js/voice/RecorderProfile.ts b/shared/js/voice/RecorderProfile.ts index 9461478a..26870ada 100644 --- a/shared/js/voice/RecorderProfile.ts +++ b/shared/js/voice/RecorderProfile.ts @@ -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 { diff --git a/shared/tsconfig/dtsconfig_app.json b/shared/tsconfig/dtsconfig_app.json deleted file mode 100644 index fa89fdd9..00000000 --- a/shared/tsconfig/dtsconfig_app.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "source_files": [ - "**/*.ts", - "**/*.tsx" - ], - "exclude": [ - "workers/**/*.ts" - ], - "base_directory": "shared/js/", - "target_directory": "../../declarations/shared-app", - "modular": true -} \ No newline at end of file diff --git a/shared/tsconfig/tsconfig.declarations.json b/shared/tsconfig/tsconfig.declarations.json new file mode 100644 index 00000000..2bd9cb69 --- /dev/null +++ b/shared/tsconfig/tsconfig.declarations.json @@ -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" + ] +} \ No newline at end of file diff --git a/shared/tsconfig/tsconfig_packed.json b/shared/tsconfig/tsconfig_packed.json deleted file mode 100644 index 85bfe0e1..00000000 --- a/shared/tsconfig/tsconfig_packed.json +++ /dev/null @@ -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" - ] -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index bc271f17..1ac304d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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/*"] } }, diff --git a/web/app/ExternalModalFactory.ts b/web/app/ExternalModalFactory.ts index 69d5fd51..3ca3773c 100644 --- a/web/app/ExternalModalFactory.ts +++ b/web/app/ExternalModalFactory.ts @@ -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; diff --git a/web/app/FileTransfer.ts b/web/app/FileTransfer.ts index da99413f..a2a55031 100644 --- a/web/app/FileTransfer.ts +++ b/web/app/FileTransfer.ts @@ -14,6 +14,7 @@ import { } from "tc-shared/file/Transfer"; import * as log from "tc-shared/log"; import {LogCategory} from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; TransferProvider.setProvider(new class extends TransferProvider { executeFileUpload(transfer: FileUploadTransfer) { diff --git a/web/app/audio/Recorder.ts b/web/app/audio/Recorder.ts index 5b7361c5..74ac8ef1 100644 --- a/web/app/audio/Recorder.ts +++ b/web/app/audio/Recorder.ts @@ -17,7 +17,8 @@ import * as aplayer from "./player"; import {JAbstractFilter, JStateFilter, JThresholdFilter} from "./RecorderFilter"; import {Filter, FilterType, FilterTypeClass} from "tc-shared/voice/Filter"; import {inputDeviceList} from "tc-backend/web/audio/RecorderDeviceList"; -import {requestMediaStream} from "tc-backend/web/media/Stream"; +import {requestMediaStream} from "tc-shared/media/Stream"; +import { tr } from "tc-shared/i18n/localize"; declare global { interface MediaStream { @@ -190,6 +191,10 @@ class JavascriptInput implements AbstractInput { this.state = InputState.PAUSED; return requestResult; } + + /* added the then body to avoid a inspection warning... */ + inputDeviceList.refresh().then(() => {}); + this.currentStream = requestResult; for(const filter of this.registeredFilters) { diff --git a/web/app/audio/RecorderDeviceList.ts b/web/app/audio/RecorderDeviceList.ts index 94048d60..db2a6baf 100644 --- a/web/app/audio/RecorderDeviceList.ts +++ b/web/app/audio/RecorderDeviceList.ts @@ -6,11 +6,12 @@ import { PermissionState } from "tc-shared/audio/recorder"; import * as log from "tc-shared/log"; -import {LogCategory, logWarn} from "tc-shared/log"; +import {LogCategory} from "tc-shared/log"; import {Registry} from "tc-shared/events"; import {WebIDevice} from "tc-backend/web/audio/Recorder"; import * as loader from "tc-loader"; -import {queryMediaPermissions} from "tc-backend/web/media/Stream"; +import {queryMediaPermissions} from "tc-shared/media/Stream"; +import { tr } from "tc-shared/i18n/localize"; async function requestMicrophonePermissions() : Promise { const begin = Date.now(); diff --git a/web/app/audio/player.ts b/web/app/audio/player.ts index e8cca985..63ba3cf8 100644 --- a/web/app/audio/player.ts +++ b/web/app/audio/player.ts @@ -1,6 +1,7 @@ import {Device} from "tc-shared/audio/player"; import * as log from "tc-shared/log"; import {LogCategory} from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; /* lets try without any gestures, maybe the user already clicked the page */ const kAvoidAudioContextWarning = false; diff --git a/web/app/audio/sounds.ts b/web/app/audio/sounds.ts index 86a01874..c59a8ea6 100644 --- a/web/app/audio/sounds.ts +++ b/web/app/audio/sounds.ts @@ -2,6 +2,7 @@ import {LogCategory} from "tc-shared/log"; import * as log from "tc-shared/log"; import {SoundFile} from "tc-shared/sound/Sounds"; import * as aplayer from "./player"; +import { tr } from "tc-shared/i18n/localize"; interface SoundEntry { cached?: AudioBuffer; diff --git a/web/app/connection/LegacySupportVoiceBridge.ts b/web/app/connection/LegacySupportVoiceBridge.ts index f83a2d0d..584c7b91 100644 --- a/web/app/connection/LegacySupportVoiceBridge.ts +++ b/web/app/connection/LegacySupportVoiceBridge.ts @@ -11,6 +11,7 @@ import {WhisperSession, WhisperTarget} from "tc-shared/voice/VoiceWhisper"; import {AbstractServerConnection, ConnectionStatistics} from "tc-shared/connection/ConnectionBase"; import {Registry} from "tc-shared/events"; import {VoicePlayerEvents, VoicePlayerLatencySettings, VoicePlayerState} from "tc-shared/voice/VoicePlayer"; +import { tr } from "tc-shared/i18n/localize"; class ProxiedVoiceClient implements VoiceClient { readonly clientId: number; diff --git a/web/app/connection/ServerConnection.ts b/web/app/connection/ServerConnection.ts index 59fed20b..80099473 100644 --- a/web/app/connection/ServerConnection.ts +++ b/web/app/connection/ServerConnection.ts @@ -26,6 +26,7 @@ import {LegacySupportVoiceBridge} from "tc-backend/web/connection/LegacySupportV import {ServerFeature} from "tc-shared/connection/ServerFeatures"; import {RTCConnection} from "tc-shared/connection/rtc/Connection"; import {RtpVideoConnection} from "tc-shared/connection/rtc/video/Connection"; +import { tr } from "tc-shared/i18n/localize"; class ReturnListener { resolve: (value?: T | PromiseLike) => void; @@ -48,8 +49,6 @@ export class ServerConnection extends AbstractServerConnection { private returnListeners: ReturnListener[] = []; - private _connection_state_listener: ConnectionStateListener; - private rtcConnection: RTCConnection; private voiceConnection: RtpVoiceConnection; private videoConnection: RtpVideoConnection; @@ -500,13 +499,6 @@ export class ServerConnection extends AbstractServerConnection { return this.commandHandlerBoss; } - get onconnectionstatechanged() : ConnectionStateListener { - return this._connection_state_listener; - } - set onconnectionstatechanged(listener: ConnectionStateListener) { - this._connection_state_listener = listener; - } - handshake_handler(): HandshakeHandler { return this.handshakeHandler; } diff --git a/web/app/connection/WrappedWebSocket.ts b/web/app/connection/WrappedWebSocket.ts index 59fee602..4eb70bf4 100644 --- a/web/app/connection/WrappedWebSocket.ts +++ b/web/app/connection/WrappedWebSocket.ts @@ -1,6 +1,7 @@ import * as log from "tc-shared/log"; import {LogCategory} from "tc-shared/log"; import {ConnectionStatistics} from "tc-shared/connection/ConnectionBase"; +import { tr } from "tc-shared/i18n/localize"; const kPreventOpeningWebSocketClosing = false; diff --git a/web/app/dns.ts b/web/app/dns.ts index 33de99fe..ad8f8f7f 100644 --- a/web/app/dns.ts +++ b/web/app/dns.ts @@ -2,6 +2,7 @@ import {AddressTarget, default_options, ResolveOptions} from "tc-shared/dns"; import {LogCategory} from "tc-shared/log"; import * as log from "tc-shared/log"; import {ServerAddress} from "tc-shared/tree/Server"; +import { tr } from "tc-shared/i18n/localize"; export enum RRType { A = 1, // a host address,[RFC1035], diff --git a/web/app/hooks/Video.ts b/web/app/hooks/Video.ts index 9578c93c..7eddb646 100644 --- a/web/app/hooks/Video.ts +++ b/web/app/hooks/Video.ts @@ -1,7 +1,7 @@ import * as loader from "tc-loader"; import {Stage} from "tc-loader"; import {setVideoDriver} from "tc-shared/video/VideoSource"; -import {WebVideoDriver} from "tc-backend/web/media/Video"; +import {WebVideoDriver} from "tc-shared/media/Video"; loader.register_task(Stage.JAVASCRIPT_INITIALIZING, { priority: 10, diff --git a/web/app/legacy/audio-lib/AudioClient.ts b/web/app/legacy/audio-lib/AudioClient.ts index a5884286..1c7ccbbe 100644 --- a/web/app/legacy/audio-lib/AudioClient.ts +++ b/web/app/legacy/audio-lib/AudioClient.ts @@ -1,5 +1,6 @@ import {AudioLibrary} from "./index"; import {LogCategory, logWarn} from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; export class AudioClient { private readonly handle: AudioLibrary; diff --git a/web/app/legacy/audio-lib/index.ts b/web/app/legacy/audio-lib/index.ts index ec72c421..c68d01a4 100644 --- a/web/app/legacy/audio-lib/index.ts +++ b/web/app/legacy/audio-lib/index.ts @@ -10,6 +10,7 @@ import {AudioClient} from "./AudioClient"; import {LogCategory, logWarn} from "tc-shared/log"; import * as loader from "tc-loader"; import {Stage} from "tc-loader"; +import { tr } from "tc-shared/i18n/localize"; export type AudioLibraryWorker = WorkerOwner; export class AudioLibrary { diff --git a/web/app/legacy/voice/AudioResampler.ts b/web/app/legacy/voice/AudioResampler.ts index d3363eed..f14c5f46 100644 --- a/web/app/legacy/voice/AudioResampler.ts +++ b/web/app/legacy/voice/AudioResampler.ts @@ -1,4 +1,5 @@ import {LogCategory, logWarn} from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; const OfflineAudioContext = window.webkitOfflineAudioContext || window.OfflineAudioContext; export class AudioResampler { diff --git a/web/app/legacy/voice/VoicePlayer.ts b/web/app/legacy/voice/VoicePlayer.ts index c1b09752..a7f45106 100644 --- a/web/app/legacy/voice/VoicePlayer.ts +++ b/web/app/legacy/voice/VoicePlayer.ts @@ -10,6 +10,7 @@ import {Registry} from "tc-shared/events"; import * as aplayer from "tc-backend/web/audio/player"; import {getAudioLibrary} from "../audio-lib"; import {LogCategory, logDebug, logError, logWarn} from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; const kDefaultLatencySettings = { minBufferTime: 60, diff --git a/web/app/ppt.ts b/web/app/ppt.ts index 6dd864e0..c94752f3 100644 --- a/web/app/ppt.ts +++ b/web/app/ppt.ts @@ -1,6 +1,7 @@ import {EventType, KeyEvent, KeyHook, SpecialKey} from "tc-shared/PPTListener"; import {LogCategory} from "tc-shared/log"; import * as log from "tc-shared/log"; +import { tr } from "tc-shared/i18n/localize"; interface WebKeyEvent extends KeyEvent { canceled: boolean; diff --git a/web/app/voice/VoicePlayer.ts b/web/app/voice/VoicePlayer.ts index 202808a6..3ff3fd5c 100644 --- a/web/app/voice/VoicePlayer.ts +++ b/web/app/voice/VoicePlayer.ts @@ -6,6 +6,7 @@ import { import {Registry} from "tc-shared/events"; import {LogCategory, logWarn} from "tc-shared/log"; import {RemoteRTPAudioTrack, RemoteRTPTrackState} from "tc-shared/connection/rtc/RemoteTrack"; +import { tr } from "tc-shared/i18n/localize"; export interface RtpVoicePlayerEvents { notify_state_changed: { oldState: VoicePlayerState, newState: VoicePlayerState } diff --git a/web/app/voice/WhisperClient.ts b/web/app/voice/WhisperClient.ts index 9df68fdb..21f815cc 100644 --- a/web/app/voice/WhisperClient.ts +++ b/web/app/voice/WhisperClient.ts @@ -4,6 +4,7 @@ import {VoicePlayerState} from "tc-shared/voice/VoicePlayer"; import {WhisperSessionInitializeData} from "tc-shared/connection/VoiceConnection"; import {VoicePlayer} from "./VoicePlayer"; import {RemoteRTPAudioTrack, TrackClientInfo} from "tc-shared/connection/rtc/RemoteTrack"; +import { tr, tra } from "tc-shared/i18n/localize"; export class RtpWhisperSession implements WhisperSession { readonly events: Registry;