mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
(WIP) Import JSON from .charx
This commit is contained in:
@@ -8288,8 +8288,13 @@ export async function processDroppedFiles(files, preserveFileNames = false) {
|
||||
'text/x-yaml',
|
||||
];
|
||||
|
||||
const allowedExtensions = [
|
||||
'charx',
|
||||
];
|
||||
|
||||
for (const file of files) {
|
||||
if (allowedMimeTypes.includes(file.type)) {
|
||||
const extension = file.name.split('.').pop().toLowerCase();
|
||||
if (allowedMimeTypes.includes(file.type) || allowedExtensions.includes(extension)) {
|
||||
await importCharacter(file, preserveFileNames);
|
||||
} else {
|
||||
toastr.warning('Unsupported file type: ' + file.name);
|
||||
@@ -8310,7 +8315,7 @@ async function importCharacter(file, preserveFileName = false) {
|
||||
}
|
||||
|
||||
const ext = file.name.match(/\.(\w+)$/);
|
||||
if (!ext || !(['json', 'png', 'yaml', 'yml'].includes(ext[1].toLowerCase()))) {
|
||||
if (!ext || !(['json', 'png', 'yaml', 'yml', 'charx'].includes(ext[1].toLowerCase()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user