Disable imports and char.creation while generating

This could cause data corruption due to active char Id being shifted.
This commit is contained in:
Cohee 2024-03-06 21:29:00 +02:00
parent 8bbab12848
commit 66a926c8c7
1 changed files with 10 additions and 0 deletions

View File

@ -7144,6 +7144,11 @@ async function createOrEditCharacter(e) {
formData.set('fav', fav_ch_checked);
if ($('#form_create').attr('actiontype') == 'createcharacter') {
if ($('#character_name_pole').val().length > 0) {
if (is_group_generating || is_send_press) {
toastr.error('Cannot create characters while generating. Stop the request and try again.', 'Creation aborted');
throw new Error('Cannot import character while generating');
}
//if the character name text area isn't empty (only posible when creating a new character)
let url = '/api/characters/create';
@ -7896,6 +7901,11 @@ export async function processDroppedFiles(files, preserveFileNames = false) {
* @returns {Promise<void>}
*/
async function importCharacter(file, preserveFileName = false) {
if (is_group_generating || is_send_press) {
toastr.error('Cannot import characters while generating. Stop the request and try again.', 'Import aborted');
throw new Error('Cannot import character while generating');
}
const ext = file.name.match(/\.(\w+)$/);
if (!ext || !(['json', 'png', 'yaml', 'yml'].includes(ext[1].toLowerCase()))) {
return;