ntfy fix
This commit is contained in:
@@ -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('?') ? '&' : '?';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user