Directly importing logging methods and some general code and logging messages cleanup
parent
55f9c2737f
commit
4c515cc055
|
@ -4,8 +4,7 @@ import {GroupManager} from "./permission/GroupManager";
|
|||
import {ServerSettings, Settings, settings, StaticSettings} from "./settings";
|
||||
import {Sound, SoundManager} from "./sound/Sounds";
|
||||
import {ConnectionProfile} from "./profiles/ConnectionProfile";
|
||||
import * as log from "./log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "./log";
|
||||
import {LogCategory, logError, logInfo, logTrace, logWarn} from "./log";
|
||||
import {createErrorModal, createInfoModal, createInputModal, Modal} from "./ui/elements/Modal";
|
||||
import {hashPassword} from "./utils/helpers";
|
||||
import {HandshakeHandler} from "./connection/HandshakeHandler";
|
||||
|
@ -375,7 +374,7 @@ export class ConnectionHandler {
|
|||
try {
|
||||
await this.serverConnection.disconnect();
|
||||
} catch (error) {
|
||||
log.warn(LogCategory.CLIENT, tr("Failed to successfully disconnect from server: {}"), error);
|
||||
logWarn(LogCategory.CLIENT, tr("Failed to successfully disconnect from server: {}"), error);
|
||||
}
|
||||
this.sound.play(Sound.CONNECTION_DISCONNECTED);
|
||||
this.log.log("disconnected", {});
|
||||
|
@ -525,7 +524,7 @@ export class ConnectionHandler {
|
|||
}
|
||||
break;
|
||||
case DisconnectReason.DNS_FAILED:
|
||||
log.error(LogCategory.CLIENT, tr("Failed to resolve hostname: %o"), data);
|
||||
logError(LogCategory.CLIENT, tr("Failed to resolve hostname: %o"), data);
|
||||
this.log.log("connection.hostname.resolve.error", {
|
||||
message: data as any
|
||||
});
|
||||
|
@ -538,9 +537,9 @@ export class ConnectionHandler {
|
|||
}
|
||||
|
||||
if(data) {
|
||||
log.error(LogCategory.CLIENT, tr("Could not connect to remote host! Extra data: %o"), data);
|
||||
logError(LogCategory.CLIENT, tr("Could not connect to remote host! Extra data: %o"), data);
|
||||
} else {
|
||||
log.error(LogCategory.CLIENT, tr("Could not connect to remote host!"), data);
|
||||
logError(LogCategory.CLIENT, tr("Could not connect to remote host!"), data);
|
||||
}
|
||||
|
||||
if(__build.target === "client" || !dns.resolve_address_ipv4) {
|
||||
|
@ -583,7 +582,7 @@ export class ConnectionHandler {
|
|||
break;
|
||||
case DisconnectReason.HANDSHAKE_FAILED:
|
||||
//TODO sound
|
||||
log.error(LogCategory.CLIENT, tr("Failed to process handshake: %o"), data);
|
||||
logError(LogCategory.CLIENT, tr("Failed to process handshake: %o"), data);
|
||||
createErrorModal(
|
||||
tr("Could not connect"),
|
||||
tr("Failed to process handshake: ") + data as string
|
||||
|
@ -607,7 +606,7 @@ export class ConnectionHandler {
|
|||
autoReconnect = false;
|
||||
break;
|
||||
case DisconnectReason.CONNECTION_CLOSED:
|
||||
log.error(LogCategory.CLIENT, tr("Lost connection to remote server!"));
|
||||
logError(LogCategory.CLIENT, tr("Lost connection to remote server!"));
|
||||
if(!this.autoReconnectAttempt) {
|
||||
createErrorModal(
|
||||
tr("Connection closed"),
|
||||
|
@ -619,7 +618,7 @@ export class ConnectionHandler {
|
|||
autoReconnect = true;
|
||||
break;
|
||||
case DisconnectReason.CONNECTION_PING_TIMEOUT:
|
||||
log.error(LogCategory.CLIENT, tr("Connection ping timeout"));
|
||||
logError(LogCategory.CLIENT, tr("Connection ping timeout"));
|
||||
this.sound.play(Sound.CONNECTION_DISCONNECTED_TIMEOUT);
|
||||
createErrorModal(
|
||||
tr("Connection lost"),
|
||||
|
@ -699,8 +698,8 @@ export class ConnectionHandler {
|
|||
this.sound.play(Sound.CONNECTION_BANNED);
|
||||
break;
|
||||
default:
|
||||
log.error(LogCategory.CLIENT, tr("Got uncaught disconnect!"));
|
||||
log.error(LogCategory.CLIENT, tr("Type: %o Data: %o"), type, data);
|
||||
logError(LogCategory.CLIENT, tr("Got uncaught disconnect!"));
|
||||
logError(LogCategory.CLIENT, tr("Type: %o Data: %o"), type, data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -747,7 +746,7 @@ export class ConnectionHandler {
|
|||
}
|
||||
|
||||
private on_connection_state_changed(old_state: ConnectionState, new_state: ConnectionState) {
|
||||
console.log("From %s to %s", ConnectionState[old_state], ConnectionState[new_state]);
|
||||
logTrace(LogCategory.CLIENT, tr("From %s to %s"), ConnectionState[old_state], ConnectionState[new_state]);
|
||||
this.events_.fire("notify_connection_state_changed", {
|
||||
oldState: old_state,
|
||||
newState: new_state
|
||||
|
@ -834,7 +833,7 @@ export class ConnectionHandler {
|
|||
|
||||
this.clientStatusSync = true;
|
||||
this.serverConnection.send_command("clientupdate", localClientUpdates).catch(error => {
|
||||
log.warn(LogCategory.GENERAL, tr("Failed to update client audio hardware properties. Error: %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to update client audio hardware properties. Error: %o"), error);
|
||||
this.log.log("error.custom", { message: tr("Failed to update audio hardware properties.") });
|
||||
this.clientStatusSync = false;
|
||||
});
|
||||
|
@ -880,7 +879,7 @@ export class ConnectionHandler {
|
|||
//client_input_hardware: this.client_status.sound_record_supported && this.getInputHardwareState() === InputHardwareState.VALID,
|
||||
//client_output_hardware: this.client_status.sound_playback_supported
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.GENERAL, tr("Failed to sync handler state with server. Error: %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to sync handler state with server. Error: %o"), error);
|
||||
this.log.log("error.custom", {message: tr("Failed to sync handler state with server.")});
|
||||
});
|
||||
}
|
||||
|
@ -990,7 +989,7 @@ export class ConnectionHandler {
|
|||
}).then(() => {
|
||||
createInfoModal(tr("Avatar deleted"), tr("Avatar successfully deleted")).open();
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to reset avatar flag: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to reset avatar flag: %o"), error);
|
||||
|
||||
let message;
|
||||
if(error instanceof CommandResult) {
|
||||
|
@ -1021,7 +1020,7 @@ export class ConnectionHandler {
|
|||
|
||||
if(transfer.transferState() !== FileTransferState.FINISHED) {
|
||||
if(transfer.transferState() === FileTransferState.ERRORED) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Failed to upload clients avatar: %o"), transfer.currentError());
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Failed to upload clients avatar: %o"), transfer.currentError());
|
||||
createErrorModal(tr("Failed to upload avatar"), traj("Failed to upload avatar:{:br:}{0}", transfer.currentErrorMessage())).open();
|
||||
return;
|
||||
} else if(transfer.transferState() === FileTransferState.CANCELED) {
|
||||
|
@ -1038,7 +1037,7 @@ export class ConnectionHandler {
|
|||
client_flag_avatar: md5(new Uint8Array(data))
|
||||
});
|
||||
} catch(error) {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to update avatar flag: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to update avatar flag: %o"), error);
|
||||
|
||||
let message;
|
||||
if(error instanceof CommandResult)
|
||||
|
@ -1217,7 +1216,7 @@ export class ConnectionHandler {
|
|||
client_away: typeof(this.client_status.away) === "string" || this.client_status.away,
|
||||
client_away_message: typeof(this.client_status.away) === "string" ? this.client_status.away : "",
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.GENERAL, tr("Failed to update away status. Error: %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to update away status. Error: %o"), error);
|
||||
this.log.log("error.custom", {message: tr("Failed to update away status.")});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as ppt from "tc-backend/ppt";
|
||||
import * as log from "./log";
|
||||
import {LogCategory, logWarn} from "./log";
|
||||
import {LogCategory, logError, logWarn} from "./log";
|
||||
import {KeyDescriptor, KeyHook} from "./PPTListener";
|
||||
import {Settings, settings} from "./settings";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
|
@ -137,7 +137,7 @@ export function initializeKeyControl() {
|
|||
try {
|
||||
cfg = JSON.parse(settings.getValue(Settings.KEY_KEYCONTROL_DATA));
|
||||
} catch (e) {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to parse old key control data."));
|
||||
logError(LogCategory.GENERAL, tr("Failed to parse old key control data."));
|
||||
cfg = {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "./log";
|
||||
import {LogCategory} from "./log";
|
||||
import {LogCategory, logError} from "./log";
|
||||
import {guid} from "./crypto/uid";
|
||||
import {createErrorModal, createInfoModal, createInputModal} from "./ui/elements/Modal";
|
||||
import {defaultConnectProfile, findConnectProfile} from "./profiles/ConnectionProfile";
|
||||
|
@ -99,7 +98,7 @@ function bookmark_config() : BookmarkConfig {
|
|||
try {
|
||||
bookmarks = JSON.parse(bookmark_json) || {} as BookmarkConfig;
|
||||
} catch(error) {
|
||||
log.error(LogCategory.BOOKMARKS, tr("Failed to load bookmarks: %o"), error);
|
||||
logError(LogCategory.BOOKMARKS, tr("Failed to load bookmarks: %o"), error);
|
||||
bookmarks = {} as any;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import {
|
||||
AbstractServerConnection,
|
||||
ServerCommand,
|
||||
SingleCommandHandler
|
||||
} from "../connection/ConnectionBase";
|
||||
import {AbstractServerConnection, ServerCommand, SingleCommandHandler} from "../connection/ConnectionBase";
|
||||
import {tr} from "../i18n/localize";
|
||||
import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||
|
||||
export abstract class AbstractCommandHandler {
|
||||
readonly connection: AbstractServerConnection;
|
||||
|
@ -67,7 +64,7 @@ export abstract class AbstractCommandHandlerBoss {
|
|||
|
||||
unregister_handler(handler: AbstractCommandHandler) {
|
||||
if(!handler.volatile_handler_boss && handler.handler_boss !== this) {
|
||||
console.warn(tr("Tried to unregister command handler which does not belong to the handler boss"));
|
||||
logWarn(LogCategory.NETWORKING, tr("Tried to unregister command handler which does not belong to the handler boss"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -98,7 +95,7 @@ export abstract class AbstractCommandHandlerBoss {
|
|||
if(!flag_consumed || handler.ignore_consumed)
|
||||
flag_consumed = handler.handle_command(command) || flag_consumed;
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to invoke command handler. Invocation results in an exception: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to invoke command handler. Invocation results in an exception: %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +105,7 @@ export abstract class AbstractCommandHandlerBoss {
|
|||
try {
|
||||
flag_consumed = handler(command, flag_consumed) || flag_consumed;
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to invoke command handler. Invocation results in an exception: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to invoke command handler. Invocation results in an exception: %o"), error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +119,7 @@ export abstract class AbstractCommandHandlerBoss {
|
|||
if(handler.function(command))
|
||||
this.single_command_handler.remove(handler);
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to invoke single command handler. Invocation results in an exception: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to invoke single command handler. Invocation results in an exception: %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory, logError, logWarn} from "../log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "../log";
|
||||
import {AbstractServerConnection, CommandOptions, ServerCommand} from "../connection/ConnectionBase";
|
||||
import {Sound} from "../sound/Sounds";
|
||||
import {CommandResult} from "../connection/ServerConnectionDeclaration";
|
||||
|
@ -125,7 +124,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
} else if(typeof(ex) === "string") {
|
||||
this.connection_handler.log.log("connection.command.error", {error: ex});
|
||||
} else {
|
||||
log.error(LogCategory.NETWORKING, tr("Invalid promise result type: %s. Result: %o"), typeof (ex), ex);
|
||||
logError(LogCategory.NETWORKING, tr("Invalid promise result type: %s. Result: %o"), typeof (ex), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +159,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
handleCommandResult(json) {
|
||||
let code : string = json[0]["return_code"];
|
||||
if(!code || code.length == 0) {
|
||||
log.warn(LogCategory.NETWORKING, tr("Invalid return code! (%o)"), json);
|
||||
logWarn(LogCategory.NETWORKING, tr("Invalid return code! (%o)"), json);
|
||||
return;
|
||||
}
|
||||
let retListeners = this.connection["_retListener"] || this.connection["returnListeners"];
|
||||
|
@ -278,7 +277,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const client = this.connection_handler.channelTree.findClient(parseInt(json["clid"]));
|
||||
if(!client) {
|
||||
log.warn(LogCategory.NETWORKING, tr("Received client connection info for unknown client (%o)"), json["clid"]);
|
||||
logWarn(LogCategory.NETWORKING, tr("Received client connection info for unknown client (%o)"), json["clid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -410,7 +409,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
let playSound = false;
|
||||
|
||||
log.info(LogCategory.NETWORKING, tr("Got %d channel deletions"), json.length);
|
||||
logInfo(LogCategory.NETWORKING, tr("Got %d channel deletions"), json.length);
|
||||
for(let index = 0; index < json.length; index++) {
|
||||
conversations.destroyConversation(parseInt(json[index]["cid"]));
|
||||
let channel = tree.findChannel(json[index]["cid"]);
|
||||
|
@ -442,7 +441,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
handleCommandChannelHide(json) {
|
||||
let tree = this.connection.client.channelTree;
|
||||
|
||||
log.info(LogCategory.NETWORKING, tr("Got %d channel hides"), json.length);
|
||||
logInfo(LogCategory.NETWORKING, tr("Got %d channel hides"), json.length);
|
||||
for(let index = 0; index < json.length; index++) {
|
||||
let channel = tree.findChannel(json[index]["cid"]);
|
||||
if(!channel) {
|
||||
|
@ -471,6 +470,12 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
for(const entry of json) {
|
||||
/* attempt to update properties if given */
|
||||
channel = typeof(entry["ctid"]) !== "undefined" ? tree.findChannel(parseInt(entry["ctid"])) : channel;
|
||||
if(!channel) {
|
||||
/* TODO: Close the connection */
|
||||
logError(LogCategory.NETWORKING, tr("Received client enter view for invalid target channel: %o"), entry["ctid"]);
|
||||
continue;
|
||||
}
|
||||
|
||||
old_channel = typeof(entry["cfid"]) !== "undefined" ? tree.findChannel(parseInt(entry["cfid"])) : old_channel;
|
||||
reasonId = typeof(entry["reasonid"]) !== "undefined" ? entry["reasonid"] : reasonId;
|
||||
reasonMsg = typeof(entry["reason_msg"]) !== "undefined" ? entry["reason_msg"] : reasonMsg;
|
||||
|
@ -522,7 +527,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
} else if(reasonId == ViewReasonId.VREASON_SYSTEM) {
|
||||
|
||||
} else {
|
||||
console.warn(tr("Unknown reasonid for %o"), reasonId);
|
||||
logWarn(LogCategory.NETWORKING, tr("Unknown reasonid for %o"), reasonId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,7 +565,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
let tree = this.connection.client.channelTree;
|
||||
let client = tree.findClient(entry["clid"]);
|
||||
if(!client) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown client left!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown client left!"));
|
||||
return 0;
|
||||
}
|
||||
if(client == this.connection.client.getClient()) {
|
||||
|
@ -611,7 +616,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
} else if(reason_id == ViewReasonId.VREASON_MOVED) {
|
||||
this.connection_handler.sound.play(Sound.USER_LEFT_MOVED);
|
||||
} else {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown client left reason %d!"), reason_id);
|
||||
logError(LogCategory.NETWORKING, tr("Unknown client left reason %d!"), reason_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -630,21 +635,21 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
let channelFrom = tree.findChannel(parseInt(json["cfid"]));
|
||||
|
||||
if(!client) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown client move (Client)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown client move (Client)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!channel_to) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown client move (Channel to)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown client move (Channel to)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!self) {
|
||||
if(!channelFrom) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown client move (Channel from)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown client move (Channel from)!"));
|
||||
channelFrom = client.currentChannel();
|
||||
} else if(channelFrom != client.currentChannel()) {
|
||||
log.error(LogCategory.NETWORKING,
|
||||
logError(LogCategory.NETWORKING,
|
||||
tr("Client move from invalid source channel! Local client registered in channel %d but server send %d."),
|
||||
client.currentChannel().channelId, channelFrom.channelId
|
||||
);
|
||||
|
@ -713,7 +718,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
else if(own_channel == channelFrom)
|
||||
this.connection_handler.sound.play(Sound.USER_LEFT_KICKED_CHANNEL);
|
||||
} else {
|
||||
console.warn(tr("Unknown reason id %o"), json["reasonid"]);
|
||||
logWarn(LogCategory.NETWORKING, tr("Unknown reason id %o"), json["reasonid"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -723,19 +728,19 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
let tree = this.connection.client.channelTree;
|
||||
let channel = tree.findChannel(json["cid"]);
|
||||
if(!channel) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown channel move (Channel)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown channel move (Channel)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
let prev = tree.findChannel(json["order"]);
|
||||
if(!prev && json["order"] != 0) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown channel move (prev)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown channel move (prev)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
let parent = tree.findChannel(json["cpid"]);
|
||||
if(!parent && json["cpid"] != 0) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown channel move (parent)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown channel move (parent)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -748,7 +753,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
let tree = this.connection.client.channelTree;
|
||||
let channel = tree.findChannel(json["cid"]);
|
||||
if(!channel) {
|
||||
log.error(LogCategory.NETWORKING, tr("Unknown channel edit (Channel)!"));
|
||||
logError(LogCategory.NETWORKING, tr("Unknown channel edit (Channel)!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -797,7 +802,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
const targetIsOwn = targetClientEntry instanceof LocalClientEntry;
|
||||
|
||||
if(targetIsOwn && targetClientId === invokerClientId) {
|
||||
log.error(LogCategory.NETWORKING, tr("Received conversation message from our self. This should be impossible."), json);
|
||||
logError(LogCategory.NETWORKING, tr("Received conversation message from our self. This should be impossible."), json);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -899,7 +904,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
const conversationManager = this.connection_handler.getPrivateConversations();
|
||||
const conversation = conversationManager.findConversation(json["cluid"]);
|
||||
if(!conversation) {
|
||||
log.warn(LogCategory.GENERAL, tr("Received chat close for client, but we haven't a chat open."));
|
||||
logWarn(LogCategory.GENERAL, tr("Received chat close for client, but we haven't a chat open."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -911,7 +916,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
let client = this.connection.client.channelTree.findClient(json["clid"]);
|
||||
if(!client) {
|
||||
log.error(LogCategory.NETWORKING, tr("Tried to update an non existing client"));
|
||||
logError(LogCategory.NETWORKING, tr("Tried to update an non existing client"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -968,7 +973,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
let bot = this.connection.client.channelTree.find_client_by_dbid(json["bot_id"]);
|
||||
if(!bot || !(bot instanceof MusicClientEntry)) {
|
||||
log.warn(LogCategory.CLIENT, tr("Got music player info for unknown or invalid bot! (ID: %i, Entry: %o)"), json["bot_id"], bot);
|
||||
logWarn(LogCategory.CLIENT, tr("Got music player info for unknown or invalid bot! (ID: %i, Entry: %o)"), json["bot_id"], bot);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1031,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
for(const entry of json) {
|
||||
const channel = this.connection.client.channelTree.findChannel(parseInt(entry["cid"]));
|
||||
if(!channel) {
|
||||
console.warn(tr("Received channel subscribed for not visible channel (cid: %d)"), entry['cid']);
|
||||
logWarn(LogCategory.NETWORKING, tr("Received channel subscribed for not visible channel (cid: %o)"), entry["cid"]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1046,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
for(const entry of json) {
|
||||
const channel = this.connection.client.channelTree.findChannel(entry["cid"]);
|
||||
if(!channel) {
|
||||
console.warn(tr("Received channel unsubscribed for not visible channel (cid: %d)"), entry['cid']);
|
||||
logWarn(LogCategory.NETWORKING, tr("Received channel unsubscribed for not visible channel (cid: %o)"), entry["cid"]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1063,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
const bot_id = parseInt(json["bot_id"]);
|
||||
const client = this.connection.client.channelTree.find_client_by_dbid(bot_id);
|
||||
if(!client || !(client instanceof MusicClientEntry)) {
|
||||
log.warn(LogCategory.CLIENT, tr("Received music bot status update for unknown bot (%d)"), bot_id);
|
||||
logWarn(LogCategory.CLIENT, tr("Received music bot status update for unknown bot (%d)"), bot_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1079,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
const bot_id = parseInt(json["bot_id"]);
|
||||
const client = this.connection.client.channelTree.find_client_by_dbid(bot_id);
|
||||
if(!client || !(client instanceof MusicClientEntry)) {
|
||||
log.warn(LogCategory.CLIENT, tr("Received music bot status update for unknown bot (%d)"), bot_id);
|
||||
logWarn(LogCategory.CLIENT, tr("Received music bot status update for unknown bot (%d)"), bot_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {ServerCommand, SingleCommandHandler} from "../connection/ConnectionBase";
|
||||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logError} from "../log";
|
||||
import {
|
||||
ClientNameInfo,
|
||||
CommandResult,
|
||||
|
@ -221,7 +220,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
needed_power_song_remove: parseInt(entry["needed_power_song_remove"])
|
||||
});
|
||||
} catch(error) {
|
||||
log.error(LogCategory.NETWORKING, tr("Failed to parse playlist entry: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to parse playlist entry: %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +280,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
song_metadata: entry["song_metadata"]
|
||||
});
|
||||
} catch(error) {
|
||||
log.error(LogCategory.NETWORKING, tr("Failed to parse playlist song entry: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to parse playlist song entry: %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +318,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
const json = command.arguments;
|
||||
|
||||
if(json[0]["playlist_id"] != playlist_id) {
|
||||
log.error(LogCategory.NETWORKING, tr("Received invalid notification for playlist clients"));
|
||||
logError(LogCategory.NETWORKING, tr("Received invalid notification for playlist clients"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -355,7 +354,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
command: "notifyservergroupclientlist",
|
||||
function: command => {
|
||||
if (command.arguments[0]["sgid"] != group_id) {
|
||||
log.error(LogCategory.NETWORKING, tr("Received invalid notification for server group client list"));
|
||||
logError(LogCategory.NETWORKING, tr("Received invalid notification for server group client list"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -372,7 +371,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
}
|
||||
resolve(result);
|
||||
} catch (error) {
|
||||
log.error(LogCategory.NETWORKING, tr("Failed to parse server group client list: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to parse server group client list: %o"), error);
|
||||
reject("failed to parse info");
|
||||
}
|
||||
|
||||
|
@ -394,7 +393,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
function: command => {
|
||||
const json = command.arguments[0];
|
||||
if (json["playlist_id"] != playlist_id) {
|
||||
log.error(LogCategory.NETWORKING, tr("Received invalid notification for playlist info"));
|
||||
logError(LogCategory.NETWORKING, tr("Received invalid notification for playlist info"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -416,7 +415,7 @@ export class CommandHelper extends AbstractCommandHandler {
|
|||
playlist_max_songs: parseInt(json["playlist_max_songs"])
|
||||
});
|
||||
} catch (error) {
|
||||
log.error(LogCategory.NETWORKING, tr("Failed to parse playlist info: %o"), error);
|
||||
logError(LogCategory.NETWORKING, tr("Failed to parse playlist info: %o"), error);
|
||||
reject("failed to parse info");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {AbstractServerConnection, ServerCommand, ServerConnectionEvents} from "tc-shared/connection/ConnectionBase";
|
||||
import {ConnectionState} from "tc-shared/ConnectionHandler";
|
||||
import * as log from "tc-shared/log";
|
||||
import {group, LogCategory, logDebug, logError, logGroupNative, logTrace, LogType, logWarn} from "tc-shared/log";
|
||||
import {LogCategory, logDebug, logError, logGroupNative, logTrace, LogType, logWarn} from "tc-shared/log";
|
||||
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {tr, tra} from "tc-shared/i18n/localize";
|
||||
|
@ -307,8 +306,6 @@ class CommandHandler extends AbstractCommandHandler {
|
|||
} else {
|
||||
logWarn(LogCategory.WEBRTC, tr("Received unknown/invalid rtc track state: %d"), state);
|
||||
}
|
||||
} else if(command.command === "notifybroadcastvideo") {
|
||||
/* FIXME: TODO! */
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -920,9 +917,6 @@ export class RTCConnection {
|
|||
this.peer.ondatachannel = event => this.handleDataChannel(event.channel);
|
||||
this.peer.ontrack = event => this.handleTrack(event);
|
||||
|
||||
/* FIXME: Remove this debug! */
|
||||
(window as any).rtp = this;
|
||||
|
||||
this.updateConnectionState(RTPConnectionState.CONNECTING);
|
||||
this.doInitialSetup0().catch(error => {
|
||||
this.handleFatalError(tr("initial setup failed"), true);
|
||||
|
@ -959,7 +953,7 @@ export class RTCConnection {
|
|||
/* Firefox has some crazy issues */
|
||||
if(window.detectedBrowser.name !== "firefox") {
|
||||
if(target) {
|
||||
console.error("Setting sendrecv from %o", this.currentTransceiver[type].direction, this.currentTransceiver[type].currentDirection);
|
||||
logTrace(LogCategory.NETWORKING, "Setting sendrecv from %o", this.currentTransceiver[type].direction, this.currentTransceiver[type].currentDirection);
|
||||
this.currentTransceiver[type].direction = "sendrecv";
|
||||
} else if(type === "video" || type === "video-screen") {
|
||||
/*
|
||||
|
@ -1046,7 +1040,6 @@ export class RTCConnection {
|
|||
|
||||
private handleLocalIceCandidate(candidate: RTCIceCandidate | undefined) {
|
||||
if(candidate) {
|
||||
console.error(candidate.candidate);
|
||||
if(candidate.address?.endsWith(".local")) {
|
||||
logTrace(LogCategory.WEBRTC, tr("Skipping local fqdn ICE candidate %s"), candidate.toJSON().candidate);
|
||||
return;
|
||||
|
@ -1109,18 +1102,18 @@ export class RTCConnection {
|
|||
|
||||
private handleIceCandidateError(event: RTCPeerConnectionIceErrorEvent) {
|
||||
if(this.peer.iceGatheringState === "gathering") {
|
||||
log.warn(LogCategory.WEBRTC, tr("Received error while gathering the ice candidates: %d/%s for %s (url: %s)"),
|
||||
logWarn(LogCategory.WEBRTC, tr("Received error while gathering the ice candidates: %d/%s for %s (url: %s)"),
|
||||
event.errorCode, event.errorText, event.hostCandidate, event.url);
|
||||
} else {
|
||||
log.trace(LogCategory.WEBRTC, tr("Ice candidate %s (%s) errored: %d/%s"),
|
||||
logTrace(LogCategory.WEBRTC, tr("Ice candidate %s (%s) errored: %d/%s"),
|
||||
event.url, event.hostCandidate, event.errorCode, event.errorText);
|
||||
}
|
||||
}
|
||||
private handleIceConnectionStateChanged() {
|
||||
log.trace(LogCategory.WEBRTC, tr("ICE connection state changed to %s"), this.peer.iceConnectionState);
|
||||
logTrace(LogCategory.WEBRTC, tr("ICE connection state changed to %s"), this.peer.iceConnectionState);
|
||||
}
|
||||
private handleIceGatheringStateChanged() {
|
||||
log.trace(LogCategory.WEBRTC, tr("ICE gathering state changed to %s"), this.peer.iceGatheringState);
|
||||
logTrace(LogCategory.WEBRTC, tr("ICE gathering state changed to %s"), this.peer.iceGatheringState);
|
||||
}
|
||||
|
||||
private handleSignallingStateChanged() {
|
||||
|
|
|
@ -218,7 +218,6 @@ function generateSdp(session: RTCNegotiationMessage) {
|
|||
generateMedia(session.ssrc[index], flags);
|
||||
}
|
||||
|
||||
console.error(JSON.stringify(session));
|
||||
return sdpTransform.write(sdp);
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ export class RTCNegotiator {
|
|||
|
||||
}
|
||||
}
|
||||
/* FIXME: mozilla...THIS_IS_SDPARTA-82.0.3 (Needs to be parsed from the offer) */
|
||||
/* TODO: mozilla...THIS_IS_SDPARTA-82.0.3 (Needs to be parsed from the offer) */
|
||||
/*
|
||||
console.error("XYX\n%s",
|
||||
generateSdp({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Registry} from "tc-shared/events";
|
||||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
import {LogCategory, logTrace, logWarn} from "tc-shared/log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {globalAudioContext, on_ready} from "tc-backend/audio/player";
|
||||
|
||||
|
@ -104,10 +104,10 @@ export class RemoteRTPVideoTrack extends RemoteRTPTrack {
|
|||
this.mediaStream.addTrack(transceiver.receiver.track);
|
||||
|
||||
const track = transceiver.receiver.track;
|
||||
track.onended = () => console.error("TRACK %d ended", ssrc);
|
||||
track.onmute = () => console.error("TRACK %d muted", ssrc);
|
||||
track.onunmute = () => console.error("TRACK %d unmuted", ssrc);
|
||||
track.onisolationchange = () => console.error("TRACK %d onisolationchange", ssrc);
|
||||
track.onended = () => logTrace(LogCategory.VIDEO, "Track %d ended", ssrc);
|
||||
track.onmute = () => logTrace(LogCategory.VIDEO, "Track %d muted", ssrc);
|
||||
track.onunmute = () => logTrace(LogCategory.VIDEO, "Track %d unmuted", ssrc);
|
||||
track.onisolationchange = () => logTrace(LogCategory.VIDEO, "Track %d isolation changed", ssrc);
|
||||
}
|
||||
|
||||
getMediaStream() : MediaStream {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {
|
||||
VideoBroadcastConfig,
|
||||
LocalVideoBroadcast,
|
||||
LocalVideoBroadcastEvents,
|
||||
LocalVideoBroadcastState,
|
||||
VideoBroadcastConfig,
|
||||
VideoBroadcastStatistics,
|
||||
VideoBroadcastType,
|
||||
VideoClient,
|
||||
|
@ -13,7 +13,7 @@ import {
|
|||
import {Registry} from "tc-shared/events";
|
||||
import {VideoSource} from "tc-shared/video/VideoSource";
|
||||
import {RTCBroadcastableTrackType, RTCConnection, RTCConnectionEvents, RTPConnectionState} from "../Connection";
|
||||
import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||
import {LogCategory, logError, logTrace, logWarn} from "tc-shared/log";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import {RtpVideoClient} from "./VideoClient";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
@ -77,7 +77,7 @@ class LocalRtpVideoBroadcast implements LocalVideoBroadcast {
|
|||
let sourceRef = source.ref();
|
||||
try {
|
||||
if(this.currentSource !== source) {
|
||||
console.error("Source changed");
|
||||
logTrace(LogCategory.VIDEO, tr("Video broadcast %s source changed"), this.type);
|
||||
const videoTracks = source.getStream().getVideoTracks();
|
||||
if(videoTracks.length === 0) {
|
||||
throw tr("missing video stream track");
|
||||
|
@ -110,7 +110,7 @@ class LocalRtpVideoBroadcast implements LocalVideoBroadcast {
|
|||
|
||||
this.setCurrentSource(sourceRef);
|
||||
} else if(!_.isEqual(this.currentConfig, constraints)) {
|
||||
console.error("Constraints changed");
|
||||
logTrace(LogCategory.VIDEO, tr("Video broadcast %s constraints changed"), this.type);
|
||||
await this.applyConstraints(constraints);
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -2,14 +2,14 @@ import * as loader from "tc-loader";
|
|||
import {Stage} from "tc-loader";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
import {getIconManager} from "tc-shared/file/Icons";
|
||||
import { tra, tr } from "tc-shared/i18n/localize";
|
||||
import {tr, tra} from "tc-shared/i18n/localize";
|
||||
import {EventClient, EventServerAddress, EventType, TypeInfo} from "tc-shared/connectionlog/Definitions";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import {format_time} from "tc-shared/ui/frames/chat";
|
||||
import {ViewReasonId} from "tc-shared/ConnectionHandler";
|
||||
import {formatDate} from "tc-shared/MessageFormatter";
|
||||
import {renderBBCodeAsText} from "tc-shared/text/bbcode";
|
||||
import {LogCategory, logInfo} from "tc-shared/log";
|
||||
import {LogCategory, logInfo, logTrace} from "tc-shared/log";
|
||||
|
||||
export type DispatcherLog<T extends keyof TypeInfo> = (data: TypeInfo[T], handlerId: string, eventType: T) => void;
|
||||
|
||||
|
@ -77,7 +77,7 @@ function spawnNotification(title: string, options: NotificationOptions) {
|
|||
try {
|
||||
new Notification(title, options);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
logTrace(LogCategory.GENERAL, tr("Failed to spawn notification: %o"), error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as loader from "tc-loader";
|
||||
import {Stage} from "tc-loader";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {LogCategory, logDebug, logError, logInfo, logWarn} from "tc-shared/log";
|
||||
import {ChatEvent} from "../ui/frames/side/AbstractConversationDefinitions";
|
||||
|
||||
|
@ -176,7 +176,7 @@ async function doOpenDatabase(forceUpgrade: boolean) {
|
|||
};
|
||||
|
||||
openRequest.onerror = () => {
|
||||
console.error("Private conversation history opening error: %o", openRequest.error);
|
||||
logWarn(LogCategory.CHAT, tr("Private conversation history opening error: %o"), openRequest.error);
|
||||
reject(openRequest.error.message);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "./log";
|
||||
import {LogCategory} from "./log";
|
||||
import {LogCategory, logTrace, logWarn} from "./log";
|
||||
import {guid} from "./crypto/uid";
|
||||
import * as React from "react";
|
||||
import {useEffect} from "react";
|
||||
|
@ -181,7 +180,7 @@ export class Registry<Events extends { [key: string]: any } = { [key: string]: a
|
|||
|
||||
fire<T extends keyof Events>(event_type: T, data?: Events[T], overrideTypeKey?: boolean) {
|
||||
if(this.debugPrefix)
|
||||
log.trace(LogCategory.EVENT_REGISTRY, tr("[%s] Trigger event: %s"), this.debugPrefix, event_type);
|
||||
logTrace(LogCategory.EVENT_REGISTRY, tr("[%s] Trigger event: %s"), this.debugPrefix, event_type);
|
||||
|
||||
if(typeof data === "object" && 'type' in data && !overrideTypeKey) {
|
||||
if((data as any).type !== event_type) {
|
||||
|
@ -222,7 +221,7 @@ export class Registry<Events extends { [key: string]: any } = { [key: string]: a
|
|||
invokeCount++;
|
||||
}
|
||||
if(this.warnUnhandledEvents && invokeCount === 0) {
|
||||
log.warn(LogCategory.EVENT_REGISTRY, tr("Event handler (%s) triggered event %s which has no consumers."), this.debugPrefix, type);
|
||||
logWarn(LogCategory.EVENT_REGISTRY, tr("Event handler (%s) triggered event %s which has no consumers."), this.debugPrefix, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,7 +327,7 @@ export class Registry<Events extends { [key: string]: any } = { [key: string]: a
|
|||
break;
|
||||
} while ((currentPrototype = Object.getPrototypeOf(currentPrototype)));
|
||||
if(Object.keys(registered_events).length === 0) {
|
||||
log.warn(LogCategory.EVENT_REGISTRY, tr("No events found in event handler which has been registered."));
|
||||
logWarn(LogCategory.EVENT_REGISTRY, tr("No events found in event handler which has been registered."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
|
|||
|
||||
event_registry.on("action_open_window", event => {
|
||||
const handle_import_error = error => {
|
||||
console.error("Failed to import script: %o", error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to import script: %o"), error);
|
||||
createErrorModal(tr("Failed to load window"), tr("Failed to load the bookmark window.\nSee the console for more details.")).open();
|
||||
};
|
||||
|
||||
|
@ -136,7 +136,6 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
|
|||
}).then(() => {
|
||||
createInfoModal(tr("Use token"), tr("Toke successfully used!")).open();
|
||||
}).catch(error => {
|
||||
//TODO tr
|
||||
createErrorModal(tr("Use token"), formatMessage(tr("Failed to use token: {}"), error instanceof CommandResult ? error.message : error)).open();
|
||||
});
|
||||
}).open();
|
||||
|
@ -166,7 +165,7 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
|
|||
break;
|
||||
|
||||
default:
|
||||
console.warn(tr("Received open window event for an unknown window: %s"), event.window);
|
||||
logWarn(LogCategory.GENERAL, tr("Received open window event for an unknown window: %s"), event.window);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -199,7 +198,6 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
|
|||
try {
|
||||
const broadcast = connection.getServerConnection().getVideoConnection().getLocalBroadcast(event.broadcastType);
|
||||
if(broadcast.getState().state === "initializing" || broadcast.getState().state === "broadcasting") {
|
||||
console.error("Change source");
|
||||
broadcast.changeSource(source, config).catch(error => {
|
||||
logError(LogCategory.VIDEO, tr("Failed to change broadcast source: %o"), event.broadcastType, error);
|
||||
if(typeof error !== "string") {
|
||||
|
@ -213,7 +211,6 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
|
|||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Start broadcast");
|
||||
broadcast.startBroadcasting(source, config).catch(error => {
|
||||
logError(LogCategory.VIDEO, tr("Failed to start %s broadcasting: %o"), event.broadcastType, error);
|
||||
if(typeof error !== "string") {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ServerCommand} from "tc-shared/connection/ConnectionBase";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
|
@ -172,7 +171,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const transfer = this.manager.findTransfer(parseInt(data["clientftfid"]));
|
||||
if(!transfer) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,7 +212,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const transfer = this.manager.findTransfer(parseInt(data["clientftfid"])) as FileUploadTransfer;
|
||||
if(!transfer) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const transfer = this.manager.findTransfer(parseInt(data["clientftfid"])) as FileUploadTransfer;
|
||||
if(!transfer) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file transfer start notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -258,7 +257,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const transfer = this.manager.findTransfer(parseInt(data["clientftfid"])) as FileUploadTransfer;
|
||||
if(!transfer) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file transfer progress notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file transfer progress notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -283,7 +282,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
|
||||
const transfer = this.manager.findTransfer(parseInt(data["clientftfid"])) as FileUploadTransfer;
|
||||
if(!transfer) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file transfer status notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file transfer status notification for unknown transfer (%s)"), data["clientftfid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,7 +307,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
private handleNotifyFileList(data: any[]) {
|
||||
const query = this.pendingFileLists.find(e => e.path === data[0]["path"] && (e.channelId === parseInt(data[0]["cid"]) || e.channelId === undefined && !data[0]["cid"]));
|
||||
if(!query) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file list for not request path: %s (channel %s)"), data[0]["path"], data[0]["cid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file list for not request path: %s (channel %s)"), data[0]["path"], data[0]["cid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -326,7 +325,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
private handleNotifyFileListFinished(data) {
|
||||
const query = this.pendingFileLists.find(e => e.path === data[0]["path"] && (e.channelId === parseInt(data[0]["cid"]) || e.channelId === undefined && !data[0]["cid"]));
|
||||
if(!query) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file list finish for not request path: %s (channel %s)"), data[0]["path"], data[0]["cid"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file list finish for not request path: %s (channel %s)"), data[0]["path"], data[0]["cid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -336,11 +335,11 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
private handleNotifyFileInfo(data: any[]) {
|
||||
const query = this.pendingFileInfos.find(e => e.returnCode === data[0]["return_code"]);
|
||||
if(!query) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file info for unknown return code: %s"), data[0]["return_code"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file info for unknown return code: %s"), data[0]["return_code"]);
|
||||
return;
|
||||
}
|
||||
if(query.finished) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file info for already finished return code: %s"), data[0]["return_code"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file info for already finished return code: %s"), data[0]["return_code"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -358,7 +357,7 @@ class FileCommandHandler extends AbstractCommandHandler {
|
|||
private handleNotifyFileInfoFinished(data) {
|
||||
const query = this.pendingFileInfos.find(e => e.returnCode === data[0]["return_code"]);
|
||||
if(!query) {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Received file info for unknown return code: %s"), data[0]["return_code"]);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Received file info for unknown return code: %s"), data[0]["return_code"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -656,7 +655,7 @@ export class FileManager {
|
|||
|
||||
const index = this.registeredTransfers_.findIndex(e => e.transfer === transfer);
|
||||
if(index === -1) {
|
||||
log.error(LogCategory.FILE_TRANSFER, tr("Missing file transfer in file transfer list!"));
|
||||
logError(LogCategory.FILE_TRANSFER, tr("Missing file transfer in file transfer list!"));
|
||||
return;
|
||||
} else {
|
||||
this.registeredTransfers_.splice(index, 1);
|
||||
|
@ -680,7 +679,7 @@ export class FileManager {
|
|||
transferErrorMessage: transfer.currentErrorMessage(),
|
||||
});
|
||||
} else {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tra("File transfer finished callback called with invalid transfer state ({0})", FileTransferState[state]));
|
||||
logWarn(LogCategory.FILE_TRANSFER, tra("File transfer finished callback called with invalid transfer state ({0})", FileTransferState[state]));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Registry} from "tc-shared/events";
|
||||
import { tr, tra } from "tc-shared/i18n/localize";
|
||||
import {tr, tra} from "tc-shared/i18n/localize";
|
||||
|
||||
export const kIPCIconChannel = "icons";
|
||||
export const kGlobalIconHandlerId = "global";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {tr} from "../i18n/localize";
|
||||
import {LogCategory, logDebug} from "tc-shared/log";
|
||||
import {LogCategory, logDebug, logWarn} from "tc-shared/log";
|
||||
|
||||
export enum ImageType {
|
||||
UNKNOWN,
|
||||
|
@ -169,7 +169,7 @@ export class ImageCache {
|
|||
ignoreSearch: true
|
||||
});
|
||||
if(!flag) {
|
||||
console.warn(tr("Failed to delete key %s from cache!"), key);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Failed to delete key %s from cache!"), key);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logDebug, logError, logInfo, logWarn} from "../log";
|
||||
import * as ipc from "../ipc/BrowserIPC";
|
||||
import {ChannelMessage} from "../ipc/BrowserIPC";
|
||||
import * as loader from "tc-loader";
|
||||
|
@ -58,7 +57,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
}
|
||||
|
||||
create_avatar_download(client_avatar_id: string) : FileDownloadTransfer {
|
||||
log.debug(LogCategory.GENERAL, "Requesting download for avatar %s", client_avatar_id);
|
||||
logDebug(LogCategory.GENERAL, "Requesting download for avatar %s", client_avatar_id);
|
||||
|
||||
return this.handle.initializeFileDownload({
|
||||
path: "",
|
||||
|
@ -86,11 +85,11 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
let cachedAvatarHash = response.headers.has("X-avatar-version") ? response.headers.get("X-avatar-version") : undefined;
|
||||
if(avatar.getAvatarHash() !== "unknown") {
|
||||
if(cachedAvatarHash === undefined) {
|
||||
log.debug(LogCategory.FILE_TRANSFER, tr("Invalidating cached avatar for %s (Version miss match. Cached: unset, Current: %s)"), avatar.clientAvatarId, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.FILE_TRANSFER, tr("Invalidating cached avatar for %s (Version miss match. Cached: unset, Current: %s)"), avatar.clientAvatarId, avatar.getAvatarHash());
|
||||
await localAvatarCache.delete('avatar_' + avatar.clientAvatarId);
|
||||
break cache_lookup;
|
||||
} else if(cachedAvatarHash !== avatar.getAvatarHash()) {
|
||||
log.debug(LogCategory.FILE_TRANSFER, tr("Invalidating cached avatar for %s (Version miss match. Cached: %s, Current: %s)"), avatar.clientAvatarId, cachedAvatarHash, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.FILE_TRANSFER, tr("Invalidating cached avatar for %s (Version miss match. Cached: %s, Current: %s)"), avatar.clientAvatarId, cachedAvatarHash, avatar.getAvatarHash());
|
||||
await localAvatarCache.delete('avatar_' + avatar.clientAvatarId);
|
||||
break cache_lookup;
|
||||
}
|
||||
|
@ -122,7 +121,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
if(commandResult instanceof CommandResult) {
|
||||
if(commandResult.id === ErrorCode.FILE_NOT_FOUND) {
|
||||
if(avatar.getAvatarHash() !== initialAvatarHash) {
|
||||
log.debug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,7 +135,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
}
|
||||
}
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Could not request download for avatar %s: %o"), avatar.clientAvatarId, error);
|
||||
logError(LogCategory.CLIENT, tr("Could not request download for avatar %s: %o"), avatar.clientAvatarId, error);
|
||||
if(error === transfer.currentError())
|
||||
throw transfer.currentErrorMessage();
|
||||
|
||||
|
@ -161,7 +160,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
const media = imageType2MediaType(type);
|
||||
|
||||
if(avatar.getAvatarHash() !== initialAvatarHash) {
|
||||
log.debug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,7 +187,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
|
||||
/* ensure we're still up to date */
|
||||
if(avatar.getAvatarHash() !== initialAvatarHash) {
|
||||
log.debug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), initialAvatarHash, avatar.getAvatarHash());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -207,7 +206,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
avatar.loadingTimestamp = Date.now();
|
||||
this.executeAvatarLoad0(avatar).catch(error => {
|
||||
if(avatar.getAvatarHash() !== avatarHash) {
|
||||
log.debug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), avatarHash, avatar.getAvatarHash());
|
||||
logDebug(LogCategory.GENERAL, tr("Ignoring avatar not found since the avatar itself got updated. Out version: %s, current version: %s"), avatarHash, avatar.getAvatarHash());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -216,7 +215,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
} else if(error instanceof Error) {
|
||||
avatar.setErrored({ message: error.message });
|
||||
} else {
|
||||
log.error(LogCategory.FILE_TRANSFER, tr("Failed to load avatar %s (hash: %s): %o"), avatar.clientAvatarId, avatarHash, error);
|
||||
logError(LogCategory.FILE_TRANSFER, tr("Failed to load avatar %s (hash: %s): %o"), avatar.clientAvatarId, avatarHash, error);
|
||||
avatar.setErrored({ message: tr("lookup the console") });
|
||||
}
|
||||
});
|
||||
|
@ -228,7 +227,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
if(cached.getAvatarHash() === clientAvatarHash)
|
||||
return;
|
||||
|
||||
log.info(LogCategory.GENERAL, tr("Deleting cached avatar for client %s. Cached version: %s; New version: %s"), cached.getAvatarHash(), clientAvatarHash);
|
||||
logInfo(LogCategory.GENERAL, tr("Deleting cached avatar for client %s. Cached version: %s; New version: %s"), cached.getAvatarHash(), clientAvatarHash);
|
||||
}
|
||||
|
||||
const response = await localAvatarCache.resolveCached('avatar_' + clientAvatarId);
|
||||
|
@ -236,7 +235,7 @@ export class AvatarManager extends AbstractAvatarManager {
|
|||
let cachedAvatarHash = response.headers.has("X-avatar-version") ? response.headers.get("X-avatar-version") : undefined;
|
||||
if(cachedAvatarHash !== clientAvatarHash) {
|
||||
await localAvatarCache.delete("avatar_" + clientAvatarId).catch(error => {
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Failed to delete avatar %s: %o"), clientAvatarId, error);
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Failed to delete avatar %s: %o"), clientAvatarId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import * as loader from "tc-loader";
|
|||
import {Stage} from "tc-loader";
|
||||
import {ImageCache, ImageType, imageType2MediaType, responseImageType} from "tc-shared/file/ImageCache";
|
||||
import {AbstractIconManager, kIPCIconChannel, RemoteIcon, RemoteIconState, setIconManager} from "tc-shared/file/Icons";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, logDebug, logError, logWarn} from "tc-shared/log";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
import {ConnectionEvents, ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler";
|
||||
|
@ -292,7 +291,7 @@ class IconManager extends AbstractIconManager {
|
|||
throw error.extra_message || error.message;
|
||||
}
|
||||
}
|
||||
log.error(LogCategory.FILE_TRANSFER, tr("Could not request download for icon %d: %o"), icon.iconId, error);
|
||||
logError(LogCategory.FILE_TRANSFER, tr("Could not request download for icon %d: %o"), icon.iconId, error);
|
||||
if(error === transfer.currentError()) {
|
||||
throw transfer.currentErrorMessage();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "../log";
|
||||
import {guid} from "../crypto/uid";
|
||||
import {Settings, StaticSettings} from "../settings";
|
||||
import * as loader from "tc-loader";
|
||||
|
@ -54,7 +53,7 @@ export function tr(message: string, key?: string) {
|
|||
const sloppy = fast_translate[message];
|
||||
if(sloppy) return sloppy;
|
||||
|
||||
log.info(LogCategory.I18N, "Translating \"%s\". Default: \"%s\"", key, message);
|
||||
logInfo(LogCategory.I18N, "Translating \"%s\". Default: \"%s\"", key, message);
|
||||
|
||||
let translated = message;
|
||||
for(const translation of translations) {
|
||||
|
@ -116,7 +115,7 @@ async function load_translation_file(url: string, path: string) : Promise<Transl
|
|||
//TODO: Validate file
|
||||
resolve(file);
|
||||
} catch(error) {
|
||||
log.warn(LogCategory.I18N, tr("Failed to load translation file %s. Failed to parse or process json: %o"), url, error);
|
||||
logWarn(LogCategory.I18N, tr("Failed to load translation file %s. Failed to parse or process json: %o"), url, error);
|
||||
reject(tr("Failed to process or parse json!"));
|
||||
}
|
||||
},
|
||||
|
@ -136,10 +135,10 @@ export function load_file(url: string, path: string) : Promise<void> {
|
|||
throw "dummy test failed";
|
||||
}
|
||||
|
||||
log.info(LogCategory.I18N, tr("Successfully initialized up translation file from %s"), url);
|
||||
logInfo(LogCategory.I18N, tr("Successfully initialized up translation file from %s"), url);
|
||||
translations = result.translations;
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.I18N, tr("Failed to load translation file from \"%s\". Error: %o"), url, error);
|
||||
logWarn(LogCategory.I18N, tr("Failed to load translation file from \"%s\". Error: %o"), url, error);
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
|
@ -210,7 +209,7 @@ export namespace config {
|
|||
try {
|
||||
config = config_string ? JSON.parse(config_string) : {};
|
||||
} catch(error) {
|
||||
log.error(LogCategory.I18N, tr("Failed to parse repository config: %o"), error);
|
||||
logError(LogCategory.I18N, tr("Failed to parse repository config: %o"), error);
|
||||
}
|
||||
config.repositories = config.repositories || [];
|
||||
for(const repo of config.repositories)
|
||||
|
@ -219,10 +218,10 @@ export namespace config {
|
|||
if(config.repositories.length == 0) {
|
||||
//Add the default TeaSpeak repository
|
||||
load_repository(StaticSettings.instance.static(Settings.KEY_I18N_DEFAULT_REPOSITORY)).then(repo => {
|
||||
log.info(LogCategory.I18N, tr("Successfully added default repository from \"%s\"."), repo.url);
|
||||
logInfo(LogCategory.I18N, tr("Successfully added default repository from \"%s\"."), repo.url);
|
||||
register_repository(repo);
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.I18N, tr("Failed to add default repository. Error: %o"), error);
|
||||
logWarn(LogCategory.I18N, tr("Failed to add default repository. Error: %o"), error);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -244,7 +243,7 @@ export namespace config {
|
|||
try {
|
||||
_cached_translation_config = config_string ? JSON.parse(config_string) : {};
|
||||
} catch(error) {
|
||||
log.error(LogCategory.I18N, tr("Failed to initialize translation config. Using default one. Error: %o"), error);
|
||||
logError(LogCategory.I18N, tr("Failed to initialize translation config. Using default one. Error: %o"), error);
|
||||
_cached_translation_config = {} as any;
|
||||
}
|
||||
return _cached_translation_config;
|
||||
|
@ -284,7 +283,7 @@ export async function iterate_repositories(callback_entry: (repository: Translat
|
|||
|
||||
for(const repository of registered_repositories()) {
|
||||
promises.push(load_repository0(repository, false).then(() => callback_entry(repository)).catch(error => {
|
||||
log.warn(LogCategory.I18N, "Failed to fetch repository %s. error: %o", repository.url, error);
|
||||
logWarn(LogCategory.I18N, "Failed to fetch repository %s. error: %o", repository.url, error);
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -318,7 +317,7 @@ export async function initialize() {
|
|||
try {
|
||||
await load_file(cfg.current_translation_url, cfg.current_translation_path);
|
||||
} catch (error) {
|
||||
console.error(tr("Failed to initialize selected translation: %o"), error);
|
||||
logError(LogCategory.I18N, tr("Failed to initialize selected translation: %o"), error);
|
||||
const show_error = () => {
|
||||
import("../ui/elements/Modal").then(Modal => {
|
||||
Modal.createErrorModal(tr("Translation System"), tra("Failed to load current selected translation file.{:br:}File: {0}{:br:}Error: {1}{:br:}{:br:}Using default fallback translations.", cfg.current_translation_url, error)).open()
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import "broadcastchannel-polyfill";
|
||||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logDebug, logError, logWarn} from "../log";
|
||||
import {ConnectHandler} from "../ipc/ConnectHandler";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export interface BroadcastMessage {
|
||||
timestamp: number;
|
||||
|
@ -67,7 +66,7 @@ export abstract class BasicIPCHandler {
|
|||
|
||||
if(message.receiver === BasicIPCHandler.BROADCAST_UNIQUE_ID) {
|
||||
if(message.type == "process-query") {
|
||||
log.debug(LogCategory.IPC, tr("Received a device query from %s."), message.sender);
|
||||
logDebug(LogCategory.IPC, tr("Received a device query from %s."), message.sender);
|
||||
this.sendMessage("process-query-response", {
|
||||
request_query_id: (<ProcessQuery>message.data).query_id,
|
||||
request_timestamp: (<ProcessQuery>message.data).timestamp,
|
||||
|
@ -83,14 +82,14 @@ export abstract class BasicIPCHandler {
|
|||
if(this._query_results[response.request_query_id])
|
||||
this._query_results[response.request_query_id].push(response);
|
||||
else {
|
||||
log.warn(LogCategory.IPC, tr("Received a query response for an unknown request."));
|
||||
logWarn(LogCategory.IPC, tr("Received a query response for an unknown request."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(message.type == "certificate-accept-callback") {
|
||||
const data: CertificateAcceptCallback = message.data;
|
||||
if(!this._cert_accept_callbacks[data.request_id]) {
|
||||
log.warn(LogCategory.IPC, tr("Received certificate accept callback for an unknown request ID."));
|
||||
logWarn(LogCategory.IPC, tr("Received certificate accept callback for an unknown request ID."));
|
||||
return;
|
||||
}
|
||||
this._cert_accept_callbacks[data.request_id]();
|
||||
|
@ -103,7 +102,7 @@ export abstract class BasicIPCHandler {
|
|||
}
|
||||
else if(message.type == "certificate-accept-succeeded") {
|
||||
if(!this._cert_accept_succeeded[message.sender]) {
|
||||
log.warn(LogCategory.IPC, tr("Received certificate accept succeeded, but haven't a callback."));
|
||||
logWarn(LogCategory.IPC, tr("Received certificate accept succeeded, but haven't a callback."));
|
||||
return;
|
||||
}
|
||||
this._cert_accept_succeeded[message.sender]();
|
||||
|
@ -230,7 +229,7 @@ class BroadcastChannelIPC extends BasicIPCHandler {
|
|||
|
||||
private onMessage(event: MessageEvent) {
|
||||
if(typeof(event.data) !== "string") {
|
||||
log.warn(LogCategory.IPC, tr("Received message with an invalid type (%s): %o"), typeof(event.data), event.data);
|
||||
logWarn(LogCategory.IPC, tr("Received message with an invalid type (%s): %o"), typeof(event.data), event.data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -238,14 +237,14 @@ class BroadcastChannelIPC extends BasicIPCHandler {
|
|||
try {
|
||||
message = JSON.parse(event.data);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IPC, tr("Received an invalid encoded message: %o"), event.data);
|
||||
logError(LogCategory.IPC, tr("Received an invalid encoded message: %o"), event.data);
|
||||
return;
|
||||
}
|
||||
super.handleMessage(message);
|
||||
}
|
||||
|
||||
private onError(event: MessageEvent) {
|
||||
log.warn(LogCategory.IPC, tr("Received error: %o"), event);
|
||||
logWarn(LogCategory.IPC, tr("Received error: %o"), event);
|
||||
}
|
||||
|
||||
sendMessage(type: string, data: any, target?: string) {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "../ipc/BrowserIPC";
|
||||
import {LogCategory, logDebug, logError, logWarn} from "../log";
|
||||
import {BasicIPCHandler, ChannelMessage, IPCChannel} from "../ipc/BrowserIPC";
|
||||
import {guid} from "../crypto/uid";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export type ConnectRequestData = {
|
||||
address: string;
|
||||
|
@ -91,7 +90,7 @@ export class ConnectHandler {
|
|||
} as ConnectOfferAnswer;
|
||||
|
||||
if(response.accepted) {
|
||||
log.debug(LogCategory.IPC, tr("Received new connect offer from %s: %s"), sender, data.request_id);
|
||||
logDebug(LogCategory.IPC, tr("Received new connect offer from %s: %s"), sender, data.request_id);
|
||||
|
||||
const ld = {
|
||||
remote_handler: sender,
|
||||
|
@ -101,7 +100,7 @@ export class ConnectHandler {
|
|||
};
|
||||
this._pending_connect_offers.push(ld);
|
||||
ld.timeout = setTimeout(() => {
|
||||
log.debug(LogCategory.IPC, tr("Dropping connect request %s, because we never received an execute."), ld.id);
|
||||
logDebug(LogCategory.IPC, tr("Dropping connect request %s, because we never received an execute."), ld.id);
|
||||
this._pending_connect_offers.remove(ld);
|
||||
}, 120 * 1000) as any;
|
||||
}
|
||||
|
@ -112,19 +111,19 @@ export class ConnectHandler {
|
|||
const data = message.data as ConnectOfferAnswer;
|
||||
const request = this._pending_connects_requests.find(e => e.id === data.request_id);
|
||||
if(!request) {
|
||||
log.warn(LogCategory.IPC, tr("Received connect offer answer with unknown request id (%s)."), data.request_id);
|
||||
logWarn(LogCategory.IPC, tr("Received connect offer answer with unknown request id (%s)."), data.request_id);
|
||||
return;
|
||||
}
|
||||
if(!data.accepted) {
|
||||
log.debug(LogCategory.IPC, tr("Client %s rejected the connect offer (%s)."), sender, request.id);
|
||||
logDebug(LogCategory.IPC, tr("Client %s rejected the connect offer (%s)."), sender, request.id);
|
||||
return;
|
||||
}
|
||||
if(request.remote_handler) {
|
||||
log.debug(LogCategory.IPC, tr("Client %s accepted the connect offer (%s), but offer has already been accepted."), sender, request.id);
|
||||
logDebug(LogCategory.IPC, tr("Client %s accepted the connect offer (%s), but offer has already been accepted."), sender, request.id);
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug(LogCategory.IPC, tr("Client %s accepted the connect offer (%s). Request local acceptance."), sender, request.id);
|
||||
logDebug(LogCategory.IPC, tr("Client %s accepted the connect offer (%s). Request local acceptance."), sender, request.id);
|
||||
request.remote_handler = sender;
|
||||
clearTimeout(request.timeout);
|
||||
|
||||
|
@ -134,7 +133,7 @@ export class ConnectHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
log.debug(LogCategory.IPC, tr("Executing connect with client %s"), request.remote_handler);
|
||||
logDebug(LogCategory.IPC, tr("Executing connect with client %s"), request.remote_handler);
|
||||
this.ipc_channel.sendMessage("execute", {
|
||||
request_id: request.id
|
||||
} as ConnectExecute, request.remote_handler);
|
||||
|
@ -142,7 +141,7 @@ export class ConnectHandler {
|
|||
request.callback_failed("connect execute timeout");
|
||||
}, 1000) as any;
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.IPC, tr("Local avail callback caused an error: %o"), error);
|
||||
logError(LogCategory.IPC, tr("Local avail callback caused an error: %o"), error);
|
||||
request.callback_failed(tr("local avail callback caused an error"));
|
||||
});
|
||||
|
||||
|
@ -151,16 +150,16 @@ export class ConnectHandler {
|
|||
const data = message.data as ConnectExecuted;
|
||||
const request = this._pending_connects_requests.find(e => e.id === data.request_id);
|
||||
if(!request) {
|
||||
log.warn(LogCategory.IPC, tr("Received connect executed with unknown request id (%s)."), data.request_id);
|
||||
logWarn(LogCategory.IPC, tr("Received connect executed with unknown request id (%s)."), data.request_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if(request.remote_handler != sender) {
|
||||
log.warn(LogCategory.IPC, tr("Received connect executed for request %s, but from wrong client: %s (expected %s)"), data.request_id, sender, request.remote_handler);
|
||||
logWarn(LogCategory.IPC, tr("Received connect executed for request %s, but from wrong client: %s (expected %s)"), data.request_id, sender, request.remote_handler);
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug(LogCategory.IPC, tr("Received connect executed response from client %s for request %s. Succeeded: %o (%s)"), sender, data.request_id, data.succeeded, data.message);
|
||||
logDebug(LogCategory.IPC, tr("Received connect executed response from client %s for request %s. Succeeded: %o (%s)"), sender, data.request_id, data.succeeded, data.message);
|
||||
clearTimeout(request.timeout);
|
||||
if(data.succeeded)
|
||||
request.callback_success();
|
||||
|
@ -171,18 +170,18 @@ export class ConnectHandler {
|
|||
const data = message.data as ConnectExecute;
|
||||
const request = this._pending_connect_offers.find(e => e.id === data.request_id);
|
||||
if(!request) {
|
||||
log.warn(LogCategory.IPC, tr("Received connect execute with unknown request id (%s)."), data.request_id);
|
||||
logWarn(LogCategory.IPC, tr("Received connect execute with unknown request id (%s)."), data.request_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if(request.remote_handler != sender) {
|
||||
log.warn(LogCategory.IPC, tr("Received connect execute for request %s, but from wrong client: %s (expected %s)"), data.request_id, sender, request.remote_handler);
|
||||
logWarn(LogCategory.IPC, tr("Received connect execute for request %s, but from wrong client: %s (expected %s)"), data.request_id, sender, request.remote_handler);
|
||||
return;
|
||||
}
|
||||
clearTimeout(request.timeout);
|
||||
this._pending_connect_offers.remove(request);
|
||||
|
||||
log.debug(LogCategory.IPC, tr("Executing connect for %s"), data.request_id);
|
||||
logDebug(LogCategory.IPC, tr("Executing connect for %s"), data.request_id);
|
||||
const cr = this.callback_execute(request.data);
|
||||
|
||||
const response = {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {BasicIPCHandler, IPCChannel, ChannelMessage} from "../ipc/BrowserIPC";
|
||||
import {LogCategory, logDebug, logInfo, logWarn} from "../log";
|
||||
import {BasicIPCHandler, ChannelMessage, IPCChannel} from "../ipc/BrowserIPC";
|
||||
import {guid} from "../crypto/uid";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export interface MethodProxyInvokeData {
|
||||
method_name: string;
|
||||
|
@ -81,10 +80,10 @@ export abstract class MethodProxy {
|
|||
protected register_method<R>(method: (...args: any[]) => Promise<R> | string) {
|
||||
let method_name: string;
|
||||
if(typeof method === "function") {
|
||||
log.debug(LogCategory.IPC, tr("Registering method proxy for %s"), method.name);
|
||||
logDebug(LogCategory.IPC, tr("Registering method proxy for %s"), method.name);
|
||||
method_name = method.name;
|
||||
} else {
|
||||
log.debug(LogCategory.IPC, tr("Registering method proxy for %s"), method);
|
||||
logDebug(LogCategory.IPC, tr("Registering method proxy for %s"), method);
|
||||
method_name = method;
|
||||
}
|
||||
|
||||
|
@ -169,11 +168,11 @@ export abstract class MethodProxy {
|
|||
}
|
||||
|
||||
try {
|
||||
log.info(LogCategory.IPC, tr("Invoking method %s with arguments: %o"), data.method_name, data.arguments);
|
||||
logInfo(LogCategory.IPC, tr("Invoking method %s with arguments: %o"), data.method_name, data.arguments);
|
||||
|
||||
const promise = this[data.method_name](...data.arguments);
|
||||
promise.then(result => {
|
||||
log.info(LogCategory.IPC, tr("Result: %o"), result);
|
||||
logInfo(LogCategory.IPC, tr("Result: %o"), result);
|
||||
this._send_result(data.promise_id, true, result);
|
||||
}).catch(error => {
|
||||
this._send_result(data.promise_id, false, error);
|
||||
|
@ -186,7 +185,7 @@ export abstract class MethodProxy {
|
|||
|
||||
private _handle_result(data: MethodProxyResultData) {
|
||||
if(!this._proxied_callbacks[data.promise_id]) {
|
||||
console.warn(tr("Received proxy method result for unknown promise"));
|
||||
logWarn(LogCategory.IPC, tr("Received proxy method result for unknown promise"));
|
||||
return;
|
||||
}
|
||||
const callback = this._proxied_callbacks[data.promise_id];
|
||||
|
|
|
@ -131,7 +131,7 @@ function logDirect(type: LogType, message: string, ...optionalParams: any[]) {
|
|||
}
|
||||
}
|
||||
|
||||
export function log(type: LogType, category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
function doLog(type: LogType, category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
if(!enabled_mapping.get(category)) return;
|
||||
|
||||
optionalParams.unshift(categoryMapping.get(category));
|
||||
|
@ -139,45 +139,25 @@ export function log(type: LogType, category: LogCategory, message: string, ...op
|
|||
logDirect(type, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function trace(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.TRACE, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function debug(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.DEBUG, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function info(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.INFO, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function warn(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.WARNING, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function error(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.ERROR, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
/* methods for direct import */
|
||||
export function logTrace(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.TRACE, category, message, ...optionalParams);
|
||||
doLog(LogType.TRACE, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function logDebug(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.DEBUG, category, message, ...optionalParams);
|
||||
doLog(LogType.DEBUG, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function logInfo(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.INFO, category, message, ...optionalParams);
|
||||
doLog(LogType.INFO, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function logWarn(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.WARNING, category, message, ...optionalParams);
|
||||
doLog(LogType.WARNING, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function logError(category: LogCategory, message: string, ...optionalParams: any[]) {
|
||||
log(LogType.ERROR, category, message, ...optionalParams);
|
||||
doLog(LogType.ERROR, category, message, ...optionalParams);
|
||||
}
|
||||
|
||||
export function group(level: LogType, category: LogCategory, name: string, ...optionalParams: any[]) : Group {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {InputStartError} from "tc-shared/voice/RecorderBase";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, logInfo, logWarn} from "tc-shared/log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
|
@ -28,17 +27,17 @@ export async function requestMediaStreamWithConstraints(constraints: MediaTrackC
|
|||
if('name' in error) {
|
||||
if(error.name === "NotAllowedError") {
|
||||
if(Date.now() - beginTimestamp < 250) {
|
||||
log.warn(LogCategory.AUDIO, tr("Media stream request failed (System denied). Browser message: %o"), error.message);
|
||||
logWarn(LogCategory.AUDIO, tr("Media stream request failed (System denied). Browser message: %o"), error.message);
|
||||
return InputStartError.ESYSTEMDENIED;
|
||||
} else {
|
||||
log.warn(LogCategory.AUDIO, tr("Media stream request failed (No permissions). Browser message: %o"), error.message);
|
||||
logWarn(LogCategory.AUDIO, tr("Media stream request failed (No permissions). Browser message: %o"), error.message);
|
||||
return InputStartError.ENOTALLOWED;
|
||||
}
|
||||
} else {
|
||||
log.warn(LogCategory.AUDIO, tr("Media stream request failed. Request resulted in error: %o: %o"), error.name, error);
|
||||
logWarn(LogCategory.AUDIO, tr("Media stream request failed. Request resulted in error: %o: %o"), error.name, error);
|
||||
}
|
||||
} else {
|
||||
log.warn(LogCategory.AUDIO, tr("Failed to initialize media stream (%o)"), error);
|
||||
logWarn(LogCategory.AUDIO, tr("Failed to initialize media stream (%o)"), error);
|
||||
}
|
||||
|
||||
return InputStartError.EUNKNOWN;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {LaterPromise} from "../utils/LaterPromise";
|
||||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logDebug, logError, logWarn} from "../log";
|
||||
import {PermissionManager, PermissionValue} from "../permission/PermissionManager";
|
||||
import {ServerCommand} from "../connection/ConnectionBase";
|
||||
import {CommandResult} from "../connection/ServerConnectionDeclaration";
|
||||
|
@ -188,7 +187,7 @@ export class GroupManager extends AbstractCommandHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
log.debug(LogCategory.PERMISSIONS, tr("Resetting server/channel groups"));
|
||||
logDebug(LogCategory.PERMISSIONS, tr("Resetting server/channel groups"));
|
||||
this.serverGroups = [];
|
||||
this.channelGroups = [];
|
||||
this.allGroupsReceived = false;
|
||||
|
@ -219,11 +218,11 @@ export class GroupManager extends AbstractCommandHandler {
|
|||
|
||||
requestGroups(){
|
||||
this.connectionHandler.serverConnection.send_command("servergrouplist", {}, { process_result: false }).catch(error => {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Failed to request the server group list: %o"), error);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Failed to request the server group list: %o"), error);
|
||||
});
|
||||
|
||||
this.connectionHandler.serverConnection.send_command("channelgrouplist", {}, { process_result: false }).catch(error => {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Failed to request the channel group list: %o"), error);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Failed to request the channel group list: %o"), error);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -257,7 +256,7 @@ export class GroupManager extends AbstractCommandHandler {
|
|||
case 1: type = GroupType.NORMAL; break;
|
||||
case 2: type = GroupType.QUERY; break;
|
||||
default:
|
||||
log.error(LogCategory.CLIENT, tr("Invalid group type: %o for group %s"), groupData["type"], groupData["name"]);
|
||||
logError(LogCategory.CLIENT, tr("Invalid group type: %o for group %s"), groupData["type"], groupData["name"]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -332,7 +331,7 @@ export class GroupManager extends AbstractCommandHandler {
|
|||
private handleGroupPermissionList(json: any[]) {
|
||||
let group = json[0]["sgid"] ? this.findServerGroup(parseInt(json[0]["sgid"])) : this.findChannelGroup(parseInt(json[0]["cgid"]));
|
||||
if(!group) {
|
||||
log.error(LogCategory.PERMISSIONS, tr("Got group permissions for group %o/%o, but its not a registered group!"), json[0]["sgid"], json[0]["cgid"]);
|
||||
logError(LogCategory.PERMISSIONS, tr("Got group permissions for group %o/%o, but its not a registered group!"), json[0]["sgid"], json[0]["cgid"]);
|
||||
return;
|
||||
}
|
||||
let requests: GroupPermissionRequest[] = [];
|
||||
|
@ -341,7 +340,7 @@ export class GroupManager extends AbstractCommandHandler {
|
|||
requests.push(req);
|
||||
|
||||
if(requests.length == 0) {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Got group permissions for group %o/%o, but it was never requested!"), json[0]["sgid"], json[0]["cgid"]);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Got group permissions for group %o/%o, but it was never requested!"), json[0]["sgid"], json[0]["cgid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory, LogType} from "../log";
|
||||
import {LogCategory, logDebug, logInfo, logTrace, LogType, logWarn} from "../log";
|
||||
import {PermissionType} from "../permission/PermissionType";
|
||||
import {LaterPromise} from "../utils/LaterPromise";
|
||||
import {ServerCommand} from "../connection/ConnectionBase";
|
||||
|
@ -51,7 +51,7 @@ export class PermissionValue {
|
|||
let result;
|
||||
result = this.value == -1 || this.value >= requiredValue || (this.value == -2 && requiredValue == -2 && !required);
|
||||
|
||||
log.trace(LogCategory.PERMISSIONS,
|
||||
logTrace(LogCategory.PERMISSIONS,
|
||||
tr("Required permission test resulted for permission %s: %s. Required value: %s, Granted value: %s"),
|
||||
this.type ? this.type.name : "unknown",
|
||||
result ? tr("granted") : tr("denied"),
|
||||
|
@ -227,7 +227,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
|
||||
let perm_info = manager.resolveInfo(perm_id);
|
||||
if(!perm_info) {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Got unknown permission id (%o/%o (%o))!"), perm["permid"], perm_id, perm["permsid"]);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Got unknown permission id (%o/%o (%o))!"), perm["permid"], perm_id, perm["permsid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
log.table(LogType.DEBUG, LogCategory.PERMISSIONS, "Permission list", table_entries);
|
||||
group.end();
|
||||
|
||||
log.info(LogCategory.PERMISSIONS, tr("Got %i permissions"), this.permissionList.length);
|
||||
logInfo(LogCategory.PERMISSIONS, tr("Got %i permissions"), this.permissionList.length);
|
||||
if(this._cacheNeededPermissions)
|
||||
this.onNeededPermissions(this._cacheNeededPermissions);
|
||||
for(let listener of this.initializedListener)
|
||||
|
@ -369,7 +369,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
|
||||
private onNeededPermissions(json) {
|
||||
if(this.permissionList.length == 0) {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Got needed permissions but don't have a permission list!"));
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Got needed permissions but don't have a permission list!"));
|
||||
this._cacheNeededPermissions = json;
|
||||
return;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
entry = new NeededPermissionValue(info, -2);
|
||||
this.neededPermissions.push(entry);
|
||||
} else {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Could not resolve perm for id %s (%o|%o)"), e["permid"], e, info);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Could not resolve perm for id %s (%o|%o)"), e["permid"], e, info);
|
||||
continue;
|
||||
}
|
||||
addcount++;
|
||||
|
@ -417,7 +417,7 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
log.table(LogType.DEBUG, LogCategory.PERMISSIONS, "Needed client permissions", table_entries);
|
||||
group.end();
|
||||
|
||||
log.debug(LogCategory.PERMISSIONS, tr("Dropping %o needed permissions and added %o permissions."), copy.length, addcount);
|
||||
logDebug(LogCategory.PERMISSIONS, tr("Dropping %o needed permissions and added %o permissions."), copy.length, addcount);
|
||||
for(let e of copy) {
|
||||
e.value = -2;
|
||||
for(const listener of this.needed_permission_change_listener[e.type.name] || [])
|
||||
|
@ -704,10 +704,10 @@ export class PermissionManager extends AbstractCommandHandler {
|
|||
if(perm.type.id == key || perm.type.name == key || perm.type == key)
|
||||
return perm;
|
||||
|
||||
log.debug(LogCategory.PERMISSIONS, tr("Could not resolve grant permission %o. Creating a new one."), key);
|
||||
logDebug(LogCategory.PERMISSIONS, tr("Could not resolve grant permission %o. Creating a new one."), key);
|
||||
let info = key instanceof PermissionInfo ? key : this.resolveInfo(key);
|
||||
if(!info) {
|
||||
log.warn(LogCategory.PERMISSIONS, tr("Requested needed permission with invalid key! (%o)"), key);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Requested needed permission with invalid key! (%o)"), key);
|
||||
return new NeededPermissionValue(undefined, -2);
|
||||
}
|
||||
let result = new NeededPermissionValue(info, -2);
|
||||
|
|
|
@ -9,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export class ConnectionProfile {
|
||||
id: string;
|
||||
|
@ -135,7 +135,7 @@ async function loadConnectProfiles() {
|
|||
try {
|
||||
return profiles_json ? JSON.parse(profiles_json) : {version: 0} as any;
|
||||
} catch (error) {
|
||||
console.error(tr("Invalid profile json! Resetting profiles :( (%o)"), profiles_json);
|
||||
logError(LogCategory.IDENTITIES, tr("Invalid profile json! Resetting profiles :( (%o)"), profiles_json);
|
||||
createErrorModal(tr("Profile data invalid"), formatMessage(tr("The profile data is invalid.{:br:}This might cause data loss."))).open();
|
||||
return { version: 0 };
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ async function loadConnectProfiles() {
|
|||
for (const profile_data of profiles_data.profiles) {
|
||||
const profile = await decodeProfile(profile_data);
|
||||
if (typeof profile === "string") {
|
||||
console.error(tr("Failed to load profile. Reason: %s, Profile data: %s"), profile, profiles_data);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to load profile. Reason: %s, Profile data: %s"), profile, profiles_data);
|
||||
} else {
|
||||
availableProfiles_.push(profile as ConnectionProfile);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {AbstractServerConnection, ServerCommand} from "../connection/ConnectionBase";
|
||||
import {HandshakeIdentityHandler} from "../connection/HandshakeHandler";
|
||||
import {AbstractCommandHandler} from "../connection/AbstractCommandHandler";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export enum IdentitifyType {
|
||||
TEAFORO,
|
||||
|
@ -45,8 +46,7 @@ export async function decode_identity(type: IdentitifyType, data: string) : Prom
|
|||
try {
|
||||
await identity.decode(data)
|
||||
} catch(error) {
|
||||
/* todo better error handling! */
|
||||
console.error(error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to decode identity: %o"), error);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ export class HandshakeCommandHandler<T extends AbstractHandshakeIdentityHandler>
|
|||
} else if(command.command == "error") {
|
||||
return false;
|
||||
} else {
|
||||
console.warn(tr("Received unknown command while handshaking (%o)"), command);
|
||||
logWarn(LogCategory.IDENTITIES, tr("Received unknown command while handshaking (%o)"), command);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ import {
|
|||
IdentitifyType,
|
||||
Identity
|
||||
} from "../../profiles/Identity";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logError} from "../../log";
|
||||
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
|
||||
import {AbstractServerConnection} from "../../connection/ConnectionBase";
|
||||
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
|
||||
|
@ -30,7 +29,7 @@ class NameHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|||
authentication_method: this.identity.type(),
|
||||
client_nickname: this.identity.name()
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to initialize name based handshake. Error: %o"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to initialize name based handshake. Error: %o"), error);
|
||||
if(error instanceof CommandResult)
|
||||
error = error.extra_message || error.message;
|
||||
this.trigger_fail("failed to execute begin (" + error + ")");
|
||||
|
|
|
@ -4,8 +4,7 @@ import {
|
|||
IdentitifyType,
|
||||
Identity
|
||||
} from "../../profiles/Identity";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logError} from "../../log";
|
||||
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
|
||||
import {AbstractServerConnection} from "../../connection/ConnectionBase";
|
||||
import {HandshakeIdentityHandler} from "../../connection/HandshakeHandler";
|
||||
|
@ -30,7 +29,7 @@ class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|||
authentication_method: this.identity.type(),
|
||||
data: this.identity.data().data_json()
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to initialize TeaForum based handshake. Error: %o"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to initialize TeaForum based handshake. Error: %o"), error);
|
||||
|
||||
if(error instanceof CommandResult)
|
||||
error = error.extra_message || error.message;
|
||||
|
@ -43,7 +42,7 @@ class TeaForumHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|||
this.connection.send_command("handshakeindentityproof", {
|
||||
proof: this.identity.data().data_sign()
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to proof the identity. Error: %o"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to proof the identity. Error: %o"), error);
|
||||
|
||||
if(error instanceof CommandResult)
|
||||
error = error.extra_message || error.message;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as log from "../../log";
|
||||
import {LogCategory, logTrace, logWarn} from "../../log";
|
||||
import {LogCategory, logError, logInfo, logTrace, logWarn} from "../../log";
|
||||
import * as asn1 from "../../crypto/asn1";
|
||||
import * as sha from "../../crypto/sha";
|
||||
|
||||
|
@ -244,7 +243,7 @@ export class TeaSpeakHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|||
authentication_method: this.identity.type(),
|
||||
publicKey: this.identity.publicKey
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to initialize TeamSpeak based handshake. Error: %o"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to initialize TeamSpeak based handshake. Error: %o"), error);
|
||||
|
||||
if(error instanceof CommandResult)
|
||||
error = error.extra_message || error.message;
|
||||
|
@ -260,7 +259,7 @@ export class TeaSpeakHandshakeHandler extends AbstractHandshakeIdentityHandler {
|
|||
|
||||
this.identity.sign_message(json[0]["message"], json[0]["digest"]).then(proof => {
|
||||
this.connection.send_command("handshakeindentityproof", {proof: proof}).catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to proof the identity. Error: %o"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to proof the identity. Error: %o"), error);
|
||||
|
||||
if(error instanceof CommandResult)
|
||||
error = error.extra_message || error.message;
|
||||
|
@ -318,7 +317,7 @@ class IdentityPOWWorker {
|
|||
resolve();
|
||||
};
|
||||
this._worker.onerror = event => {
|
||||
log.error(LogCategory.IDENTITIES, tr("POW Worker error %o"), event);
|
||||
logError(LogCategory.IDENTITIES, tr("POW Worker error %o"), event);
|
||||
clearTimeout(timeout_id);
|
||||
reject("Failed to load worker (" + event.message + ")");
|
||||
};
|
||||
|
@ -433,7 +432,7 @@ class IdentityPOWWorker {
|
|||
};
|
||||
});
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to finalize POW worker! (%o)"), error);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to finalize POW worker! (%o)"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,7 +441,7 @@ class IdentityPOWWorker {
|
|||
}
|
||||
|
||||
private handle_message(message: any) {
|
||||
log.info(LogCategory.IDENTITIES, tr("Received message: %o"), message);
|
||||
logInfo(LogCategory.IDENTITIES, tr("Received message: %o"), message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +451,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
try {
|
||||
key = await crypto.subtle.generateKey({name:'ECDH', namedCurve: 'P-256'}, true, ["deriveKey"]);
|
||||
} catch(e) {
|
||||
log.error(LogCategory.IDENTITIES, tr("Could not generate a new key: %o"), e);
|
||||
logError(LogCategory.IDENTITIES, tr("Could not generate a new key: %o"), e);
|
||||
throw "Failed to generate keypair";
|
||||
}
|
||||
const private_key = await CryptoHelper.export_ecc_key(key.privateKey, false);
|
||||
|
@ -509,7 +508,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
try {
|
||||
buffer = new Uint8Array(arrayBufferBase64(data));
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, tr("Failed to decode given base64 data (%s)"), data);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to decode given base64 data (%s)"), data);
|
||||
throw "failed to base data (base64 decode failed)";
|
||||
}
|
||||
const key64 = await CryptoHelper.decryptTeaSpeakIdentity(buffer);
|
||||
|
@ -538,7 +537,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
|
||||
if(this.private_key && (typeof(initialize) === "undefined" || initialize)) {
|
||||
this.initialize().catch(error => {
|
||||
log.error(LogCategory.IDENTITIES, "Failed to initialize TeaSpeakIdentity (%s)", error);
|
||||
logError(LogCategory.IDENTITIES, "Failed to initialize TeaSpeakIdentity (%s)", error);
|
||||
this._initialized = false;
|
||||
});
|
||||
}
|
||||
|
@ -698,7 +697,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
try {
|
||||
await Promise.all(initialize_promise);
|
||||
} catch (error) {
|
||||
log.error(LogCategory.IDENTITIES, error);
|
||||
logError(LogCategory.IDENTITIES, error);
|
||||
throw "failed to initialize";
|
||||
}
|
||||
}
|
||||
|
@ -753,7 +752,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
if (worker.current_level() > best_level) {
|
||||
this.hash_number = worker.current_hash();
|
||||
|
||||
log.info(LogCategory.IDENTITIES, "Found new best at %s (%d). Old was %d", this.hash_number, worker.current_level(), best_level);
|
||||
logInfo(LogCategory.IDENTITIES, "Found new best at %s (%d). Old was %d", this.hash_number, worker.current_level(), best_level);
|
||||
best_level = worker.current_level();
|
||||
if (callback_level)
|
||||
callback_level(best_level);
|
||||
|
@ -777,7 +776,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
}).catch(error => {
|
||||
worker_promise.remove(p);
|
||||
|
||||
log.warn(LogCategory.IDENTITIES, "POW worker error %o", error);
|
||||
logWarn(LogCategory.IDENTITIES, "POW worker error %o", error);
|
||||
reject(error);
|
||||
|
||||
return Promise.resolve();
|
||||
|
@ -803,7 +802,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
try {
|
||||
await Promise.all(finalize_promise);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, "Failed to shutdown worker: %o", error);
|
||||
logError(LogCategory.IDENTITIES, "Failed to shutdown worker: %o", error);
|
||||
}
|
||||
}
|
||||
throw "this should never be reached";
|
||||
|
@ -882,14 +881,14 @@ export class TeaSpeakIdentity implements Identity {
|
|||
try {
|
||||
this._crypto_key_sign = await crypto.subtle.importKey("jwk", jwk, {name:'ECDSA', namedCurve: 'P-256'}, false, ["sign"]);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, error);
|
||||
logError(LogCategory.IDENTITIES, error);
|
||||
throw "failed to create crypto sign key";
|
||||
}
|
||||
|
||||
try {
|
||||
this._crypto_key = await crypto.subtle.importKey("jwk", jwk, {name:'ECDH', namedCurve: 'P-256'}, true, ["deriveKey"]);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, error);
|
||||
logError(LogCategory.IDENTITIES, error);
|
||||
throw "failed to create crypto key";
|
||||
}
|
||||
|
||||
|
@ -897,7 +896,7 @@ export class TeaSpeakIdentity implements Identity {
|
|||
this.publicKey = await CryptoHelper.export_ecc_key(this._crypto_key, true);
|
||||
this._unique_id = base64_encode_ab(await sha.sha1(this.publicKey));
|
||||
} catch(error) {
|
||||
log.error(LogCategory.IDENTITIES, error);
|
||||
logError(LogCategory.IDENTITIES, error);
|
||||
throw "failed to calculate unique id";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {settings, Settings} from "../../settings";
|
||||
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";
|
||||
import {LogCategory, logDebug, logError, logInfo, logWarn} from "../../log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
@ -48,7 +47,7 @@ export namespace gcaptcha {
|
|||
script.remove();
|
||||
script = undefined;
|
||||
|
||||
console.error(tr("Failed to fetch recaptcha javascript source: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to fetch recaptcha javascript source: %o"), error);
|
||||
throw tr("failed to download source");
|
||||
} finally {
|
||||
if(script)
|
||||
|
@ -66,7 +65,7 @@ export namespace gcaptcha {
|
|||
try {
|
||||
await initialize();
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to initialize G-Recaptcha. Error: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to initialize G-Recaptcha. Error: %o"), error);
|
||||
throw tr("initialisation failed");
|
||||
}
|
||||
if(container.attr("captcha-uuid"))
|
||||
|
@ -163,7 +162,7 @@ export async function login(username: string, password: string, captcha?: any) :
|
|||
|
||||
success: resolve,
|
||||
error: (xhr, status, error) => {
|
||||
console.log(tr("Login request failed %o: %o"), status, error);
|
||||
logDebug(LogCategory.GENERAL, tr("Login request failed %o: %o"), status, error);
|
||||
reject(tr("request failed"));
|
||||
}
|
||||
})
|
||||
|
@ -176,7 +175,7 @@ export async function login(username: string, password: string, captcha?: any) :
|
|||
}
|
||||
|
||||
if(response["status"] !== "ok") {
|
||||
console.error(tr("Response status not okey. Error happend: %o"), response);
|
||||
logError(LogCategory.GENERAL, tr("Response status not okey. Error happend: %o"), response);
|
||||
return {
|
||||
status: "error",
|
||||
error_message: (response["errors"] || [])[0] || tr("Unknown error")
|
||||
|
@ -184,7 +183,7 @@ export async function login(username: string, password: string, captcha?: any) :
|
|||
}
|
||||
|
||||
if(!response["success"]) {
|
||||
console.error(tr("Login failed. Response %o"), response);
|
||||
logError(LogCategory.GENERAL, tr("Login failed. Response %o"), response);
|
||||
|
||||
let message = tr("failed to login");
|
||||
let captcha;
|
||||
|
@ -216,7 +215,7 @@ export async function login(username: string, password: string, captcha?: any) :
|
|||
localStorage.setItem("teaspeak-forum-auth", response["auth-key"]);
|
||||
fidentity.update_forum();
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to parse forum given data: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to parse forum given data: %o"), error);
|
||||
return {
|
||||
status: "error",
|
||||
error_message: tr("Failed to parse response data")
|
||||
|
@ -245,7 +244,7 @@ export async function renew_data() : Promise<"success" | "login-required"> {
|
|||
|
||||
success: resolve,
|
||||
error: (xhr, status, error) => {
|
||||
console.log(tr("Renew request failed %o: %o"), status, error);
|
||||
logError(LogCategory.GENERAL, tr("Renew request failed %o: %o"), status, error);
|
||||
reject(tr("request failed"));
|
||||
}
|
||||
})
|
||||
|
@ -255,7 +254,7 @@ export async function renew_data() : Promise<"success" | "login-required"> {
|
|||
}
|
||||
|
||||
if(response["status"] !== "ok") {
|
||||
console.error(tr("Response status not okey. Error happend: %o"), response);
|
||||
logError(LogCategory.GENERAL, tr("Response status not okey. Error happend: %o"), response);
|
||||
throw (response["errors"] || [])[0] || tr("Unknown error");
|
||||
}
|
||||
|
||||
|
@ -268,7 +267,7 @@ export async function renew_data() : Promise<"success" | "login-required"> {
|
|||
if(!response["data"] || !response["sign"])
|
||||
throw tr("response missing data");
|
||||
|
||||
console.debug(tr("Renew succeeded. Parsing data."));
|
||||
logDebug(LogCategory.GENERAL, tr("Renew succeeded. Parsing data."));
|
||||
|
||||
try {
|
||||
_data = new Data(_data.auth_key, response["data"], response["sign"]);
|
||||
|
@ -276,7 +275,7 @@ export async function renew_data() : Promise<"success" | "login-required"> {
|
|||
localStorage.setItem("teaspeak-forum-sign", response["sign"]);
|
||||
fidentity.update_forum();
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to parse forum given data: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to parse forum given data: %o"), error);
|
||||
throw tr("failed to parse data");
|
||||
}
|
||||
|
||||
|
@ -303,7 +302,7 @@ export async function logout() : Promise<void> {
|
|||
|
||||
success: resolve,
|
||||
error: (xhr, status, error) => {
|
||||
console.log(tr("Logout request failed %o: %o"), status, error);
|
||||
logInfo(LogCategory.GENERAL, tr("Logout request failed %o: %o"), status, error);
|
||||
reject(tr("request failed"));
|
||||
}
|
||||
})
|
||||
|
@ -313,7 +312,7 @@ export async function logout() : Promise<void> {
|
|||
}
|
||||
|
||||
if(response["status"] !== "ok") {
|
||||
console.error(tr("Response status not okey. Error happend: %o"), response);
|
||||
logError(LogCategory.GENERAL, tr("Response status not okey. Error happend: %o"), response);
|
||||
throw (response["errors"] || [])[0] || tr("Unknown error");
|
||||
}
|
||||
|
||||
|
@ -339,53 +338,53 @@ loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, {
|
|||
const raw_sign = localStorage.getItem("teaspeak-forum-sign");
|
||||
const forum_auth = localStorage.getItem("teaspeak-forum-auth");
|
||||
if(!raw_data || !raw_sign || !forum_auth) {
|
||||
console.log(tr("No TeaForo authentification found. TeaForo connection status: unconnected"));
|
||||
logInfo(LogCategory.GENERAL, tr("No TeaForo authentification found. TeaForo connection status: unconnected"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
_data = new Data(forum_auth, raw_data, raw_sign);
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to initialize TeaForo connection from local data. Error: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to initialize TeaForo connection from local data. Error: %o"), error);
|
||||
return;
|
||||
}
|
||||
if(_data.should_renew()) {
|
||||
console.info(tr("TeaForo data should be renewed. Executing renew."));
|
||||
logInfo(LogCategory.GENERAL, tr("TeaForo data should be renewed. Executing renew."));
|
||||
renew_data().then(status => {
|
||||
if(status === "success") {
|
||||
console.info(tr("TeaForo data has been successfully renewed."));
|
||||
logInfo(LogCategory.GENERAL, tr("TeaForo data has been successfully renewed."));
|
||||
} else {
|
||||
console.warn(tr("Failed to renew TeaForo data. New login required."));
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. New login required."));
|
||||
localStorage.removeItem("teaspeak-forum-data");
|
||||
localStorage.removeItem("teaspeak-forum-sign");
|
||||
localStorage.removeItem("teaspeak-forum-auth");
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn(tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if(_data && _data.is_expired()) {
|
||||
console.error(tr("TeaForo data is expired. TeaForo connection isn't available!"));
|
||||
logError(LogCategory.GENERAL, tr("TeaForo data is expired. TeaForo connection isn't available!"));
|
||||
}
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
/* if we don't have any _data object set we could not renew anything */
|
||||
if(_data) {
|
||||
log.info(LogCategory.IDENTITIES, tr("Renewing TeaForo data."));
|
||||
logInfo(LogCategory.IDENTITIES, tr("Renewing TeaForo data."));
|
||||
renew_data().then(status => {
|
||||
if(status === "success") {
|
||||
log.info(LogCategory.IDENTITIES,tr("TeaForo data has been successfully renewed."));
|
||||
logInfo(LogCategory.IDENTITIES,tr("TeaForo data has been successfully renewed."));
|
||||
} else {
|
||||
log.warn(LogCategory.IDENTITIES,tr("Failed to renew TeaForo data. New login required."));
|
||||
logWarn(LogCategory.IDENTITIES,tr("Failed to renew TeaForo data. New login required."));
|
||||
localStorage.removeItem("teaspeak-forum-data");
|
||||
localStorage.removeItem("teaspeak-forum-sign");
|
||||
localStorage.removeItem("teaspeak-forum-auth");
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn(tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to renew TeaForo data. An error occurred: %o"), error);
|
||||
});
|
||||
}
|
||||
}, 24 * 60 * 60 * 1000);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* setup jsrenderer */
|
||||
import "jsrender";
|
||||
import { tr } from "./i18n/localize";
|
||||
import {tr} from "./i18n/localize";
|
||||
import {LogCategory, logTrace} from "tc-shared/log";
|
||||
|
||||
if(__build.target === "web") {
|
||||
(window as any).$ = require("jquery");
|
||||
|
@ -114,11 +115,11 @@ if(!JSON.map_to) {
|
|||
let updates = 0;
|
||||
for (let field of variables) {
|
||||
if (typeof json[field] === "undefined") {
|
||||
console.trace(tr("Json does not contains %s"), field);
|
||||
logTrace(LogCategory.GENERAL, tr("Json does not contains %s"), field);
|
||||
continue;
|
||||
}
|
||||
if (!validator(field, json[field])) {
|
||||
console.trace(tr("Validator results in false for %s"), field);
|
||||
logTrace(LogCategory.GENERAL, tr("Validator results in false for %s"), field);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as log from "./log";
|
||||
import {LogCategory, logTrace} from "./log";
|
||||
import {LogCategory, logError, logTrace} from "./log";
|
||||
import * as loader from "tc-loader";
|
||||
import {Stage} from "tc-loader";
|
||||
import {Registry} from "./events";
|
||||
|
@ -82,11 +82,11 @@ function resolveKey<ValueType extends RegistryValueType, DefaultType>(
|
|||
|
||||
let value = resolver(key.key);
|
||||
if(typeof value === "string") {
|
||||
return this.decodeValueFromString(value, key.valueType);
|
||||
return decodeValueFromString(value, key.valueType);
|
||||
}
|
||||
|
||||
/* trying fallback values */
|
||||
for(const fallback of key.fallbackKeys) {
|
||||
for(const fallback of key.fallbackKeys || []) {
|
||||
value = resolver(fallback);
|
||||
if(typeof value !== "string") {
|
||||
continue;
|
||||
|
@ -125,7 +125,7 @@ export namespace AppParameters {
|
|||
|
||||
search.substr(1).split("&").forEach(part => {
|
||||
let item = part.split("=");
|
||||
this.staticValues[item[0]] = decodeURIComponent(item[1]);
|
||||
parameters[item[0]] = decodeURIComponent(item[1]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ export class Settings {
|
|||
try {
|
||||
this.cacheGlobal = JSON.parse(json);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to load global settings!\nJson: %s\nError: %o"), json, error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load global settings!\nJson: %s\nError: %o"), json, error);
|
||||
|
||||
const show_popup = () => {
|
||||
//FIXME: Readd this
|
||||
|
@ -823,6 +823,7 @@ export class Settings {
|
|||
} else if("defaultValue" in key) {
|
||||
return resolveKey(key, key => this.cacheGlobal[key], key.defaultValue);
|
||||
} else {
|
||||
debugger;
|
||||
throw tr("missing default value");
|
||||
}
|
||||
}
|
||||
|
@ -900,7 +901,9 @@ export class ServerSettings {
|
|||
this.serverSaveWorker = undefined;
|
||||
}
|
||||
|
||||
getValue<V extends RegistryValueType, DV extends V | undefined = undefined>(key: RegistryKey<V> | ValuedRegistryKey<V>, defaultValue?: DV) : V | DV {
|
||||
getValue<V extends RegistryValueType, DV>(key: RegistryKey<V>, defaultValue: DV) : V | DV;
|
||||
getValue<V extends RegistryValueType>(key: ValuedRegistryKey<V>, defaultValue?: V) : V;
|
||||
getValue(key, defaultValue) {
|
||||
if(this._destroyed) {
|
||||
throw "destroyed";
|
||||
}
|
||||
|
@ -910,6 +913,7 @@ export class ServerSettings {
|
|||
} else if("defaultValue" in key) {
|
||||
return resolveKey(key, key => this.cacheServer[key], key.defaultValue);
|
||||
} else {
|
||||
debugger;
|
||||
throw tr("missing default value");
|
||||
}
|
||||
}
|
||||
|
@ -950,7 +954,7 @@ export class ServerSettings {
|
|||
try {
|
||||
this.cacheServer = JSON.parse(json);
|
||||
} catch(error) {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to load server settings for server %s!\nJson: %s\nError: %o"), server_unique_id, json, error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load server settings for server %s!\nJson: %s\nError: %o"), server_unique_id, json, error);
|
||||
}
|
||||
if(!this.cacheServer)
|
||||
this.cacheServer = {};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "../log";
|
||||
import {Settings, settings} from "../settings";
|
||||
import {ConnectionHandler} from "../ConnectionHandler";
|
||||
import * as sbackend from "tc-backend/audio/sounds";
|
||||
|
@ -199,7 +199,7 @@ export function initialize() : Promise<void> {
|
|||
resolve();
|
||||
},
|
||||
error: error => {
|
||||
log.error(LogCategory.AUDIO, "error: %o", error);
|
||||
logError(LogCategory.AUDIO, "error: %o", error);
|
||||
reject();
|
||||
},
|
||||
timeout: 5000,
|
||||
|
@ -239,7 +239,7 @@ export class SoundManager {
|
|||
options = options || {};
|
||||
|
||||
const volume = get_sound_volume(_sound, options.default_volume);
|
||||
log.info(LogCategory.AUDIO, tr("Replaying sound %s (Sound volume: %o | Master volume %o)"), _sound, volume, master_volume);
|
||||
logInfo(LogCategory.AUDIO, tr("Replaying sound %s (Sound volume: %o | Master volume %o)"), _sound, volume, master_volume);
|
||||
|
||||
if(volume == 0 || master_volume == 0)
|
||||
return;
|
||||
|
@ -251,7 +251,7 @@ export class SoundManager {
|
|||
if(!handle) return;
|
||||
|
||||
if(!options.ignore_overlap && (this._playing_sounds[handle.filename] > 0) && !overlap_activated()) {
|
||||
log.info(LogCategory.AUDIO, tr("Dropping requested playback for sound %s because it would overlap."), _sound);
|
||||
logInfo(LogCategory.AUDIO, tr("Dropping requested playback for sound %s because it would overlap."), _sound);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,14 +263,14 @@ export class SoundManager {
|
|||
if(options.callback)
|
||||
options.callback(true);
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.AUDIO, tr("Failed to replay sound %s: %o"), handle.filename, error);
|
||||
logWarn(LogCategory.AUDIO, tr("Failed to replay sound %s: %o"), handle.filename, error);
|
||||
if(options.callback)
|
||||
options.callback(false);
|
||||
}).then(() => {
|
||||
this._playing_sounds[handle.filename]--;
|
||||
});
|
||||
}).catch(error => {
|
||||
log.warn(LogCategory.AUDIO, tr("Failed to replay sound %o because it could not be resolved: %o"), _sound, error);
|
||||
logWarn(LogCategory.AUDIO, tr("Failed to replay sound %o because it could not be resolved: %o"), _sound, error);
|
||||
if(options.callback)
|
||||
options.callback(false);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {LogCategory} from "./log";
|
||||
import {LogCategory, logDebug, logInfo, logTrace, logWarn} from "./log";
|
||||
import * as log from "./log";
|
||||
import { tr } from "./i18n/localize";
|
||||
|
||||
|
@ -74,7 +74,7 @@ function initialize_config_object(target_object: any, source_object: any) : any
|
|||
export function initialize(config: Config) {
|
||||
current_config = initialize_config_object(config || {}, DEFAULT_CONFIG);
|
||||
if(current_config.verbose)
|
||||
log.info(LogCategory.STATISTICS, tr("Initializing statistics with this config: %o"), current_config);
|
||||
logInfo(LogCategory.STATISTICS, tr("Initializing statistics with this config: %o"), current_config);
|
||||
|
||||
connection.start_connection();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace connection {
|
|||
if(connection_copy !== connection) return;
|
||||
|
||||
if(current_config.verbose)
|
||||
log.warn(LogCategory.STATISTICS, tr("Lost connection to statistics server (Connection closed). Reason: %o. Event object: %o"), CloseCodes[event.code] || event.code, event);
|
||||
logWarn(LogCategory.STATISTICS, tr("Lost connection to statistics server (Connection closed). Reason: %o. Event object: %o"), CloseCodes[event.code] || event.code, event);
|
||||
|
||||
if(event.code != CloseCodes.BANNED)
|
||||
invoke_reconnect();
|
||||
|
@ -118,7 +118,7 @@ namespace connection {
|
|||
if(connection_copy !== connection) return;
|
||||
|
||||
if(current_config.verbose)
|
||||
log.debug(LogCategory.STATISTICS, tr("Successfully connected to server. Initializing session."));
|
||||
logDebug(LogCategory.STATISTICS, tr("Successfully connected to server. Initializing session."));
|
||||
|
||||
connection_state = ConnectionState.INITIALIZING;
|
||||
initialize_session();
|
||||
|
@ -128,7 +128,7 @@ namespace connection {
|
|||
if(connection_copy !== connection) return;
|
||||
|
||||
if(current_config.verbose)
|
||||
log.warn(LogCategory.STATISTICS, tr("Received an error. Closing connection. Object: %o"), event);
|
||||
logWarn(LogCategory.STATISTICS, tr("Received an error. Closing connection. Object: %o"), event);
|
||||
|
||||
connection.close(CloseCodes.INTERNAL_ERROR);
|
||||
invoke_reconnect();
|
||||
|
@ -139,7 +139,7 @@ namespace connection {
|
|||
|
||||
if(typeof(event.data) !== 'string') {
|
||||
if(current_config.verbose)
|
||||
log.warn(LogCategory.STATISTICS, tr("Received an message which isn't a string. Event object: %o"), event);
|
||||
logWarn(LogCategory.STATISTICS, tr("Received an message which isn't a string. Event object: %o"), event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -168,11 +168,11 @@ namespace connection {
|
|||
}
|
||||
|
||||
if(current_config.verbose)
|
||||
log.info(LogCategory.STATISTICS, tr("Scheduled reconnect in %dms"), current_config.reconnect_interval);
|
||||
logInfo(LogCategory.STATISTICS, tr("Scheduled reconnect in %dms"), current_config.reconnect_interval);
|
||||
|
||||
reconnect_timer = setTimeout(() => {
|
||||
if(current_config.verbose)
|
||||
log.info(LogCategory.STATISTICS, tr("Reconnecting"));
|
||||
logInfo(LogCategory.STATISTICS, tr("Reconnecting"));
|
||||
start_connection();
|
||||
}, current_config.reconnect_interval);
|
||||
}
|
||||
|
@ -210,10 +210,10 @@ namespace connection {
|
|||
|
||||
if(typeof(handler[type]) === 'function') {
|
||||
if(current_config.verbose)
|
||||
log.trace(LogCategory.STATISTICS, tr("Handling message of type %s"), type);
|
||||
logTrace(LogCategory.STATISTICS, tr("Handling message of type %s"), type);
|
||||
handler[type](data);
|
||||
} else if(current_config.verbose) {
|
||||
log.warn(LogCategory.STATISTICS, tr("Received message with an unknown type (%s). Dropping message. Full message: %o"), type, data_object);
|
||||
logWarn(LogCategory.STATISTICS, tr("Received message with an unknown type (%s). Dropping message. Full message: %o"), type, data_object);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace connection {
|
|||
interface NotifyInitialized {}
|
||||
function handle_notify_initialized(json: NotifyInitialized) {
|
||||
if(current_config.verbose)
|
||||
log.info(LogCategory.STATISTICS, tr("Session successfully initialized."));
|
||||
logInfo(LogCategory.STATISTICS, tr("Session successfully initialized."));
|
||||
|
||||
connection_state = ConnectionState.CONNECTED;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,11 @@ import {MenuEntryType, spawn_context_menu} from "tc-shared/ui/elements/ContextMe
|
|||
|
||||
import '!style-loader!css-loader!highlight.js/styles/darcula.css';
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
|
||||
const registerLanguage = (name, language: Promise<any>) => {
|
||||
language.then(lan => hljs.registerLanguage(name, lan)).catch(error => {
|
||||
console.warn("Failed to load language %s (%o)", name, error);
|
||||
logWarn(LogCategory.CHAT, tr("Failed to load language %s (%o)"), name, error);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ export function preprocessChatMessageForSend(message: string) : string {
|
|||
break;
|
||||
}
|
||||
}
|
||||
console.error("Message: %s; No Parse: %s", message, noParseRanges);
|
||||
|
||||
message = bbcodeLinkUrls(message, noParseRanges);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory, logTrace} from "../log";
|
||||
import {LogCategory, logDebug, logTrace, logWarn} from "../log";
|
||||
import {
|
||||
CodeToken,
|
||||
Env,
|
||||
|
@ -135,10 +135,10 @@ export class MD2BBCodeRenderer {
|
|||
}
|
||||
|
||||
private renderToken(token: Token) {
|
||||
log.debug(LogCategory.GENERAL, tr("Render Markdown token: %o"), token);
|
||||
logDebug(LogCategory.GENERAL, tr("Render Markdown token: %o"), token);
|
||||
const renderer = MD2BBCodeRenderer.renderers[token.type];
|
||||
if(typeof(renderer) === "undefined") {
|
||||
log.warn(LogCategory.CHAT, tr("Missing markdown to bbcode renderer for token %s: %o"), token.type, token);
|
||||
logWarn(LogCategory.CHAT, tr("Missing markdown to bbcode renderer for token %s: %o"), token.type, token);
|
||||
return 'content' in token ? this.options().textProcessor(token.content) : "";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {ChannelTree} from "./ChannelTree";
|
||||
import {ClientEntry, ClientEvents} from "./Client";
|
||||
import * as log from "../log";
|
||||
import {LogCategory, LogType} from "../log";
|
||||
import {LogCategory, logInfo, LogType, logWarn} from "../log";
|
||||
import {PermissionType} from "../permission/PermissionType";
|
||||
import {settings, Settings} from "../settings";
|
||||
import * as contextmenu from "../ui/elements/ContextMenu";
|
||||
|
@ -223,7 +223,7 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
});
|
||||
|
||||
this.collapsed = this.channelTree.client.settings.getValue(Settings.FN_SERVER_CHANNEL_COLLAPSED(this.channelId));
|
||||
this.subscriptionMode = this.channelTree.client.settings.getValue(Settings.FN_SERVER_CHANNEL_SUBSCRIBE_MODE(this.channelId));
|
||||
this.subscriptionMode = this.channelTree.client.settings.getValue(Settings.FN_SERVER_CHANNEL_SUBSCRIBE_MODE(this.channelId), ChannelSubscribeMode.INHERITED);
|
||||
|
||||
this.channelDescriptionCached = false;
|
||||
this.channelDescriptionCallback = [];
|
||||
|
@ -310,7 +310,7 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
unregisterClient(client: ClientEntry, noEvent?: boolean) {
|
||||
client.events.off("notify_properties_updated", this.clientPropertyChangedListener);
|
||||
if(!this.client_list.remove(client)) {
|
||||
log.warn(LogCategory.CHANNEL, tr("Unregistered unknown client from channel %s"), this.channelName());
|
||||
logWarn(LogCategory.CHANNEL, tr("Unregistered unknown client from channel %s"), this.channelName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
this.channelTree.client.serverConnection.send_command("channeledit", properties).then(() => {
|
||||
this.channelTree.client.sound.play(Sound.CHANNEL_EDITED_SELF);
|
||||
});
|
||||
log.info(LogCategory.CHANNEL, tr("Changed channel properties of channel %s: %o"), this.channelName(), properties);
|
||||
logInfo(LogCategory.CHANNEL, tr("Changed channel properties of channel %s: %o"), this.channelName(), properties);
|
||||
}
|
||||
|
||||
if(permissions.length > 0) {
|
||||
|
@ -720,7 +720,6 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
cached_password() { return this.cachedPasswordHash; }
|
||||
|
||||
async updateSubscribeMode() {
|
||||
console.error("Update subscribe mode");
|
||||
let shouldBeSubscribed = false;
|
||||
switch (this.subscriptionMode) {
|
||||
case ChannelSubscribeMode.INHERITED:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
|
||||
import {MenuEntryType} from "tc-shared/ui/elements/ContextMenu";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, logError, logWarn} from "tc-shared/log";
|
||||
import {LogCategory, logDebug, logError, logWarn} from "tc-shared/log";
|
||||
import {PermissionType} from "tc-shared/permission/PermissionType";
|
||||
import {Sound} from "tc-shared/sound/Sounds";
|
||||
import {Group} from "tc-shared/permission/GroupManager";
|
||||
|
@ -236,12 +235,12 @@ export class ChannelTree {
|
|||
batch_updates(BatchUpdateType.CHANNEL_TREE);
|
||||
try {
|
||||
if(!this.channels.remove(channel)) {
|
||||
log.warn(LogCategory.CHANNEL, tr("Deleting an unknown channel!"));
|
||||
logWarn(LogCategory.CHANNEL, tr("Deleting an unknown channel!"));
|
||||
}
|
||||
|
||||
channel.children(false).forEach(e => this.deleteChannel(e));
|
||||
if(channel.clients(false).length !== 0) {
|
||||
log.warn(LogCategory.CHANNEL, tr("Deleting a non empty channel! This could cause some errors."));
|
||||
logWarn(LogCategory.CHANNEL, tr("Deleting a non empty channel! This could cause some errors."));
|
||||
for(const client of channel.clients(false)) {
|
||||
this.deleteClient(client, { reason: ViewReasonId.VREASON_SYSTEM, serverLeave: false });
|
||||
}
|
||||
|
@ -308,7 +307,7 @@ export class ChannelTree {
|
|||
|
||||
moveChannel(channel: ChannelEntry, channelPrevious: ChannelEntry, parent: ChannelEntry, isInsertMove: boolean) {
|
||||
if(channelPrevious != null && channelPrevious.parent != parent) {
|
||||
console.error(tr("Invalid channel move (different parents! (%o|%o)"), channelPrevious.parent, parent);
|
||||
logError(LogCategory.CHANNEL, tr("Invalid channel move (different parents! (%o|%o)"), channelPrevious.parent, parent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -890,11 +889,11 @@ export class ChannelTree {
|
|||
spawnCreateChannel(parent?: ChannelEntry) {
|
||||
spawnChannelEditNew(this.client, undefined, parent, (properties, permissions) => {
|
||||
properties["cpid"] = parent ? parent.channelId : 0;
|
||||
log.debug(LogCategory.CHANNEL, tr("Creating a new channel.\nProperties: %o\nPermissions: %o"), properties);
|
||||
logDebug(LogCategory.CHANNEL, tr("Creating a new channel.\nProperties: %o\nPermissions: %o"), properties);
|
||||
this.client.serverConnection.send_command("channelcreate", properties).then(() => {
|
||||
let channel = this.find_channel_by_name(properties.channel_name, parent, true);
|
||||
if(!channel) {
|
||||
log.error(LogCategory.CHANNEL, tr("Failed to resolve channel after creation. Could not apply permissions!"));
|
||||
logError(LogCategory.CHANNEL, tr("Failed to resolve channel after creation. Could not apply permissions!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -947,11 +946,11 @@ export class ChannelTree {
|
|||
|
||||
if(channels.length > 0) {
|
||||
this.client.serverConnection.send_command('channelsubscribe', channels.map(e => { return {cid: e}; })).catch(error => {
|
||||
console.warn(tr("Failed to subscribe to specific channels (%o): %o"), channels, error);
|
||||
logWarn(LogCategory.NETWORKING, tr("Failed to subscribe to specific channels (%o): %o"), channels, error);
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn(tr("Failed to unsubscribe to all channels! (%o)"), error);
|
||||
logWarn(LogCategory.NETWORKING, tr("Failed to unsubscribe to all channels! (%o)"), error);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -969,11 +968,11 @@ export class ChannelTree {
|
|||
|
||||
if(channels.length > 0) {
|
||||
this.client.serverConnection.send_command('channelunsubscribe', channels.map(e => { return {cid: e}; })).catch(error => {
|
||||
console.warn(tr("Failed to unsubscribe to specific channels (%o): %o"), channels, error);
|
||||
logWarn(LogCategory.CHANNEL, tr("Failed to unsubscribe to specific channels (%o): %o"), channels, error);
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn(tr("Failed to subscribe to all channels! (%o)"), error);
|
||||
logWarn(LogCategory.CHANNEL, tr("Failed to subscribe to all channels! (%o)"), error);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as contextmenu from "../ui/elements/ContextMenu";
|
|||
import {Registry} from "../events";
|
||||
import {ChannelTree} from "./ChannelTree";
|
||||
import * as log from "../log";
|
||||
import {LogCategory, logInfo, LogType} from "../log";
|
||||
import {LogCategory, logDebug, logError, logInfo, LogType} from "../log";
|
||||
import {Settings, settings} from "../settings";
|
||||
import {Sound} from "../sound/Sounds";
|
||||
import {Group, GroupManager, GroupTarget, GroupType} from "../permission/GroupManager";
|
||||
|
@ -219,11 +219,11 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
|
|||
|
||||
destroy() {
|
||||
if(this.voiceHandle) {
|
||||
log.error(LogCategory.AUDIO, tr("Destroying client with an active audio handle. This could cause memory leaks!"));
|
||||
logError(LogCategory.AUDIO, tr("Destroying client with an active audio handle. This could cause memory leaks!"));
|
||||
this.setVoiceClient(undefined);
|
||||
}
|
||||
if(this.videoHandle) {
|
||||
log.error(LogCategory.AUDIO, tr("Destroying client with an active video handle. This could cause memory leaks!"));
|
||||
logError(LogCategory.AUDIO, tr("Destroying client with an active video handle. This could cause memory leaks!"));
|
||||
this.setVideoClient(undefined);
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ export class ClientEntry<Events extends ClientEvents = ClientEvents> extends Cha
|
|||
const mute_status = this.channelTree.client.settings.getValue(Settings.FN_CLIENT_MUTED(this.clientUid()), false);
|
||||
this.setMuted(mute_status, mute_status); /* force only needed when we want to mute the client */
|
||||
this.updateVoiceVolume();
|
||||
log.debug(LogCategory.CLIENT, tr("Loaded client (%s) server specific properties. Volume: %o Muted: %o."), this.clientUid(), this.voiceVolume, this.voiceMuted);
|
||||
logDebug(LogCategory.CLIENT, tr("Loaded client (%s) server specific properties. Volume: %o Muted: %o."), this.clientUid(), this.voiceVolume, this.voiceMuted);
|
||||
}
|
||||
if(variable.key == "client_talk_power") {
|
||||
reorder_channel = true;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {ChannelTree} from "./ChannelTree";
|
|||
import {Settings, settings} from "../settings";
|
||||
import * as contextmenu from "../ui/elements/ContextMenu";
|
||||
import * as log from "../log";
|
||||
import {LogCategory, LogType} from "../log";
|
||||
import {LogCategory, logInfo, LogType} from "../log";
|
||||
import {Sound} from "../sound/Sounds";
|
||||
import * as bookmarks from "../bookmarks";
|
||||
import {spawnInviteEditor} from "../ui/modal/ModalInvite";
|
||||
|
@ -228,8 +228,7 @@ export class ServerEntry extends ChannelTreeEntry<ServerEvents> {
|
|||
name: tr("Edit"),
|
||||
callback: () => {
|
||||
createServerModal(this, properties => {
|
||||
log.info(LogCategory.SERVER, tr("Changing server properties %o"), properties);
|
||||
console.log(tr("Changed properties: %o"), properties);
|
||||
logInfo(LogCategory.SERVER, tr("Changing server properties %o"), properties);
|
||||
if (Object.keys(properties || {}).length > 0) {
|
||||
return this.channelTree.client.serverConnection.send_command("serveredit", properties).then(() => {
|
||||
this.channelTree.client.sound.play(Sound.SERVER_EDITED_SELF);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as React from "react";
|
||||
import {useEffect, useState} from "react";
|
||||
import {ControlBar2} from "tc-shared/ui/frames/control-bar/Renderer";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ControlBarEvents} from "tc-shared/ui/frames/control-bar/Definitions";
|
||||
|
@ -15,7 +16,6 @@ import {FooterRenderer} from "tc-shared/ui/frames/footer/Renderer";
|
|||
import {HostBanner} from "tc-shared/ui/frames/HostBannerRenderer";
|
||||
import {HostBannerUiEvents} from "tc-shared/ui/frames/HostBannerDefinitions";
|
||||
import {AppUiEvents} from "tc-shared/ui/AppDefinitions";
|
||||
import {useEffect, useState} from "react";
|
||||
import {ChannelTreeRenderer} from "tc-shared/ui/tree/Renderer";
|
||||
import {ChannelTreeUIEvents} from "tc-shared/ui/tree/Definitions";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {RemoteIcon} from "tc-shared/file/Icons";
|
||||
import {ClientIcon} from "svg-sprites/client-icons";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export type MenuEntryLabel = {
|
||||
text: string,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {Settings, settings} from "../../settings";
|
||||
import {LogCategory} from "../../log";
|
||||
import * as log from "../../log";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {LogCategory, logDebug, logError} from "../../log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
declare global {
|
||||
interface JQuery<TElement = HTMLElement> {
|
||||
|
@ -132,12 +131,12 @@ if(!$.fn.dividerfy) {
|
|||
try {
|
||||
const config = JSON.parse(settings.getValue(Settings.FN_SEPARATOR_STATE(seperator_id), undefined));
|
||||
if(config) {
|
||||
log.debug(LogCategory.GENERAL, tr("Applying previous changed sperator settings for %s: %o"), seperator_id, config);
|
||||
logDebug(LogCategory.GENERAL, tr("Applying previous changed sperator settings for %s: %o"), seperator_id, config);
|
||||
apply_view(config.property, config.previous, config.next);
|
||||
}
|
||||
} catch(e) {
|
||||
if(!(e instanceof SyntaxError))
|
||||
log.error(LogCategory.GENERAL, tr("Failed to parse seperator settings for sperator %s: %o"), seperator_id, e);
|
||||
logError(LogCategory.GENERAL, tr("Failed to parse seperator settings for sperator %s: %o"), seperator_id, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {closeContextMenu, ContextMenuEntry, spawnContextMenu} from "tc-shared/ui/ContextMenu";
|
||||
import {ClientIcon} from "svg-sprites/client-icons";
|
||||
import {LogCategory, logError} from "tc-shared/log";
|
||||
|
||||
export interface MenuEntry {
|
||||
callback?: () => void;
|
||||
|
@ -57,7 +58,7 @@ export interface ContextMenuProvider {
|
|||
let provider: ContextMenuProvider;
|
||||
export function spawn_context_menu(x: number, y: number, ...entries: MenuEntry[]) {
|
||||
if(!provider) {
|
||||
console.error(tr("Failed to spawn context menu! Missing provider!"));
|
||||
logError(LogCategory.GENERAL, tr("Failed to spawn context menu! Missing provider!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as loader from "tc-loader";
|
|||
import {Stage} from "tc-loader";
|
||||
import {KeyCode} from "../../PPTListener";
|
||||
import * as $ from "jquery";
|
||||
import {LogCategory, logError} from "tc-shared/log";
|
||||
|
||||
export enum ElementType {
|
||||
HEADER,
|
||||
|
@ -40,7 +41,7 @@ export const ModalFunctions = {
|
|||
case "undefined":
|
||||
return undefined;
|
||||
default:
|
||||
console.error(("Invalid type %o"), typeof val);
|
||||
logError(LogCategory.GENERAL, "Invalid type %o", typeof val);
|
||||
return $();
|
||||
}
|
||||
},
|
||||
|
@ -210,7 +211,6 @@ export class Modal {
|
|||
const body = ModalFunctions.jqueriefy(this.properties.body, ElementType.BODY);
|
||||
const footer = ModalFunctions.jqueriefy(this.properties.footer, ElementType.FOOTER);
|
||||
|
||||
//FIXME: cache template
|
||||
const template = $(this.properties.template || "#tmpl_modal");
|
||||
|
||||
const properties = {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import {LogCategory, logDebug} from "tc-shared/log";
|
||||
|
||||
export type Entry = {
|
||||
timestamp: number;
|
||||
|
||||
|
@ -120,10 +122,11 @@ export class Graph {
|
|||
if(Graph._loops.length == 1) {
|
||||
const static_loop = () => {
|
||||
Graph._loops.forEach(l => l());
|
||||
if(Graph._loops.length > 0)
|
||||
if(Graph._loops.length > 0) {
|
||||
requestAnimationFrame(static_loop);
|
||||
else
|
||||
console.log("STATIC terminate!");
|
||||
} else {
|
||||
logDebug(LogCategory.GENERAL, tr("NetGraph static terminate"));
|
||||
}
|
||||
};
|
||||
static_loop();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ export function sliderfy(slider: JQuery, options?: SliderOptions) : Slider {
|
|||
|
||||
tool.hide();
|
||||
slider.removeClass("active");
|
||||
console.log("Events removed");
|
||||
};
|
||||
|
||||
const mouse_listener = (event: MouseEvent | TouchEvent) => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
|
||||
declare global {
|
||||
interface JQuery<TElement = HTMLElement> {
|
||||
asTabWidget(copy?: boolean) : JQuery<TElement>;
|
||||
|
@ -19,17 +21,14 @@ if(typeof (customElements) !== "undefined") {
|
|||
customElements.define('x-tag', X_Tag, { extends: 'div' });
|
||||
customElements.define('x-content', X_Content, { extends: 'div' });
|
||||
} catch(error) {
|
||||
console.warn("failed to define costum elements");
|
||||
logWarn(LogCategory.GENERAL, tr("failed to define costume elements"));
|
||||
}
|
||||
} else {
|
||||
console.warn(tr("Could not defied tab customElements!"));
|
||||
logWarn(LogCategory.GENERAL, tr("Could not defied tab customElements!"));
|
||||
}
|
||||
|
||||
export const TabFunctions = {
|
||||
tabify(template: JQuery, copy: boolean = true) : JQuery {
|
||||
console.log("Tabify: copy=" + copy);
|
||||
console.log(template);
|
||||
|
||||
let tag = $.spawn("div");
|
||||
tag.addClass("tab");
|
||||
|
||||
|
@ -48,7 +47,6 @@ export const TabFunctions = {
|
|||
const update_height = () => {
|
||||
const height_watcher = tag.find("> .tab-content .height-watcher");
|
||||
const entries: JQuery = tag.find("> .tab-content-invisible x-content, > .tab-content x-content");
|
||||
console.error(entries);
|
||||
let max_height = 0;
|
||||
|
||||
entries.each((_, _e) => {
|
||||
|
@ -92,8 +90,6 @@ export const TabFunctions = {
|
|||
} else {
|
||||
element.first().trigger('click');
|
||||
}
|
||||
console.log("Next: %o", tag_header.next('.entry:visible'));
|
||||
console.log("prev: %o", tag_header.prev('.entry:visible'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -111,7 +107,6 @@ export const TabFunctions = {
|
|||
let entries = tag_content.find(".tab-show-partitional");
|
||||
entries.hide();
|
||||
const show_next = index => {
|
||||
console.log("Show " + index);
|
||||
if(index >= entries.length) return;
|
||||
entries.eq(index).show();
|
||||
|
||||
|
@ -123,7 +118,6 @@ export const TabFunctions = {
|
|||
tag_content.show();
|
||||
});
|
||||
|
||||
console.log(this);
|
||||
header.append(tag_header);
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as React from "react";
|
|||
import {useEffect, useRef, useState} from "react";
|
||||
import {useGlobalSetting, useTr} from "tc-shared/ui/react-elements/Helper";
|
||||
import {ErrorBoundary} from "tc-shared/ui/react-elements/ErrorBoundary";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import {Settings} from "tc-shared/settings";
|
||||
|
||||
const cssStyle = require("./HostBannerRenderer.scss");
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import {ClientInfoRenderer} from "tc-shared/ui/frames/side/ClientInfoRenderer";
|
|||
import {PrivateConversationsPanel} from "tc-shared/ui/frames/side/PrivateConversationRenderer";
|
||||
import {ChannelBarRenderer} from "tc-shared/ui/frames/side/ChannelBarRenderer";
|
||||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
import React = require("react");
|
||||
import {ErrorBoundary} from "tc-shared/ui/react-elements/ErrorBoundary";
|
||||
import {MusicBotRenderer} from "tc-shared/ui/frames/side/MusicBotRenderer";
|
||||
import {ConversationPanel} from "tc-shared/ui/frames/side/AbstractConversationRenderer";
|
||||
import React = require("react");
|
||||
|
||||
const cssStyle = require("./SideBarRenderer.scss");
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logWarn} 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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export enum ChatType {
|
||||
GENERAL,
|
||||
|
@ -83,7 +82,7 @@ export function formatMessage(pattern: string, ...objects: any[]) : JQuery[] {
|
|||
}
|
||||
|
||||
if(objects.length < number)
|
||||
log.warn(LogCategory.GENERAL, tr("Message to format contains invalid index (%o)"), number);
|
||||
logWarn(LogCategory.GENERAL, tr("Message to format contains invalid index (%o)"), number);
|
||||
|
||||
result.push(...formatElement(objects[number]));
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ export function parseMessageWithArguments(pattern: string, argumentCount: number
|
|||
}
|
||||
|
||||
if(argumentCount < number) {
|
||||
log.warn(LogCategory.GENERAL, tr("Message to format contains invalid index (%o)"), number);
|
||||
logWarn(LogCategory.GENERAL, tr("Message to format contains invalid index (%o)"), number);
|
||||
result.push("{" + offset.toString() + "}");
|
||||
} else {
|
||||
result.push(number);
|
||||
|
|
|
@ -3,7 +3,7 @@ import {ConnectionListUIEvents, HandlerConnectionState} from "tc-shared/ui/frame
|
|||
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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export function initializeConnectionListController(events: Registry<ConnectionListUIEvents>) {
|
||||
let registeredHandlerEvents: {[key: string]:(() => void)[]} = {};
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as React from "react";
|
|||
import {ReactComponentBase} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {DropdownContainer} from "./DropDown";
|
||||
import {ClientIcon} from "svg-sprites/client-icons";
|
||||
|
||||
const cssStyle = require("./Button.scss");
|
||||
|
||||
export interface ButtonState {
|
||||
|
|
|
@ -3,7 +3,8 @@ import {
|
|||
Bookmark,
|
||||
ControlBarEvents,
|
||||
ControlBarMode,
|
||||
HostButtonInfo, VideoDeviceInfo,
|
||||
HostButtonInfo,
|
||||
VideoDeviceInfo,
|
||||
VideoState
|
||||
} from "tc-shared/ui/frames/control-bar/Definitions";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
|
@ -23,7 +24,7 @@ import {
|
|||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import {VideoBroadcastType, VideoConnectionStatus} from "tc-shared/connection/VideoConnection";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {getVideoDriver} from "tc-shared/video/VideoSource";
|
||||
import {kLocalBroadcastChannels} from "tc-shared/ui/frames/video/Definitions";
|
||||
|
||||
|
@ -412,7 +413,6 @@ export function initializeControlBarController(events: Registry<ControlBarEvents
|
|||
});
|
||||
events.on("action_toggle_video", event => {
|
||||
if(infoHandler.getCurrentHandler()) {
|
||||
/* TODO: Just update the stream and don't "rebroadcast" */
|
||||
global_client_actions.fire("action_toggle_video_broadcasting", {
|
||||
connection: infoHandler.getCurrentHandler(),
|
||||
broadcastType: event.broadcastType,
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as React from "react";
|
|||
import {ReactComponentBase} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {IconRenderer, RemoteIconRenderer} from "tc-shared/ui/react-elements/Icon";
|
||||
import {getIconManager, RemoteIconInfo} from "tc-shared/file/Icons";
|
||||
|
||||
const cssStyle = require("./Button.scss");
|
||||
|
||||
export interface DropdownEntryProperties {
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
ControlBarEvents,
|
||||
ControlBarMode,
|
||||
HostButtonInfo,
|
||||
MicrophoneState, VideoDeviceInfo,
|
||||
MicrophoneState,
|
||||
VideoDeviceInfo,
|
||||
VideoState
|
||||
} from "tc-shared/ui/frames/control-bar/Definitions";
|
||||
import * as React from "react";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as React from "react";
|
||||
import {useMemo} from "react";
|
||||
import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {useEffect, useMemo, useState} from "react";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
import {StatusController} from "tc-shared/ui/frames/footer/StatusController";
|
||||
import {ConnectionStatusEvents} from "tc-shared/ui/frames/footer/StatusDefinitions";
|
||||
|
@ -23,8 +22,8 @@ const VersionsRenderer = () => (
|
|||
</React.Fragment>
|
||||
);
|
||||
|
||||
/* FIXME: Outsource this! */
|
||||
const RtcStatus = () => {
|
||||
/* FIXME: Outsource this! */
|
||||
const statusController = useMemo(() => new StatusController(new Registry<ConnectionStatusEvents>()), []);
|
||||
statusController.setConnectionHandler(server_connections.getActiveConnectionHandler());
|
||||
|
||||
|
|
|
@ -4,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
enum StatusNotifyState {
|
||||
/* no notify has been scheduled */
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as React from "react";
|
|||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {network} from "tc-shared/ui/frames/chat";
|
||||
import {date_format} from "tc-shared/utils/DateUtils";
|
||||
|
||||
const cssStyle = require("./Renderer.scss");
|
||||
export const StatusEvents = React.createContext<Registry<ConnectionStatusEvents>>(undefined);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {VariadicTranslatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import * as React from "react";
|
||||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {findLogEventRenderer} from "./RendererEvent";
|
||||
import {LogMessage} from "tc-shared/connectionlog/Definitions";
|
||||
import {ServerEventLogUiEvents} from "tc-shared/ui/frames/log/Definitions";
|
||||
|
|
|
@ -5,7 +5,6 @@ import {formatDate} from "tc-shared/MessageFormatter";
|
|||
import {BBCodeRenderer} from "tc-shared/text/bbcode";
|
||||
import {format_time} from "tc-shared/ui/frames/chat";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {XBBCodeRenderer} from "vendor/xbbcode/react";
|
||||
import {ChannelTag, ClientTag} from "tc-shared/ui/tree/EntryTags";
|
||||
import {EventChannelData, EventClient, EventType, TypeInfo} from "tc-shared/connectionlog/Definitions";
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
DirectoryBookmark
|
||||
} from "tc-shared/bookmarks";
|
||||
import {getBackend} from "tc-shared/backend";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
function renderConnectionItems() {
|
||||
const items: MenuBarEntry[] = [];
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
import {
|
||||
ChatHistoryState,
|
||||
AbstractConversationUiEvents
|
||||
} from "./AbstractConversationDefinitions";
|
||||
import {AbstractConversationUiEvents, ChatHistoryState} from "./AbstractConversationDefinitions";
|
||||
import {EventHandler, Registry} from "../../../events";
|
||||
import * as log from "../../../log";
|
||||
import {LogCategory} from "../../../log";
|
||||
import {tra, tr} from "../../../i18n/localize";
|
||||
import {LogCategory, logError} from "../../../log";
|
||||
import {tr, tra} from "../../../i18n/localize";
|
||||
import {
|
||||
AbstractChat,
|
||||
AbstractConversationEvents,
|
||||
AbstractChatManager,
|
||||
AbstractChatManagerEvents
|
||||
AbstractChatManagerEvents,
|
||||
AbstractConversationEvents
|
||||
} from "tc-shared/conversations/AbstractConversion";
|
||||
|
||||
export const kMaxChatFrameMessageSize = 50; /* max 100 messages, since the server does not support more than 100 messages queried at once */
|
||||
|
@ -288,7 +284,7 @@ export abstract class AbstractConversationController<
|
|||
chatId: event.chatId
|
||||
});
|
||||
|
||||
log.error(LogCategory.CLIENT, tr("Tried to query history for an unknown conversation with id %s"), event.chatId);
|
||||
logError(LogCategory.CLIENT, tr("Tried to query history for an unknown conversation with id %s"), event.chatId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -305,7 +301,7 @@ export abstract class AbstractConversationController<
|
|||
protected handleSendMessage(event: AbstractConversationUiEvents["action_send_message"]) {
|
||||
const conversation = this.conversationManager?.findConversationById(event.chatId);
|
||||
if(!conversation) {
|
||||
log.error(LogCategory.CLIENT, tr("Tried to send a chat message to an unknown conversation with id %s"), event.chatId);
|
||||
logError(LogCategory.CLIENT, tr("Tried to send a chat message to an unknown conversation with id %s"), event.chatId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,7 +312,7 @@ export abstract class AbstractConversationController<
|
|||
protected handleJumpToPresent(event: AbstractConversationUiEvents["action_jump_to_present"]) {
|
||||
const conversation = this.conversationManager?.findConversationById(event.chatId);
|
||||
if(!conversation) {
|
||||
log.error(LogCategory.CLIENT, tr("Tried to jump to present for an unknown conversation with id %s"), event.chatId);
|
||||
logError(LogCategory.CLIENT, tr("Tried to jump to present for an unknown conversation with id %s"), event.chatId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
import * as React from "react";
|
||||
import {EventHandler, ReactEventHandler, Registry} from "tc-shared/events";
|
||||
import {Ref, useEffect, useRef, useState} from "react";
|
||||
import {EventHandler, ReactEventHandler, Registry} from "tc-shared/events";
|
||||
import {AvatarRenderer} from "tc-shared/ui/react-elements/Avatar";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
import {Countdown} from "tc-shared/ui/react-elements/Countdown";
|
||||
import {
|
||||
AbstractConversationUiEvents,
|
||||
ChatEvent,
|
||||
ChatEventLocalAction,
|
||||
ChatEventLocalUserSwitch,
|
||||
ChatEventMessageSendFailed,
|
||||
ChatEventModeChanged,
|
||||
ChatEventPartnerAction,
|
||||
ChatEventPartnerInstanceChanged,
|
||||
ChatEventQueryFailed,
|
||||
ChatEventPartnerAction,
|
||||
ChatHistoryState,
|
||||
ChatMessage,
|
||||
AbstractConversationUiEvents, ChatEventModeChanged
|
||||
ChatMessage
|
||||
} from "./AbstractConversationDefinitions";
|
||||
import {TimestampRenderer} from "tc-shared/ui/react-elements/TimestampRenderer";
|
||||
import {BBCodeRenderer} from "tc-shared/text/bbcode";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {Registry} from "tc-shared/events";
|
||||
import {ChannelBarMode, ChannelBarModeData, ChannelBarUiEvents} from "tc-shared/ui/frames/side/ChannelBarDefinitions";
|
||||
import {useContext, useState} from "react";
|
||||
import * as React from "react";
|
||||
import {useContext, useState} from "react";
|
||||
import {ConversationPanel} from "tc-shared/ui/frames/side/AbstractConversationRenderer";
|
||||
import {useDependentState} from "tc-shared/ui/react-elements/Helper";
|
||||
import {ChannelDescriptionRenderer} from "tc-shared/ui/frames/side/ChannelDescriptionRenderer";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {ConnectionHandler, ConnectionState} from "../../../ConnectionHandler";
|
||||
import {ConnectionHandler} from "../../../ConnectionHandler";
|
||||
import {EventHandler} from "../../../events";
|
||||
import * as log from "../../../log";
|
||||
import {LogCategory} from "../../../log";
|
||||
import {LogCategory, logError} from "../../../log";
|
||||
import {tr} from "../../../i18n/localize";
|
||||
import {AbstractConversationUiEvents} from "./AbstractConversationDefinitions";
|
||||
import {AbstractConversationController} from "./AbstractConversationController";
|
||||
|
@ -80,7 +79,7 @@ export class ChannelConversationController extends AbstractConversationControlle
|
|||
private handleMessageDelete(event: AbstractConversationUiEvents["action_delete_message"]) {
|
||||
const conversation = this.conversationManager?.findConversationById(event.chatId);
|
||||
if(!conversation) {
|
||||
log.error(LogCategory.CLIENT, tr("Tried to delete a chat message from an unknown conversation with id %s"), event.chatId);
|
||||
logError(LogCategory.CLIENT, tr("Tried to delete a chat message from an unknown conversation with id %s"), event.chatId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ import * as React from "react";
|
|||
import {useState} from "react";
|
||||
import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
import {allowedBBCodes, BBCodeRenderer} from "tc-shared/text/bbcode";
|
||||
import {parse as parseBBCode} from "vendor/xbbcode/parser";
|
||||
import {BBCodeRenderer} from "tc-shared/text/bbcode";
|
||||
|
||||
const cssStyle = require("./ChannelDescriptionRenderer.scss");
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import * as React from "react";
|
||||
import {useState} from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ChannelFileBrowserUiEvents} from "tc-shared/ui/frames/side/ChannelFileBrowserDefinitions";
|
||||
import {channelPathPrefix, FileBrowserEvents} from "tc-shared/ui/modal/transfer/FileDefinitions";
|
||||
import {
|
||||
FileBrowserClassContext,
|
||||
FileBrowserRenderer, FileBrowserRendererClasses,
|
||||
FileBrowserRenderer,
|
||||
FileBrowserRendererClasses,
|
||||
NavigationBar
|
||||
} from "tc-shared/ui/modal/transfer/FileBrowserRenderer";
|
||||
import * as React from "react";
|
||||
|
||||
const cssStyle = require("./ChannelFileBrowserRenderer.scss");
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {
|
||||
ClientGroupInfo,
|
||||
ClientInfoEvents,
|
||||
} from "tc-shared/ui/frames/side/ClientInfoDefinitions";
|
||||
import {ClientGroupInfo, ClientInfoEvents,} from "tc-shared/ui/frames/side/ClientInfoDefinitions";
|
||||
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {openClientInfo} from "tc-shared/ui/modal/ModalClientInfo";
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import * as React from "react";
|
||||
import {useContext, useEffect, useState} from "react";
|
||||
import {
|
||||
ClientCountryInfo, ClientForumInfo, ClientGroupInfo,
|
||||
ClientCountryInfo,
|
||||
ClientForumInfo,
|
||||
ClientGroupInfo,
|
||||
ClientInfoEvents,
|
||||
ClientInfoOnline,
|
||||
ClientStatusInfo,
|
||||
|
|
|
@ -5,8 +5,6 @@ import {ChannelEntry, ChannelProperties} from "tc-shared/tree/Channel";
|
|||
import {LocalClientEntry, MusicClientEntry} from "tc-shared/tree/Client";
|
||||
import {openMusicManage} from "tc-shared/ui/modal/ModalMusicManage";
|
||||
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import {server_connections} from "tc-shared/ConnectionManager";
|
||||
import {appViewController} from "tc-shared/ui/AppController";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {LogCategory, logError} from "tc-shared/log";
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import * as React from "react";
|
||||
import {useContext, useState} from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {
|
||||
SideHeaderEvents,
|
||||
SideHeaderState,
|
||||
PrivateConversationInfo,
|
||||
SideHeaderChannelState,
|
||||
SideHeaderPingInfo, PrivateConversationInfo, SideHeaderServerInfo
|
||||
SideHeaderEvents,
|
||||
SideHeaderPingInfo,
|
||||
SideHeaderServerInfo,
|
||||
SideHeaderState
|
||||
} from "tc-shared/ui/frames/side/HeaderDefinitions";
|
||||
import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {useContext, useState} from "react";
|
||||
import {RemoteIconRenderer} from "tc-shared/ui/react-elements/Icon";
|
||||
import {getIconManager} from "tc-shared/file/Icons";
|
||||
|
||||
|
|
|
@ -276,7 +276,6 @@ export class MusicBotController {
|
|||
let playlistId: number = 0;
|
||||
if(this.currentConnection && this.currentBot) {
|
||||
playlistId = this.currentBot.properties.client_playlist_id;
|
||||
console.error("Client playlist id: %o", playlistId);
|
||||
}
|
||||
|
||||
let playlist: SubscribedPlaylist;
|
||||
|
|
|
@ -2,13 +2,13 @@ import {Registry} from "tc-shared/events";
|
|||
import {MusicPlaylistUiEvents} from "tc-shared/ui/frames/side/MusicPlaylistDefinitions";
|
||||
import {DefaultThumbnail, formatPlaytime, MusicPlaylistList} from "tc-shared/ui/frames/side/MusicPlaylistRenderer";
|
||||
import * as React from "react";
|
||||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {
|
||||
MusicBotPlayerState,
|
||||
MusicBotPlayerTimestamp,
|
||||
MusicBotSongInfo,
|
||||
MusicBotUiEvents
|
||||
} from "tc-shared/ui/frames/side/MusicBotDefinitions";
|
||||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {preview_image} from "tc-shared/ui/frames/image_preview";
|
||||
import {Slider} from "tc-shared/ui/react-elements/Slider";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as React from "react";
|
||||
import {useContext, useRef, useState} from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {
|
||||
MusicPlaylistEntryInfo,
|
||||
MusicPlaylistStatus,
|
||||
MusicPlaylistUiEvents
|
||||
} from "tc-shared/ui/frames/side/MusicPlaylistDefinitions";
|
||||
import {useContext, useRef, useState} from "react";
|
||||
import {Button} from "tc-shared/ui/react-elements/Button";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
|
@ -236,7 +236,6 @@ const PlaylistEntry = React.memo((props: { serverUniqueId: string, playlistId: n
|
|||
onDragEnd={() => setInsertMarker("none")}
|
||||
onDrop={event => {
|
||||
const info = parseDragIds(event.dataTransfer);
|
||||
console.error("Info: %o - %o - %o", info, insertMarker, { playlistId: props.playlistId, serverUniqueId: props.serverUniqueId });
|
||||
if(!info) {
|
||||
setInsertMarker("none");
|
||||
return;
|
||||
|
|
|
@ -4,13 +4,10 @@ import {
|
|||
PrivateConversationInfo,
|
||||
PrivateConversationUIEvents
|
||||
} from "../../../ui/frames/side/PrivateConversationDefinitions";
|
||||
import {
|
||||
AbstractConversationUiEvents
|
||||
} from "./AbstractConversationDefinitions";
|
||||
import * as log from "../../../log";
|
||||
import {LogCategory} from "../../../log";
|
||||
import {AbstractConversationUiEvents} from "./AbstractConversationDefinitions";
|
||||
import {LogCategory, logError, logWarn} from "../../../log";
|
||||
import {AbstractConversationController} from "./AbstractConversationController";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {
|
||||
PrivateConversation,
|
||||
PrivateConversationEvents,
|
||||
|
@ -147,7 +144,7 @@ export class PrivateConversationController extends AbstractConversationControlle
|
|||
private handleConversationClose(event: PrivateConversationUIEvents["action_close_chat"]) {
|
||||
const conversation = this.conversationManager?.findConversation(event.chatId);
|
||||
if(!conversation) {
|
||||
log.error(LogCategory.CLIENT, tr("Tried to close a not existing private conversation with id %s"), event.chatId);
|
||||
logError(LogCategory.CLIENT, tr("Tried to close a not existing private conversation with id %s"), event.chatId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -167,7 +164,7 @@ export class PrivateConversationController extends AbstractConversationControlle
|
|||
}
|
||||
|
||||
this.connection.serverConnection.send_command("clientchatcomposing", { clid: clientId }).catch(error => {
|
||||
log.warn(LogCategory.CHAT, tr("Failed to send chat composing to server for chat %d: %o"), clientId, error);
|
||||
logWarn(LogCategory.CHAT, tr("Failed to send chat composing to server for chat %d: %o"), clientId, error);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
import * as React from "react";
|
||||
import {useContext, useEffect, useState} from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {
|
||||
PrivateConversationInfo,
|
||||
PrivateConversationUIEvents
|
||||
} from "tc-shared/ui/frames/side/PrivateConversationDefinitions";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ContextDivider} from "tc-shared/ui/react-elements/ContextDivider";
|
||||
import {ConversationPanel} from "./AbstractConversationRenderer";
|
||||
import {useContext, useEffect, useState} from "react";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
import {AvatarRenderer} from "tc-shared/ui/react-elements/Avatar";
|
||||
import {TimestampRenderer} from "tc-shared/ui/react-elements/TimestampRenderer";
|
||||
|
|
|
@ -7,7 +7,10 @@ import {
|
|||
ChannelVideoEvents,
|
||||
ChannelVideoInfo,
|
||||
ChannelVideoStreamState,
|
||||
kLocalVideoId, makeVideoAutoplay, VideoStreamState, VideoSubscribeInfo
|
||||
kLocalVideoId,
|
||||
makeVideoAutoplay,
|
||||
VideoStreamState,
|
||||
VideoSubscribeInfo
|
||||
} from "tc-shared/ui/frames/video/Definitions";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory} from "../log";
|
||||
import {LogCategory, logDebug, logWarn} from "../log";
|
||||
import {ChannelEntry} from "../tree/Channel";
|
||||
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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0};
|
||||
|
||||
|
@ -47,7 +46,7 @@ function generate_client_open(properties: ClientProperties) : string {
|
|||
try {
|
||||
result = result + "client-unique-id='" + encodeURIComponent(properties.client_unique_id) + "' ";
|
||||
} catch(error) {
|
||||
console.warn(tr("Failed to generate client tag attribute 'client-unique-id': %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to generate client tag attribute 'client-unique-id': %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,7 @@ function generate_client_open(properties: ClientProperties) : string {
|
|||
try {
|
||||
result = result + "client-name='" + encodeURIComponent(properties.client_name) + "' ";
|
||||
} catch(error) {
|
||||
console.warn(tr("Failed to generate client tag attribute 'client-name': %o"), error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to generate client tag attribute 'client-name': %o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +160,7 @@ export namespace callbacks {
|
|||
if(!client) {
|
||||
|
||||
/* we may should open a "offline" menu? */
|
||||
log.debug(LogCategory.GENERAL, "Failed to resolve client from html tag. Client id: %o, Client unique id: %o, Client name: %o",
|
||||
logDebug(LogCategory.GENERAL, "Failed to resolve client from html tag. Client id: %o, Client unique id: %o, Client name: %o",
|
||||
client_id,
|
||||
client_unique_id,
|
||||
decodeURIComponent(element.attr("client-name"))
|
||||
|
|
|
@ -1,8 +1,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";
|
||||
import {LogCategory, logError, logTrace} from "../log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export function setupJSRender() : boolean {
|
||||
if(!$.views) {
|
||||
|
@ -28,9 +27,9 @@ export function setupJSRender() : boolean {
|
|||
|
||||
$(".jsrender-template").each((idx, _entry) => {
|
||||
if(!$.templates(_entry.id, _entry.innerHTML)) {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to setup cache for js renderer template %s!"), _entry.id);
|
||||
logError(LogCategory.GENERAL, tr("Failed to setup cache for js renderer template %s!"), _entry.id);
|
||||
} else
|
||||
log.trace(LogCategory.GENERAL, tr("Successfully loaded jsrender template %s"), _entry.id);
|
||||
logTrace(LogCategory.GENERAL, tr("Successfully loaded jsrender template %s"), _entry.id);
|
||||
});
|
||||
return true;
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import {createModal} from "../../ui/elements/Modal";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {LogCategory, logError} from "../../log";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
function format_date(date: number) {
|
||||
const d = new Date(date);
|
||||
|
@ -34,7 +33,7 @@ export function spawnAbout() {
|
|||
(window as any).native.client_version().then(version => {
|
||||
connectModal.htmlTag.find(".version-client").text(version);
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to load client version: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load client version: %o"), error);
|
||||
connectModal.htmlTag.find(".version-client").text("unknown");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
//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, tr} from "../../i18n/localize";
|
||||
import {tr, tra} from "../../i18n/localize";
|
||||
import {arrayBufferBase64} from "../../utils/buffers";
|
||||
import {LogCategory, logError, logTrace} from "tc-shared/log";
|
||||
|
||||
export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined | null) => any) {
|
||||
const modal = createModal({
|
||||
|
@ -41,7 +42,7 @@ export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined
|
|||
input_node.multiple = false;
|
||||
|
||||
modal.htmlTag.find(".file-inputs").on('change', event => {
|
||||
console.log("Files: %o", input_node.files);
|
||||
logTrace(LogCategory.CLIENT, "Files: %o", input_node.files);
|
||||
|
||||
const read_file = (file: File) => new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
@ -55,13 +56,13 @@ export function spawnAvatarUpload(callback_data: (data: ArrayBuffer | undefined
|
|||
const data = await read_file(input_node.files[0]);
|
||||
|
||||
if (!data.startsWith("data:image/")) {
|
||||
console.error(tr("Failed to load file %s: Invalid data media type (%o)"), input_node.files[0].name, data);
|
||||
logError(LogCategory.FILE_TRANSFER, tr("Failed to load file %s: Invalid data media type (%o)"), input_node.files[0].name, data);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to select avatar {}.<br>File is not an image", input_node.files[0].name)).open();
|
||||
return;
|
||||
}
|
||||
const semi = data.indexOf(';');
|
||||
const type = data.substring(11, semi);
|
||||
console.log(tr("Given image has type %s"), type);
|
||||
logTrace(LogCategory.CLIENT, tr("Given image has type %s"), type);
|
||||
|
||||
set_avatar(data.substr(semi + 8 /* 8 bytes := base64, */), type);
|
||||
})();
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import {createErrorModal, createModal} from "../../ui/elements/Modal";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logError} from "../../log";
|
||||
import {ConnectionHandler} from "../../ConnectionHandler";
|
||||
import {base64_encode_ab} from "../../utils/buffers";
|
||||
import {spawnYesNo} from "../../ui/modal/ModalYesNo";
|
||||
import {ClientEntry} from "../../tree/Client";
|
||||
import * as moment from "moment";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
const avatar_to_uid = (id: string) => {
|
||||
const buffer = new Uint8Array(id.length / 2);
|
||||
|
@ -151,12 +150,12 @@ export function spawnAvatarList(client: ConnectionHandler) {
|
|||
(username_resolve[uid] || []).forEach(e => e(undefined));
|
||||
}
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to fetch usernames from avatar names. Error: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to fetch usernames from avatar names. Error: %o"), error);
|
||||
createErrorModal(tr("Failed to fetch usernames"), tr("Failed to fetch usernames related to their avatar names"), undefined).open();
|
||||
})
|
||||
}).catch(error => {
|
||||
//TODO: Display no perms error
|
||||
log.error(LogCategory.GENERAL, tr("Failed to receive avatar list. Error: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to receive avatar list. Error: %o"), error);
|
||||
createErrorModal(tr("Failed to list avatars"), tr("Failed to receive avatar list."), undefined).open();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -3,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export type BanEntry = {
|
||||
name?: string;
|
||||
|
|
|
@ -3,14 +3,13 @@ import {createErrorModal, createInfoModal, createModal, Modal} from "../../ui/el
|
|||
import {SingleCommandHandler} from "../../connection/ConnectionBase";
|
||||
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
|
||||
import PermissionType from "../../permission/PermissionType";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logError, logInfo} from "../../log";
|
||||
import * as tooltip from "../../ui/elements/Tooltip";
|
||||
import * as htmltags from "../../ui/htmltags";
|
||||
import {format_time, formatMessage} from "../../ui/frames/chat";
|
||||
import * as moment from "moment";
|
||||
import {ErrorCode} from "../../connection/ErrorCode";
|
||||
import { tr } from "tc-shared/i18n/localize";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export function openBanList(client: ConnectionHandler) {
|
||||
let modal: Modal;
|
||||
|
@ -322,7 +321,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
|
||||
container_add_no_permissions.hide();
|
||||
controller.permission_add().then(result => permission_add = result).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to query ban add permissions: %o"), error);
|
||||
logError(LogCategory.CLIENT, tr("Failed to query ban add permissions: %o"), error);
|
||||
}).then(() => {
|
||||
if (permission_add[0] !== permission_add[1]) {
|
||||
const input_global = container_add.find(".group-global input");
|
||||
|
@ -332,7 +331,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
});
|
||||
|
||||
controller.permission_edit().then(result => permission_edit = result).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to query ban edit permissions: %o"), error);
|
||||
logError(LogCategory.CLIENT, tr("Failed to query ban edit permissions: %o"), error);
|
||||
}).then(() => {
|
||||
if (selected_ban) update_edit_window(false);
|
||||
});
|
||||
|
@ -408,7 +407,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
update_edit_window(false);
|
||||
}
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to delete ban: %o"), error);
|
||||
logError(LogCategory.CLIENT, tr("Failed to delete ban: %o"), error);
|
||||
if (error instanceof CommandResult)
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to delete ban"), formatMessage(tr("Failed to delete ban. {:br:}Error: {}"), error)).open();
|
||||
|
@ -465,7 +464,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
}
|
||||
update_ban_filter();
|
||||
}).catch(error => {
|
||||
log.info(LogCategory.CLIENT, tr("Failed to update ban list: %o"), error);
|
||||
logInfo(LogCategory.CLIENT, tr("Failed to update ban list: %o"), error);
|
||||
if (error instanceof CommandResult)
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? tr("no permissions") : error.extra_message || error.message;
|
||||
container_ban_entries_error.show().find("a").text(tr("Failed to receive banlist: ") + error);
|
||||
|
@ -543,7 +542,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
|
||||
update_trigger_filter();
|
||||
}).catch(error => {
|
||||
log.info(LogCategory.CLIENT, tr("Failed to update trigger list: %o"), error);
|
||||
logInfo(LogCategory.CLIENT, tr("Failed to update trigger list: %o"), error);
|
||||
if (error instanceof CommandResult)
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? tr("no permissions") : error.extra_message || error.message;
|
||||
container_trigger_entries_error.show().find("a").text(tr("Failed to receive trigger list: ") + error);
|
||||
|
@ -801,7 +800,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
|
||||
createInfoModal(tr("Ban successfully edited"), tr("Your ban has been successfully edited.")).open();
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to edited ban: %o"), error);
|
||||
logError(LogCategory.CLIENT, tr("Failed to edited ban: %o"), error);
|
||||
if (error instanceof CommandResult)
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to edited ban"), formatMessage(tr("Failed to edited ban. {:br:}Error: {}"), error)).open();
|
||||
|
@ -869,7 +868,7 @@ function generate_dom(controller: BanListController): JQuery {
|
|||
|
||||
createInfoModal(tr("Ban successfully added"), tr("Your ban has been successfully added.")).open();
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.CLIENT, tr("Failed to add ban: %o"), error);
|
||||
logError(LogCategory.CLIENT, tr("Failed to add ban: %o"), error);
|
||||
if (error instanceof CommandResult)
|
||||
error = error.id === ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS ? "no permissions" : error.extra_message || error.message;
|
||||
createErrorModal(tr("Failed to add ban"), formatMessage(tr("Failed to add ban. {:br:}Error: {}"), error)).open();
|
||||
|
|
|
@ -14,8 +14,7 @@ import {Regex} from "../../ui/modal/ModalConnect";
|
|||
import {availableConnectProfiles} from "../../profiles/ConnectionProfile";
|
||||
import {spawnYesNo} from "../../ui/modal/ModalYesNo";
|
||||
import {Settings, settings} from "../../settings";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logWarn} from "../../log";
|
||||
import * as i18nc from "../../i18n/country";
|
||||
import {formatMessage} from "../../ui/frames/chat";
|
||||
import {generateIconJQueryTag, getIconManager} from "tc-shared/file/Icons";
|
||||
|
@ -128,7 +127,7 @@ export function spawnBookmarkModal() {
|
|||
|
||||
let profile = input_connect_profile.find("option[value='" + entry.connect_profile + "']");
|
||||
if (profile.length == 0) {
|
||||
log.warn(LogCategory.GENERAL, tr("Failed to find bookmark profile %s. Displaying default one."), entry.connect_profile);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to find bookmark profile %s. Displaying default one."), entry.connect_profile);
|
||||
profile = input_connect_profile.find("option[value=default]");
|
||||
}
|
||||
profile.prop("selected", true);
|
||||
|
@ -365,7 +364,7 @@ export function spawnBookmarkModal() {
|
|||
(selected_bookmark as Bookmark).connect_profile = id;
|
||||
save_bookmark(selected_bookmark);
|
||||
} else {
|
||||
log.warn(LogCategory.GENERAL, tr("Failed to change connect profile for profile %s to %s"), selected_bookmark.unique_id, id);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to change connect profile for profile %s to %s"), selected_bookmark.unique_id, id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
|||
import {EventHandler, ReactEventHandler, Registry} from "tc-shared/events";
|
||||
import {ClientEntry, MusicClientEntry} from "tc-shared/tree/Client";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
|
||||
const cssStyle = require("./ModalChangeVolume.scss");
|
||||
|
||||
export interface VolumeChangeEvents {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {copyToClipboard} 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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export function openChannelInfo(channel: ChannelEntry) {
|
||||
let modal: Modal;
|
||||
|
|
|
@ -7,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
type InfoUpdateCallback = (info: ClientConnectionInfo) => any;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logWarn} from "../../log";
|
||||
import {createModal, Modal} from "../../ui/elements/Modal";
|
||||
import * as log from "../../log";
|
||||
import {ClientEntry} from "../../tree/Client";
|
||||
import {GroupManager, GroupType} from "../../permission/GroupManager";
|
||||
import PermissionType from "../../permission/PermissionType";
|
||||
|
@ -47,12 +46,12 @@ export function createServerGroupAssignmentModal(client: ClientEntry, callback:
|
|||
let group_id = parseInt(entry.attr("group-id"));
|
||||
let group = client.channelTree.client.groups.findServerGroup(group_id);
|
||||
if(!group) {
|
||||
console.warn(tr("Could not resolve target group!"));
|
||||
logWarn(LogCategory.GENERAL, tr("Could not resolve target group!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let target = entry.prop("checked");
|
||||
callback([group.id], target).catch(e => { log.warn(LogCategory.GENERAL, tr("Failed to change group assignment: %o"), e)}).then(update_groups);
|
||||
callback([group.id], target).catch(e => { logWarn(LogCategory.GENERAL, tr("Failed to change group assignment: %o"), e)}).then(update_groups);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -68,7 +67,7 @@ export function createServerGroupAssignmentModal(client: ClientEntry, callback:
|
|||
group_ids.push(parseInt(entry.attr("group-id")));
|
||||
});
|
||||
|
||||
callback(group_ids, false).catch(e => { log.warn(LogCategory.GENERAL, tr("Failed to remove all group assignments: %o"), e)}).then(update_groups);
|
||||
callback(group_ids, false).catch(e => { logWarn(LogCategory.GENERAL, tr("Failed to remove all group assignments: %o"), e)}).then(update_groups);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import {createErrorModal, createInfoModal} from "tc-shared/ui/elements/Modal";
|
|||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
import {LogCategory, logError} from "tc-shared/log";
|
||||
|
||||
const cssStyle = require("./ModalGroupCreate.scss");
|
||||
|
||||
|
@ -348,7 +349,7 @@ function initializeGroupCreateController(connection: ConnectionHandler, events:
|
|||
return;
|
||||
}
|
||||
|
||||
console.warn(tr("Failed to create group: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to create group: %o"), error);
|
||||
createErrorModal(tr("Failed to create group"),
|
||||
tra("Failed to create group.\n{}", stringifyError(error))).open();
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {spawnReactModal} from "tc-shared/ui/react-elements/Modal";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import * as React from "react";
|
||||
import {useRef, useState} from "react";
|
||||
import {Select} from "tc-shared/ui/react-elements/InputField";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import * as React from "react";
|
||||
import {Button} from "tc-shared/ui/react-elements/Button";
|
||||
import {GroupType} from "tc-shared/permission/GroupManager";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
|
@ -13,6 +13,7 @@ import {createErrorModal, createInfoModal} from "tc-shared/ui/elements/Modal";
|
|||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
import {LogCategory, logWarn} from "tc-shared/log";
|
||||
|
||||
const cssStyle = require("./ModalGroupPermissionCopy.scss");
|
||||
|
||||
|
@ -222,7 +223,7 @@ function initializeGroupPermissionCopyController(connection: ConnectionHandler,
|
|||
return;
|
||||
}
|
||||
|
||||
console.warn(tr("Failed to copy group permissions: %o"), error);
|
||||
logWarn(LogCategory.PERMISSIONS, tr("Failed to copy group permissions: %o"), error);
|
||||
createErrorModal(tr("Failed to copy group permissions"),
|
||||
tra("Failed to copy group permissions.\n{}", stringifyError(error))).open();
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import {ConnectionHandler} from "../../ConnectionHandler";
|
||||
import PermissionType from "../../permission/PermissionType";
|
||||
import {createErrorModal, createModal} from "../../ui/elements/Modal";
|
||||
import * as log from "../../log";
|
||||
import {LogCategory} from "../../log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "../../log";
|
||||
import {CommandResult} from "../../connection/ServerConnectionDeclaration";
|
||||
import {tra, traj} from "../../i18n/localize";
|
||||
import {arrayBufferBase64} from "../../utils/buffers";
|
||||
|
@ -106,7 +105,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
for (const icon of chunk) {
|
||||
const iconId = parseInt((icon.name || "").substr("icon_".length));
|
||||
if (Number.isNaN(iconId)) {
|
||||
log.warn(LogCategory.GENERAL, tr("Received an unparsable icon within icon list (%o)"), icon);
|
||||
logWarn(LogCategory.GENERAL, tr("Received an unparsable icon within icon list (%o)"), icon);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -146,7 +145,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
if (error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS) {
|
||||
container_no_permissions.show();
|
||||
} else {
|
||||
log.error(LogCategory.GENERAL, tr("Failed to fetch icon list. Error: %o"), error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to fetch icon list. Error: %o"), error);
|
||||
display_remote_error(tr("Failed to fetch icon list"));
|
||||
}
|
||||
container_loading.hide();
|
||||
|
@ -159,7 +158,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
|
||||
const selected = modal.htmlTag.find(".selected");
|
||||
if (selected.length != 1)
|
||||
console.warn(tr("UI selected icon length does not equal with 1! (%o)"), selected.length);
|
||||
logWarn(LogCategory.GENERAL, tr("UI selected icon length does not equal with 1! (%o)"), selected.length);
|
||||
|
||||
if (selected_icon < 1000) return; /* we cant delete local icons */
|
||||
|
||||
|
@ -168,7 +167,7 @@ export function spawnIconSelect(client: ConnectionHandler, callback_icon?: (id:
|
|||
}).catch(error => {
|
||||
if (error instanceof CommandResult && error.id == ErrorCode.SERVER_INSUFFICIENT_PERMISSIONS)
|
||||
return;
|
||||
console.warn(tr("Failed to delete icon %d: %o"), selected_icon, error);
|
||||
logWarn(LogCategory.GENERAL, tr("Failed to delete icon %d: %o"), selected_icon, error);
|
||||
|
||||
error = error instanceof CommandResult ? error.extra_message || error.message : error;
|
||||
|
||||
|
@ -214,14 +213,14 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
icon.upload_state = "unset";
|
||||
|
||||
const file_too_big = () => {
|
||||
console.error(tr("Failed to load file %s: File is too big!"), file.name);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: File is too big!"), file.name);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>The given file is too big!", file.name)).open();
|
||||
icon.state = "error";
|
||||
};
|
||||
if (file.size > 1024 * 1024 * 512) {
|
||||
file_too_big();
|
||||
} else if ((file.size | 0) <= 0) {
|
||||
console.error(tr("Failed to load file %s: Your browser does not support file sizes!"), file.name);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Your browser does not support file sizes!"), file.name);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>Your browser does not support file sizes!", file.name)).open();
|
||||
icon.state = "error";
|
||||
return;
|
||||
|
@ -237,8 +236,7 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
reader.readAsDataURL(file);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Image failed to load (%o)", error);
|
||||
console.error(tr("Failed to load file %s: Image failed to load"), file.name);
|
||||
logError(LogCategory.CLIENT, tr("Failed to load file %s: Image failed to load: %o"), file.name, error);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>Failed to load image", file.name)).open();
|
||||
icon.state = "error";
|
||||
return;
|
||||
|
@ -246,7 +244,7 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
|
||||
const result = reader.result as string;
|
||||
if (typeof (result) !== "string") {
|
||||
console.error(tr("Failed to load file %s: Result is not an media string (%o)"), file.name, result);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Result is not an media string (%o)"), file.name, result);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>Result is not an media string", file.name)).open();
|
||||
icon.state = "error";
|
||||
return;
|
||||
|
@ -256,16 +254,16 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
/* get the CRC32 sum */
|
||||
{
|
||||
if (!result.startsWith("data:image/")) {
|
||||
console.error(tr("Failed to load file %s: Invalid data media type (%o)"), file.name, result);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Invalid data media type (%o)"), file.name, result);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>File is not an image", file.name)).open();
|
||||
icon.state = "error";
|
||||
return;
|
||||
}
|
||||
const semi = result.indexOf(';');
|
||||
const type = result.substring(11, semi);
|
||||
console.log(tr("Given image has type %s"), type);
|
||||
logInfo(LogCategory.GENERAL, tr("Given image has type %s"), type);
|
||||
if (!result.substr(semi + 1).startsWith("base64,")) {
|
||||
console.error(tr("Failed to load file %s: Mimetype isnt base64 encoded (%o)"), file.name, result.substr(semi + 1));
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Mimetype isn't base64 encoded (%o)"), file.name, result.substr(semi + 1));
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.<br>Decoder returned unknown result", file.name)).open();
|
||||
icon.state = "error";
|
||||
return;
|
||||
|
@ -285,14 +283,14 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
image.src = result;
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Image failed to load (%o)", error);
|
||||
console.error(tr("Failed to load file %s: Image failed to load"), file.name);
|
||||
logInfo(LogCategory.GENERAL, "Image failed to load (%o)", error);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Image failed to load"), file.name);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.{:br:}Failed to load image", file.name)).open();
|
||||
icon.state = "error";
|
||||
}
|
||||
|
||||
const width_error = message => {
|
||||
console.error(tr("Failed to load file %s: Invalid bounds: %s"), file.name, message);
|
||||
logError(LogCategory.GENERAL, tr("Failed to load file %s: Invalid bounds: %s"), file.name, message);
|
||||
createErrorModal(tr("Icon upload failed"), tra("Failed to upload icon {}.{:br:}Image is too large ({})", file.name, message)).open();
|
||||
icon.state = "error";
|
||||
};
|
||||
|
@ -311,7 +309,7 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
return;
|
||||
}
|
||||
}
|
||||
console.log("Image loaded (%dx%d) %s (%s)", image.naturalWidth, image.naturalHeight, image.name, icon.icon_id);
|
||||
logInfo(LogCategory.GENERAL, "Image loaded (%dx%d) %s (%s)", image.naturalWidth, image.naturalHeight, image.name, icon.icon_id);
|
||||
icon.image_element = () => {
|
||||
const image = document.createElement("img");
|
||||
image.src = result;
|
||||
|
@ -426,7 +424,7 @@ function handle_icon_upload(file: File, client: ConnectionHandler): UploadingIco
|
|||
break;
|
||||
|
||||
case FileTransferState.ERRORED:
|
||||
log.warn(LogCategory.FILE_TRANSFER, tr("Failed to upload icon %s: %o"), icon.file.name, transfer.currentError());
|
||||
logWarn(LogCategory.FILE_TRANSFER, tr("Failed to upload icon %s: %o"), icon.file.name, transfer.currentError());
|
||||
bar.set_value(100);
|
||||
bar.set_error(tr("upload failed: ") + transfer.currentErrorMessage());
|
||||
icon.upload_state = "error";
|
||||
|
|
|
@ -2,7 +2,8 @@ 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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {LogCategory, logError} from "tc-shared/log";
|
||||
|
||||
export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name: string): Modal {
|
||||
let modal: Modal;
|
||||
|
@ -58,7 +59,6 @@ export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name:
|
|||
}, hash_rate => {
|
||||
input_hash_rate.val(hash_rate);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
createErrorModal(tr("Failed to improve identity"), tr("Failed to improve identity.<br>Error:") + error).open();
|
||||
if (active)
|
||||
button_start_stop.trigger('click');
|
||||
|
@ -80,7 +80,6 @@ export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name:
|
|||
if (active)
|
||||
button_start_stop.trigger('click');
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
createErrorModal(tr("Failed to improve identity"), tr("Failed to improve identity.<br>Error:") + error).open();
|
||||
if (active)
|
||||
button_start_stop.trigger('click');
|
||||
|
@ -185,7 +184,7 @@ export function spawnTeamSpeakIdentityImport(callback: (identity: TeaSpeakIdenti
|
|||
};
|
||||
|
||||
file_reader.onerror = ev => {
|
||||
console.error(tr("Failed to read give identity file: %o"), ev);
|
||||
logError(LogCategory.IDENTITIES, tr("Failed to read give identity file: %o"), ev);
|
||||
set_status(tr("Failed to read the identity file."), "error");
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -2,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
type URLGeneratorSettings = {
|
||||
flag_direct: boolean,
|
||||
|
|
|
@ -1,7 +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";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
|
||||
export function spawnKeySelect(callback: (key?: KeyEvent) => void) {
|
||||
let modal = createModal({
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue