mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-14 02:20:12 +01:00
b557bb9ede
* implemented logo customization for single-user mode * removing unneeded comments * added dark and light mode support for default logo * implemented dark and light mode switching in frontend * fixed dark and light mode switching for failed to load logo from backend * removed unneeded comment * custom logos for admin implemented * refactor logo mgmt functions abstract logo management utils into their own file for simplicity * added settings tab for appearance on single-user mode * unchecking files with unneeded changes * fixed appearance settings tab to be hidden on multiuser mode * allow readall for logo --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
const multer = require("multer");
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
|
|
function setupMulter() {
|
|
// Handle File uploads for auto-uploading.
|
|
const storage = multer.diskStorage({
|
|
destination: function (_, _, cb) {
|
|
const uploadOutput =
|
|
process.env.NODE_ENV === "development"
|
|
? path.resolve(__dirname, `../../../collector/hotdir`)
|
|
: path.resolve(process.env.STORAGE_DIR, `../../collector/hotdir`);
|
|
cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
|
|
return { handleUploads: multer({ storage }) };
|
|
}
|
|
|
|
function setupDataImports() {
|
|
// Handle File uploads for auto-uploading.
|
|
const storage = multer.diskStorage({
|
|
destination: function (_, _, cb) {
|
|
const uploadOutput = path.resolve(__dirname, `../../storage/imports`);
|
|
fs.mkdirSync(uploadOutput, { recursive: true });
|
|
return cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
|
|
return { handleImports: multer({ storage }) };
|
|
}
|
|
|
|
function setupLogoUploads() {
|
|
// Handle Logo uploads.
|
|
const storage = multer.diskStorage({
|
|
destination: function (_, _, cb) {
|
|
const uploadOutput = path.resolve(__dirname, `../../storage/assets`);
|
|
fs.mkdirSync(uploadOutput, { recursive: true });
|
|
return cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
|
|
return { handleLogoUploads: multer({ storage }) };
|
|
}
|
|
|
|
module.exports = {
|
|
setupMulter,
|
|
setupDataImports,
|
|
setupLogoUploads,
|
|
};
|