Fixed invalid identities
This commit is contained in:
parent
15ab95c1f9
commit
032b03f769
6 changed files with 57 additions and 17 deletions
|
@ -33,12 +33,18 @@ namespace loader {
|
|||
/*
|
||||
invoking main task
|
||||
*/
|
||||
LOADED
|
||||
LOADED,
|
||||
|
||||
DONE
|
||||
}
|
||||
|
||||
let current_stage: Stage = Stage.INITIALIZING;
|
||||
const tasks: {[key:number]:Task[]} = {};
|
||||
|
||||
export function finished() {
|
||||
return current_stage == Stage.DONE;
|
||||
}
|
||||
|
||||
export function register_task(stage: Stage, task: Task) {
|
||||
const task_array = tasks[stage] || (tasks[stage] = []);
|
||||
task_array.push(task);
|
||||
|
@ -409,9 +415,11 @@ const loader_webassembly = {
|
|||
};
|
||||
|
||||
Module['onAbort'] = message => {
|
||||
Module['onAbort'] = undefined;
|
||||
Module['_initialized'] = false;
|
||||
displayCriticalError("Could not load webassembly files!<br>Message: <code>" + message + "</code>");
|
||||
if(!loader.finished()) {
|
||||
Module['onAbort'] = undefined;
|
||||
Module['_initialized'] = false;
|
||||
displayCriticalError("Could not load webassembly files!<br>Message: <code>" + message + "</code>");
|
||||
}
|
||||
};
|
||||
|
||||
Module['locateFile'] = file => "wasm/" + file;
|
||||
|
|
|
@ -166,7 +166,17 @@ function main() {
|
|||
const address = settings.static("connect_address", "");
|
||||
const username = settings.static("connect_username", "Another TeaSpeak user");
|
||||
|
||||
globalClient.startConnection(address, profile, username);
|
||||
if(profile.valid()) {
|
||||
globalClient.startConnection(address, profile, username);
|
||||
} else {
|
||||
Modals.spawnConnectModal({
|
||||
url: address,
|
||||
enforce: true
|
||||
}, {
|
||||
profile: profile,
|
||||
enforce: true
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
let tag = $("#tmpl_music_frame").renderTag({
|
||||
|
|
|
@ -52,9 +52,14 @@ namespace profiles.identities {
|
|||
}
|
||||
|
||||
export function loadIdentity(key: string) : TeamSpeakIdentity {
|
||||
let handle = funcationParseIdentity(key);
|
||||
if(!handle) return undefined;
|
||||
return new TeamSpeakIdentity(handle, "TeaWeb user");
|
||||
try {
|
||||
let handle = funcationParseIdentity(key);
|
||||
if(!handle) return undefined;
|
||||
return new TeamSpeakIdentity(handle, "TeaWeb user");
|
||||
} catch(error) {
|
||||
console.error(error);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function loadIdentityFromFileContains(contains: string) : TeamSpeakIdentity {
|
||||
|
|
|
@ -352,15 +352,26 @@ class ControlBar {
|
|||
.text(bookmark.display_name)
|
||||
.on('click', event => {
|
||||
this.htmlTag.find(".btn_bookmark").find(".dropdown").removeClass("displayed");
|
||||
this.handle.startConnection(
|
||||
mark.server_properties.server_address + ":" + mark.server_properties.server_port,
|
||||
profiles.find_profile(mark.connect_profile) || profiles.default_profile(),
|
||||
mark.nickname,
|
||||
{
|
||||
password: mark.server_properties.server_password_hash,
|
||||
hashed: true
|
||||
}
|
||||
);
|
||||
const profile = profiles.find_profile(mark.connect_profile) || profiles.default_profile();
|
||||
if(profile.valid()) {
|
||||
this.handle.startConnection(
|
||||
mark.server_properties.server_address + ":" + mark.server_properties.server_port,
|
||||
profile,
|
||||
mark.nickname,
|
||||
{
|
||||
password: mark.server_properties.server_password_hash,
|
||||
hashed: true
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Modals.spawnConnectModal({
|
||||
url: mark.server_properties.server_address + ":" + mark.server_properties.server_port,
|
||||
enforce: true
|
||||
}, {
|
||||
profile: profile,
|
||||
enforce: true
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -98,6 +98,7 @@ namespace Modals {
|
|||
|
||||
tag.find(".connect_nickname").on("keyup", () => updateFields());
|
||||
|
||||
setTimeout(() => updateFields(), 100);
|
||||
//connect_address
|
||||
return tag;
|
||||
},
|
||||
|
|
|
@ -594,9 +594,14 @@ namespace Modals {
|
|||
const element = event.target as HTMLInputElement;
|
||||
if(element.value.length == 0) {
|
||||
display_error("Please provide an identity");
|
||||
selected_profile.set_identity(IdentitifyType.TEAMSPEAK, undefined as any);
|
||||
profiles.mark_need_save();
|
||||
} else {
|
||||
const identity = profiles.identities.TSIdentityHelper.loadIdentity(element.value);
|
||||
if(!identity) {
|
||||
selected_profile.set_identity(IdentitifyType.TEAMSPEAK, identity as any);
|
||||
profiles.mark_need_save();
|
||||
|
||||
display_error("Failed to parse identity string!");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue