From 26606605fbed687b3b67ba0b6fe951fda143a632 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 9 Oct 2018 13:40:38 +0200 Subject: [PATCH] Some small changes and fixes --- package.json | 1 + setup.md | 10 ++++++++-- shared/js/connection.ts | 16 ++++++++++++---- shared/js/load.ts | 2 +- shared/js/workers/compile.sh | 2 -- 5 files changed, 22 insertions(+), 9 deletions(-) delete mode 100755 shared/js/workers/compile.sh diff --git a/package.json b/package.json index 19beed1f..cd8d64c9 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "directories": {}, "scripts": { "compile-sass": "sass --update .:.", + "build-worker": "tsc -p shared/js/workers/tsconfig_worker_codec.json", "build-web-app": "tsc -p tsconfig/tsconfig_web_app.json", "build-web-app-release": "tsc -p tsconfig/tsconfig_web_app_packaged.json", "build-web-preload": "tsc -p tsconfig/tsconfig_web_preload.json" diff --git a/setup.md b/setup.md index a698eb3c..a9a4e26f 100644 --- a/setup.md +++ b/setup.md @@ -54,7 +54,7 @@ echo "PATH=\"$PATH:`pwd`\"" >> ~/.bashrc ``` # Build TeaWeb -## Close and initialize project +## Clone and initialize project ```bash git clone https://github.com/TeaSpeak/TeaWeb git submodule update --init --recursive --remote --checkout @@ -62,10 +62,16 @@ git submodule update --init --recursive --remote --checkout ## Build native libraries ### Opus +#### Native loader ```bash cd asm ./make_opus.sh ``` +#### Javascript loader +```bash +npm run build-worker +``` + ### Tommath ```bash @@ -90,7 +96,7 @@ emcmake cmake .. emmake make -j 4 ``` -# Now generate project structure +## Now generate project structure ```bash npm install --only=dev ./scripts/build_web_release.sh diff --git a/shared/js/connection.ts b/shared/js/connection.ts index 2a8a0447..f55d2009 100644 --- a/shared/js/connection.ts +++ b/shared/js/connection.ts @@ -331,15 +331,23 @@ class HandshakeHandler { } private handshake_finished() { - this.connection.sendCommand("clientinit", { + let data = { //TODO variables! client_nickname: this.name ? this.name : this.identity.name(), client_platform: navigator.platform, client_version: navigator.userAgent, - client_server_password: this.server_password - //client_browser_engine: navigator.product - }).catch(error => { + client_server_password: this.server_password, + client_browser_engine: navigator.product + }; + + if(window.require) { + const os = require('os'); + data.client_version = "TeaClient"; //FIXME get version + data.client_platform = os.platform() + " (" + os.arch() + ")"; + } + + this.connection.sendCommand("clientinit", data).catch(error => { this.connection.disconnect(); if(error instanceof CommandResult) { if(error.id == 1028) { diff --git a/shared/js/load.ts b/shared/js/load.ts index 004c5a0e..e67f7f09 100644 --- a/shared/js/load.ts +++ b/shared/js/load.ts @@ -244,7 +244,7 @@ function loadSide() { if(window.require !== undefined) { console.log("Loading node specific things"); const remote = require('electron').remote; - module.paths.push(remote.app.getAppPath()); + module.paths.push(remote.app.getAppPath() + "/app"); module.paths.push(remote.getGlobal("browser-root") + "js/"); window.$ = require("assets/jquery.min.js"); require("native/loader_adapter.js"); diff --git a/shared/js/workers/compile.sh b/shared/js/workers/compile.sh deleted file mode 100755 index 194dce09..00000000 --- a/shared/js/workers/compile.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -/usr/local/bin/tsc -p tsconfig_worker_codec.json