Some opus improvements and removed the required login
This commit is contained in:
parent
a733779537
commit
abf32e114b
7 changed files with 34 additions and 18 deletions
|
@ -4,7 +4,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "") #Override some config values from the parent proje
|
||||||
set(CMAKE_CXX_COMPILER "emcc")
|
set(CMAKE_CXX_COMPILER "emcc")
|
||||||
set(CMAKE_C_COMPILER "emcc")
|
set(CMAKE_C_COMPILER "emcc")
|
||||||
set(CMAKE_C_LINK_EXECUTABLE "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_VERBOSE_MAKEFILE ON)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\", \"Pointer_stringify\"]'") #
|
set(CMAKE_EXE_LINKER_FLAGS "-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\", \"Pointer_stringify\"]'") #
|
||||||
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
|
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
|
||||||
|
|
|
@ -182,6 +182,10 @@
|
||||||
die(json_encode($response));
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logged_in() {
|
||||||
|
return testSession() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
function logout()
|
function logout()
|
||||||
{
|
{
|
||||||
$app = getXF();
|
$app = getXF();
|
||||||
|
@ -245,7 +249,5 @@
|
||||||
logout();
|
logout();
|
||||||
} else die("unknown type!");
|
} else die("unknown type!");
|
||||||
} else if(isset($_POST)) {
|
} else if(isset($_POST)) {
|
||||||
error_log("Got auth> request!");
|
error_log("Got auth request!");
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log("Got auth request!");
|
|
16
index.php
16
index.php
|
@ -20,7 +20,7 @@
|
||||||
$localhost = true;
|
$localhost = true;
|
||||||
}
|
}
|
||||||
if (!$localhost || $testXF) {
|
if (!$localhost || $testXF) {
|
||||||
redirectOnInvalidSession();
|
//redirectOnInvalidSession();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -183,10 +183,18 @@
|
||||||
<div style="height: 100px"></div>
|
<div style="height: 100px"></div>
|
||||||
</body>
|
</body>
|
||||||
<footer>
|
<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;">TeaSpeak Web client by WolverinDEV</div>
|
||||||
<div style="align-self: center; position: fixed; right: 5px;"><a
|
<div style="align-self: center; position: fixed; right: 5px;">
|
||||||
href="<?php echo authPath() . "auth.php?type=logout"; ?>">logout</a></div>
|
<?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>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</html>
|
</html>
|
|
@ -63,6 +63,8 @@ interface Identity {
|
||||||
name() : string;
|
name() : string;
|
||||||
uid() : string;
|
uid() : string;
|
||||||
type() : IdentitifyType;
|
type() : IdentitifyType;
|
||||||
|
|
||||||
|
valid() : boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TeamSpeakIdentity implements Identity {
|
class TeamSpeakIdentity implements Identity {
|
||||||
|
@ -97,6 +99,8 @@ class TeamSpeakIdentity implements Identity {
|
||||||
publicKey() : string {
|
publicKey() : string {
|
||||||
return TSIdentityHelper.unwarpString(TSIdentityHelper.funcationPublicKey(this.handle));
|
return TSIdentityHelper.unwarpString(TSIdentityHelper.funcationPublicKey(this.handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
valid() : boolean { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class TeaForumIdentity implements Identity {
|
class TeaForumIdentity implements Identity {
|
||||||
|
@ -104,6 +108,10 @@ class TeaForumIdentity implements Identity {
|
||||||
readonly identityDataJson: string;
|
readonly identityDataJson: string;
|
||||||
readonly identitySign: string;
|
readonly identitySign: string;
|
||||||
|
|
||||||
|
valid() : boolean {
|
||||||
|
return this.identityData.length > 0 && this.identityDataJson.length > 0 && this.identitySign.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(data: string, sign: string) {
|
constructor(data: string, sign: string) {
|
||||||
this.identityDataJson = data;
|
this.identityDataJson = data;
|
||||||
this.identityData = JSON.parse(this.identityDataJson);
|
this.identityData = JSON.parse(this.identityDataJson);
|
||||||
|
|
|
@ -113,7 +113,6 @@ class CodecWrapper extends BasicCodec {
|
||||||
for (let channel = 0; channel < this.channelCount; channel++)
|
for (let channel = 0; channel < this.channelCount; channel++)
|
||||||
buffer[offset * this.channelCount + channel] = data.getChannelData(channel)[offset];
|
buffer[offset * this.channelCount + channel] = data.getChannelData(channel)[offset];
|
||||||
}
|
}
|
||||||
//FIXME test if this is right!
|
|
||||||
|
|
||||||
this.sendWorkerMessage({
|
this.sendWorkerMessage({
|
||||||
command: "encodeSamples",
|
command: "encodeSamples",
|
||||||
|
@ -143,7 +142,7 @@ class CodecWrapper extends BasicCodec {
|
||||||
|
|
||||||
private sendWorkerMessage(message: any, transfare?: any[]) {
|
private sendWorkerMessage(message: any, transfare?: any[]) {
|
||||||
message["timestamp"] = Date.now();
|
message["timestamp"] = Date.now();
|
||||||
this._worker.postMessage(JSON.stringify(message), transfare);
|
this._worker.postMessage(message, transfare);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onWorkerMessage(message: any) {
|
private onWorkerMessage(message: any) {
|
||||||
|
@ -192,7 +191,7 @@ class CodecWrapper extends BasicCodec {
|
||||||
this._workerCallbackResolve = resolve;
|
this._workerCallbackResolve = resolve;
|
||||||
|
|
||||||
this._worker = new Worker(settings.static("worker_directory", "js/workers/") + "WorkerCodec.js");
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,7 +54,7 @@ function main() {
|
||||||
if(settings.static("default_connect_url")) {
|
if(settings.static("default_connect_url")) {
|
||||||
switch (settings.static("default_connect_type")) {
|
switch (settings.static("default_connect_type")) {
|
||||||
case "teaforo":
|
case "teaforo":
|
||||||
if(forumIdentity)
|
if(forumIdentity.valid())
|
||||||
globalClient.startConnection(settings.static("default_connect_url"), forumIdentity);
|
globalClient.startConnection(settings.static("default_connect_url"), forumIdentity);
|
||||||
else
|
else
|
||||||
Modals.spawnConnectModal(settings.static("default_connect_url"), IdentitifyType.TEAFORO);
|
Modals.spawnConnectModal(settings.static("default_connect_url"), IdentitifyType.TEAFORO);
|
||||||
|
@ -62,7 +62,7 @@ function main() {
|
||||||
|
|
||||||
case "teamspeak":
|
case "teamspeak":
|
||||||
let connectIdentity = TSIdentityHelper.loadIdentity(settings.global("connect_identity_teamspeak_identity", ""));
|
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);
|
Modals.spawnConnectModal(settings.static("default_connect_url"), IdentitifyType.TEAMSPEAK);
|
||||||
else
|
else
|
||||||
globalClient.startConnection(settings.static("default_connect_url"), connectIdentity);
|
globalClient.startConnection(settings.static("default_connect_url"), connectIdentity);
|
||||||
|
|
|
@ -17,8 +17,8 @@ enum CodecWorkerType {
|
||||||
|
|
||||||
let codecInstance: CodecWorker;
|
let codecInstance: CodecWorker;
|
||||||
|
|
||||||
onmessage = function(e) {
|
onmessage = function(e: MessageEvent) {
|
||||||
let data = JSON.parse(e.data);
|
let data = e.data;
|
||||||
|
|
||||||
let res: any = {};
|
let res: any = {};
|
||||||
res.token = data.token;
|
res.token = data.token;
|
||||||
|
@ -97,7 +97,6 @@ function printMessageToServerTab(message: string) {
|
||||||
|
|
||||||
declare function postMessage(message: any): void;
|
declare function postMessage(message: any): void;
|
||||||
function sendMessage(message: any, origin?: string){
|
function sendMessage(message: any, origin?: string){
|
||||||
//console.log(prefix + " Send to main: %o", message);
|
|
||||||
message["timestamp"] = Date.now();
|
message["timestamp"] = Date.now();
|
||||||
postMessage(JSON.stringify(message));
|
postMessage(message);
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue