Add Echobell provider

This commit is contained in:
headlessdev
2025-04-29 22:52:29 +02:00
parent 1a395783b0
commit 1fccc59c01
9 changed files with 43 additions and 24 deletions

View File

@@ -22,13 +22,12 @@ interface AddRequest {
pushoverToken?: string;
pushoverUser?: string;
echobellURL?: string;
echobellData?: string;
}
export async function POST(request: NextRequest) {
try {
const body: AddRequest = await request.json();
const { type, name, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, smtpFrom, smtpTo, telegramToken, telegramChatId, discordWebhook, gotifyUrl, gotifyToken, ntfyUrl, ntfyToken, pushoverUrl, pushoverToken, pushoverUser, echobellURL, echobellData } = body;
const { type, name, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, smtpFrom, smtpTo, telegramToken, telegramChatId, discordWebhook, gotifyUrl, gotifyToken, ntfyUrl, ntfyToken, pushoverUrl, pushoverToken, pushoverUser, echobellURL } = body;
const notification = await prisma.notification.create({
data: {
@@ -51,8 +50,7 @@ export async function POST(request: NextRequest) {
pushoverUrl: pushoverUrl,
pushoverToken: pushoverToken,
pushoverUser: pushoverUser,
echobellURL: echobellURL,
echobellData: echobellData,
echobellURL: echobellURL
}
});

View File

@@ -83,7 +83,6 @@ export default function Settings() {
const [pushoverToken, setPushoverToken] = useState<string>("")
const [pushoverUser, setPushoverUser] = useState<string>("")
const [echobellURL, setEchobellURL] = useState<string>("")
const [echobellData, setEchobellData] = useState<string>("")
const [language, setLanguage] = useState<string>("english")
const [notifications, setNotifications] = useState<any[]>([])
@@ -193,7 +192,6 @@ export default function Settings() {
pushoverToken: pushoverToken,
pushoverUser: pushoverUser,
echobellURL: echobellURL,
echobellData: echobellData,
})
getNotifications()
} catch (error: any) {
@@ -701,17 +699,7 @@ export default function Settings() {
onChange={(e) => setEchobellURL(e.target.value)}
/>
</div>
<div className="grid w-full items-center gap-1.5">
<Label>{t('Settings.Notifications.AddNotification.Echobell.Data')}</Label>
<Textarea
placeholder={`e.g.:
"title": "Server Status",
"message": "Server is online"
`}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setEchobellData(e.target.value)}
rows={4}
/>
</div>
<span className="text-xs text-muted-foreground">Add in Echobell the "message" field.</span>
</div>
)}