ntfy fix
This commit is contained in:
@@ -28,7 +28,7 @@ async function sendNtfyNotification(adminNtfy, userNtfy, payload) {
|
|||||||
const server = (userNtfy.serverUrl || adminNtfy.serverUrl || 'https://ntfy.sh').replace(/\/+$/, '');
|
const server = (userNtfy.serverUrl || adminNtfy.serverUrl || 'https://ntfy.sh').replace(/\/+$/, '');
|
||||||
const sanitizedPrefix = (adminNtfy.topicPrefix || '').replace(/^-+|-+$/g, '');
|
const sanitizedPrefix = (adminNtfy.topicPrefix || '').replace(/^-+|-+$/g, '');
|
||||||
const sanitizedTopic = (userNtfy.topic || '').replace(/^-+|-+$/g, '');
|
const sanitizedTopic = (userNtfy.topic || '').replace(/^-+|-+$/g, '');
|
||||||
const separator = sanitizedPrefix && sanitizedTopic ? '-' : '';
|
const separator = sanitizedPrefix && sanitizedTopic ? '_' : '';
|
||||||
const topic = `${sanitizedPrefix}${separator}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
|
const topic = `${sanitizedPrefix}${separator}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
|
||||||
let url = `${server}/${topic}`;
|
let url = `${server}/${topic}`;
|
||||||
if (payload.title) {
|
if (payload.title) {
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ function App() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const prefix = (notificationCapabilities.ntfy.topicPrefix || '').replace(/^-+|-+$/g, '');
|
const prefix = (notificationCapabilities.ntfy.topicPrefix || '').replace(/^-+|-+$/g, '');
|
||||||
const separator = prefix && sanitizedTopic ? '-' : '';
|
const separator = prefix && sanitizedTopic ? '_' : '';
|
||||||
const slug = `${prefix}${separator}${sanitizedTopic}` || sanitizedTopic || prefix;
|
const slug = `${prefix}${separator}${sanitizedTopic}` || sanitizedTopic || prefix;
|
||||||
if (!slug) {
|
if (!slug) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const NotificationPanel = ({
|
|||||||
)}
|
)}
|
||||||
{capabilities.ntfy.topicPrefix && (
|
{capabilities.ntfy.topicPrefix && (
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
Präfix: {capabilities.ntfy.topicPrefix} (Bindestrich wird automatisch ergänzt)
|
Präfix: {capabilities.ntfy.topicPrefix} (Unterstrich wird automatisch ergänzt)
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{ntfyPreviewUrl && (
|
{ntfyPreviewUrl && (
|
||||||
|
|||||||
Reference in New Issue
Block a user