update
This commit is contained in:
@@ -17,6 +17,15 @@ app.get('/admin', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'admin.html'));
|
||||
});
|
||||
|
||||
// Serve preferences page
|
||||
app.get('/preferences.html', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'preferences.html'));
|
||||
});
|
||||
|
||||
app.get('/preferences', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'preferences.html'));
|
||||
});
|
||||
|
||||
// Serve static files
|
||||
app.use(express.static('public'));
|
||||
|
||||
@@ -61,6 +70,83 @@ app.post('/api/unsubscribe', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/subscribers/:email', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/subscribers/${req.params.email}`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to get subscriber' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/categories', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/categories`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to get categories' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.delete('/api/admin/subscribers/delete-all', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.delete(`${API_URL}/api/admin/subscribers/delete-all`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to delete subscribers' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/rss-feeds', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/rss-feeds`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to get RSS feeds' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/rss-feeds/export', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/rss-feeds/export`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to export RSS feeds' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/api/rss-feeds/import', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.post(`${API_URL}/api/rss-feeds/import`, req.body);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to import RSS feeds' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/admin/recent-articles', async (req, res) => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/admin/recent-articles`);
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
res.status(error.response?.status || 500).json(
|
||||
error.response?.data || { error: 'Failed to get recent articles' }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Ollama API proxy endpoints for admin dashboard
|
||||
app.get('/api/ollama/ping', async (req, res) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user