Some opus improvements and removed the required login

This commit is contained in:
WolverinDEV 2018-06-27 15:53:03 +02:00
parent a733779537
commit abf32e114b
7 changed files with 34 additions and 18 deletions

View file

@ -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)

View file

@ -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!");
error_log("Got auth request!");
}

View file

@ -20,7 +20,7 @@
$localhost = true;
}
if (!$localhost || $testXF) {
redirectOnInvalidSession();
//redirectOnInvalidSession();
}
?>
@ -183,10 +183,18 @@
<div style="height: 100px"></div>
</body>
<footer>
<div class="container">
<div class="container" style="display: flex; flex-direction: row; align-content: space-between;">
<div style="align-self: center; position: fixed; left: 5px;">Open source on <a href="https://github.com/TeaSpeak/TeaSpeak-Web" style="display: inline-block; position: relative">github.com</a></div>
<div style="align-self: center;">TeaSpeak Web client by WolverinDEV</div>
<div style="align-self: center; position: fixed; right: 5px;"><a
href="<?php echo authPath() . "auth.php?type=logout"; ?>">logout</a></div>
<div style="align-self: center; position: fixed; right: 5px;">
<?php
if(logged_in()) {
?> <a href="<?php echo authPath() . "auth.php?type=logout"; ?>">logout</a> <?php
} else {
?> <a href="<?php echo authPath() . "login.php"; ?>">Login</a> via the TeaSpeak forum. <?php
}
?>
</div>
</div>
</footer>
</html>

View file

@ -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);

View file

@ -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);
});
}
}

View file

@ -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);

View file

@ -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);
}