next
ci/woodpecker/push/base Pipeline failed Details

strip2
gapodo 2023-11-21 00:36:09 +01:00
parent 9bb82e3083
commit 6372bff69f
5 changed files with 193 additions and 190 deletions

View File

@ -1,53 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, min-zoom=1, max-zoom: 1, user-scalable=no">
<meta name="description" content="The TeaSpeak Web client is a in the browser running client for the VoIP communication software TeaSpeak." />
<meta name="keywords" content="TeaSpeak, TeaWeb, TeaSpeak-Web,Web client TeaSpeak, веб клієнт TeaSpeak, TSDNS, багатомовність, мультимовність, теми, функціонал"/>
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, min-zoom=1, max-zoom: 1, user-scalable=no">
<meta name="description"
content="The TeaSpeak Web client is a in the browser running client for the VoIP communication software TeaSpeak." />
<meta name="keywords"
content="TeaSpeak, TeaWeb, TeaSpeak-Web,Web client TeaSpeak, веб клієнт TeaSpeak, TSDNS, багатомовність, мультимовність, теми, функціонал" />
<meta name="og:description" content="The TeaSpeak Web client is a in the browser running client for the VoIP communication software TeaSpeak." />
<meta name="og:description"
content="The TeaSpeak Web client is a in the browser running client for the VoIP communication software TeaSpeak." />
<meta name="og:url" content="https://web.teaspeak.de/">
<% /* TODO: Put in an appropriate image <meta name="og:image" content="https://www.whatsapp.com/img/whatsapp-promo.png"> */ %>
<% /* TODO: Put in an appropriate image <meta name="og:image"
content="https://www.whatsapp.com/img/whatsapp-promo.png"> */ %>
<% /* Using an absolute path here since the manifest.json works only with such. */ %>
<% /* <link rel="manifest" href="/manifest.json"> */ %>
<% if(buildTarget === "client") { %>
<% if(buildTarget==="client" ) { %>
<title>TeaClient</title>
<meta name='og:title' content='TeaClient'>
<% } else { %>
<% } else { %>
<title>TeaSpeak-Web</title>
<meta name='og:title' content='TeaSpeak-Web'>
<link rel='shortcut icon' href='<%= require("./images/favicon_teacup.png") %>' type='image/x-icon' id="favicon">
<% /* <link rel="apple-touch-icon" sizes="194x194" href="/apple-touch-icon.png" type="image/png"> */ %>
<% } %>
<link rel='shortcut icon' href='<%= require("./images/favicon_teacup.png") %>'
type='image/x-icon' id="favicon">
<% /* <link rel="apple-touch-icon" sizes="194x194" href="/apple-touch-icon.png"
type="image/png"> */ %>
<% } %>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer async src="https://www.googletagmanager.com/gtag/js?id=UA-113151733-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-113151733-4');
</script>
<link rel="preload" as="image" href="<%= require("./images/initial-sequence.gif") %>">
<link rel="preload" as="image" href="<%= require("./images/bowl.png") %>">
<link rel="preload" as="image" href="<%= require(" ./images/initial-sequence.gif") %>">
<link rel="preload" as="image" href="<%= require(" ./images/bowl.png") %>">
<% /* We don't preload the bowl since it's only a div background */ %>
<link rel="preload" as="image" href="<%= require("./images/text.png") %>">
<link rel="preload" as="image" href="<%= require(" ./images/text.png") %>">
<%= htmlWebpackPlugin.tags.headTags %>
</head>
<body>
</head>
<body>
<!-- No javascript error -->
<noscript>
<div id="overlay-no-js">
@ -66,16 +62,21 @@
<div class="loader" id="loader-overlay">
<div class="container">
<div class="setup">
<lazy-img src="<%= require("./images/initial-sequence.gif") %>" alt="initial loading sequence" x-animation-depend="normal"></lazy-img>
<lazy-img src="<%= require("./images/halloween-initial-sequence.gif") %>" alt="initial loading sequence" x-animation-depend="halloween"></lazy-img>
<lazy-img src="<%= require(" ./images/initial-sequence.gif") %>" alt="initial loading sequence"
x-animation-depend="normal"></lazy-img>
<lazy-img src="<%= require(" ./images/halloween-initial-sequence.gif") %>" alt="initial loading
sequence" x-animation-depend="halloween"></lazy-img>
</div>
<div class="idle animation-normal">
<lazy-img class="bowl" src="<%= require("./images/bowl.png") %>" alt="bowl" x-animation-depend="normal"></lazy-img>
<lazy-img class="text" src="<%= require("./images/text.png") %>" alt="TeaSpeak" x-animation-depend="normal"></lazy-img>
<lazy-img class="bowl" src="<%= require(" ./images/bowl.png") %>" alt="bowl"
x-animation-depend="normal"></lazy-img>
<lazy-img class="text" src="<%= require(" ./images/text.png") %>" alt="TeaSpeak"
x-animation-depend="normal"></lazy-img>
<div class="steam"></div>
</div>
<div class="idle animation-halloween">
<lazy-img src="<%= require("./images/halloween-loop.gif") %>" alt="halloween loop" x-animation-depend="halloween"></lazy-img>
<lazy-img src="<%= require(" ./images/halloween-loop.gif") %>" alt="halloween loop"
x-animation-depend="halloween"></lazy-img>
</div>
</div>
@ -95,5 +96,6 @@
</div>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</body>
</html>

View File

@ -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, WritableKeys<BookmarkInfo>>) : BookmarkInfo {
createBookmark(properties: Pick<BookmarkInfo, WritableKeys<BookmarkInfo>>): 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<BookmarkInfo, WritableKeys<BookmarkDirectory>>) : BookmarkDirectory {
createDirectory(properties: Pick<BookmarkInfo, WritableKeys<BookmarkDirectory>>): 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<BookmarkBase>) {
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;
}
});

View File

@ -364,7 +364,7 @@ export class Settings {
static readonly KEY_I18N_DEFAULT_REPOSITORY: ValuedRegistryKey<string> = {
key: "i18n.default_repository",
valueType: "string",
defaultValue: "https://web.teaspeak.de/i18n/"
defaultValue: "i18n/"
};
/* Default client states */

View File

@ -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<ConnectUiVariables>) {7
constructor(uiVariables: UiVariableProvider<ConnectUiVariables>) {
7
this.uiEvents = new Registry<ConnectUiEvents>();
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;
}

View File

@ -30,9 +30,9 @@ interface ChatBoxEvents {
}
const LastUsedEmoji = () => {
const le = new Emoji({ id: 'smiley', set: 'native' });
return le.component;
// const le = new Emoji({ id: 'smiley', set: 'native' });
// return le.component;
return (<p>+*+</p>)
}
const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {