mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add character asset type
This commit is contained in:
@@ -8,7 +8,7 @@ const { DIRECTORIES, UNSAFE_EXTENSIONS } = require('../constants');
|
||||
const { jsonParser } = require('../express-common');
|
||||
const { clientRelativePath } = require('../util');
|
||||
|
||||
const VALID_CATEGORIES = ['bgm', 'ambient', 'blip', 'live2d', 'vrm'];
|
||||
const VALID_CATEGORIES = ['bgm', 'ambient', 'blip', 'live2d', 'vrm', 'character'];
|
||||
|
||||
/**
|
||||
* Validates the input filename for the asset.
|
||||
@@ -199,6 +199,13 @@ router.post('/download', jsonParser, async (request, response) => {
|
||||
const fileStream = fs.createWriteStream(destination, { flags: 'wx' });
|
||||
await finished(res.body.pipe(fileStream));
|
||||
|
||||
if (category === 'character') {
|
||||
response.sendFile(temp_path, { root: process.cwd() }, () => {
|
||||
fs.rmSync(temp_path);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Move into asset place
|
||||
console.debug('Download finished, moving file from', temp_path, 'to', file_path);
|
||||
fs.renameSync(temp_path, file_path);
|
||||
|
Reference in New Issue
Block a user