can personalize UI message

This commit is contained in:
counterweight 2025-10-18 18:13:47 +02:00
parent 40d08e21ae
commit b4a769c557
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 30 additions and 1 deletions

View file

@ -10,7 +10,8 @@ const PORT = process.env.PORT || 3000;
const NTFY_URL = process.env.NTFY_URL;
const NTFY_USER = process.env.NTFY_USER;
const NTFY_PASSWORD = process.env.NTFY_PASSWORD;
const NTFY_TOPIC = process.env.NTFY_TOPIC || 'emergencia';
const NTFY_TOPIC = process.env.NTFY_TOPIC;
const UI_MESSAGE = process.env.UI_MESSAGE;
// Middleware
app.use(express.json());
@ -28,6 +29,13 @@ app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// Route to get UI configuration
app.get('/api/config', (req, res) => {
res.json({
uiMessage: UI_MESSAGE || 'Emergency Message'
});
});
// Route to handle message submission
app.post('/send-message', async (req, res) => {
try {