Update v1.2.0-beta - Dynamic context menu & permissions
All checks were successful
continuous-integration/drone/push Build is passing

 New Features:
- Dynamic permission-based context menus for files and folders
- Support for collaborative folder access control
- Upload to specific folders including shared folders
- Changelog modal for version updates
- Improved dark mode synchronization

🐛 Bug Fixes:
- Fixed context menu displaying incorrect options
- Fixed CSS !important override preventing dynamic menu behavior
- Fixed folder collaboration permission checks
- Fixed breadcrumb navigation with empty segments
- Fixed "Premature close" error loop in attachments
- Fixed missing user variable in admin routes
- Fixed avatar loading COEP policy issues

🔒 Security:
- Added security middleware (CSRF, rate limiting, input validation)
- Fixed collaboration folder access validation
- Improved shared folder permission handling

🎨 UI/UX Improvements:
- Removed Actions column from folder view
- Context menu now properly hides/shows based on permissions
- Better visual feedback for collaborative folders
- Improved upload flow with inline modals

🧹 Code Quality:
- Added collaboration data to folder routes
- Refactored context menu logic for better maintainability
- Added debug logging for troubleshooting
- Improved file upload handling with chunking support
This commit is contained in:
2025-10-25 23:55:51 +02:00
parent 58b57fbb84
commit 2df1b28962
33 changed files with 6275 additions and 1462 deletions

View File

@@ -28,15 +28,54 @@ router.get('/', authMiddleware, async (req, res) => {
const data = fs.readFileSync(path.join(__dirname, '../../../data', 'user.json'), 'utf8');
const users = JSON.parse(data);
const user = users.find(user => user.name === req.user.name);
if (!user || user.role !== 'admin') {
console.log('Access denied');
console.log('Access denied');
return res.status(403).json({ message: "You do not have the necessary rights to access this resource." });
}
res.render('paramAdmin', { users: User, setup: setup });
// Calculer les stats pour le dashboard admin
let foldersCount = 0;
let totalSize = 0;
try {
const fileInfoData = fs.readFileSync(path.join(__dirname, '../../../data', 'file_info.json'), 'utf8');
const fileInfo = JSON.parse(fileInfoData);
// Compter les dossiers
users.forEach(u => {
const userFolderPath = path.join(__dirname, '../../../cdn-files', u.name);
if (fs.existsSync(userFolderPath)) {
const folders = fs.readdirSync(userFolderPath, { withFileTypes: true })
.filter(dirent => dirent.isDirectory());
foldersCount += folders.length;
}
});
// Calculer l'espace total utilisé
totalSize = fileInfo.reduce((sum, item) => sum + (item.size || 0), 0);
} catch (err) {
console.warn('Could not read file_info.json:', err.message);
}
// Stats système
const uptime = process.uptime();
const memoryUsage = process.memoryUsage();
const cpuUsage = process.cpuUsage();
res.render('paramAdmin', {
user: user,
users: User,
setup: setup,
stats: {
foldersCount,
totalSize,
uptime,
memoryUsage: Math.round(memoryUsage.heapUsed / 1024 / 1024), // MB
cpuUsage: Math.round((cpuUsage.user + cpuUsage.system) / 1000) // ms
}
});
} catch (err) {
console.error(err);
res.status(500).send('Server Error');