mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add ability to delete UI themes
This commit is contained in:
17
server.js
17
server.js
@@ -261,17 +261,6 @@ app.post('/deleteuseravatar', jsonParser, function (request, response) {
|
||||
return response.sendStatus(404);
|
||||
});
|
||||
|
||||
app.post('/savetheme', jsonParser, (request, response) => {
|
||||
if (!request.body || !request.body.name) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
const filename = path.join(DIRECTORIES.themes, sanitize(request.body.name) + '.json');
|
||||
writeFileAtomicSync(filename, JSON.stringify(request.body, null, 4), 'utf8');
|
||||
|
||||
return response.sendStatus(200);
|
||||
});
|
||||
|
||||
app.post('/savemovingui', jsonParser, (request, response) => {
|
||||
if (!request.body || !request.body.name) {
|
||||
return response.sendStatus(400);
|
||||
@@ -499,6 +488,12 @@ redirect('/delbackground', '/api/backgrounds/delete');
|
||||
redirect('/renamebackground', '/api/backgrounds/rename');
|
||||
redirect('/downloadbackground', '/api/backgrounds/upload'); // yes, the downloadbackground endpoint actually uploads one
|
||||
|
||||
// Redirect deprecated theme API endpoints
|
||||
redirect('/savetheme', '/api/themes/save');
|
||||
|
||||
// Theme management
|
||||
app.use('/api/themes', require('./src/endpoints/themes').router);
|
||||
|
||||
// OpenAI API
|
||||
app.use('/api/openai', require('./src/endpoints/openai').router);
|
||||
|
||||
|
Reference in New Issue
Block a user