
* cleaned up some files * Fundamental style update * Redesigned some style * fixed hostbanner popup * Removed old identity stuff * fixed close listener * Fixed changelog date * fixed release chat icons * fixed url * Fixed hostbanner * Uploaded missing images * Improved update handling * Improved script files * Fixed loading error and icon error * fixed Yes/No modal * Fixed loader issues with MS Edge * fixed modal style bug * Fixed control bar overflow for small devices * Improved error handling on identity creation * Logging generate error to terminal * fixed possible php error * fixed some possible loading errors when other files have'nt been already loaded. * removed debug message * Changed emsrcypten flags * Improved codec error handling * removed webassembly as required dependency * Improved and fixed channel tree issues * Improved the sliders * Removed unneeded files * fixed loader versions cache * second slight performance improved (dont animate elements anymore if they are not shown) * Fixed query visibility setting * not showing useless client infos for query clients * Added an auto reconnect system * Added a canceled message and increased reconnect interval * removed implemented todo * fixed repetitive channel names * Reworked the channel tree selected lines * Fixed channel tree names * Fixed name alignment * fixed the native client * added min width to the server select groups to avoid a disappearing effect on shrink * fixed bugged downloaded icons
84 lines
No EOL
3.3 KiB
TypeScript
84 lines
No EOL
3.3 KiB
TypeScript
/// <reference path="../../utils/modal.ts" />
|
|
/// <reference path="../../proto.ts" />
|
|
/// <reference path="../../client.ts" />
|
|
|
|
namespace Modals {
|
|
export function spawnQueryCreate(callback_created?: (user, pass) => any) {
|
|
let modal;
|
|
modal = createModal({
|
|
header: tr("Create a server query login"),
|
|
body: () => {
|
|
let template = $("#tmpl_query_create").renderTag();
|
|
template = $.spawn("div").append(template);
|
|
|
|
template.find(".button-close").on('click', event => modal.close());
|
|
template.find(".button-create").on('click', event => {
|
|
const name = template.find(".input-name").val() as string;
|
|
if(name.length < 3 || name.length > 64) {
|
|
createErrorModal(tr("Invalid username"), tr("Please enter a valid name!")).open();
|
|
return;
|
|
}
|
|
|
|
//client_login_password
|
|
globalClient.serverConnection.commandHandler["notifyquerycreated"] = json => {
|
|
json = json[0];
|
|
|
|
spawnQueryCreated({
|
|
username: name,
|
|
password: json.client_login_password
|
|
}, true);
|
|
|
|
if(callback_created)
|
|
callback_created(name, json.client_login_password);
|
|
};
|
|
|
|
globalClient.serverConnection.sendCommand("querycreate", {
|
|
client_login_name: name
|
|
}).catch(error => {
|
|
if(error instanceof CommandResult)
|
|
error = error.extra_message || error.message;
|
|
createErrorModal(tr("Unable to create account"), tr("Failed to create account<br>Message: ") + error).open();
|
|
});
|
|
|
|
modal.close();
|
|
//TODO create account
|
|
});
|
|
return template;
|
|
},
|
|
footer: undefined,
|
|
width: 750
|
|
});
|
|
modal.open();
|
|
}
|
|
|
|
export function spawnQueryCreated(credentials: {
|
|
username: string,
|
|
password: string
|
|
}, just_created: boolean) {
|
|
let modal;
|
|
modal = createModal({
|
|
header: just_created ? tr("Server query credentials") : tr("New server query credentials"),
|
|
body: () => {
|
|
let template = $("#tmpl_query_created").renderTag(credentials);
|
|
template = $.spawn("div").append(template);
|
|
|
|
template.find(".button-close").on('click', event => modal.close());
|
|
template.find(".query_name").text(credentials.username);
|
|
template.find(".query_password").text(credentials.password);
|
|
|
|
template.find(".btn_copy_name").on('click', () => {
|
|
template.find(".query_name").select();
|
|
document.execCommand("copy");
|
|
});
|
|
template.find(".btn_copy_password").on('click', () => {
|
|
template.find(".query_password").select();
|
|
document.execCommand("copy");
|
|
});
|
|
return template;
|
|
},
|
|
footer: undefined,
|
|
width: 750
|
|
});
|
|
modal.open();
|
|
}
|
|
} |