This commit is contained in:
2025-11-11 09:35:19 +01:00
parent 2125d545f2
commit 88c546bf87
3 changed files with 12 additions and 4 deletions

View File

@@ -28,8 +28,7 @@ async function sendNtfyNotification(adminNtfy, userNtfy, payload) {
const server = (userNtfy.serverUrl || adminNtfy.serverUrl || 'https://ntfy.sh').replace(/\/+$/, '');
const sanitizedPrefix = (adminNtfy.topicPrefix || '').replace(/^-+|-+$/g, '');
const sanitizedTopic = (userNtfy.topic || '').replace(/^-+|-+$/g, '');
const separator = sanitizedPrefix && sanitizedTopic ? '_' : '';
const topic = `${sanitizedPrefix}${separator}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
const topic = `${sanitizedPrefix}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
let url = `${server}/${topic}`;
if (payload.title) {
const delimiter = url.includes('?') ? '&' : '?';

View File

@@ -575,8 +575,7 @@ function App() {
return null;
}
const prefix = (notificationCapabilities.ntfy.topicPrefix || '').replace(/^-+|-+$/g, '');
const separator = prefix && sanitizedTopic ? '_' : '';
const slug = `${prefix}${separator}${sanitizedTopic}` || sanitizedTopic || prefix;
const slug = `${prefix}${sanitizedTopic}` || sanitizedTopic || prefix;
if (!slug) {
return null;
}

View File

@@ -72,6 +72,16 @@ const NotificationPanel = ({
disabled={!settings.ntfy.enabled}
/>
</div>
{capabilities.ntfy.serverUrl && (
<p className="text-xs text-gray-500">
Server: {capabilities.ntfy.serverUrl} (vom Admin festgelegt)
</p>
)}
{capabilities.ntfy.topicPrefix && (
<p className="text-xs text-gray-500">
Präfix: {capabilities.ntfy.topicPrefix} (Topic wird direkt angehängt)
</p>
)}
{ntfyPreviewUrl && (
<div className="flex items-center gap-2 text-xs text-gray-600">
<a