resturctured the project a bit
parent
8dd4cb285c
commit
391205cb34
|
@ -0,0 +1,18 @@
|
|||
import * as path from "path";
|
||||
import * as fs from "fs-extra";
|
||||
|
||||
|
||||
async function processFile(file: string) {
|
||||
|
||||
}
|
||||
|
||||
async function processDirectory(directory: string) {
|
||||
const files = await fs.readdir(directory);
|
||||
for(const file of files) {
|
||||
console.log(file);
|
||||
}
|
||||
}
|
||||
|
||||
processDirectory(path.join(__dirname, "js")).catch(error => {
|
||||
console.error(error);
|
||||
});
|
|
@ -1,19 +1,15 @@
|
|||
import {ChannelTree} from "tc-shared/ui/view";
|
||||
import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase";
|
||||
import {PermissionManager} from "tc-shared/permission/PermissionManager";
|
||||
import {GroupManager} from "tc-shared/permission/GroupManager";
|
||||
import {ServerSettings, Settings, settings, StaticSettings} from "tc-shared/settings";
|
||||
import {Sound, SoundManager} from "tc-shared/sound/Sounds";
|
||||
import {LocalClientEntry} from "tc-shared/ui/client";
|
||||
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile";
|
||||
import {ServerAddress} from "tc-shared/ui/server";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, logError, logInfo, logWarn} from "tc-shared/log";
|
||||
import {createErrorModal, createInfoModal, createInputModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {hashPassword} from "tc-shared/utils/helpers";
|
||||
import {HandshakeHandler} from "tc-shared/connection/HandshakeHandler";
|
||||
import * as htmltags from "./ui/htmltags";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {FilterMode, InputStartResult, InputState} from "tc-shared/voice/RecorderBase";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {defaultRecorder, RecorderProfile} from "tc-shared/voice/RecorderProfile";
|
||||
|
@ -24,7 +20,6 @@ import {connection_log, Regex} from "tc-shared/ui/modal/ModalConnect";
|
|||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {spawnAvatarUpload} from "tc-shared/ui/modal/ModalAvatar";
|
||||
import * as dns from "tc-backend/dns";
|
||||
import * as top_menu from "tc-shared/ui/frames/MenuBar";
|
||||
import {EventHandler, Registry} from "tc-shared/events";
|
||||
import {FileManager} from "tc-shared/file/FileManager";
|
||||
import {FileTransferState, TransferProvider} from "tc-shared/file/Transfer";
|
||||
|
@ -40,6 +35,9 @@ import {getServerConnectionFactory} from "tc-shared/connection/ConnectionFactory
|
|||
import {WhisperSession} from "tc-shared/voice/VoiceWhisper";
|
||||
import {spawnEchoTestModal} from "tc-shared/ui/modal/echo-test/Controller";
|
||||
import {ServerFeature, ServerFeatures} from "tc-shared/connection/ServerFeatures";
|
||||
import {ChannelTree} from "tc-shared/tree/ChannelTree";
|
||||
import {LocalClientEntry} from "tc-shared/tree/Client";
|
||||
import {ServerAddress} from "tc-shared/tree/Server";
|
||||
|
||||
export enum InputHardwareState {
|
||||
MISSING,
|
||||
|
@ -794,7 +792,7 @@ export class ConnectionHandler {
|
|||
}
|
||||
|
||||
private _last_record_error_popup: number = 0;
|
||||
update_voice_status(targetChannel?: ChannelEntry) {
|
||||
update_voice_status() {
|
||||
this.updateVoiceStatus();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ import {
|
|||
LocalClientEntry,
|
||||
MusicClientEntry,
|
||||
SongInfo
|
||||
} from "tc-shared/ui/client";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
} from "tc-shared/tree/Client";
|
||||
import {ChannelEntry} from "tc-shared/tree/Channel";
|
||||
import {ConnectionHandler, ConnectionState, DisconnectReason, ViewReasonId} from "tc-shared/ConnectionHandler";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
|
@ -606,7 +606,7 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
tree.moveClient(client, channel_to);
|
||||
|
||||
if(self) {
|
||||
this.connection_handler.update_voice_status(channel_to);
|
||||
this.connection_handler.update_voice_status();
|
||||
|
||||
for(const entry of client.channelTree.clientsByChannel(channelFrom)) {
|
||||
entry.getVoiceClient()?.abortReplay();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {CommandHelper} from "tc-shared/connection/CommandHelper";
|
||||
import {HandshakeHandler} from "tc-shared/connection/HandshakeHandler";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ServerAddress} from "tc-shared/ui/server";
|
||||
import {ServerAddress} from "tc-shared/tree/Server";
|
||||
import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler";
|
||||
import {AbstractCommandHandlerBoss} from "tc-shared/connection/AbstractCommandHandler";
|
||||
import {Registry} from "tc-shared/events";
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {LaterPromise} from "tc-shared/utils/LaterPromise";
|
||||
import {ErrorCode} from "./ErrorCode";
|
||||
|
||||
export class CommandResult {
|
||||
success: boolean;
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "tc-shared/file/Transfer";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import {tr} from "tc-shared/i18n/localize";
|
||||
import {
|
||||
AbstractAvatarManager,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {ChannelTree} from "tc-shared/ui/view";
|
||||
import {ClientEntry, ClientEvents} from "tc-shared/ui/client";
|
||||
import {ChannelTree} from "./ChannelTree";
|
||||
import {ClientEntry, ClientEvents} from "./Client";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, LogType} from "tc-shared/log";
|
||||
import {PermissionType} from "tc-shared/permission/PermissionType";
|
||||
|
@ -9,7 +9,7 @@ import {MenuEntryType} from "tc-shared/ui/elements/ContextMenu";
|
|||
import {Sound} from "tc-shared/sound/Sounds";
|
||||
import {createErrorModal, createInfoModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import * as htmltags from "./htmltags";
|
||||
import * as htmltags from "../ui/htmltags";
|
||||
import {hashPassword} from "tc-shared/utils/helpers";
|
||||
import {openChannelInfo} from "tc-shared/ui/modal/ModalChannelInfo";
|
||||
import {createChannelModal} from "tc-shared/ui/modal/ModalCreateChannel";
|
||||
|
@ -17,8 +17,8 @@ import {formatMessage} from "tc-shared/ui/frames/chat";
|
|||
|
||||
import * as React from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "tc-shared/ui/TreeEntry";
|
||||
import {ChannelEntryView as ChannelEntryView} from "./tree/Channel";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
|
||||
import {ChannelEntryView as ChannelEntryView} from "../ui/tree/Channel";
|
||||
import {spawnFileTransferModal} from "tc-shared/ui/modal/transfer/ModalFileTransfer";
|
||||
import {ViewReasonId} from "tc-shared/ConnectionHandler";
|
||||
import {EventChannelData} from "tc-shared/ui/frames/log/Definitions";
|
|
@ -7,9 +7,10 @@ import {PermissionType} from "tc-shared/permission/PermissionType";
|
|||
import {KeyCode, SpecialKey} from "tc-shared/PPTListener";
|
||||
import {Sound} from "tc-shared/sound/Sounds";
|
||||
import {Group} from "tc-shared/permission/GroupManager";
|
||||
import {ServerAddress, ServerEntry} from "tc-shared/ui/server";
|
||||
import {ChannelEntry, ChannelProperties, ChannelSubscribeMode} from "tc-shared/ui/channel";
|
||||
import {ClientEntry, LocalClientEntry, MusicClientEntry} from "tc-shared/ui/client";
|
||||
import {ServerAddress, ServerEntry} from "./Server";
|
||||
import {ChannelEntry, ChannelProperties, ChannelSubscribeMode} from "./Channel";
|
||||
import {ClientEntry, LocalClientEntry, MusicClientEntry} from "./Client";
|
||||
import {ChannelTreeEntry} from "./ChannelTreeEntry";
|
||||
import {ConnectionHandler, ViewReasonId} from "tc-shared/ConnectionHandler";
|
||||
import {createChannelModal} from "tc-shared/ui/modal/ModalCreateChannel";
|
||||
import {Registry} from "tc-shared/events";
|
||||
|
@ -19,7 +20,6 @@ import * as React from "react";
|
|||
import * as ppt from "tc-backend/ppt";
|
||||
|
||||
import {batch_updates, BatchUpdateType, flush_batched_updates} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {ChannelTreeEntry} from "tc-shared/ui/TreeEntry";
|
||||
import {createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import {spawnBanClient} from "tc-shared/ui/modal/ModalBanClient";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
|
@ -1,6 +1,6 @@
|
|||
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ChannelTree} from "tc-shared/ui/view";
|
||||
import {ChannelTree} from "./ChannelTree";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory, logInfo, LogType} from "tc-shared/log";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
|
@ -10,7 +10,7 @@ import PermissionType from "tc-shared/permission/PermissionType";
|
|||
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
import {CommandResult, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {ChannelEntry} from "./Channel";
|
||||
import {ConnectionHandler, ViewReasonId} from "tc-shared/ConnectionHandler";
|
||||
import {createServerGroupAssignmentModal} from "tc-shared/ui/modal/ModalGroupAssignment";
|
||||
import {openClientInfo} from "tc-shared/ui/modal/ModalClientInfo";
|
||||
|
@ -19,9 +19,9 @@ import {spawnChangeLatency} from "tc-shared/ui/modal/ModalChangeLatency";
|
|||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||
import * as hex from "tc-shared/crypto/hex";
|
||||
import {ClientEntry as ClientEntryView} from "./tree/Client";
|
||||
import {ClientEntry as ClientEntryView} from "../ui/tree/Client";
|
||||
import * as React from "react";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "tc-shared/ui/TreeEntry";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
|
||||
import {spawnClientVolumeChange, spawnMusicBotVolumeChange} from "tc-shared/ui/modal/ModalChangeVolumeNew";
|
||||
import {spawnPermissionEditorModal} from "tc-shared/ui/modal/permission/ModalPermissionEditor";
|
||||
import {EventClient, EventType} from "tc-shared/ui/frames/log/Definitions";
|
|
@ -1,4 +1,4 @@
|
|||
import {ChannelTree} from "tc-shared/ui/view";
|
||||
import {ChannelTree} from "./ChannelTree";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
|
||||
import * as log from "tc-shared/log";
|
||||
|
@ -12,12 +12,12 @@ import {spawnIconSelect} from "tc-shared/ui/modal/ModalIconSelect";
|
|||
import {spawnAvatarList} from "tc-shared/ui/modal/ModalAvatarList";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
import {connection_log} from "tc-shared/ui/modal/ModalConnect";
|
||||
import * as top_menu from "./frames/MenuBar";
|
||||
import * as top_menu from "../ui/frames/MenuBar";
|
||||
import {control_bar_instance} from "tc-shared/ui/frames/control-bar";
|
||||
import { ServerEntry as ServerEntryView } from "./tree/Server";
|
||||
import { ServerEntry as ServerEntryView } from "../ui/tree/Server";
|
||||
import * as React from "react";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "tc-shared/ui/TreeEntry";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "./ChannelTreeEntry";
|
||||
|
||||
export class ServerProperties {
|
||||
virtualserver_host: string = "";
|
|
@ -88,8 +88,6 @@ export class Graph {
|
|||
};
|
||||
private _max_space = 1.12;
|
||||
private _max_gap = 5;
|
||||
private _listener_mouse_move;
|
||||
private _listener_mouse_out;
|
||||
private _animate_loop;
|
||||
|
||||
_time_span: TimeSpan = {
|
||||
|
|
|
@ -10,7 +10,6 @@ export enum ChatType {
|
|||
CLIENT
|
||||
}
|
||||
|
||||
declare const xbbcode: any;
|
||||
export function htmlEscape(message: string) : string[] {
|
||||
const div = document.createElement('div');
|
||||
div.innerText = message;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* the bar on the right with the chats (Channel & Client) */
|
||||
import {ClientEntry, MusicClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry, MusicClientEntry} from "tc-shared/tree/Client";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {ServerEntry} from "tc-shared/ui/server";
|
||||
import {ChannelEntry} from "tc-shared/tree/Channel";
|
||||
import {ServerEntry} from "tc-shared/tree/Server";
|
||||
import {openMusicManage} from "tc-shared/ui/modal/ModalMusicManage";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
import {ClientInfo} from "tc-shared/ui/frames/side/client_info";
|
||||
|
|
|
@ -3,7 +3,6 @@ import {EventHandler, ReactEventHandler, Registry} from "tc-shared/events";
|
|||
import {ChatBox} from "tc-shared/ui/frames/side/ChatBox";
|
||||
import {Ref, useEffect, useRef, useState} from "react";
|
||||
import {AvatarRenderer} from "tc-shared/ui/react-elements/Avatar";
|
||||
import {format} from "tc-shared/ui/frames/side/chat_helper";
|
||||
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";
|
||||
|
@ -22,6 +21,7 @@ import {
|
|||
import {TimestampRenderer} from "tc-shared/ui/react-elements/TimestampRenderer";
|
||||
import {BBCodeRenderer} from "tc-shared/text/bbcode";
|
||||
import {getGlobalAvatarManagerFactory} from "tc-shared/file/Avatars";
|
||||
import {ColloquialFormat, date_format, format_date_general, formatDayTime} from "tc-shared/utils/DateUtils";
|
||||
|
||||
const cssStyle = require("./ConversationUI.scss");
|
||||
|
||||
|
@ -86,18 +86,18 @@ const ChatEventMessageRenderer = React.memo((props: {
|
|||
|
||||
|
||||
const TimestampEntry = (props: { timestamp: Date, refDiv: React.Ref<HTMLDivElement> }) => {
|
||||
const diff = format.date.date_format(props.timestamp, new Date());
|
||||
const diff = date_format(props.timestamp, new Date());
|
||||
let formatted;
|
||||
let update: boolean;
|
||||
|
||||
if(diff == format.date.ColloquialFormat.YESTERDAY) {
|
||||
if(diff == ColloquialFormat.YESTERDAY) {
|
||||
formatted = <Translatable key={"yesterday"}>Yesterday</Translatable>;
|
||||
update = true;
|
||||
} else if(diff == format.date.ColloquialFormat.TODAY) {
|
||||
} else if(diff == ColloquialFormat.TODAY) {
|
||||
formatted = <Translatable key={"today"}>Today</Translatable>;
|
||||
update = true;
|
||||
} else if(diff == format.date.ColloquialFormat.GENERAL) {
|
||||
formatted = <>{format.date.format_date_general(props.timestamp, false)}</>;
|
||||
} else if(diff == ColloquialFormat.GENERAL) {
|
||||
formatted = <>{format_date_general(props.timestamp, false)}</>;
|
||||
update = false;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ const ChatEventLocalUserSwitchRenderer = (props: { event: ChatEventLocalUserSwit
|
|||
<a>
|
||||
{props.event.mode === "join" ? <Translatable>You joined at</Translatable> : <Translatable>You left at</Translatable>}
|
||||
|
||||
{format.date.formatDayTime(new Date(props.timestamp))}
|
||||
{formatDayTime(new Date(props.timestamp))}
|
||||
</a>
|
||||
<div />
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler";
|
||||
import {EventHandler, Registry} from "tc-shared/events";
|
||||
import {
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
|
||||
const escapeBBCode = (text: string) => text.replace(/([\[\]])/g, "\\$1");
|
||||
|
||||
export namespace helpers {
|
||||
export namespace date {
|
||||
export function same_day(a: number | Date, b: number | Date) {
|
||||
a = a instanceof Date ? a : new Date(a);
|
||||
b = b instanceof Date ? b : new Date(b);
|
||||
|
||||
if(a.getDate() !== b.getDate())
|
||||
return false;
|
||||
if(a.getMonth() !== b.getMonth())
|
||||
return false;
|
||||
return a.getFullYear() === b.getFullYear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace format {
|
||||
export namespace date {
|
||||
export enum ColloquialFormat {
|
||||
YESTERDAY,
|
||||
TODAY,
|
||||
GENERAL
|
||||
}
|
||||
|
||||
function dateEqual(a: Date, b: Date) {
|
||||
return a.getUTCFullYear() === b.getUTCFullYear() &&
|
||||
a.getUTCMonth() === b.getUTCMonth() &&
|
||||
a.getUTCDate() === b.getUTCDate();
|
||||
}
|
||||
|
||||
export function date_format(date: Date, now: Date, ignore_settings?: boolean) : ColloquialFormat {
|
||||
if(!ignore_settings && !settings.static_global(Settings.KEY_CHAT_COLLOQUIAL_TIMESTAMPS))
|
||||
return ColloquialFormat.GENERAL;
|
||||
|
||||
if(dateEqual(date, now))
|
||||
return ColloquialFormat.TODAY;
|
||||
|
||||
date = new Date(date.getTime());
|
||||
date.setDate(date.getDate() + 1);
|
||||
|
||||
if(dateEqual(date, now))
|
||||
return ColloquialFormat.YESTERDAY;
|
||||
|
||||
return ColloquialFormat.GENERAL;
|
||||
}
|
||||
|
||||
export function formatDayTime(date: Date) {
|
||||
return ("0" + date.getHours()).substr(-2) + ":" + ("0" + date.getMinutes()).substr(-2);
|
||||
}
|
||||
|
||||
export function format_date_general(date: Date, hours?: boolean) : string {
|
||||
return ('00' + date.getDate()).substr(-2) + "."
|
||||
+ ('00' + date.getMonth()).substr(-2) + "."
|
||||
+ date.getFullYear() +
|
||||
(typeof(hours) === "undefined" || hours ? " at "
|
||||
+ ('00' + date.getHours()).substr(-2) + ":"
|
||||
+ ('00' + date.getMinutes()).substr(-2)
|
||||
: "");
|
||||
}
|
||||
|
||||
export function format_date_colloquial(date: Date, current_timestamp: Date) : { result: string; format: ColloquialFormat } {
|
||||
const format = date_format(date, current_timestamp);
|
||||
if(format == ColloquialFormat.GENERAL) {
|
||||
return {
|
||||
result: format_date_general(date),
|
||||
format: format
|
||||
};
|
||||
} else {
|
||||
let hrs = date.getHours();
|
||||
let time = "AM";
|
||||
if(hrs > 12) {
|
||||
hrs -= 12;
|
||||
time = "PM";
|
||||
}
|
||||
return {
|
||||
result: (format == ColloquialFormat.YESTERDAY ? tr("Yesterday at") : tr("Today at")) + " " + ("0" + hrs).substr(-2) + ":" + ("0" + date.getMinutes()).substr(-2) + " " + time,
|
||||
format: format
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function format_chat_time(date: Date) : {
|
||||
result: string,
|
||||
next_update: number /* in MS */
|
||||
} {
|
||||
const timestamp = date.getTime();
|
||||
const current_timestamp = new Date();
|
||||
|
||||
const result = {
|
||||
result: "",
|
||||
next_update: 0
|
||||
};
|
||||
|
||||
if(settings.static_global(Settings.KEY_CHAT_FIXED_TIMESTAMPS)) {
|
||||
const format = format_date_colloquial(date, current_timestamp);
|
||||
result.result = format.result;
|
||||
result.next_update = 0; /* TODO: Update on day change? */
|
||||
} else {
|
||||
const delta = current_timestamp.getTime() - timestamp;
|
||||
if(delta < 2000) {
|
||||
result.result = "now";
|
||||
result.next_update = 2500 - delta; /* update after two seconds */
|
||||
} else if(delta < 30000) { /* 30 seconds */
|
||||
result.result = Math.floor(delta / 1000) + " " + tr("seconds ago");
|
||||
result.next_update = 1000; /* update every second */
|
||||
} else if(delta < 30 * 60 * 1000) { /* 30 minutes */
|
||||
if(delta < 120 * 1000)
|
||||
result.result = tr("one minute ago");
|
||||
else
|
||||
result.result = Math.floor(delta / (1000 * 60)) + " " + tr("minutes ago");
|
||||
result.next_update = 60000; /* updater after a minute */
|
||||
} else {
|
||||
result.result = format_date_colloquial(date, current_timestamp).result;
|
||||
result.next_update = 0; /* TODO: Update on day change? */
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
export namespace time {
|
||||
export function format_online_time(secs: number) : string {
|
||||
let years = Math.floor(secs / (60 * 60 * 24 * 365));
|
||||
let days = Math.floor(secs / (60 * 60 * 24)) % 365;
|
||||
let hours = Math.floor(secs / (60 * 60)) % 24;
|
||||
let minutes = Math.floor(secs / 60) % 60;
|
||||
let seconds = Math.floor(secs % 60);
|
||||
|
||||
let result = "";
|
||||
if(years > 0)
|
||||
result += years + " " + tr("years") + " ";
|
||||
if(years > 0 || days > 0)
|
||||
result += days + " " + tr("days") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0)
|
||||
result += hours + " " + tr("hours") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0 || minutes > 0)
|
||||
result += minutes + " " + tr("minutes") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0 || minutes > 0 || seconds > 0)
|
||||
result += seconds + " " + tr("seconds") + " ";
|
||||
else
|
||||
result = tr("now") + " ";
|
||||
|
||||
return result.substr(0, result.length - 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
import {GroupManager} from "tc-shared/permission/GroupManager";
|
||||
import {Frame, FrameContent} from "tc-shared/ui/frames/chat_frame";
|
||||
import {ClientEntry, LocalClientEntry} from "tc-shared/ui/client";
|
||||
import {openClientInfo} from "tc-shared/ui/modal/ModalClientInfo";
|
||||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
import * as image_preview from "../image_preview";
|
||||
import {format} from "tc-shared/ui/frames/side/chat_helper";
|
||||
import * as i18nc from "tc-shared/i18n/country";
|
||||
import {ClientEntry, LocalClientEntry} from "tc-shared/tree/Client";
|
||||
import {format_online_time} from "tc-shared/utils/TimeUtils";
|
||||
|
||||
export class ClientInfo {
|
||||
readonly handle: Frame;
|
||||
|
@ -94,7 +94,7 @@ export class ClientInfo {
|
|||
/* updating the info fields */
|
||||
{
|
||||
const online_time = this._html_tag.find(".client-online-time");
|
||||
online_time.text(format.time.format_online_time(client ? client.calculateOnlineTime() : 0));
|
||||
online_time.text(format_online_time(client ? client.calculateOnlineTime() : 0));
|
||||
if(this._online_time_updater) {
|
||||
clearInterval(this._online_time_updater);
|
||||
this._online_time_updater = 0;
|
||||
|
@ -109,7 +109,7 @@ export class ClientInfo {
|
|||
}
|
||||
|
||||
if(client.currentChannel()) /* If he has no channel then he might be disconnected */
|
||||
online_time.text(format.time.format_online_time(client.calculateOnlineTime()));
|
||||
online_time.text(format_online_time(client.calculateOnlineTime()));
|
||||
else {
|
||||
online_time.text(online_time.text() + tr(" (left view)"));
|
||||
clearInterval(this._online_time_updater);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {Frame, FrameContent} from "tc-shared/ui/frames/chat_frame";
|
||||
import {ClientEvents, MusicClientEntry, MusicClientPlayerState, SongInfo} from "tc-shared/ui/client";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {CommandResult, PlaylistSong} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createInputModal} from "tc-shared/ui/elements/Modal";
|
||||
|
@ -7,7 +6,7 @@ import * as log from "tc-shared/log";
|
|||
import * as image_preview from "../image_preview";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ErrorCode} from "tc-shared/connection/ErrorCode";
|
||||
import {VoicePlayerState} from "tc-shared/voice/VoicePlayer";
|
||||
import {ClientEvents, MusicClientEntry, SongInfo} from "tc-shared/tree/Client";
|
||||
|
||||
export interface MusicSidebarEvents {
|
||||
"open": {}, /* triggers when frame should be shown */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ChannelEntry} from "tc-shared/tree/Channel";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import {htmlEscape} from "tc-shared/ui/frames/chat";
|
||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||
import {guid} from "tc-shared/crypto/uid";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {LogCategory} from "tc-shared/log";
|
|||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {base64_encode_ab} from "tc-shared/utils/buffers";
|
||||
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import * as log from "tc-shared/log";
|
||||
import * as moment from "moment";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import {Slider, sliderfy} from "tc-shared/ui/elements/Slider";
|
||||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
import {VoicePlayerLatencySettings} from "tc-shared/voice/VoicePlayer";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import {sliderfy} from "tc-shared/ui/elements/Slider";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import * as htmltags from "tc-shared/ui/htmltags";
|
||||
|
||||
let modal: Modal;
|
||||
|
|
|
@ -4,7 +4,7 @@ import {Slider} from "tc-shared/ui/react-elements/Slider";
|
|||
import {Button} from "tc-shared/ui/react-elements/Button";
|
||||
import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
||||
import {EventHandler, ReactEventHandler, Registry} from "tc-shared/events";
|
||||
import {ClientEntry, MusicClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry, MusicClientEntry} from "tc-shared/tree/Client";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
const cssStyle = require("./ModalChangeVolume.scss");
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {ChannelEntry} from "tc-shared/ui/channel";
|
||||
import {ChannelEntry} from "tc-shared/tree/Channel";
|
||||
import {copy_to_clipboard} from "tc-shared/utils/helpers";
|
||||
import * as tooltip from "tc-shared/ui/elements/Tooltip";
|
||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ClientConnectionInfo, ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientConnectionInfo, ClientEntry} from "tc-shared/tree/Client";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {createInfoModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {copy_to_clipboard} from "tc-shared/utils/helpers";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ChannelEntry, ChannelProperties} from "tc-shared/ui/channel";
|
||||
import {ChannelEntry, ChannelProperties} from "tc-shared/tree/Channel";
|
||||
import {PermissionManager, PermissionValue} from "tc-shared/permission/PermissionManager";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {createModal} from "tc-shared/ui/elements/Modal";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {LogCategory} from "tc-shared/log";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import * as log from "tc-shared/log";
|
||||
import {ClientEntry} from "tc-shared/ui/client";
|
||||
import {ClientEntry} from "tc-shared/tree/Client";
|
||||
import {GroupManager, GroupType} from "tc-shared/permission/GroupManager";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {settings, Settings} from "tc-shared/settings";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {ServerAddress} from "tc-shared/ui/server";
|
||||
import {ServerAddress} from "tc-shared/tree/Server";
|
||||
|
||||
type URLGeneratorSettings = {
|
||||
flag_direct: boolean,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {createErrorModal, createModal} from "tc-shared/ui/elements/Modal";
|
||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||
import {MusicClientEntry} from "tc-shared/ui/client";
|
||||
import {MusicClientEntry} from "tc-shared/tree/Client";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
|
|
|
@ -2,7 +2,6 @@ import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
|||
import {tra} from "tc-shared/i18n/localize";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {modal_settings} from "tc-shared/ui/modal/ModalSettings";
|
||||
import {profiles} from "tc-shared/profiles/ConnectionProfile";
|
||||
import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||
import {initialize_audio_microphone_controller, MicrophoneSettingsEvents} from "tc-shared/ui/modal/settings/Microphone";
|
||||
import {MicrophoneSettings} from "tc-shared/ui/modal/settings/MicrophoneRenderer";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ServerEntry, ServerProperties} from "tc-shared/ui/server";
|
||||
import {ServerEntry, ServerProperties} from "tc-shared/tree/Server";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import PermissionType from "tc-shared/permission/PermissionType";
|
||||
import {GroupManager} from "tc-shared/permission/GroupManager";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
RequestInfoStatus,
|
||||
ServerBandwidthInfoUpdateCallback
|
||||
} from "tc-shared/ui/modal/ModalServerInfoBandwidth";
|
||||
import {ServerEntry} from "tc-shared/ui/server";
|
||||
import {ServerEntry} from "tc-shared/tree/Server";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {createErrorModal, createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ServerConnectionInfo, ServerEntry} from "tc-shared/ui/server";
|
||||
import {ServerConnectionInfo, ServerEntry} from "tc-shared/tree/Server";
|
||||
import {createModal, Modal} from "tc-shared/ui/elements/Modal";
|
||||
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
|
||||
import {Graph} from "tc-shared/ui/elements/NetGraph";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {format} from "tc-shared/ui/frames/side/chat_helper";
|
||||
import {useEffect, useState} from "react";
|
||||
import * as React from "react";
|
||||
import {format_chat_time} from "tc-shared/utils/DateUtils";
|
||||
|
||||
export const TimestampRenderer = (props: { timestamp: number }) => {
|
||||
const time = format.date.format_chat_time(new Date(props.timestamp));
|
||||
const time = format_chat_time(new Date(props.timestamp));
|
||||
const [ revision, setRevision ] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
ReactComponentBase
|
||||
} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import * as React from "react";
|
||||
import {ChannelEntry as ChannelEntryController, ChannelEvents, ChannelProperties} from "../channel";
|
||||
import {ChannelEntry as ChannelEntryController, ChannelEvents, ChannelProperties} from "../../tree/Channel";
|
||||
import {LocalIconRenderer} from "tc-shared/ui/react-elements/Icon";
|
||||
import {EventHandler, ReactEventHandler} from "tc-shared/events";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
ClientType,
|
||||
LocalClientEntry,
|
||||
MusicClientEntry
|
||||
} from "../client";
|
||||
} from "../../tree/Client";
|
||||
import {EventHandler, ReactEventHandler} from "tc-shared/events";
|
||||
import {Group, GroupEvents} from "tc-shared/permission/GroupManager";
|
||||
import {Settings, settings} from "tc-shared/settings";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
BatchUpdateType,
|
||||
ReactComponentBase
|
||||
} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {ServerEntry as ServerEntryController, ServerEvents} from "../server";
|
||||
import {ServerEntry as ServerEntryController, ServerEvents} from "../../tree/Server";
|
||||
import * as React from "react";
|
||||
import {LocalIconRenderer} from "tc-shared/ui/react-elements/Icon";
|
||||
import {EventHandler, ReactEventHandler} from "tc-shared/events";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {ReactComponentBase} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "tc-shared/ui/TreeEntry";
|
||||
import {ChannelTreeEntry, ChannelTreeEntryEvents} from "tc-shared/tree/ChannelTreeEntry";
|
||||
import * as React from "react";
|
||||
import {EventHandler, ReactEventHandler} from "tc-shared/events";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
BatchUpdateType,
|
||||
ReactComponentBase
|
||||
} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||
import {ChannelTree, ChannelTreeEvents} from "tc-shared/ui/view";
|
||||
import {ChannelTree, ChannelTreeEvents} from "tc-shared/tree/ChannelTree";
|
||||
import ResizeObserver from 'resize-observer-polyfill';
|
||||
|
||||
import * as React from "react";
|
||||
|
@ -14,9 +14,9 @@ import {ChannelEntryView as ChannelEntryView} from "./Channel";
|
|||
import {ServerEntry as ServerEntryView} from "./Server";
|
||||
import {ClientEntry as ClientEntryView} from "./Client";
|
||||
|
||||
import {ChannelEntry, ChannelEvents} from "tc-shared/ui/channel";
|
||||
import {ServerEntry} from "tc-shared/ui/server";
|
||||
import {ClientEntry, ClientType} from "tc-shared/ui/client";
|
||||
import {ChannelEntry, ChannelEvents} from "tc-shared/tree/Channel";
|
||||
import {ServerEntry} from "tc-shared/tree/server";
|
||||
import {ClientEntry, ClientType} from "tc-shared/tree/Client";
|
||||
import * as log from "tc-shared/log";
|
||||
import {LogCategory} from "tc-shared/log";
|
||||
import {ConnectionEvents} from "tc-shared/ConnectionHandler";
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
import {Settings, settings} from "tc-shared/settings";
|
||||
|
||||
export enum ColloquialFormat {
|
||||
YESTERDAY,
|
||||
TODAY,
|
||||
GENERAL
|
||||
}
|
||||
|
||||
function dateEqual(a: Date, b: Date) {
|
||||
return a.getUTCFullYear() === b.getUTCFullYear() &&
|
||||
a.getUTCMonth() === b.getUTCMonth() &&
|
||||
a.getUTCDate() === b.getUTCDate();
|
||||
}
|
||||
|
||||
export function same_day(a: number | Date, b: number | Date) {
|
||||
a = a instanceof Date ? a : new Date(a);
|
||||
b = b instanceof Date ? b : new Date(b);
|
||||
|
||||
if(a.getDate() !== b.getDate())
|
||||
return false;
|
||||
if(a.getMonth() !== b.getMonth())
|
||||
return false;
|
||||
return a.getFullYear() === b.getFullYear();
|
||||
}
|
||||
|
||||
export function date_format(date: Date, now: Date, ignore_settings?: boolean) : ColloquialFormat {
|
||||
if(!ignore_settings && !settings.static_global(Settings.KEY_CHAT_COLLOQUIAL_TIMESTAMPS))
|
||||
return ColloquialFormat.GENERAL;
|
||||
|
||||
if(dateEqual(date, now))
|
||||
return ColloquialFormat.TODAY;
|
||||
|
||||
date = new Date(date.getTime());
|
||||
date.setDate(date.getDate() + 1);
|
||||
|
||||
if(dateEqual(date, now))
|
||||
return ColloquialFormat.YESTERDAY;
|
||||
|
||||
return ColloquialFormat.GENERAL;
|
||||
}
|
||||
|
||||
export function formatDayTime(date: Date) {
|
||||
return ("0" + date.getHours()).substr(-2) + ":" + ("0" + date.getMinutes()).substr(-2);
|
||||
}
|
||||
|
||||
export function format_date_general(date: Date, hours?: boolean) : string {
|
||||
return ('00' + date.getDate()).substr(-2) + "."
|
||||
+ ('00' + date.getMonth()).substr(-2) + "."
|
||||
+ date.getFullYear() +
|
||||
(typeof(hours) === "undefined" || hours ? " at "
|
||||
+ ('00' + date.getHours()).substr(-2) + ":"
|
||||
+ ('00' + date.getMinutes()).substr(-2)
|
||||
: "");
|
||||
}
|
||||
|
||||
export function format_date_colloquial(date: Date, current_timestamp: Date) : { result: string; format: ColloquialFormat } {
|
||||
const format = date_format(date, current_timestamp);
|
||||
if(format == ColloquialFormat.GENERAL) {
|
||||
return {
|
||||
result: format_date_general(date),
|
||||
format: format
|
||||
};
|
||||
} else {
|
||||
let hrs = date.getHours();
|
||||
let time = "AM";
|
||||
if(hrs > 12) {
|
||||
hrs -= 12;
|
||||
time = "PM";
|
||||
}
|
||||
return {
|
||||
result: (format == ColloquialFormat.YESTERDAY ? tr("Yesterday at") : tr("Today at")) + " " + ("0" + hrs).substr(-2) + ":" + ("0" + date.getMinutes()).substr(-2) + " " + time,
|
||||
format: format
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function format_chat_time(date: Date) : {
|
||||
result: string,
|
||||
next_update: number /* in MS */
|
||||
} {
|
||||
const timestamp = date.getTime();
|
||||
const current_timestamp = new Date();
|
||||
|
||||
const result = {
|
||||
result: "",
|
||||
next_update: 0
|
||||
};
|
||||
|
||||
if(settings.static_global(Settings.KEY_CHAT_FIXED_TIMESTAMPS)) {
|
||||
const format = format_date_colloquial(date, current_timestamp);
|
||||
result.result = format.result;
|
||||
result.next_update = 0; /* TODO: Update on day change? */
|
||||
} else {
|
||||
const delta = current_timestamp.getTime() - timestamp;
|
||||
if(delta < 2000) {
|
||||
result.result = "now";
|
||||
result.next_update = 2500 - delta; /* update after two seconds */
|
||||
} else if(delta < 30000) { /* 30 seconds */
|
||||
result.result = Math.floor(delta / 1000) + " " + tr("seconds ago");
|
||||
result.next_update = 1000; /* update every second */
|
||||
} else if(delta < 30 * 60 * 1000) { /* 30 minutes */
|
||||
if(delta < 120 * 1000)
|
||||
result.result = tr("one minute ago");
|
||||
else
|
||||
result.result = Math.floor(delta / (1000 * 60)) + " " + tr("minutes ago");
|
||||
result.next_update = 60000; /* updater after a minute */
|
||||
} else {
|
||||
result.result = format_date_colloquial(date, current_timestamp).result;
|
||||
result.next_update = 0; /* TODO: Update on day change? */
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
export function format_online_time(secs: number) : string {
|
||||
let years = Math.floor(secs / (60 * 60 * 24 * 365));
|
||||
let days = Math.floor(secs / (60 * 60 * 24)) % 365;
|
||||
let hours = Math.floor(secs / (60 * 60)) % 24;
|
||||
let minutes = Math.floor(secs / 60) % 60;
|
||||
let seconds = Math.floor(secs % 60);
|
||||
|
||||
let result = "";
|
||||
if(years > 0)
|
||||
result += years + " " + tr("years") + " ";
|
||||
if(years > 0 || days > 0)
|
||||
result += days + " " + tr("days") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0)
|
||||
result += hours + " " + tr("hours") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0 || minutes > 0)
|
||||
result += minutes + " " + tr("minutes") + " ";
|
||||
if(years > 0 || days > 0 || hours > 0 || minutes > 0 || seconds > 0)
|
||||
result += seconds + " " + tr("seconds") + " ";
|
||||
else
|
||||
result = tr("now") + " ";
|
||||
|
||||
return result.substr(0, result.length - 1);
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
import * as log from "../log";
|
||||
import {LogCategory, logDebug, logWarn} from "../log";
|
||||
import {WorkerMessage, WorkerMessageCommand, WorkerMessageNotify} from "./Protocol";
|
||||
import {CommandResponseType, ExecuteResult, GenericCommandMapping, GenericCommands, GenericNotify} from "./Definitions";
|
||||
import {LogCategory, logDebug} from "../log";
|
||||
import {WorkerMessage} from "./Protocol";
|
||||
import {GenericCommandMapping, GenericCommands, GenericNotify} from "./Definitions";
|
||||
import {tr} from "../i18n/localize";
|
||||
import {Registry} from "../events";
|
||||
import {WorkerCommunication} from "tc-shared/workers/Worker";
|
||||
|
||||
type PendingCommand = {
|
||||
timeout?: any,
|
||||
|
||||
timestampSend: number,
|
||||
callbackResolve: (_: ExecuteResult) => void;
|
||||
}
|
||||
|
||||
export interface WorkerEvents {
|
||||
notify_worker_died: {}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ declare function postMessage(message: any): void;
|
|||
|
||||
const prefix = "[POWWorker] ";
|
||||
|
||||
let initialized = false;
|
||||
let memory: WebAssembly.Memory;
|
||||
let memory_u8: Uint8Array;
|
||||
let wasm_object: WebAssembly.WebAssemblyInstantiatedSource;
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "none",
|
||||
"target": "es6",
|
||||
"sourceMap": true,
|
||||
"outFile": "WorkerPOW.js"
|
||||
},
|
||||
"include": [
|
||||
"../../types/*.d.ts"
|
||||
],
|
||||
"files": [
|
||||
"pow/POWWorker.ts"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue