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 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 topic = `${sanitizedPrefix}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
|
||||||
const topic = `${sanitizedPrefix}${separator}${sanitizedTopic}` || sanitizedPrefix || sanitizedTopic;
|
|
||||||
let url = `${server}/${topic}`;
|
let url = `${server}/${topic}`;
|
||||||
if (payload.title) {
|
if (payload.title) {
|
||||||
const delimiter = url.includes('?') ? '&' : '?';
|
const delimiter = url.includes('?') ? '&' : '?';
|
||||||
|
|||||||
@@ -575,8 +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 slug = `${prefix}${sanitizedTopic}` || sanitizedTopic || prefix;
|
||||||
const slug = `${prefix}${separator}${sanitizedTopic}` || sanitizedTopic || prefix;
|
|
||||||
if (!slug) {
|
if (!slug) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,16 @@ const NotificationPanel = ({
|
|||||||
disabled={!settings.ntfy.enabled}
|
disabled={!settings.ntfy.enabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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 && (
|
{ntfyPreviewUrl && (
|
||||||
<div className="flex items-center gap-2 text-xs text-gray-600">
|
<div className="flex items-center gap-2 text-xs text-gray-600">
|
||||||
<a
|
<a
|
||||||
|
|||||||
Reference in New Issue
Block a user