Updated TypeScript to 3.0.3 and some restructuring
parent
5982f477fc
commit
d280ae7679
|
@ -5,7 +5,7 @@ Welcome here! This repository is created with two reasons:
|
||||||
2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.
|
2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.
|
||||||
|
|
||||||
#Requirements
|
#Requirements
|
||||||
1. TypeScript Version 2.8.3
|
1. TypeScript Version 3.0.3
|
||||||
|
|
||||||
#
|
#
|
||||||
To **report an issue**, then find and push the **New Issue** button, fill all the fields you see in a template, and then click the **Submit new issue** button.
|
To **report an issue**, then find and push the **New Issue** button, fill all the fields you see in a template, and then click the **Submit new issue** button.
|
||||||
|
|
|
@ -92,6 +92,12 @@ class Settings extends StaticSettings {
|
||||||
}, 5 * 1000);
|
}, 5 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static_global?<T>(key: string, _default?: T) : T {
|
||||||
|
let _static = this.static<string>(key);
|
||||||
|
if(_static) StaticSettings.transformStO(_static, _default);
|
||||||
|
return this.global<T>(key, _default);
|
||||||
|
}
|
||||||
|
|
||||||
global?<T>(key: string, _default?: T) : T {
|
global?<T>(key: string, _default?: T) : T {
|
||||||
let result = this.cacheGlobal[key];
|
let result = this.cacheGlobal[key];
|
||||||
return StaticSettings.transformStO(result, _default);
|
return StaticSettings.transformStO(result, _default);
|
||||||
|
|
|
@ -152,7 +152,7 @@ class ControlBar {
|
||||||
if(!targetChannel) targetChannel = this.handle.getClient().currentChannel();
|
if(!targetChannel) targetChannel = this.handle.getClient().currentChannel();
|
||||||
let client = this.handle.getClient();
|
let client = this.handle.getClient();
|
||||||
|
|
||||||
this.codec_supported = this.handle.voiceConnection.codecSupported(targetChannel.properties.channel_codec);
|
this.codec_supported = targetChannel ? this.handle.voiceConnection.codecSupported(targetChannel.properties.channel_codec) : true;
|
||||||
this.support_record = this.handle.voiceConnection.voice_send_support();
|
this.support_record = this.handle.voiceConnection.voice_send_support();
|
||||||
this.support_playback = this.handle.voiceConnection.voice_playback_support();
|
this.support_playback = this.handle.voiceConnection.voice_playback_support();
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace Modals {
|
||||||
tag.find(".identity_file").change(function (this: HTMLInputElement) {
|
tag.find(".identity_file").change(function (this: HTMLInputElement) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = function() {
|
reader.onload = function() {
|
||||||
connectIdentity = TSIdentityHelper.loadIdentityFromFileContains(reader.result);
|
connectIdentity = TSIdentityHelper.loadIdentityFromFileContains(reader.result as string);
|
||||||
|
|
||||||
console.log(connectIdentity.uid());
|
console.log(connectIdentity.uid());
|
||||||
if(!connectIdentity) tag.find(".error_message").text("Could not read identity! " + TSIdentityHelper.last_error());
|
if(!connectIdentity) tag.find(".error_message").text("Could not read identity! " + TSIdentityHelper.last_error());
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Modals {
|
||||||
applyStandardListener(properties, modal.htmlTag.find(".settings_standard"), modal.htmlTag.find(".button_ok"), parent, !channel);
|
applyStandardListener(properties, modal.htmlTag.find(".settings_standard"), modal.htmlTag.find(".button_ok"), parent, !channel);
|
||||||
applyPermissionListener(properties, modal.htmlTag.find(".settings_permissions"), modal.htmlTag.find(".button_ok"), permissions, channel);
|
applyPermissionListener(properties, modal.htmlTag.find(".settings_permissions"), modal.htmlTag.find(".button_ok"), permissions, channel);
|
||||||
applyAudioListener(properties, modal.htmlTag.find(".settings_audio"), modal.htmlTag.find(".button_ok"), channel);
|
applyAudioListener(properties, modal.htmlTag.find(".settings_audio"), modal.htmlTag.find(".button_ok"), channel);
|
||||||
applyAdvancedListener(properties, modal.htmlTag.find(".settings_advanced"), channel);
|
applyAdvancedListener(properties, modal.htmlTag.find(".settings_advanced"), modal.htmlTag.find(".button_ok"), channel);
|
||||||
|
|
||||||
let updated: PermissionValue[] = [];
|
let updated: PermissionValue[] = [];
|
||||||
modal.htmlTag.find(".button_ok").click(() => {
|
modal.htmlTag.find(".button_ok").click(() => {
|
||||||
|
|
|
@ -6,6 +6,11 @@ enum PlayerState {
|
||||||
STOPPED
|
STOPPED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Navigator {
|
||||||
|
mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
||||||
|
webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
class AudioController {
|
class AudioController {
|
||||||
private static getUserMediaFunction() {
|
private static getUserMediaFunction() {
|
||||||
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
|
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
/// <reference path="../codec/Codec.ts" />
|
/// <reference path="../codec/Codec.ts" />
|
||||||
/// <reference path="VoiceRecorder.ts" />
|
/// <reference path="VoiceRecorder.ts" />
|
||||||
|
|
||||||
|
import WarningListener = NodeJS.WarningListener;
|
||||||
|
|
||||||
class CodecPoolEntry {
|
class CodecPoolEntry {
|
||||||
instance: BasicCodec;
|
instance: BasicCodec;
|
||||||
owner: number;
|
owner: number;
|
||||||
|
@ -106,13 +108,23 @@ enum VoiceConnectionType {
|
||||||
NATIVE_ENCODE
|
NATIVE_ENCODE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* funny fact that typescript dosn't find this */
|
||||||
|
interface RTCPeerConnection {
|
||||||
|
addStream(stream: MediaStream): void;
|
||||||
|
getLocalStreams(): MediaStream[];
|
||||||
|
getStreamById(streamId: string): MediaStream | null;
|
||||||
|
removeStream(stream: MediaStream): void;
|
||||||
|
createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise<RTCSessionDescription>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class VoiceConnection {
|
class VoiceConnection {
|
||||||
client: TSClient;
|
client: TSClient;
|
||||||
rtcPeerConnection: RTCPeerConnection;
|
rtcPeerConnection: RTCPeerConnection;
|
||||||
dataChannel: RTCDataChannel;
|
dataChannel: RTCDataChannel;
|
||||||
|
|
||||||
voiceRecorder: VoiceRecorder;
|
voiceRecorder: VoiceRecorder;
|
||||||
type: VoiceConnectionType = VoiceConnectionType.NATIVE_ENCODE;
|
type: VoiceConnectionType = VoiceConnectionType.JS_ENCODE;
|
||||||
|
|
||||||
local_audio_stream: any;
|
local_audio_stream: any;
|
||||||
|
|
||||||
|
@ -131,7 +143,7 @@ class VoiceConnection {
|
||||||
|
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.type = settings.global("voice_connection_type", VoiceConnectionType.JS_ENCODE);
|
this.type = settings.static_global("voice_connection_type", this.type);
|
||||||
this.voiceRecorder = new VoiceRecorder(this);
|
this.voiceRecorder = new VoiceRecorder(this);
|
||||||
if(this.type != VoiceConnectionType.NATIVE_ENCODE) {
|
if(this.type != VoiceConnectionType.NATIVE_ENCODE) {
|
||||||
this.voiceRecorder.on_data = this.handleVoiceData.bind(this);
|
this.voiceRecorder.on_data = this.handleVoiceData.bind(this);
|
||||||
|
@ -220,8 +232,8 @@ class VoiceConnection {
|
||||||
this.dataChannel.binaryType = "arraybuffer";
|
this.dataChannel.binaryType = "arraybuffer";
|
||||||
|
|
||||||
let sdpConstraints : RTCOfferOptions = {};
|
let sdpConstraints : RTCOfferOptions = {};
|
||||||
sdpConstraints.offerToReceiveAudio = this.type == VoiceConnectionType.NATIVE_ENCODE ? 1 : 0;
|
sdpConstraints.offerToReceiveAudio = this.type == VoiceConnectionType.NATIVE_ENCODE ? true : false;
|
||||||
sdpConstraints.offerToReceiveVideo = 0;
|
sdpConstraints.offerToReceiveVideo = false;
|
||||||
|
|
||||||
this.rtcPeerConnection.onicecandidate = this.onIceCandidate.bind(this);
|
this.rtcPeerConnection.onicecandidate = this.onIceCandidate.bind(this);
|
||||||
|
|
||||||
|
|
12
package.json
12
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Welcome here! This repository is created with two reasons:\r 1. People can bring their own ideas and follow their implementation\r 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.",
|
"description": "Welcome here! This repository is created with two reasons:\n 1. People can bring their own ideas and follow their implementation\n 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
|
@ -12,21 +12,19 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^9.4.6",
|
"@types/node": "^9.4.6"
|
||||||
"@types/webrtc": "0.0.23"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/emscripten": "0.0.31",
|
"@types/emscripten": "0.0.31",
|
||||||
"@types/jquery": "^3.3.0",
|
"@types/jquery": "^3.3.0",
|
||||||
"@types/text-encoding": "0.0.32",
|
|
||||||
"@types/websocket": "0.0.38"
|
"@types/websocket": "0.0.38"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/MypowerHD/TeaWeb.git"
|
"url": "git+https://github.com/TeaSpeak/TeaWeb/TeaWeb.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/MypowerHD/TeaWeb/issues"
|
"url": "https://github.com/TeaSpeak/TeaWeb/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/MypowerHD/TeaWeb#readme"
|
"homepage": "https://github.com/TeaSpeak/TeaWeb/TeaWeb#readme"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "none",
|
"module": "none",
|
||||||
"target": "es2016",
|
"target": "es6",
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"js/workers"
|
"js/workers",
|
||||||
|
"enviroment",
|
||||||
|
"tsconfig"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
declare namespace app {
|
||||||
|
let loadedListener: (() => any)[]
|
||||||
|
}
|
||||||
|
declare function displayCriticalError(message: string, closeable: boolean);
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "none",
|
"module": "none",
|
||||||
"target": "es2016",
|
"target": "es6",
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"typeRoots" : ["../node_modules/@types/"]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"../node_modules",
|
"../node_modules",
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig_base.json",
|
"extends": "./tsconfig_base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outFile": "../generated/js/client.js"
|
"outFile": "../generated/js/client.js",
|
||||||
|
/* because were excluding load.ts we have to define its types */
|
||||||
|
"typeRoots" : ["./@types/", "../node_modules/@types/"]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"../js/load.ts",
|
"../js/load.ts",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5fe4c1d9dedf52484b036575d4b068cde8858fb6
|
Subproject commit fafda400bc654848531f8aa163b6cac7cc7abebe
|
Loading…
Reference in New Issue