From 5b3a208f1607432850b28e99e9135b639e0c701c Mon Sep 17 00:00:00 2001 From: Gapodo Date: Tue, 21 Nov 2023 01:58:05 +0100 Subject: [PATCH] redo emoji --- loader/index.ejs | 14 --- package-lock.json | 35 +++--- package.json | 5 +- shared/img/smiley.png | Bin 0 -> 17376 bytes shared/js/Bookmarks.ts | 136 +++++++++++------------ shared/js/settings.ts | 2 +- shared/js/ui/modal/connect/Controller.ts | 77 ++++++------- shared/js/ui/react-elements/ChatBox.tsx | 127 ++++++++++----------- 8 files changed, 188 insertions(+), 208 deletions(-) create mode 100644 shared/img/smiley.png diff --git a/loader/index.ejs b/loader/index.ejs index 59343f28..604b457b 100644 --- a/loader/index.ejs +++ b/loader/index.ejs @@ -9,7 +9,6 @@ - <% /* TODO: Put in an appropriate image */ %> <% /* Using an absolute path here since the manifest.json works only with such. */ %> <% /* */ %> @@ -27,19 +26,6 @@ - - - - "> "> <% /* We don't preload the bowl since it's only a div background */ %> diff --git a/package-lock.json b/package-lock.json index 543338b1..dd760333 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2834,6 +2834,7 @@ "version": "7.10.3", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.3.tgz", "integrity": "sha512-RzGO0RLSdokm9Ipe/YD+7ww8X2Ro79qiXZF3HU9ljrM+qnJmH1Vqth+hbiQZy761LnMJTMitHDuKVYTk3k4dLw==", + "dev": true, "requires": { "regenerator-runtime": "^0.13.4" } @@ -3037,6 +3038,16 @@ "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true }, + "@emoji-mart/data": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@emoji-mart/data/-/data-1.1.2.tgz", + "integrity": "sha512-1HP8BxD2azjqWJvxIaWAMyTySeZY0Osr83ukYjltPVkNXeJvTz7yDrPLBtnrD5uqJ3tg4CcLuuBW09wahqL/fg==" + }, + "@emoji-mart/react": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@emoji-mart/react/-/react-1.1.1.tgz", + "integrity": "sha512-NMlFNeWgv1//uPsvLxvGQoIerPuVdXwK/EUek8OOkJ6wVOWPUizRBJU0hDqWZCOROVpfBgCemaC3m6jDOXi03g==" + }, "@google-cloud/common": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-2.4.0.tgz", @@ -4970,15 +4981,6 @@ "integrity": "sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==", "dev": true }, - "@types/emoji-mart": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/@types/emoji-mart/-/emoji-mart-3.0.12.tgz", - "integrity": "sha512-ff8xM0+98PhhX15xjDseOWGDz413QvCK6D+yes88u0GJ7DoH3qR5AdMI9CbYA7/jE25WxSvX2SsGnI8Mw1Wbkw==", - "dev": true, - "requires": { - "@types/react": "*" - } - }, "@types/emscripten": { "version": "1.39.10", "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.10.tgz", @@ -9915,13 +9917,9 @@ } }, "emoji-mart": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/emoji-mart/-/emoji-mart-3.0.1.tgz", - "integrity": "sha512-sxpmMKxqLvcscu6mFn9ITHeZNkGzIvD0BSNFE/LJESPbCA8s1jM6bCDPjWbV31xHq7JXaxgpHxLB54RCbBZSlg==", - "requires": { - "@babel/runtime": "^7.0.0", - "prop-types": "^15.6.0" - } + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/emoji-mart/-/emoji-mart-5.5.2.tgz", + "integrity": "sha512-Sqc/nso4cjxhOwWJsp9xkVm8OF5c+mJLZJFoFfzRuKO+yWiN7K8c96xmtughYb0d/fZ8UC6cLIQ/p4BR6Pv3/A==" }, "emoji-regex": { "version": "9.2.2", @@ -19527,7 +19525,8 @@ "regenerator-runtime": { "version": "0.13.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", - "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "dev": true }, "regenerator-transform": { "version": "0.14.5", @@ -23899,4 +23898,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 71021666..12afd3b1 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "@svgr/webpack": "^5.5.0", "@types/dompurify": "^2.4.0", "@types/ejs": "^3.1.5", - "@types/emoji-mart": "^3.0.12", "@types/emscripten": "^1.39.10", "@types/fs-extra": "^8.1.5", "@types/html-minifier": "^3.5.3", @@ -98,6 +97,8 @@ }, "homepage": "https://www.teaspeak.de", "dependencies": { + "@emoji-mart/data": "^1.1.2", + "@emoji-mart/react": "^1.1.1", "@types/crypto-js": "^4.2.1", "broadcastchannel-polyfill": "^1.0.1", "buffer": "^6.0.3", @@ -105,7 +106,7 @@ "crypto-js": "^4.2.0", "detect-browser": "^5.3.0", "dompurify": "^2.4.7", - "emoji-mart": "^3.0.1", + "emoji-mart": "^5.5.2", "emoji-regex": "^9.2.2", "highlight.js": "^10.7.3", "ip-regex": "^4.3.0", diff --git a/shared/img/smiley.png b/shared/img/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..84f9c5b9f090fcccab04302f6010e4404109ffd8 GIT binary patch literal 17376 zcmXt=Rb151-^IVn(k)%Wf=DP`(kvj|A)SJBcXx`kbcb|FE44I8t#o(iQqu7J{uj^1 z%v{gKIj`58^Zrb(}|mN5U4@uC%55K0+D~3UINEEYK>+zBM%O8$wBe8WtoRQ2e~hgjLWVQ zF+-F~M?T1OwMT7%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f1APn&*m0X(){*MES}~snGaBo=Yz!r zGg7~|`;<#aID5tZ{_kFXq5U*5HzZ zf4_zA1s4KCMgJhI5utr%q=gaMv)|WuMyr`I_0hj9Igd^Kei0=_dz-2`bp|azU1B|7^ZO;JeM& zHwc@C5X$y48S@yq&QC9`@DG>?IFQl7Vo?7+Y5okk04*X7fuTg}=RpCTpILh09~1yA zb#$5ga?L(%oQgCqQdY62FU4JrzBCT$L90=;c_zJgM61?}HU_`&Z@^TX^D@Os!3 zgaP7szw7e{Pw;;H4+#bcgCTWW49_0H+Ub4V$}@RhVCBLI*8=#Mzg)O`C5b`;uH^8| zCH!(`Kyhnf#pkr#_@Hlx902@??2B2Li_S{~x-Z)AslVLmbEuk0^8<&{dw3!KKNPe+ zjJiV>0Q&-jndsl!+TcCxh*7vpwI7{@((bmt5j+H2}&7J9$gQ+<~(Ces7a!N)!cucUm4e zaWmL{f1CrEvRx`*y`}(AK1e(M@3o7_`^YE^h$fwIt02+{+sPSiqpYmUj97IYrCad_4fP P00000NkvXXu0mjfN66WE literal 0 HcmV?d00001 diff --git a/shared/js/Bookmarks.ts b/shared/js/Bookmarks.ts index e8bf474e..3d141dfe 100644 --- a/shared/js/Bookmarks.ts +++ b/shared/js/Bookmarks.ts @@ -1,14 +1,14 @@ import * as loader from "tc-loader"; -import {Stage} from "tc-loader"; -import {ignorePromise, WritableKeys} from "tc-shared/proto"; -import {LogCategory, logDebug, logError, logInfo, logTrace, logWarn} from "tc-shared/log"; -import {guid} from "tc-shared/crypto/uid"; -import {Registry} from "tc-events"; -import {server_connections} from "tc-shared/ConnectionManager"; -import {defaultConnectProfile, findConnectProfile} from "tc-shared/profiles/ConnectionProfile"; -import {ConnectionState} from "tc-shared/ConnectionHandler"; +import { Stage } from "tc-loader"; +import { ignorePromise, WritableKeys } from "tc-shared/proto"; +import { LogCategory, logDebug, logError, logInfo, logTrace, logWarn } from "tc-shared/log"; +import { guid } from "tc-shared/crypto/uid"; +import { Registry } from "tc-events"; +import { server_connections } from "tc-shared/ConnectionManager"; +import { defaultConnectProfile, findConnectProfile } from "tc-shared/profiles/ConnectionProfile"; +import { ConnectionState } from "tc-shared/ConnectionHandler"; import * as _ from "lodash"; -import {getStorageAdapter} from "tc-shared/StorageAdapter"; +import { getStorageAdapter } from "tc-shared/StorageAdapter"; type BookmarkBase = { readonly uniqueId: string, @@ -64,9 +64,9 @@ export class BookmarkManager { async loadBookmarks() { const bookmarksJson = await getStorageAdapter().get(kStorageKey); - if(typeof bookmarksJson !== "string") { + if (typeof bookmarksJson !== "string") { const oldBookmarksJson = await getStorageAdapter().get("bookmarks"); - if(typeof oldBookmarksJson === "string") { + if (typeof oldBookmarksJson === "string") { logDebug(LogCategory.BOOKMARKS, tr("Found no new bookmarks but found old bookmarks. Trying to import.")); try { this.importOldBookmarks(oldBookmarksJson); @@ -83,7 +83,7 @@ export class BookmarkManager { } else { try { const storageData = JSON.parse(bookmarksJson); - if(storageData.version !== 2) { + if (storageData.version !== 2) { throw tr("bookmark storage has an invalid version"); } @@ -99,7 +99,7 @@ export class BookmarkManager { } } - if(!this.defaultBookmarkCreated && this.registeredBookmarks.length === 0) { + if (!this.defaultBookmarkCreated && this.registeredBookmarks.length === 0) { this.defaultBookmarkCreated = true; logDebug(LogCategory.BOOKMARKS, tr("No bookmarks found. Registering default bookmark.")); @@ -107,12 +107,12 @@ export class BookmarkManager { connectOnStartup: false, connectProfile: "default", - displayName: "Official TeaSpeak - Test server", + displayName: "Our LanPart<", parentEntry: undefined, previousEntry: undefined, - serverAddress: "ts.teaspeak.de", + serverAddress: "tea.lp.kle.li", serverPasswordHash: undefined, defaultChannel: undefined, @@ -123,21 +123,21 @@ export class BookmarkManager { private importOldBookmarks(jsonData: string) { const data = JSON.parse(jsonData); - if(typeof data?.root_bookmark !== "object") { + if (typeof data?.root_bookmark !== "object") { throw tr("missing root bookmark"); } - if(!Array.isArray(data?.root_bookmark?.content)) { + if (!Array.isArray(data?.root_bookmark?.content)) { throw tr("Missing root bookmarks content"); } - const registerBookmarks = (parentEntry: string, previousEntry: string, entry: any) : string | undefined => { - if(typeof entry.display_name !== "string") { + const registerBookmarks = (parentEntry: string, previousEntry: string, entry: any): string | undefined => { + if (typeof entry.display_name !== "string") { logWarn(LogCategory.BOOKMARKS, tr("Missing display_name in old bookmark entry. Skipping entry.")); return undefined; } - if("content" in entry) { + if ("content" in entry) { /* it was a directory */ const directory = this.createDirectory({ previousEntry, @@ -152,23 +152,23 @@ export class BookmarkManager { }); } else { /* it was a normal entry */ - if(typeof entry.connect_profile !== "string") { + if (typeof entry.connect_profile !== "string") { logWarn(LogCategory.BOOKMARKS, tr("Missing connect_profile in old bookmark entry. Skipping entry.")); return undefined; } - if(typeof entry.server_properties?.server_address !== "string") { + if (typeof entry.server_properties?.server_address !== "string") { logWarn(LogCategory.BOOKMARKS, tr("Missing server_address in old bookmark entry. Skipping entry.")); return undefined; } - if(typeof entry.server_properties?.server_port !== "number") { + if (typeof entry.server_properties?.server_port !== "number") { logWarn(LogCategory.BOOKMARKS, tr("Missing server_port in old bookmark entry. Skipping entry.")); return undefined; } let serverAddress; - if(entry.server_properties.server_address.indexOf(":") !== -1) { + if (entry.server_properties.server_address.indexOf(":") !== -1) { serverAddress = `[${entry.server_properties.server_address}]`; } else { serverAddress = entry.server_properties.server_address; @@ -209,23 +209,23 @@ export class BookmarkManager { })); } - getRegisteredBookmarks() : BookmarkEntry[] { + getRegisteredBookmarks(): BookmarkEntry[] { return this.registeredBookmarks; } - getOrderedRegisteredBookmarks() : OrderedBookmarkEntry[] { + getOrderedRegisteredBookmarks(): OrderedBookmarkEntry[] { const unorderedBookmarks = this.registeredBookmarks.slice(0); const orderedBookmarks: OrderedBookmarkEntry[] = []; const orderTreeLayer = (entries: BookmarkEntry[]): BookmarkEntry[] => { - if(entries.length === 0) { + if (entries.length === 0) { return []; } const result = []; - while(entries.length > 0) { + while (entries.length > 0) { let head = entries.find(entry => !entry.previousEntry) || entries[0]; - while(head) { + while (head) { result.push(head); entries.remove(head); head = entries.find(entry => entry.previousEntry === head.uniqueId); @@ -240,7 +240,7 @@ export class BookmarkManager { children.forEach(child => unorderedBookmarks.remove(child)); const childCount = children.length; - for(const entry of orderTreeLayer(children)) { + for (const entry of orderTreeLayer(children)) { let orderedEntry: OrderedBookmarkEntry = { entry: entry, depth: depth, @@ -264,11 +264,11 @@ export class BookmarkManager { return orderedBookmarks; } - findBookmark(uniqueId: string) : BookmarkEntry | undefined { + findBookmark(uniqueId: string): BookmarkEntry | undefined { return this.registeredBookmarks.find(entry => entry.uniqueId === uniqueId); } - createBookmark(properties: Pick>) : BookmarkInfo { + createBookmark(properties: Pick>): BookmarkInfo { this.validateHangInPoint(properties); const bookmark = Object.assign(properties, { uniqueId: guid(), @@ -284,7 +284,7 @@ export class BookmarkManager { this.doEditBookmark(uniqueId, newValues); } - createDirectory(properties: Pick>) : BookmarkDirectory { + createDirectory(properties: Pick>): BookmarkDirectory { this.validateHangInPoint(properties); const bookmark = Object.assign(properties, { uniqueId: guid(), @@ -300,20 +300,20 @@ export class BookmarkManager { this.doEditBookmark(uniqueId, newValues); } - directoryContents(uniqueId: string) : BookmarkEntry[] { + directoryContents(uniqueId: string): BookmarkEntry[] { return this.registeredBookmarks.filter(bookmark => bookmark.parentEntry === uniqueId); } deleteEntry(uniqueId: string) { const index = this.registeredBookmarks.findIndex(entry => entry.uniqueId === uniqueId); - if(index === -1) { + if (index === -1) { return; } - const [ entry ] = this.registeredBookmarks.splice(index, 1); - const children = [], pendingChildren = [ entry ]; + const [entry] = this.registeredBookmarks.splice(index, 1); + const children = [], pendingChildren = [entry]; - while(pendingChildren[0]) { + while (pendingChildren[0]) { const child = pendingChildren.pop_front(); children.push(child); @@ -329,12 +329,12 @@ export class BookmarkManager { executeConnect(uniqueId: string, newTab: boolean) { const bookmark = this.findBookmark(uniqueId); - if(!bookmark || bookmark.type !== "entry") { + if (!bookmark || bookmark.type !== "entry") { return; } const connection = newTab ? server_connections.spawnConnectionHandler() : server_connections.getActiveConnectionHandler(); - if(!connection) { + if (!connection) { return; } @@ -360,12 +360,12 @@ export class BookmarkManager { executeAutoConnect() { let newTab = server_connections.getActiveConnectionHandler().connection_state !== ConnectionState.UNCONNECTED; - for(const entry of this.getOrderedRegisteredBookmarks()) { - if(entry.entry.type !== "entry") { + for (const entry of this.getOrderedRegisteredBookmarks()) { + if (entry.entry.type !== "entry") { continue; } - if(!entry.entry.connectOnStartup) { + if (!entry.entry.connectOnStartup) { continue; } @@ -374,14 +374,14 @@ export class BookmarkManager { } } - exportBookmarks() : string { + exportBookmarks(): string { return JSON.stringify({ version: 1, bookmarks: this.registeredBookmarks }); } - importBookmarks(filePayload: string) : number { + importBookmarks(filePayload: string): number { let data; try { data = JSON.parse(filePayload) @@ -389,26 +389,26 @@ export class BookmarkManager { throw tr("failed to parse bookmarks"); } - if(data?.version !== 1) { + if (data?.version !== 1) { throw tr("supplied data contains invalid version"); } const newBookmarks = data.bookmarks as BookmarkEntry[]; - if(!Array.isArray(newBookmarks)) { + if (!Array.isArray(newBookmarks)) { throw tr("missing bookmarks"); } /* TODO: Validate integrity? */ - for(const knownBookmark of this.registeredBookmarks) { + for (const knownBookmark of this.registeredBookmarks) { const index = newBookmarks.findIndex(entry => entry.uniqueId === knownBookmark.uniqueId); - if(index === -1) { + if (index === -1) { continue; } newBookmarks.splice(index, 1); } - if(newBookmarks.length === 0) { + if (newBookmarks.length === 0) { return; } @@ -420,26 +420,26 @@ export class BookmarkManager { private doEditBookmark(uniqueId: string, newValues: any) { const bookmarkInfo = this.findBookmark(uniqueId); - if(!bookmarkInfo) { + if (!bookmarkInfo) { return; } const originalProperties = _.cloneDeep(bookmarkInfo); - for(const key of Object.keys(newValues)) { + for (const key of Object.keys(newValues)) { bookmarkInfo[key] = newValues[key]; } this.validateHangInPoint(bookmarkInfo); const editedKeys = []; - for(const key of Object.keys(newValues)) { - if(_.isEqual(bookmarkInfo[key], originalProperties[key])) { + for (const key of Object.keys(newValues)) { + if (_.isEqual(bookmarkInfo[key], originalProperties[key])) { continue; } editedKeys.push(key); } - if(editedKeys.length === 0) { + if (editedKeys.length === 0) { return; } @@ -448,12 +448,12 @@ export class BookmarkManager { } private validateHangInPoint(entry: Partial) { - if(entry.previousEntry) { + if (entry.previousEntry) { const previousEntry = this.findBookmark(entry.previousEntry); - if(!previousEntry) { + if (!previousEntry) { logError(LogCategory.BOOKMARKS, tr("New bookmark previous entry does not exists. Clearing it.")); entry.previousEntry = undefined; - } else if(previousEntry.parentEntry !== entry.parentEntry) { + } else if (previousEntry.parentEntry !== entry.parentEntry) { logWarn(LogCategory.BOOKMARKS, tr("Previous entries parent does not match our entries parent. Updating our parent from %s to %s"), entry.parentEntry, previousEntry.parentEntry); entry.parentEntry = previousEntry.parentEntry; } @@ -461,13 +461,13 @@ export class BookmarkManager { const openList = this.registeredBookmarks.filter(e1 => e1.parentEntry === entry.parentEntry); let currentEntry = entry; - while(true) { - if(!currentEntry.previousEntry) { + while (true) { + if (!currentEntry.previousEntry) { break; } const previousEntry = openList.find(entry => entry.uniqueId === currentEntry.previousEntry); - if(!previousEntry) { + if (!previousEntry) { logError(LogCategory.BOOKMARKS, tr("Found circular dependency within the previous entry or one of the previous entries does not exists. Clearing out previous entry.")); entry.previousEntry = undefined; break; @@ -478,22 +478,22 @@ export class BookmarkManager { } } - if(entry.parentEntry) { + if (entry.parentEntry) { const parentEntry = this.findBookmark(entry.parentEntry); - if(!parentEntry) { + if (!parentEntry) { logError(LogCategory.BOOKMARKS, tr("Missing parent entry %s. Clearing it."), entry.parentEntry); entry.parentEntry = undefined; } const openList = this.registeredBookmarks.slice(); let currentEntry = entry; - while(true) { - if(!currentEntry.parentEntry) { + while (true) { + if (!currentEntry.parentEntry) { break; } const parentEntry = openList.find(entry => entry.uniqueId === currentEntry.parentEntry); - if(!parentEntry) { + if (!parentEntry) { logError(LogCategory.BOOKMARKS, tr("Found circular dependency within a parent or one of the parents does not exists. Clearing out parent.")); entry.parentEntry = undefined; break; @@ -504,9 +504,9 @@ export class BookmarkManager { } } - if(entry.previousEntry) { + if (entry.previousEntry) { this.registeredBookmarks.forEach(bookmark => { - if(bookmark.previousEntry === entry.previousEntry && bookmark !== entry) { + if (bookmark.previousEntry === entry.previousEntry && bookmark !== entry) { bookmark.previousEntry = bookmark.uniqueId; } }); diff --git a/shared/js/settings.ts b/shared/js/settings.ts index 98cb2a0e..d8ef500f 100644 --- a/shared/js/settings.ts +++ b/shared/js/settings.ts @@ -364,7 +364,7 @@ export class Settings { static readonly KEY_I18N_DEFAULT_REPOSITORY: ValuedRegistryKey = { key: "i18n.default_repository", valueType: "string", - defaultValue: "https://web.teaspeak.de/i18n/" + defaultValue: "i18n/" }; /* Default client states */ diff --git a/shared/js/ui/modal/connect/Controller.ts b/shared/js/ui/modal/connect/Controller.ts index 50a99a7a..ece66462 100644 --- a/shared/js/ui/modal/connect/Controller.ts +++ b/shared/js/ui/modal/connect/Controller.ts @@ -1,25 +1,25 @@ -import {Registry} from "tc-shared/events"; +import { Registry } from "tc-shared/events"; import { ConnectUiEvents, ConnectUiVariables, } from "tc-shared/ui/modal/connect/Definitions"; -import {LogCategory, logError, logWarn} from "tc-shared/log"; +import { LogCategory, logError, logWarn } from "tc-shared/log"; import { availableConnectProfiles, ConnectionProfile, defaultConnectProfile, findConnectProfile } from "tc-shared/profiles/ConnectionProfile"; -import {Settings, settings} from "tc-shared/settings"; -import {connectionHistory, ConnectionHistoryEntry} from "tc-shared/connectionlog/History"; -import {createErrorModal} from "tc-shared/ui/elements/Modal"; -import {ConnectionHandler} from "tc-shared/ConnectionHandler"; -import {server_connections} from "tc-shared/ConnectionManager"; -import {parseServerAddress} from "tc-shared/tree/Server"; -import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings"; -import {UiVariableProvider} from "tc-shared/ui/utils/Variable"; -import {createIpcUiVariableProvider} from "tc-shared/ui/utils/IpcVariable"; -import {spawnModal} from "tc-shared/ui/react-elements/modal"; +import { Settings, settings } from "tc-shared/settings"; +import { connectionHistory, ConnectionHistoryEntry } from "tc-shared/connectionlog/History"; +import { createErrorModal } from "tc-shared/ui/elements/Modal"; +import { ConnectionHandler } from "tc-shared/ConnectionHandler"; +import { server_connections } from "tc-shared/ConnectionManager"; +import { parseServerAddress } from "tc-shared/tree/Server"; +import { spawnSettingsModal } from "tc-shared/ui/modal/ModalSettings"; +import { UiVariableProvider } from "tc-shared/ui/utils/Variable"; +import { createIpcUiVariableProvider } from "tc-shared/ui/utils/IpcVariable"; +import { spawnModal } from "tc-shared/ui/react-elements/modal"; import ipRegex from "ip-regex"; const kRegexDomain = /^(localhost|((([a-zA-Z0-9_-]{0,63}\.){0,253})?[a-zA-Z0-9_-]{0,63}\.[a-zA-Z]{2,64}))$/i; @@ -61,7 +61,8 @@ class ConnectController { private validateNickname: boolean; private validateAddress: boolean; - constructor(uiVariables: UiVariableProvider) {7 + constructor(uiVariables: UiVariableProvider) { + 7 this.uiEvents = new Registry(); this.uiEvents.enableDebug("modal-connect"); @@ -71,7 +72,7 @@ class ConnectController { this.validateNickname = false; this.validateAddress = false; - this.defaultAddress = "ts.teaspeak.de"; + this.defaultAddress = "tea.lp.kle.li"; this.historyShown = settings.getValue(Settings.KEY_CONNECT_SHOW_HISTORY); this.currentAddress = settings.getValue(Settings.KEY_CONNECT_ADDRESS); @@ -109,11 +110,11 @@ class ConnectController { })); this.uiVariables.setVariableProvider("server_address_valid", () => { - if(this.validateAddress) { + if (this.validateAddress) { const address = this.currentAddress || this.defaultAddress || ""; const parsedAddress = parseServerAddress(address); - if(parsedAddress) { + if (parsedAddress) { kRegexDomain.lastIndex = 0; return kRegexDomain.test(parsedAddress.host) || ipRegex({ exact: true }).test(parsedAddress.host); } else { @@ -125,7 +126,7 @@ class ConnectController { }); this.uiVariables.setVariableEditor("server_address", newValue => { - if(this.currentAddress === newValue.currentAddress) { + if (this.currentAddress === newValue.currentAddress) { return false; } @@ -139,7 +140,7 @@ class ConnectController { })); this.uiVariables.setVariableProvider("nickname_valid", () => { - if(this.validateNickname) { + if (this.validateNickname) { const nickname = this.currentNickname || this.currentProfile?.connectUsername() || ""; return nickname.length >= 3 && nickname.length <= 30; } else { @@ -148,7 +149,7 @@ class ConnectController { }); this.uiVariables.setVariableEditor("nickname", newValue => { - if(this.currentNickname === newValue.currentNickname) { + if (this.currentNickname === newValue.currentNickname) { return false; } @@ -166,7 +167,7 @@ class ConnectController { })); this.uiVariables.setVariableEditor("password", newValue => { - if(this.currentPassword === newValue.password) { + if (this.currentPassword === newValue.password) { return false; } @@ -179,7 +180,7 @@ class ConnectController { this.uiVariables.setVariableProvider("historyShown", () => this.historyShown); this.uiVariables.setVariableEditor("historyShown", newValue => { - if(this.historyShown === newValue) { + if (this.historyShown === newValue) { return false; } @@ -188,8 +189,8 @@ class ConnectController { return true; }); - this.uiVariables.setVariableProvider("history",async () => { - if(!this.history) { + this.uiVariables.setVariableProvider("history", async () => { + if (!this.history) { this.history = await connectionHistory.lastConnectedServers(10); } @@ -237,7 +238,7 @@ class ConnectController { this.uiVariables.setVariableEditor("profiles", newValue => { const profile = findConnectProfile(newValue.selected); - if(!profile) { + if (!profile) { createErrorModal(tr("Invalid profile"), tr("Target connect profile is missing.")).open(); return false; } @@ -252,16 +253,16 @@ class ConnectController { this.uiVariables.destroy(); } - generateConnectParameters() : ConnectParameters | undefined { - if(!this.uiVariables.getVariableSync("nickname_valid", undefined, true)) { + generateConnectParameters(): ConnectParameters | undefined { + if (!this.uiVariables.getVariableSync("nickname_valid", undefined, true)) { return undefined; } - if(!this.uiVariables.getVariableSync("server_address_valid", undefined, true)) { + if (!this.uiVariables.getVariableSync("server_address_valid", undefined, true)) { return undefined; } - if(!this.uiVariables.getVariableSync("profile_valid", undefined, true)) { + if (!this.uiVariables.getVariableSync("profile_valid", undefined, true)) { return undefined; } @@ -279,7 +280,7 @@ class ConnectController { } setSelectedHistoryId(id: number | -1) { - if(this.selectedHistoryId === id) { + if (this.selectedHistoryId === id) { return; } @@ -287,7 +288,7 @@ class ConnectController { this.uiVariables.sendVariable("history"); const historyEntry = this.history?.find(entry => entry.id === id); - if(!historyEntry) { return; } + if (!historyEntry) { return; } this.currentAddress = historyEntry.targetAddress; this.currentNickname = historyEntry.nickname; @@ -300,12 +301,12 @@ class ConnectController { } setSelectedAddress(address: string | undefined, validate: boolean, updateUi: boolean) { - if(this.currentAddress !== address) { + if (this.currentAddress !== address) { this.currentAddress = address; settings.setValue(Settings.KEY_CONNECT_ADDRESS, address); this.setSelectedHistoryId(-1); - if(updateUi) { + if (updateUi) { this.uiVariables.sendVariable("server_address"); } } @@ -315,7 +316,7 @@ class ConnectController { } setSelectedProfile(profile: ConnectionProfile | undefined) { - if(this.currentProfile === profile) { + if (this.currentProfile === profile) { return; } @@ -347,11 +348,11 @@ export function spawnConnectModalNew(options: ConnectModalOptions) { const variableProvider = createIpcUiVariableProvider(); const controller = new ConnectController(variableProvider); - if(typeof options.selectedAddress === "string") { + if (typeof options.selectedAddress === "string") { controller.setSelectedAddress(options.selectedAddress, false, true); } - if(typeof options.selectedProfile === "object") { + if (typeof options.selectedProfile === "object") { controller.setSelectedProfile(options.selectedProfile); } @@ -363,7 +364,7 @@ export function spawnConnectModalNew(options: ConnectModalOptions) { controller.uiEvents.on("action_connect", event => { const parameters = controller.generateConnectParameters(); - if(!parameters) { + if (!parameters) { /* invalid parameters detected */ return; } @@ -371,14 +372,14 @@ export function spawnConnectModalNew(options: ConnectModalOptions) { modal.destroy(); let connection: ConnectionHandler; - if(event.newTab) { + if (event.newTab) { connection = server_connections.spawnConnectionHandler(); server_connections.setActiveConnectionHandler(connection); } else { connection = server_connections.getActiveConnectionHandler(); } - if(!connection) { + if (!connection) { return; } diff --git a/shared/js/ui/react-elements/ChatBox.tsx b/shared/js/ui/react-elements/ChatBox.tsx index 8f3b2ec1..32c4b331 100644 --- a/shared/js/ui/react-elements/ChatBox.tsx +++ b/shared/js/ui/react-elements/ChatBox.tsx @@ -1,14 +1,16 @@ import * as React from "react"; -import {useEffect, useRef, useState} from "react"; -import {Registry} from "tc-shared/events"; +import { useEffect, useRef, useState } from "react"; +import { Registry } from "tc-shared/events"; + +import { settings, Settings } from "tc-shared/settings"; +import { Translatable } from "tc-shared/ui/react-elements/i18n"; + +import Picker from '@emoji-mart/react' +import data from '@emoji-mart/data' +import { Emoji, init } from "emoji-mart"; + +init({ data }) -import '!style-loader!css-loader!emoji-mart/css/emoji-mart.css' -import {Picker, emojiIndex} from 'emoji-mart' -import {settings, Settings} from "tc-shared/settings"; -import {Translatable} from "tc-shared/ui/react-elements/i18n"; -import {getTwenmojiHashFromNativeEmoji} from "tc-shared/text/bbcode/EmojiUtil"; -import {BaseEmoji} from "emoji-mart"; -import {useGlobalSetting} from "tc-shared/ui/react-elements/Helper"; const cssStyle = require("./ChatBox.scss"); @@ -28,34 +30,26 @@ interface ChatBoxEvents { } const LastUsedEmoji = () => { - const settingValue = useGlobalSetting(Settings.KEY_CHAT_LAST_USED_EMOJI); - const lastEmoji: BaseEmoji = (emojiIndex.emojis[settingValue] || emojiIndex.emojis["joy"]) as any; - if(!lastEmoji?.native) { - return {""}; - } - - return ( - {lastEmoji.native} - ) + return {""}; } const EmojiButton = (props: { events: Registry }) => { - const [ shown, setShown ] = useState(false); - const [ enabled, setEnabled ] = useState(false); + const [shown, setShown] = useState(false); + const [enabled, setEnabled] = useState(false); const refContainer = useRef(); useEffect(() => { - if(!shown) { + if (!shown) { return; } const clickListener = (event: MouseEvent) => { let target = event.target as HTMLElement; - while(target && target !== refContainer.current) + while (target && target !== refContainer.current) target = target.parentElement; - if(target === refContainer.current && target) + if (target === refContainer.current && target) return; setShown(false); @@ -76,22 +70,21 @@ const EmojiButton = (props: { events: Registry }) => {
{!shown ? undefined : { - if(enabled) { - settings.setValue(Settings.KEY_CHAT_LAST_USED_EMOJI, emoji.id as string); + onEmojiSelect={(emoji: any) => { + if (enabled) { props.events.fire("action_insert_text", { text: emoji.native, focus: true }); } }} /> + }
@@ -101,27 +94,27 @@ const EmojiButton = (props: { events: Registry }) => { const pasteTextTransformElement = document.createElement("div"); const nodeToText = (element: Node) => { - if(element instanceof Text) { + if (element instanceof Text) { return element.textContent; - } else if(element instanceof HTMLElement) { - if(element instanceof HTMLImageElement) { + } else if (element instanceof HTMLElement) { + if (element instanceof HTMLImageElement) { return element.alt || element.title; - } else if(element instanceof HTMLBRElement) { + } else if (element instanceof HTMLBRElement) { return '\n'; - } else if(element instanceof HTMLAnchorElement) { + } else if (element instanceof HTMLAnchorElement) { const content = [...element.childNodes].map(nodeToText).join(""); - if(element.href) { - if(settings.getValue(Settings.KEY_CHAT_ENABLE_MARKDOWN)) { - if(content && element.title) { + if (element.href) { + if (settings.getValue(Settings.KEY_CHAT_ENABLE_MARKDOWN)) { + if (content && element.title) { return `[${content}](${element.href} "${element.title}")`; - } else if(content) { + } else if (content) { return `[${content}](${element.href})`; } else { return `[${element.href}](${element.href})`; } - } else if(settings.getValue(Settings.KEY_CHAT_ENABLE_BBCODE)) { - if(content) { + } else if (settings.getValue(Settings.KEY_CHAT_ENABLE_BBCODE)) { + if (content) { return `[url=${element.href}]${content}"[/url]`; } else { return `[url]${element.href}"[/url]`; @@ -134,11 +127,11 @@ const nodeToText = (element: Node) => { } } - if(element.children.length > 0) { + if (element.children.length > 0) { return [...element.childNodes].map(nodeToText).join(""); } - return typeof(element.innerText) === "string" ? element.innerText : ""; + return typeof (element.innerText) === "string" ? element.innerText : ""; } else { return ""; } @@ -146,19 +139,19 @@ const nodeToText = (element: Node) => { const htmlEscape = (message: string) => { pasteTextTransformElement.innerText = message; - message = pasteTextTransformElement.innerHTML; + message = pasteTextTransformElement.innerHTML; return message.replace(/ /g, ' '); }; const TextInput = (props: { events: Registry, enabled?: boolean, placeholder?: string }) => { - const [ enabled, setEnabled ] = useState(!!props.enabled); - const [ historyIndex, setHistoryIndex ] = useState(-1); + const [enabled, setEnabled] = useState(!!props.enabled); + const [historyIndex, setHistoryIndex] = useState(-1); const history = useRef([]); const refInput = useRef(); const typingTimeout = useRef(undefined); const triggerTyping = () => { - if(typeof typingTimeout.current === "number") + if (typeof typingTimeout.current === "number") return; props.events.fire("notify_typing"); @@ -182,7 +175,7 @@ const TextInput = (props: { events: Registry, enabled?: boolean, event.preventDefault(); const clipboard = event.clipboardData || (window as any).clipboardData; - if(!clipboard) return; + if (!clipboard) return; const rawText = clipboard.getData('text/plain'); const selection = window.getSelection(); @@ -191,7 +184,7 @@ const TextInput = (props: { events: Registry, enabled?: boolean, } let htmlXML = clipboard.getData('text/html'); - if(!htmlXML) { + if (!htmlXML) { pasteTextTransformElement.textContent = rawText; htmlXML = pasteTextTransformElement.innerHTML; } @@ -235,33 +228,33 @@ const TextInput = (props: { events: Registry, enabled?: boolean, triggerTyping(); const inputEmpty = refInput.current.innerText.trim().length === 0; - if(event.key === "Enter" && !event.shiftKey) { - if(inputEmpty) { + if (event.key === "Enter" && !event.shiftKey) { + if (inputEmpty) { return; } const text = refInput.current.innerText; props.events.fire("action_submit_message", { message: text }); history.current.push(text); - while(history.current.length > 10) { + while (history.current.length > 10) { history.current.pop_front(); } refInput.current.innerText = ""; setHistoryIndex(-1); event.preventDefault(); - } else if(event.key === "ArrowUp") { + } else if (event.key === "ArrowUp") { const inputOriginal = history.current[historyIndex] === refInput.current.innerText; - if(inputEmpty && (historyIndex === -1 || !inputOriginal)) { + if (inputEmpty && (historyIndex === -1 || !inputOriginal)) { setHistory(history.current.length - 1); event.preventDefault(); - } else if(historyIndex > 0 && inputOriginal) { + } else if (historyIndex > 0 && inputOriginal) { setHistory(historyIndex - 1); event.preventDefault(); } - } else if(event.key === "ArrowDown") { - if(history.current[historyIndex] === refInput.current.innerText) { - if(historyIndex < history.current.length - 1) { + } else if (event.key === "ArrowDown") { + if (history.current[historyIndex] === refInput.current.innerText) { + if (historyIndex < history.current.length - 1) { setHistory(historyIndex + 1); } else { setHistory(-1); @@ -273,7 +266,7 @@ const TextInput = (props: { events: Registry, enabled?: boolean, props.events.reactUse("action_request_focus", () => refInput.current?.focus()); props.events.reactUse("notify_typing", () => { - if(typeof typingTimeout.current === "number") { + if (typeof typingTimeout.current === "number") { return; } @@ -281,15 +274,15 @@ const TextInput = (props: { events: Registry, enabled?: boolean, }); props.events.reactUse("action_insert_text", event => { refInput.current.innerHTML = refInput.current.innerHTML + event.text; - if(event.focus) { + if (event.focus) { refInput.current.focus(); } }); props.events.reactUse("action_set_enabled", event => { setEnabled(event.enabled); - if(!event.enabled) { + if (!event.enabled) { const text = refInput.current.innerText; - if(text.trim().length !== 0) + if (text.trim().length !== 0) history.current.push(text); refInput.current.innerText = ""; } @@ -324,17 +317,17 @@ export interface ChatBoxState { } const MarkdownFormatHelper = () => { - const [ visible, setVisible ] = useState(settings.getValue(Settings.KEY_CHAT_ENABLE_MARKDOWN)); + const [visible, setVisible] = useState(settings.getValue(Settings.KEY_CHAT_ENABLE_MARKDOWN)); settings.events.reactUse("notify_setting_changed", event => { - if(event.setting !== Settings.KEY_CHAT_ENABLE_MARKDOWN.key) { + if (event.setting !== Settings.KEY_CHAT_ENABLE_MARKDOWN.key) { return; } setVisible(settings.getValue(Settings.KEY_CHAT_ENABLE_MARKDOWN)); }); - if(visible) { + if (visible) { return (
*italic*, **bold**, ~~strikethrough~~, `code`, and more...
); @@ -380,7 +373,7 @@ export class ChatBox extends React.Component { } componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { - if(prevState.enabled !== this.state.enabled) { + if (prevState.enabled !== this.state.enabled) { this.events.fire_react("action_set_enabled", { enabled: this.state.enabled }); } }