Fix jwt-token

This commit is contained in:
2025-09-23 16:05:34 +02:00
parent 25d910ed3f
commit e41ae5d65b
5 changed files with 262 additions and 10 deletions

View File

@@ -308,7 +308,7 @@ class DataRetentionService {
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.setHeader('Content-Type', 'application/json');
@@ -343,6 +343,39 @@ class DataRetentionService {
res.writeHead(404);
res.end(JSON.stringify({ error: 'Not found' }));
}
} else if (req.method === 'POST') {
if (parsedUrl.pathname === '/cleanup') {
// Manual cleanup trigger
if (this.isRunning) {
res.writeHead(409);
res.end(JSON.stringify({
error: 'Cleanup already in progress',
message: 'A cleanup operation is currently running. Please wait for it to complete.'
}));
return;
}
console.log('🧹 Manual cleanup triggered via HTTP API');
// Trigger cleanup asynchronously
this.performCleanup().then(() => {
console.log('✅ Manual cleanup completed successfully');
}).catch((error) => {
console.error('❌ Manual cleanup failed:', error);
});
res.writeHead(202);
res.end(JSON.stringify({
success: true,
message: 'Data retention cleanup initiated',
timestamp: new Date().toISOString()
}));
} else {
res.writeHead(404);
res.end(JSON.stringify({ error: 'Not found' }));
}
} else {
res.writeHead(405);
res.end(JSON.stringify({ error: 'Method not allowed' }));