diff --git a/installer/package_linux.ts b/installer/package_linux.ts index a37bda8..a1bd7eb 100644 --- a/installer/package_linux.ts +++ b/installer/package_linux.ts @@ -1,4 +1,4 @@ -import * as installer from "electron-installer-debian"; +const installer = require("electron-installer-debian"); import * as packager from "./package"; import {parse_version, Version} from "../modules/shared/version"; diff --git a/installer/tsconfig_linux.json b/installer/tsconfig_linux.json new file mode 100644 index 0000000..87dbbc8 --- /dev/null +++ b/installer/tsconfig_linux.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "sourceMap": true, + "moduleResolution": "node" + }, + "include": [ + "./deploy/", + "build.ts", + "package.ts", + "package_linux.ts" + ] +} \ No newline at end of file diff --git a/installer/tsconfig_windows.json b/installer/tsconfig_windows.json new file mode 100644 index 0000000..87dbbc8 --- /dev/null +++ b/installer/tsconfig_windows.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "sourceMap": true, + "moduleResolution": "node" + }, + "include": [ + "./deploy/", + "build.ts", + "package.ts", + "package_linux.ts" + ] +} \ No newline at end of file diff --git a/jenkins/create_build.sh b/jenkins/create_build.sh new file mode 100755 index 0000000..db5e491 --- /dev/null +++ b/jenkins/create_build.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +cd "../$(dirname $0)" + +project_name="__build_teaclient" +source ../scripts/build_helper.sh + +function install_npm() { + begin_task "${project_name}_update" "Installing NPM" + npm install + check_err_exit ${project_name} "Failed to install nodejs files!" + npm update + check_err_exit ${project_name} "Failed to update nodejs files!" + begin_task "${project_name}_update" "NPM installed" +} + +function compile_scripts() { + begin_task "${project_name}_tsc_sass" "Compiling TypeScript & SASS" + npm run compile-tsc -- -p modules/tsconfig_main.json + npm run compile-tsc -- -p modules/tsconfig_renderer.json + npm run compile-tsc -- -p installer/tsconfig_linux.json + check_err_exit ${project_name} "Failed to compile typescript files!" + + npm run compile-sass + check_err_exit ${project_name} "Failed to compile sass files!" + begin_task "${project_name}_tsc_sass" "TypeScript & SASS compiled" + echo "" +} + +function compile_native() { + begin_task "${project_name}_native" "Compiling native extensions" + + local build_path="native/out/${build_os_type}_${build_os_arch}/" + [[ -d ${build_path} ]] && rm -r ${build_path} + mkdir -p ${build_path} + check_err_exit ${project_name} "Failed to create build directory!" + + cd ${build_path} + check_err_exit ${project_name} "Failed to enter build directory!" + + cmake ../../ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MODULE_PATH="/home/wolverindev/TeaSpeak-Client/cmake/" -DCMAKE_PLATFORM_INCLUDE="/home/wolverindev/TeaSpeak-Client/cmake/config/tearoot-client.cmake" -DLIBRARY_PATH="/home/wolverindev/TeaSpeak-Client/third_party/" + check_err_exit ${project_name} "Failed create build targets!" + + cmake --build `pwd` --target teaclient_connection -- -j 12 + check_err_exit ${project_name} "Failed build teaclient connection!" + + cmake --build `pwd` --target teaclient_crash_handler -- -j 12 + check_err_exit ${project_name} "Failed build teaclient crash handler!" + + cmake --build `pwd` --target teaclient_ppt -- -j 12 + check_err_exit ${project_name} "Failed build teaclient ppt!" + + begin_task "${project_name}_native" "Native extensions compiled" +} + +install_npm +compile_scripts +compile_native \ No newline at end of file diff --git a/jenkins/deploy_build.sh b/jenkins/deploy_build.sh new file mode 100755 index 0000000..cb50815 --- /dev/null +++ b/jenkins/deploy_build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +cd "../$(dirname $0)" +if [[ "${teaclient_deploy_secret}" == "" ]]; then + echo "Missing deploy secret!" + exit 1 +fi + +if [[ $# -lt 1 ]]; then + echo "Missing build channel!" + exit 1 +fi + +npm run build-linux-64 +if [[ $? -ne 0 ]]; then + echo "Failed to build project" +fi + +npm run package-linux-64 $1 +if [[ $? -ne 0 ]]; then + echo "Failed to package project" +fi \ No newline at end of file diff --git a/modules/core/app-updater/index.ts b/modules/core/app-updater/index.ts index d398413..464614e 100644 --- a/modules/core/app-updater/index.ts +++ b/modules/core/app-updater/index.ts @@ -19,7 +19,7 @@ import {Headers} from "tar-stream"; import {Arguments, process_args} from "../../shared/process-arguments"; import * as electron from "electron"; import {PassThrough} from "stream"; -import {prevent_instant_close} from "../../core/main_window"; +import * as _main_windows from "../main_window"; import ErrnoException = NodeJS.ErrnoException; import {EPERM} from "constants"; import * as winmgr from "../window"; @@ -484,7 +484,7 @@ export async function execute_update(update_file: string, restart_callback: (cal console.debug("Extracting entry %s of type %s to %s", header.name, header.type, target_file); if(header.type == "directory") { - await util.promisify(ofs.mkdir)(target_file, {recursive: true}); + await fs.mkdirp(target_file); } else if(header.type == "file") { { const directory = path.parse(target_file).dir; @@ -492,7 +492,7 @@ export async function execute_update(update_file: string, restart_callback: (cal if(!(await util.promisify(ofs.exists)(directory)) || !(await util.promisify(ofs.stat)(directory)).isDirectory()) { console.log("Creating directory %s", directory); try { - await util.promisify(ofs.mkdir)(directory, {recursive: true}); + await fs.mkdirp(directory); } catch(error) { console.warn("failed to create directory for file %s", header.type); } @@ -801,7 +801,7 @@ export async function execute_graphical(channel: string, ask_install: boolean) : try { await execute_update(update_path, callback => { - prevent_instant_close = true; + _main_windows.set_prevent_instant_close(true); update_restart_pending = true; window.close(); callback(); diff --git a/modules/core/main_window.ts b/modules/core/main_window.ts index 0c0f1ec..d5f0f3c 100644 --- a/modules/core/main_window.ts +++ b/modules/core/main_window.ts @@ -3,6 +3,10 @@ import * as electron from "electron"; import * as winmgr from "./window"; export let prevent_instant_close: boolean = true; +export function set_prevent_instant_close(flag: boolean) { + prevent_instant_close = flag; +} + export let is_debug: boolean; export let allow_dev_tools: boolean; diff --git a/modules/core/teaspeak-forum/index.ts b/modules/core/teaspeak-forum/index.ts index ad12236..c799d88 100644 --- a/modules/core/teaspeak-forum/index.ts +++ b/modules/core/teaspeak-forum/index.ts @@ -4,10 +4,17 @@ import * as fs from "fs-extra"; import {BrowserWindow, ipcMain as ipc} from "electron"; import {Arguments, process_args} from "../../shared/process-arguments"; -import UserData = forum.UserData; import {main_window} from "../main_window"; import * as winmgr from "../window"; +export interface UserData { + session_id: string; + username: string; + + application_data: string; + application_data_sign: string; +} + let current_window: BrowserWindow; let _current_data: UserData; diff --git a/modules/core/teaspeak-forum/ui/index.ts b/modules/core/teaspeak-forum/ui/index.ts index f509c68..639f4e3 100644 --- a/modules/core/teaspeak-forum/ui/index.ts +++ b/modules/core/teaspeak-forum/ui/index.ts @@ -1,4 +1,6 @@ -window.$ = require("jquery"); +import {UserData} from "../index"; + +(window as any).$ = require("jquery"); { const request = require('request'); const util = require('util'); diff --git a/modules/renderer/connection/ServerConnection.ts b/modules/renderer/connection/ServerConnection.ts index 4cdb713..4b89b22 100644 --- a/modules/renderer/connection/ServerConnection.ts +++ b/modules/renderer/connection/ServerConnection.ts @@ -259,7 +259,7 @@ export namespace _connection { data[0]["return_code"] = return_code; console.log("Sending %s (%o)", command, data); - const promise = new Promise((resolve, reject) => { + const promise = new Promise((resolve, reject) => { const timeout_id = setTimeout(() => { delete this._return_listener[return_code]; reject("timeout"); diff --git a/modules/renderer/dns/dns_resolver.ts b/modules/renderer/dns/dns_resolver.ts index 9b0ccb5..329f2b2 100644 --- a/modules/renderer/dns/dns_resolver.ts +++ b/modules/renderer/dns/dns_resolver.ts @@ -76,7 +76,7 @@ namespace _dns { const aaaa_response: string[] | undefined | null = await async_resolve_aaaa(address, options.timeout).catch(error => { options.log("AAAA record resolved unsuccessfully (%o)", error); return Promise.resolve(undefined); - }); + }) as any; if(typeof(aaaa_response) !== "undefined") { @@ -95,7 +95,7 @@ namespace _dns { const a_response: string[] | undefined | null = await async_resolve_a(address, options.timeout).catch(error => { options.log("A record resolved unsuccessfully (%o)", error); return Promise.resolve(undefined); - }); + }) as any; if(typeof(a_response) !== "undefined") { if(!a_response || a_response.length == 0) diff --git a/modules/shared/process-arguments/minimist.ts b/modules/shared/process-arguments/minimist.ts index 990b686..7bdf35d 100644 --- a/modules/shared/process-arguments/minimist.ts +++ b/modules/shared/process-arguments/minimist.ts @@ -107,7 +107,7 @@ const parse = (args: string[], options: minimist.Opts) => { flags.strings[key] || flags.bools[key] || aliases[key]; } - function setArg (key, val, arg) { + function setArg (key, val, arg?) { if (arg && flags.unknownFn && !argDefined(key, arg)) { if (flags.unknownFn(arg) === false) return; } @@ -156,7 +156,7 @@ const parse = (args: string[], options: minimist.Opts) => { // http://stackoverflow.com/a/1068308/13216 var m = arg.match(/^--([^=]+)=([\s\S]*)$/); var key = m[1]; - var value = m[2]; + var value: any = m[2]; if (flags.bools[key]) { value = value !== 'false'; } diff --git a/modules/tsconfig_main.json b/modules/tsconfig_main.json new file mode 100644 index 0000000..94712dc --- /dev/null +++ b/modules/tsconfig_main.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "sourceMap": true, + "moduleResolution": "node" + }, + "include": [ + "./core", + "./crash_handler", + "./shared", + "../main.ts" + ], + "exclude": [ + "node_modules", + "declarations", + "app/dummy-declarations/*.d.ts" + ] +} \ No newline at end of file diff --git a/modules/tsconfig_renderer.json b/modules/tsconfig_renderer.json new file mode 100644 index 0000000..02c60b1 --- /dev/null +++ b/modules/tsconfig_renderer.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "sourceMap": true, + "moduleResolution": "node" + }, + "include": [ + "./renderer", + "./crash_handler", + "./shared", + + "../native/*/exports/" + ], + "exclude": [ + "node_modules", + "declarations", + "app/dummy-declarations/*.d.ts" + ] +} \ No newline at end of file diff --git a/native/serverconnection/CMakeLists.txt b/native/serverconnection/CMakeLists.txt index daae3c4..f1a68b0 100644 --- a/native/serverconnection/CMakeLists.txt +++ b/native/serverconnection/CMakeLists.txt @@ -114,13 +114,14 @@ include_directories(${opus_INCLUDE_DIR}) find_package(spdlog REQUIRED) +message("Libraries: ${LIBEVENT_LIBRARIES}") set(REQUIRED_LIBRARIES ${TeaSpeak_SharedLib_LIBRARIES_STATIC} ${TomCrypt_LIBRARIES_STATIC} ${TomMath_LIBRARIES_STATIC} - ${LIBEVENT_STATIC_LIBRARIES} + ${LIBEVENT_LIBRARIES} ${StringVariable_LIBRARIES_STATIC} ${DataPipes_LIBRARIES_STATIC} #Needs to be static because something causes ca bad function call when loaded in electron diff --git a/native/tsconfig.json b/native/tsconfig.json deleted file mode 100644 index 70482a1..0000000 --- a/native/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -/* General file with least possible errors. This is just for your IDE (PHP-Storm for example) */ -{ - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "sourceMap": true - }, - "exclude": [ ] -} \ No newline at end of file diff --git a/package.json b/package.json index 5b03128..6d46ba7 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,9 @@ "asar": "^2.0.1", "cmake-js": "^4.0.1", "ejs": "^2.6.2", - "electron-packager": "^14.0.0", - "nodemon": "^1.19.1" + "electron-packager": "^14.0.1", + "nodemon": "^1.19.1", + "typescript": "^3.5.2" }, "dependencies": { "@types/minimist": "^1.2.0", @@ -54,7 +55,7 @@ "nan": "^2.14.0", "node-ssh": "^6.0.0", "only": "0.0.2", - "psl": "^1.1.33", + "psl": "^1.2.0", "pure-uuid": "^1.5.7", "request": "^2.47.1", "request-progress": "^3.0.0",