Fix ntfy: use JSON body instead of headers to support emoji titles
Sending emoji in HTTP headers is not valid ASCII and causes errors.
Switching to ntfy's JSON body API (POST to /topic with {topic, title,
message, priority, tags}) allows full UTF-8 including emoji.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
d46a37a219
commit
279cba5115
2 files changed
+23
-25
No files matched your search
+6
-6
@@ -1566,12 +1566,12 @@ app.post('/api/test-ntfy', async (req, res) => {
|
||||
if (!ntfy_topic) return res.status(400).json({ error: 'ntfy topic is required' });
|
||||
const base = (ntfy_url || 'https://ntfy.sh').replace(/\/$/, '');
|
||||
try {
|
||||
await axios.post(`${base}/${ntfy_topic}`, 'This is a test notification from SkyWatch', {
|
||||
headers: {
|
||||
Title: encodeURIComponent('SkyWatch Test'),
|
||||
Priority: 'default',
|
||||
Tags: 'white_check_mark',
|
||||
},
|
||||
await axios.post(`${base}/`, {
|
||||
topic: ntfy_topic,
|
||||
title: '🔔 SkyWatch Test',
|
||||
message: 'This is a test notification from SkyWatch',
|
||||
priority: 3,
|
||||
tags: ['white_check_mark'],
|
||||
});
|
||||
res.json({ message: 'Test notification sent to ntfy!' });
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user