mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add user management endpoints
This commit is contained in:
24
server.js
24
server.js
@@ -35,8 +35,6 @@ util.inspect.defaultOptions.depth = 4;
|
||||
const {
|
||||
initUserStorage,
|
||||
userDataMiddleware,
|
||||
getUserDirectories,
|
||||
getAllUserHandles,
|
||||
migrateUserData,
|
||||
getCsrfSecret,
|
||||
getCookieSecret,
|
||||
@@ -120,7 +118,7 @@ const listen = cliArguments.listen ?? getConfigValue('listen', DEFAULT_LISTEN);
|
||||
const enableCorsProxy = cliArguments.corsProxy ?? getConfigValue('enableCorsProxy', DEFAULT_CORS_PROXY);
|
||||
const basicAuthMode = getConfigValue('basicAuthMode', false);
|
||||
|
||||
const { UPLOADS_PATH, PUBLIC_DIRECTORIES } = require('./src/constants');
|
||||
const { UPLOADS_PATH } = require('./src/constants');
|
||||
|
||||
// CORS Settings //
|
||||
const CORS = cors({
|
||||
@@ -476,7 +474,7 @@ const setupTasks = async function () {
|
||||
// in any order for encapsulation reasons, but right now it's unknown if that would break anything.
|
||||
await initUserStorage();
|
||||
await settingsEndpoint.init();
|
||||
ensurePublicDirectoriesExist();
|
||||
await contentManager.ensurePublicDirectoriesExist();
|
||||
await migrateUserData();
|
||||
contentManager.checkForNewContent();
|
||||
await ensureThumbnailCache();
|
||||
@@ -567,21 +565,3 @@ if (cliArguments.ssl) {
|
||||
setupTasks,
|
||||
);
|
||||
}
|
||||
|
||||
async function ensurePublicDirectoriesExist() {
|
||||
for (const dir of Object.values(PUBLIC_DIRECTORIES)) {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
const userHandles = await getAllUserHandles();
|
||||
for (const handle of userHandles) {
|
||||
const userDirectories = getUserDirectories(handle);
|
||||
for (const dir of Object.values(userDirectories)) {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user