From 97edf1b003c2d8655686c51d4496078a02e00c22 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Wed, 2 Dec 2020 18:32:58 +0100 Subject: [PATCH] Some minor fixes --- installer/build.ts | 4 +++- jenkins/create_build.sh | 2 +- modules/core/MultiInstanceHandler.ts | 9 ++++---- modules/core/app-updater/index.ts | 1 - modules/core/main-window/index.ts | 22 +++---------------- .../client-updater/controller/ClientUpdate.ts | 3 +-- .../main-window/controller/MainWindow.ts | 4 ++++ package.json | 2 +- 8 files changed, 18 insertions(+), 29 deletions(-) diff --git a/installer/build.ts b/installer/build.ts index 99aae5f..8a747d6 100644 --- a/installer/build.ts +++ b/installer/build.ts @@ -43,6 +43,7 @@ options.protocols = [{name: "TeaSpeak - Connect", schemes: ["teaserver"]}]; options.overwrite = true; options.derefSymlinks = true; options.buildVersion = version.toString(true); +options.asar = true; interface ProjectEntry { type: ProjectEntryType; @@ -112,13 +113,14 @@ project_files.push({ if(process.argv.length < 4) { console.error("Missing process argument:"); - console.error(" "); + console.error(" "); process.exit(1); } switch (process.argv[3]) { case "release": case "beta": + case "nightly": break; default: diff --git a/jenkins/create_build.sh b/jenkins/create_build.sh index 1c8e690..90ac2ea 100755 --- a/jenkins/create_build.sh +++ b/jenkins/create_build.sh @@ -123,4 +123,4 @@ function deploy_client() { #compile_scripts #compile_native package_client -#deploy_client +deploy_client diff --git a/modules/core/MultiInstanceHandler.ts b/modules/core/MultiInstanceHandler.ts index d83bebc..1596a19 100644 --- a/modules/core/MultiInstanceHandler.ts +++ b/modules/core/MultiInstanceHandler.ts @@ -1,10 +1,11 @@ import { app } from "electron"; -import { mainWindow } from "./main-window"; +import {getMainWindow} from "./windows/main-window/controller/MainWindow"; export function handleSecondInstanceCall(argv: string[], _workingDirectory: string) { const original_args = argv.slice(1).filter(e => !e.startsWith("--original-process-start-time=") && e != "--allow-file-access-from-files"); console.log("Second instance: %o", original_args); + const mainWindow = getMainWindow() if(!mainWindow) { console.warn("Ignoring second instance call because we haven't yet started"); return; @@ -15,10 +16,10 @@ export function handleSecondInstanceCall(argv: string[], _workingDirectory: stri } export function execute_connect_urls(argv: string[]) { - const connect_urls = argv.filter(e => e.startsWith("teaclient://")); - for(const url of connect_urls) { + const connectUrls = argv.filter(e => e.startsWith("teaclient://")); + for(const url of connectUrls) { console.log("Received connect url: %s", url); - mainWindow.webContents.send('connect', url); + getMainWindow().webContents.send('connect', url); } } diff --git a/modules/core/app-updater/index.ts b/modules/core/app-updater/index.ts index 3fcbf85..b2cb592 100644 --- a/modules/core/app-updater/index.ts +++ b/modules/core/app-updater/index.ts @@ -116,7 +116,6 @@ export async function fetchRemoteUpdateData() : Promise { export async function availableRemoteChannels() : Promise { const versions = (await fetchRemoteUpdateData()).versions.map(e => e.channel); - versions.push("beta"); return [...new Set(versions)]; } diff --git a/modules/core/main-window/index.ts b/modules/core/main-window/index.ts index 103bd27..08afe15 100644 --- a/modules/core/main-window/index.ts +++ b/modules/core/main-window/index.ts @@ -5,10 +5,6 @@ export let is_debug: boolean; export let allow_dev_tools: boolean; import {Arguments, processArguments} from "../../shared/process-arguments"; -import * as url from "url"; -import {loadWindowBounds, startTrackWindowBounds} from "../../shared/window"; -import {referenceApp, dereferenceApp} from "../AppInstance"; -import {closeURLPreview, openURLPreview} from "../url-preview"; import { getLoaderWindow, hideAppLoaderWindow, @@ -17,20 +13,16 @@ import { } from "../windows/app-loader/controller/AppLoader"; import {loadUiPack} from "../ui-loader/Loader"; import {loadLocalUiCache} from "../ui-loader/Cache"; -import {showMainWindow} from "../windows/main-window/controller/MainWindow"; +import {closeMainWindow, showMainWindow} from "../windows/main-window/controller/MainWindow"; import {showUpdateWindow} from "../windows/client-updater/controller/ClientUpdate"; import { - clientUpdateChannel, currentClientVersion, availableClientUpdate, setClientUpdateChannel, initializeAppUpdater } from "../app-updater"; import * as app_updater from "../app-updater"; - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the JavaScript object is garbage collected. -export let mainWindow: BrowserWindow = null; +import {referenceApp} from "../AppInstance"; export async function execute() { console.log("Main app executed!"); @@ -50,10 +42,6 @@ export async function execute() { const version = await app_updater.currentClientVersion(); global["app_version_client"] = version.toString(); - /* FIXME! */ - await showUpdateWindow(); - return; - setAppLoaderStatus("Checking for updates", .1); try { if(processArguments.has_value(Arguments.UPDATER_CHANNEL)) { @@ -101,11 +89,7 @@ export async function execute() { hideAppLoaderWindow(); console.error("Failed to load ui: %o", error); - if(mainWindow) { - mainWindow.close(); - mainWindow = undefined; - } - + closeMainWindow(true); await dialog.showMessageBox({ type: "error", buttons: ["exit"], diff --git a/modules/core/windows/client-updater/controller/ClientUpdate.ts b/modules/core/windows/client-updater/controller/ClientUpdate.ts index df0781a..967bdff 100644 --- a/modules/core/windows/client-updater/controller/ClientUpdate.ts +++ b/modules/core/windows/client-updater/controller/ClientUpdate.ts @@ -9,10 +9,9 @@ import { newestRemoteClientVersion, prepareUpdateExecute, setClientUpdateChannel, UpdateVersion } from "../../../app-updater"; -import {mainWindow} from "../../../main-window"; import {closeMainWindow} from "../../main-window/controller/MainWindow"; -const kDeveloperTools = true; +const kDeveloperTools = false; let windowInstance: BrowserWindow; let windowSpawnPromise: Promise; diff --git a/modules/core/windows/main-window/controller/MainWindow.ts b/modules/core/windows/main-window/controller/MainWindow.ts index 382cc52..aeb758a 100644 --- a/modules/core/windows/main-window/controller/MainWindow.ts +++ b/modules/core/windows/main-window/controller/MainWindow.ts @@ -108,4 +108,8 @@ export function closeMainWindow(force: boolean) { if(force) { windowInstance?.destroy(); } +} + +export function getMainWindow() : BrowserWindow { + return windowInstance; } \ No newline at end of file diff --git a/package.json b/package.json index 04108a8..fa84f9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "TeaClient", - "version": "1.5.0", + "version": "1.5.0-1", "description": "", "main": "main.js", "scripts": {