Make it compatible without the auth stuff
This commit is contained in:
parent
e29df918d5
commit
cf321654dc
11 changed files with 36 additions and 12 deletions
|
@ -31,6 +31,7 @@
|
||||||
<link rel="stylesheet" href="css/modals.css" type="text/css">
|
<link rel="stylesheet" href="css/modals.css" type="text/css">
|
||||||
|
|
||||||
<!-- PHP generated properies -->
|
<!-- PHP generated properies -->
|
||||||
|
<!-- localhost:63342/TeaSpeak-Web/index.php?_ijt=o48hmliefjoa8cer8v7mpl98pj&connect_default_host=192.168.43.141 -->
|
||||||
<x-properties id="properties">
|
<x-properties id="properties">
|
||||||
<!-- <x-property key="" value=""/> -->
|
<!-- <x-property key="" value=""/> -->
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -124,6 +124,10 @@ class TSClient {
|
||||||
this.controlBar.updateProperties();
|
this.controlBar.updateProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get connected() : boolean {
|
||||||
|
return !!this.serverConnection && this.serverConnection.connected;
|
||||||
|
}
|
||||||
|
|
||||||
handleDisconnect(type: DisconnectReason, data: any = {}) {
|
handleDisconnect(type: DisconnectReason, data: any = {}) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DisconnectReason.REQUESTED:
|
case DisconnectReason.REQUESTED:
|
||||||
|
@ -132,9 +136,12 @@ class TSClient {
|
||||||
console.error("Could not connect to remote host! Exception");
|
console.error("Could not connect to remote host! Exception");
|
||||||
console.error(data);
|
console.error(data);
|
||||||
|
|
||||||
|
//TODO test for status 1006
|
||||||
createErrorModal(
|
createErrorModal(
|
||||||
"Could not connect",
|
"Could not connect",
|
||||||
"Could not connect to remote host (Connection refused)"
|
"Could not connect to remote host (Connection refused)<br>" +
|
||||||
|
"If you're shure that the remot host is up, than you may not allow unsigned certificates.<br>" +
|
||||||
|
"Click <a href='https://" + this.serverConnection._remoteHost + ":" + this.serverConnection._remotePort + "'>here</a> to accept the remote certificate"
|
||||||
).open();
|
).open();
|
||||||
break;
|
break;
|
||||||
case DisconnectReason.CONNECTION_CLOSED:
|
case DisconnectReason.CONNECTION_CLOSED:
|
||||||
|
|
|
@ -15,7 +15,7 @@ abstract class BasicCodec implements Codec {
|
||||||
this.samplesPerUnit = 960;
|
this.samplesPerUnit = 960;
|
||||||
this._audioContext = new OfflineAudioContext(1, 1024,44100 );
|
this._audioContext = new OfflineAudioContext(1, 1024,44100 );
|
||||||
this._codecSampleRate = codecSampleRate;
|
this._codecSampleRate = codecSampleRate;
|
||||||
this._decodeResampler = new AudioResampler();
|
this._decodeResampler = new AudioResampler(AudioController.globalContext.sampleRate);
|
||||||
this._encodeResampler = new AudioResampler(codecSampleRate);
|
this._encodeResampler = new AudioResampler(codecSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,13 @@ abstract class BasicCodec implements Codec {
|
||||||
cache._chunks.pop_front();
|
cache._chunks.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let encodeBegin = new Date().getTime();
|
||||||
this.encode(buffer).then(result => {
|
this.encode(buffer).then(result => {
|
||||||
if(result instanceof Uint8Array) this.on_encoded_data(result);
|
if(result instanceof Uint8Array) {
|
||||||
|
if(new Date().getTime() - 20 > encodeBegin)
|
||||||
|
console.error("Required time: %d", new Date().getTime() - encodeBegin);
|
||||||
|
this.on_encoded_data(result);
|
||||||
|
}
|
||||||
else console.error("[Codec][" + this.name() + "] Could not encode buffer. Result: " + result);
|
else console.error("[Codec][" + this.name() + "] Could not encode buffer. Result: " + result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ class CodecWrapper extends BasicCodec {
|
||||||
}
|
}
|
||||||
|
|
||||||
private spawnWorker() {
|
private spawnWorker() {
|
||||||
this._worker = new Worker("js/codec/CompiledCodecWorker.js");
|
this._worker = new Worker("js/codec/workers/CompiledCodecWorker.js");
|
||||||
this._worker.onmessage = event => this.onWorkerMessage(JSON.parse(event.data));
|
this._worker.onmessage = event => this.onWorkerMessage(JSON.parse(event.data));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
/usr/local/bin/tsc
|
/usr/local/bin/tsc
|
||||||
|
|
|
@ -6,10 +6,14 @@ try {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
importScripts("../../asm/generated/TeaWeb-Native.js");
|
importScripts("../../asm/generated/TeaWeb-Native.js");
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
importScripts("../../../asm/generated/TeaWeb-Native.js");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Could not load native script!");
|
console.error("Could not load native script!");
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum OpusType {
|
enum OpusType {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ServerConnection {
|
||||||
commandHandler: ConnectionCommandHandler;
|
commandHandler: ConnectionCommandHandler;
|
||||||
|
|
||||||
private _connectTimeoutHandler: NodeJS.Timer = undefined;
|
private _connectTimeoutHandler: NodeJS.Timer = undefined;
|
||||||
|
private _connected: boolean = false;
|
||||||
private _retCodeIdx: number;
|
private _retCodeIdx: number;
|
||||||
private _retListener: ReturnListener<CommandResult>[];
|
private _retListener: ReturnListener<CommandResult>[];
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ class ServerConnection {
|
||||||
this._remotePort = port;
|
this._remotePort = port;
|
||||||
this._handshakeHandler = handshake;
|
this._handshakeHandler = handshake;
|
||||||
this._handshakeHandler.setConnection(this);
|
this._handshakeHandler.setConnection(this);
|
||||||
|
this._connected = false;
|
||||||
chat.serverChat().appendMessage("Connecting to " + host + ":" + port);
|
chat.serverChat().appendMessage("Connecting to " + host + ":" + port);
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
@ -89,12 +90,13 @@ class ServerConnection {
|
||||||
|
|
||||||
this._socket.onopen = () => {
|
this._socket.onopen = () => {
|
||||||
if(this._socket != sockCpy) return;
|
if(this._socket != sockCpy) return;
|
||||||
|
this._connected = true;
|
||||||
this.on_connect();
|
this.on_connect();
|
||||||
};
|
};
|
||||||
|
|
||||||
this._socket.onclose = event => {
|
this._socket.onclose = event => {
|
||||||
if(this._socket != sockCpy) return;
|
if(this._socket != sockCpy) return;
|
||||||
this._client.handleDisconnect(DisconnectReason.CONNECTION_CLOSED, {
|
this._client.handleDisconnect(this._connected ? DisconnectReason.CONNECTION_CLOSED : DisconnectReason.CONNECT_FAILURE, {
|
||||||
code: event.code,
|
code: event.code,
|
||||||
reason: event.reason,
|
reason: event.reason,
|
||||||
event: event
|
event: event
|
||||||
|
@ -132,6 +134,7 @@ class ServerConnection {
|
||||||
future.reject("Connection closed");
|
future.reject("Connection closed");
|
||||||
this._retListener = [];
|
this._retListener = [];
|
||||||
this._retCodeIdx = 0;
|
this._retCodeIdx = 0;
|
||||||
|
this._connected = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace sha {
|
namespace sha {
|
||||||
export function sha1(message: string | ArrayBuffer) : PromiseLike<ArrayBuffer> {
|
export function sha1(message: string | ArrayBuffer) : PromiseLike<ArrayBuffer> {
|
||||||
let buffer = message instanceof ArrayBuffer ? message : new TextEncoder("utf-8").encode(message);
|
let buffer = message instanceof ArrayBuffer ? message : new TextEncoder().encode(message);
|
||||||
return crypto.subtle.digest("SHA-1", buffer);
|
return crypto.subtle.digest("SHA-1", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Settings {
|
||||||
private initializeStatic() {
|
private initializeStatic() {
|
||||||
location.search.substr(1).split("&").forEach(part => {
|
location.search.substr(1).split("&").forEach(part => {
|
||||||
let item = part.split("=");
|
let item = part.split("=");
|
||||||
$.spawn("div")
|
$("<x-property></x-property>")
|
||||||
.attr("key", item[0])
|
.attr("key", item[0])
|
||||||
.attr("value", item[1])
|
.attr("value", item[1])
|
||||||
.appendTo(this._staticPropsTag);
|
.appendTo(this._staticPropsTag);
|
||||||
|
@ -72,7 +72,7 @@ class Settings {
|
||||||
|
|
||||||
static?<T>(key: string, _default?: T) : T {
|
static?<T>(key: string, _default?: T) : T {
|
||||||
let result = this._staticPropsTag.find("[key='" + key + "']");
|
let result = this._staticPropsTag.find("[key='" + key + "']");
|
||||||
return Settings.transformStO(result.length > 0 ? decodeURIComponent(result.attr("value")) : undefined, _default);
|
return Settings.transformStO(result.length > 0 ? decodeURIComponent(result.last().attr("value")) : undefined, _default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class AudioResampler {
|
||||||
}
|
}
|
||||||
|
|
||||||
resample(buffer: AudioBuffer) : Promise<AudioBuffer> {
|
resample(buffer: AudioBuffer) : Promise<AudioBuffer> {
|
||||||
|
console.log("Encode from %i to %i", buffer.sampleRate, this.targetSampleRate);
|
||||||
if(buffer.sampleRate == this.targetSampleRate)
|
if(buffer.sampleRate == this.targetSampleRate)
|
||||||
return new Promise<AudioBuffer>(resolve => resolve(buffer));
|
return new Promise<AudioBuffer>(resolve => resolve(buffer));
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,8 @@ class VoiceConnection {
|
||||||
|
|
||||||
private handleVoiceData(data: AudioBuffer, head: boolean) {
|
private handleVoiceData(data: AudioBuffer, head: boolean) {
|
||||||
if(!this.voiceRecorder) return;
|
if(!this.voiceRecorder) return;
|
||||||
|
if(!this.client.connected) return false;
|
||||||
|
if(this.client.controlBar.muteInput) return;
|
||||||
|
|
||||||
if(head) {
|
if(head) {
|
||||||
this.chunkVPacketId = 0;
|
this.chunkVPacketId = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue