new home page route + redirect to home

This commit is contained in:
Mateo Körber Belmonte
2025-03-18 20:36:28 +01:00
parent 47c5a154ba
commit 8cea09ded6
+10 -2
View File
@@ -114,6 +114,14 @@ db.exec(`
) )
`); `);
app.get('/', (req, res) => {
res.redirect('/home');
});
app.get('/home', requireLogin, (req, res) => {
res.sendFile(path.join(__dirname, '../frontend/public', 'home.html'));
});
// LDAP-Authentifizierung Route // LDAP-Authentifizierung Route
app.post('/login', async (req, res) => { app.post('/login', async (req, res) => {
const { username, password } = req.body; const { username, password } = req.body;
@@ -436,7 +444,7 @@ app.post('/generate-pdf', requireLogin, (req, res) => {
try { try {
if (type === 'week' && trans === '') { if (type === 'week' && trans === '') {
console.log('Generating PDF for week:', val); console.log('Generating PDF for week:', val);
pdfPath = `python3 scripts/writeWeeklyMenuDE.py ${val}`; pdfPath = `python.exe .\\scripts\\writeWeeklyMenuDE.py ${val}`;
} else if (type === 'week' && trans !== '') { } else if (type === 'week' && trans !== '') {
console.log('Generating EN PDF for week:', val); console.log('Generating EN PDF for week:', val);
@@ -445,7 +453,7 @@ app.post('/generate-pdf', requireLogin, (req, res) => {
fs.writeFileSync(tempJsonPath, JSON.stringify(trans, null, 2), 'utf8'); fs.writeFileSync(tempJsonPath, JSON.stringify(trans, null, 2), 'utf8');
// Call Python script without passing the translations as command line argument // Call Python script without passing the translations as command line argument
pdfPath = `python3 scripts/writeWeeklyMenuEN.py ${val}`; pdfPath = `python.exe .\\scripts\\writeWeeklyMenuEN.py ${val}`;
} else if (type === 'day') { } else if (type === 'day') {
console.log('Generating PDF for daily:', val); console.log('Generating PDF for daily:', val);
pdfPath = `python3 scripts/writeDailyMenu.py ${val}`; pdfPath = `python3 scripts/writeDailyMenu.py ${val}`;