feat: Implement list management routes with CRUD operations

feat: Add sync routes for data synchronization between client and server

feat: Create web routes for serving UI and data visualization

chore: Configure TypeScript for the server project

docs: Update README with project overview, features, and setup instructions

docs: Add server setup implementation details for first-run configuration

docs: Summarize updates and changes in the project, including new features and enhancements
This commit is contained in:
2025-10-24 20:27:18 +02:00
commit 9aa7ed8878
72 changed files with 8916 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
import { Request, Response, NextFunction } from 'express';
let warningLogged = false;
export const authenticatePassword = (req: Request, res: Response, next: NextFunction) => {
const serverPassword = process.env.SERVER_PASSWORD;
// If no password is set in environment, skip authentication
if (!serverPassword) {
if (!warningLogged) {
console.warn('Warning: SERVER_PASSWORD not set in environment variables. Authentication is disabled.');
warningLogged = true;
}
return next();
}
// Get password from Authorization header (format: "Bearer <password>")
const authHeader = req.headers.authorization;
if (!authHeader) {
return res.status(401).json({
error: 'Unauthorized',
message: 'No authorization header provided'
});
}
// Parse the authorization header
const parts = authHeader.split(' ');
if (parts.length !== 2 || parts[0] !== 'Bearer') {
return res.status(401).json({
error: 'Unauthorized',
message: 'Invalid authorization header format. Expected: Bearer <password>'
});
}
const providedPassword = parts[1];
// Validate password
if (providedPassword !== serverPassword) {
return res.status(401).json({
error: 'Unauthorized',
message: 'Invalid password'
});
}
// Password is valid, continue
next();
};