fix:ntfy动作包含中文报错

This commit is contained in:
yilee 2025-06-02 16:38:48 +08:00
parent 054ff500ea
commit a6a1741562
3 changed files with 3 additions and 3 deletions

View File

@ -641,7 +641,7 @@ export default class NotificationService {
headers['Authorization'] = `Basic ${Buffer.from(`${ntfyUsername}:${ntfyPassword}`).toString('base64')}`;
}
if (ntfyActions) {
headers['Actions'] = ntfyActions;
headers['Actions'] = encodeRfc2047(ntfyActions);
}
const res = await httpClient.request(
`${ntfyUrl || 'https://ntfy.sh'}/${ntfyTopic}`,

View File

@ -1280,7 +1280,7 @@ function ntfyNotify(text, desp) {
options.headers['Authorization'] = `Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
}
if (NTFY_ACTIONS) {
options.headers['Actions'] = NTFY_ACTIONS;
options.headers['Actions'] = encodeRFC2047(NTFY_ACTIONS);
}
$.post(options, (err, resp, data) => {

View File

@ -817,7 +817,7 @@ def ntfy(title: str, content: str) -> None:
authStr = push_config.get("NTFY_USERNAME") + ":" + push_config.get("NTFY_PASSWORD")
headers['Authorization'] = "Basic " + base64.b64encode(authStr.encode('utf-8')).decode('utf-8')
if push_config.get("NTFY_ACTIONS"):
headers['Actions'] = push_config.get("NTFY_ACTIONS")
headers['Actions'] = encode_rfc2047(push_config.get("NTFY_ACTIONS"))
url = push_config.get("NTFY_URL") + "/" + push_config.get("NTFY_TOPIC")
response = requests.post(url, data=data, headers=headers)