diff --git a/asm/CMakeLists.txt b/asm/CMakeLists.txt index 5a5179cc..4c93ed2a 100644 --- a/asm/CMakeLists.txt +++ b/asm/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "") #Override some config values from the parent proje set(CMAKE_CXX_COMPILER "emcc") set(CMAKE_C_COMPILER "emcc") set(CMAKE_C_LINK_EXECUTABLE "emcc") -set(CMAKE_CXX_FLAGS "-O3 --llvm-lto 1 --memory-init-file 0 -s WASM=1") #-s ASSERTIONS=2 -s ALLOW_MEMORY_GROWTH=1 -O3 +set(CMAKE_CXX_FLAGS "-O2 --llvm-lto 1 --memory-init-file 0 -s WASM=1") #-s ASSERTIONS=2 -s ALLOW_MEMORY_GROWTH=1 -O3 set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_EXE_LINKER_FLAGS "-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\", \"Pointer_stringify\"]'") # add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) diff --git a/auth/auth.php b/auth/auth.php index 3d5cf593..0fc1df7d 100644 --- a/auth/auth.php +++ b/auth/auth.php @@ -182,6 +182,10 @@ die(json_encode($response)); } + function logged_in() { + return testSession() == 0; + } + function logout() { $app = getXF(); @@ -245,7 +249,5 @@ logout(); } else die("unknown type!"); } else if(isset($_POST)) { - error_log("Got auth> request!"); - } - -error_log("Got auth request!"); \ No newline at end of file + error_log("Got auth request!"); + } \ No newline at end of file diff --git a/index.php b/index.php index 62afa0de..2b6d1717 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,7 @@ $localhost = true; } if (!$localhost || $testXF) { - redirectOnInvalidSession(); + //redirectOnInvalidSession(); } ?> @@ -183,10 +183,18 @@
\ No newline at end of file diff --git a/js/Identity.ts b/js/Identity.ts index 6f193234..5c625377 100644 --- a/js/Identity.ts +++ b/js/Identity.ts @@ -63,6 +63,8 @@ interface Identity { name() : string; uid() : string; type() : IdentitifyType; + + valid() : boolean; } class TeamSpeakIdentity implements Identity { @@ -97,6 +99,8 @@ class TeamSpeakIdentity implements Identity { publicKey() : string { return TSIdentityHelper.unwarpString(TSIdentityHelper.funcationPublicKey(this.handle)); } + + valid() : boolean { return true; } } class TeaForumIdentity implements Identity { @@ -104,6 +108,10 @@ class TeaForumIdentity implements Identity { readonly identityDataJson: string; readonly identitySign: string; + valid() : boolean { + return this.identityData.length > 0 && this.identityDataJson.length > 0 && this.identitySign.length > 0; + } + constructor(data: string, sign: string) { this.identityDataJson = data; this.identityData = JSON.parse(this.identityDataJson); diff --git a/js/codec/CodecWrapper.ts b/js/codec/CodecWrapper.ts index 1889b13e..7d0c143a 100644 --- a/js/codec/CodecWrapper.ts +++ b/js/codec/CodecWrapper.ts @@ -113,7 +113,6 @@ class CodecWrapper extends BasicCodec { for (let channel = 0; channel < this.channelCount; channel++) buffer[offset * this.channelCount + channel] = data.getChannelData(channel)[offset]; } - //FIXME test if this is right! this.sendWorkerMessage({ command: "encodeSamples", @@ -143,7 +142,7 @@ class CodecWrapper extends BasicCodec { private sendWorkerMessage(message: any, transfare?: any[]) { message["timestamp"] = Date.now(); - this._worker.postMessage(JSON.stringify(message), transfare); + this._worker.postMessage(message, transfare); } private onWorkerMessage(message: any) { @@ -192,7 +191,7 @@ class CodecWrapper extends BasicCodec { this._workerCallbackResolve = resolve; this._worker = new Worker(settings.static("worker_directory", "js/workers/") + "WorkerCodec.js"); - this._worker.onmessage = event => this.onWorkerMessage(JSON.parse(event.data)); + this._worker.onmessage = event => this.onWorkerMessage(event.data); }); } } \ No newline at end of file diff --git a/js/main.ts b/js/main.ts index b28f0cbe..c9f41170 100644 --- a/js/main.ts +++ b/js/main.ts @@ -54,7 +54,7 @@ function main() { if(settings.static("default_connect_url")) { switch (settings.static("default_connect_type")) { case "teaforo": - if(forumIdentity) + if(forumIdentity.valid()) globalClient.startConnection(settings.static("default_connect_url"), forumIdentity); else Modals.spawnConnectModal(settings.static("default_connect_url"), IdentitifyType.TEAFORO); @@ -62,7 +62,7 @@ function main() { case "teamspeak": let connectIdentity = TSIdentityHelper.loadIdentity(settings.global("connect_identity_teamspeak_identity", "")); - if(!connectIdentity) + if(!connectIdentity || !connectIdentity.valid()) Modals.spawnConnectModal(settings.static("default_connect_url"), IdentitifyType.TEAMSPEAK); else globalClient.startConnection(settings.static("default_connect_url"), connectIdentity); diff --git a/js/workers/codec/CodecWorker.ts b/js/workers/codec/CodecWorker.ts index fcb7a7f3..4875d1f3 100644 --- a/js/workers/codec/CodecWorker.ts +++ b/js/workers/codec/CodecWorker.ts @@ -17,8 +17,8 @@ enum CodecWorkerType { let codecInstance: CodecWorker; -onmessage = function(e) { - let data = JSON.parse(e.data); +onmessage = function(e: MessageEvent) { + let data = e.data; let res: any = {}; res.token = data.token; @@ -97,7 +97,6 @@ function printMessageToServerTab(message: string) { declare function postMessage(message: any): void; function sendMessage(message: any, origin?: string){ - //console.log(prefix + " Send to main: %o", message); message["timestamp"] = Date.now(); - postMessage(JSON.stringify(message)); + postMessage(message); } \ No newline at end of file