Add Gotify and Ntfy configuration fields to Settings component for enhanced notification options

This commit is contained in:
headlessdev 2025-04-19 13:20:04 +02:00
parent 300547e59e
commit 2b8f7a95d2

View File

@ -69,6 +69,10 @@ export default function Settings() {
const [telegramToken, setTelegramToken] = useState<string>("") const [telegramToken, setTelegramToken] = useState<string>("")
const [telegramChatId, setTelegramChatId] = useState<string>("") const [telegramChatId, setTelegramChatId] = useState<string>("")
const [discordWebhook, setDiscordWebhook] = useState<string>("") const [discordWebhook, setDiscordWebhook] = useState<string>("")
const [gotifyUrl, setGotifyUrl] = useState<string>("")
const [gotifyToken, setGotifyToken] = useState<string>("")
const [ntfyUrl, setNtfyUrl] = useState<string>("")
const [ntfyToken, setNtfyToken] = useState<string>("")
const [notifications, setNotifications] = useState<any[]>([]) const [notifications, setNotifications] = useState<any[]>([])
@ -168,6 +172,10 @@ export default function Settings() {
telegramToken: telegramToken, telegramToken: telegramToken,
telegramChatId: telegramChatId, telegramChatId: telegramChatId,
discordWebhook: discordWebhook, discordWebhook: discordWebhook,
gotifyUrl: gotifyUrl,
gotifyToken: gotifyToken,
ntfyUrl: ntfyUrl,
ntfyToken: ntfyToken,
}) })
getNotifications() getNotifications()
} catch (error: any) { } catch (error: any) {
@ -424,6 +432,8 @@ export default function Settings() {
<SelectItem value="smtp">SMTP</SelectItem> <SelectItem value="smtp">SMTP</SelectItem>
<SelectItem value="telegram">Telegram</SelectItem> <SelectItem value="telegram">Telegram</SelectItem>
<SelectItem value="discord">Discord</SelectItem> <SelectItem value="discord">Discord</SelectItem>
<SelectItem value="gotify">Gotify</SelectItem>
<SelectItem value="ntfy">Ntfy</SelectItem>
</SelectContent> </SelectContent>
{notificationType === "smtp" && ( {notificationType === "smtp" && (
@ -538,6 +548,52 @@ export default function Settings() {
</div> </div>
</div> </div>
)} )}
{notificationType === "gotify" && (
<div className="mt-4">
<div className="grid w-full items-center gap-1.5">
<Label htmlFor="gotifyUrl">Gotify URL</Label>
<Input
type="text"
id="gotifyUrl"
placeholder=""
onChange={(e) => setGotifyUrl(e.target.value)}
/>
<div className="grid w-full items-center gap-1.5">
<Label htmlFor="gotifyToken">Gotify Token</Label>
<Input
type="text"
id="gotifyToken"
placeholder=""
onChange={(e) => setGotifyToken(e.target.value)}
/>
</div>
</div>
</div>
)}
{notificationType === "ntfy" && (
<div className="mt-4">
<div className="grid w-full items-center gap-1.5">
<Label htmlFor="ntfyUrl">Ntfy URL</Label>
<Input
type="text"
id="ntfyUrl"
placeholder=""
onChange={(e) => setNtfyUrl(e.target.value)}
/>
<div className="grid w-full items-center gap-1.5">
<Label htmlFor="ntfyToken">Ntfy Token</Label>
<Input
type="text"
id="ntfyToken"
placeholder=""
onChange={(e) => setNtfyToken(e.target.value)}
/>
</div>
</div>
</div>
)}
</Select> </Select>
</AlertDialogDescription> </AlertDialogDescription>
<AlertDialogFooter> <AlertDialogFooter>