mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 14:04:54 +00:00
Enhance the message notification feature
This commit is contained in:
308
ui/dist/assets/index-B-WSkv0U.js
vendored
Normal file
308
ui/dist/assets/index-B-WSkv0U.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ui/dist/assets/index-BLt37AhW.css
vendored
Normal file
1
ui/dist/assets/index-BLt37AhW.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ui/dist/assets/index-BmYeXvQX.css
vendored
1
ui/dist/assets/index-BmYeXvQX.css
vendored
File diff suppressed because one or more lines are too long
303
ui/dist/assets/index-Cum7econ.js
vendored
303
ui/dist/assets/index-Cum7econ.js
vendored
File diff suppressed because one or more lines are too long
4
ui/dist/index.html
vendored
4
ui/dist/index.html
vendored
@@ -5,8 +5,8 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Certimate - Your Trusted SSL Automation Partner</title>
|
||||
<script type="module" crossorigin src="/assets/index-Cum7econ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BmYeXvQX.css">
|
||||
<script type="module" crossorigin src="/assets/index-B-WSkv0U.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BLt37AhW.css">
|
||||
</head>
|
||||
<body class="bg-background">
|
||||
<div id="root"></div>
|
||||
|
@@ -23,6 +23,7 @@ const Telegram = () => {
|
||||
name: "notifyChannels",
|
||||
data: {
|
||||
apiToken: "",
|
||||
chatId: "",
|
||||
enabled: false,
|
||||
},
|
||||
});
|
||||
@@ -31,6 +32,7 @@ const Telegram = () => {
|
||||
const getDetailTelegram = () => {
|
||||
const df: NotifyChannelTelegram = {
|
||||
apiToken: "",
|
||||
chatId: "",
|
||||
enabled: false,
|
||||
};
|
||||
if (!config.content) {
|
||||
@@ -98,6 +100,20 @@ const Telegram = () => {
|
||||
}}
|
||||
/>
|
||||
|
||||
<Input
|
||||
placeholder="ChatId"
|
||||
value={telegram.data.chatId}
|
||||
onChange={(e) => {
|
||||
setTelegram({
|
||||
...telegram,
|
||||
data: {
|
||||
...telegram.data,
|
||||
chatId: e.target.value,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="flex items-center space-x-1 mt-2">
|
||||
<Switch
|
||||
id="airplane-mode"
|
||||
|
@@ -8,6 +8,7 @@ import { useEffect, useState } from "react";
|
||||
import { update } from "@/repository/settings";
|
||||
import { getErrMessage } from "@/lib/error";
|
||||
import { useToast } from "../ui/use-toast";
|
||||
import { isValidURL } from "@/lib/url";
|
||||
|
||||
type WebhookSetting = {
|
||||
id: string;
|
||||
@@ -55,6 +56,16 @@ const Webhook = () => {
|
||||
|
||||
const handleSaveClick = async () => {
|
||||
try {
|
||||
webhook.data.url = webhook.data.url.trim();
|
||||
if (!isValidURL(webhook.data.url)) {
|
||||
toast({
|
||||
title: "保存失败",
|
||||
description: "Url格式不正确",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const resp = await update({
|
||||
...config,
|
||||
name: "notifyChannels",
|
||||
|
@@ -36,6 +36,7 @@ export type NotifyChannelDingTalk = {
|
||||
|
||||
export type NotifyChannelTelegram = {
|
||||
apiToken: string;
|
||||
chatId: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
export const version = "Certimate v0.1.10";
|
||||
export const version = "Certimate v0.1.11";
|
||||
|
8
ui/src/lib/url.ts
Normal file
8
ui/src/lib/url.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export function isValidURL(url: string): boolean {
|
||||
try {
|
||||
new URL(url);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ const Notify = () => {
|
||||
</Accordion>
|
||||
</div>
|
||||
<div className="border rounded-md p-5 mt-7 shadow-lg">
|
||||
<Accordion type={"multiple"} className="dark:text-stone-200">
|
||||
<Accordion type={"single"} className="dark:text-stone-200">
|
||||
<AccordionItem value="item-2" className="dark:border-stone-200">
|
||||
<AccordionTrigger>钉钉</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
|
Reference in New Issue
Block a user