Fixed some things related to the TeaSpeak client
This commit is contained in:
parent
5b05b0c7f2
commit
83d4164a80
6 changed files with 67 additions and 15 deletions
|
@ -22,4 +22,8 @@ namespace forum {
|
||||||
export function open() {
|
export function open() {
|
||||||
ipc.send("teaforo-login");
|
ipc.send("teaforo-login");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logout() {
|
||||||
|
ipc.send("teaforo-logout");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -10,8 +10,6 @@
|
||||||
/// <reference path="ui/frames/ControlBar.ts" />
|
/// <reference path="ui/frames/ControlBar.ts" />
|
||||||
/// <reference path="connection/ConnectionBase.ts" />
|
/// <reference path="connection/ConnectionBase.ts" />
|
||||||
|
|
||||||
import spawnConnectModal = Modals.spawnConnectModal;
|
|
||||||
|
|
||||||
enum DisconnectReason {
|
enum DisconnectReason {
|
||||||
HANDLER_DESTROYED,
|
HANDLER_DESTROYED,
|
||||||
REQUESTED,
|
REQUESTED,
|
||||||
|
@ -23,6 +21,8 @@ enum DisconnectReason {
|
||||||
CLIENT_KICKED,
|
CLIENT_KICKED,
|
||||||
CLIENT_BANNED,
|
CLIENT_BANNED,
|
||||||
HANDSHAKE_FAILED,
|
HANDSHAKE_FAILED,
|
||||||
|
HANDSHAKE_TEAMSPEAK_REQUIRED,
|
||||||
|
HANDSHAKE_BANNED,
|
||||||
SERVER_CLOSED,
|
SERVER_CLOSED,
|
||||||
SERVER_REQUIRES_PASSWORD,
|
SERVER_REQUIRES_PASSWORD,
|
||||||
IDENTITY_TOO_LOW,
|
IDENTITY_TOO_LOW,
|
||||||
|
@ -407,6 +407,14 @@ class ConnectionHandler {
|
||||||
tr("Failed to process handshake: ") + data as string
|
tr("Failed to process handshake: ") + data as string
|
||||||
).open();
|
).open();
|
||||||
break;
|
break;
|
||||||
|
case DisconnectReason.HANDSHAKE_TEAMSPEAK_REQUIRED:
|
||||||
|
createErrorModal(
|
||||||
|
tr("Target server is a TeamSpeak server"),
|
||||||
|
MessageHelper.formatMessage(tr("The target server is a TeamSpeak 3 server!{:br:}Only TeamSpeak 3 based identities are able to connect.{:br}Please select another profile or change the identify type."))
|
||||||
|
).open();
|
||||||
|
this.sound.play(Sound.CONNECTION_DISCONNECTED);
|
||||||
|
auto_reconnect = false;
|
||||||
|
break;
|
||||||
case DisconnectReason.IDENTITY_TOO_LOW:
|
case DisconnectReason.IDENTITY_TOO_LOW:
|
||||||
createErrorModal(
|
createErrorModal(
|
||||||
tr("Identity level is too low"),
|
tr("Identity level is too low"),
|
||||||
|
@ -457,11 +465,18 @@ class ConnectionHandler {
|
||||||
}).open();
|
}).open();
|
||||||
break;
|
break;
|
||||||
case DisconnectReason.CLIENT_KICKED:
|
case DisconnectReason.CLIENT_KICKED:
|
||||||
this.chat.serverChat().appendError(tr("You got kicked from the server by {0}{1}"),
|
createErrorModal(
|
||||||
|
tr("You've been banned"),
|
||||||
|
MessageHelper.formatMessage(tr("You've been banned from this server.{:br:}{0}"), data["extra_message"])
|
||||||
|
).open();
|
||||||
|
this.sound.play(Sound.SERVER_KICKED);
|
||||||
|
auto_reconnect = false;
|
||||||
|
break;
|
||||||
|
case DisconnectReason.HANDSHAKE_BANNED:
|
||||||
|
this.chat.serverChat().appendError(tr("You got banned from the server by {0}{1}"),
|
||||||
ClientEntry.chatTag(data["invokerid"], data["invokername"], data["invokeruid"]),
|
ClientEntry.chatTag(data["invokerid"], data["invokername"], data["invokeruid"]),
|
||||||
data["reasonmsg"] ? " (" + data["reasonmsg"] + ")" : "");
|
data["reasonmsg"] ? " (" + data["reasonmsg"] + ")" : "");
|
||||||
this.sound.play(Sound.SERVER_KICKED);
|
this.sound.play(Sound.CONNECTION_BANNED); //TODO findout if it was a disconnect or a connect refuse
|
||||||
auto_reconnect = true;
|
|
||||||
break;
|
break;
|
||||||
case DisconnectReason.CLIENT_BANNED:
|
case DisconnectReason.CLIENT_BANNED:
|
||||||
this.chat.serverChat().appendError(tr("You got banned from the server by {0}{1}"),
|
this.chat.serverChat().appendError(tr("You got banned from the server by {0}{1}"),
|
||||||
|
|
|
@ -49,6 +49,19 @@ namespace connection {
|
||||||
this.handshake_handler.start_handshake();
|
this.handshake_handler.start_handshake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_teamspeak() {
|
||||||
|
const type = this.profile.selected_type();
|
||||||
|
if(type == profiles.identities.IdentitifyType.TEAMSPEAK)
|
||||||
|
this.handshake_finished();
|
||||||
|
else {
|
||||||
|
|
||||||
|
if(this.failed) return;
|
||||||
|
|
||||||
|
this.failed = true;
|
||||||
|
this.connection.client.handleDisconnect(DisconnectReason.HANDSHAKE_TEAMSPEAK_REQUIRED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private handshake_failed(message: string) {
|
private handshake_failed(message: string) {
|
||||||
if(this.failed) return;
|
if(this.failed) return;
|
||||||
|
|
||||||
|
@ -71,7 +84,6 @@ namespace connection {
|
||||||
const git_version = settings.static_global("version", "unknown");
|
const git_version = settings.static_global("version", "unknown");
|
||||||
const browser_name = (navigator.browserSpecs || {})["name"] || " ";
|
const browser_name = (navigator.browserSpecs || {})["name"] || " ";
|
||||||
let data = {
|
let data = {
|
||||||
//TODO variables!
|
|
||||||
client_nickname: this.name,
|
client_nickname: this.name,
|
||||||
client_platform: (browser_name ? browser_name + " " : "") + navigator.platform,
|
client_platform: (browser_name ? browser_name + " " : "") + navigator.platform,
|
||||||
client_version: "TeaWeb " + git_version + " (" + navigator.userAgent + ")",
|
client_version: "TeaWeb " + git_version + " (" + navigator.userAgent + ")",
|
||||||
|
@ -119,6 +131,8 @@ namespace connection {
|
||||||
} else if(error.id == 783 || error.id == 519) {
|
} else if(error.id == 783 || error.id == 519) {
|
||||||
error.extra_message = parseInt(error.extra_message) == NaN ? "8" : error.extra_message;
|
error.extra_message = parseInt(error.extra_message) == NaN ? "8" : error.extra_message;
|
||||||
this.connection.client.handleDisconnect(DisconnectReason.IDENTITY_TOO_LOW, error);
|
this.connection.client.handleDisconnect(DisconnectReason.IDENTITY_TOO_LOW, error);
|
||||||
|
} else if(error.id == 3329) {
|
||||||
|
this.connection.client.handleDisconnect(DisconnectReason.HANDSHAKE_BANNED, error);
|
||||||
} else {
|
} else {
|
||||||
this.connection.client.handleDisconnect(DisconnectReason.CLIENT_KICKED, error);
|
this.connection.client.handleDisconnect(DisconnectReason.CLIENT_KICKED, error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,13 @@ const loader_javascript = {
|
||||||
name: "javascript web",
|
name: "javascript web",
|
||||||
priority: 10,
|
priority: 10,
|
||||||
function: loader_javascript.load_scripts_debug_web
|
function: loader_javascript.load_scripts_debug_web
|
||||||
})
|
});
|
||||||
|
} else {
|
||||||
|
loader.register_task(loader.Stage.JAVASCRIPT, {
|
||||||
|
name: "javascript client",
|
||||||
|
priority: 10,
|
||||||
|
function: loader_javascript.load_scripts_debug_client
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load some extends classes */
|
/* load some extends classes */
|
||||||
|
@ -618,6 +624,11 @@ const loader_javascript = {
|
||||||
["js/WebPPTListener.js"]
|
["js/WebPPTListener.js"]
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
load_scripts_debug_client: async () => {
|
||||||
|
await loader.load_scripts([
|
||||||
|
["js/teaforo.js"]
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
load_release: async () => {
|
load_release: async () => {
|
||||||
console.log("Load for release!");
|
console.log("Load for release!");
|
||||||
|
|
|
@ -222,10 +222,6 @@ namespace profiles.identities {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_and_initialize() {
|
|
||||||
this.trigger_success();
|
|
||||||
}
|
|
||||||
|
|
||||||
private handle_proof(json) {
|
private handle_proof(json) {
|
||||||
if(!json[0]["digest"]) {
|
if(!json[0]["digest"]) {
|
||||||
this.trigger_fail("server too old");
|
this.trigger_fail("server too old");
|
||||||
|
|
|
@ -238,11 +238,23 @@ namespace Modals {
|
||||||
} else {
|
} else {
|
||||||
tag.find(".connected").hide();
|
tag.find(".connected").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.find(".button-logout").on('click', event => {
|
tag.find(".button-logout").on('click', event => {
|
||||||
window.location.href = settings.static("forum_path") + "auth.php?type=logout";
|
if(native_client) {
|
||||||
|
modal.close(); /* we cant update the modal so we close it */
|
||||||
|
forum.logout();
|
||||||
|
} else {
|
||||||
|
window.location.href = settings.static("forum_path") + "auth.php?type=logout";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
tag.find(".button-login").on('click', event => {
|
tag.find(".button-login").on('click', event => {
|
||||||
window.location.href = settings.static("forum_path") + "login.php";
|
if(native_client) {
|
||||||
|
modal.close(); /* we cant update the modal so we close it */
|
||||||
|
forum.open();
|
||||||
|
} else {
|
||||||
|
window.location.href = settings.static("forum_path") + "login.php";
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,7 +773,7 @@ namespace Modals {
|
||||||
if (identity && identity.valid()) {
|
if (identity && identity.valid()) {
|
||||||
forum_tag.find(".connected").show();
|
forum_tag.find(".connected").show();
|
||||||
} else {
|
} else {
|
||||||
forum_tag.find(".disconnected").show();
|
_tag.find(".disconnected").show();
|
||||||
}
|
}
|
||||||
} else if (selected_type == profiles.identities.IdentitifyType.TEAMSPEAK) {
|
} else if (selected_type == profiles.identities.IdentitifyType.TEAMSPEAK) {
|
||||||
console.log("Set: " + identity);
|
console.log("Set: " + identity);
|
||||||
|
@ -930,7 +942,7 @@ namespace Modals {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{ //The forum
|
{ //The
|
||||||
const teaforo_tag = settings_tag.find(".identity-settings-teaforo");
|
const teaforo_tag = settings_tag.find(".identity-settings-teaforo");
|
||||||
if (native_client) {
|
if (native_client) {
|
||||||
teaforo_tag.find(".native-teaforo-login").on('click', event => {
|
teaforo_tag.find(".native-teaforo-login").on('click', event => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue