Skip to content

Commit f104ed5

Browse files
authored
Merge pull request #2579 from Uncover-it/copilot/remove-discord-webhook-regex-checking
Remove Discord-specific URL validation to support arbitrary webhook endpoints
2 parents c147fcb + 7105f3c commit f104ed5

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# dependencies
44
/node_modules
5+
package-lock.json
56

67
# next.js
78
/.next/

src/app/page.tsx

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ export default function WebhookTool() {
106106
const [useSpam, setUseSpam] = useState(false);
107107
const spamRef = useRef<{ stop: boolean }>({ stop: false });
108108

109-
const isValidWebhook = (url: string) => {
110-
const regex =
111-
/https:\/\/(?:canary\.)?(?:ptb\.)?discord(?:app)?\.com\/api\/webhooks\//;
112-
return regex.test(url);
113-
};
114-
115109
useEffect(() => {
116110
const saved = localStorage.getItem("savedWebhooks");
117111
if (saved) {
@@ -163,13 +157,6 @@ export default function WebhookTool() {
163157
};
164158

165159
const editWebhook = async () => {
166-
if (!isValidWebhook(webhookUrl)) {
167-
toast.error("Error", {
168-
description: "Please enter a valid Discord webhook URL",
169-
});
170-
return;
171-
}
172-
173160
setLoading(true);
174161

175162
try {
@@ -213,13 +200,6 @@ export default function WebhookTool() {
213200
};
214201

215202
const sendWebhook = async () => {
216-
if (!isValidWebhook(webhookUrl)) {
217-
toast.error("Error", {
218-
description: "Please enter a valid Discord webhook URL",
219-
});
220-
return;
221-
}
222-
223203
setLoading(true);
224204

225205
try {
@@ -288,13 +268,6 @@ export default function WebhookTool() {
288268
};
289269

290270
const startSpam = async () => {
291-
if (!isValidWebhook(webhookUrl)) {
292-
toast.error("Error", {
293-
description: "Please enter a valid Discord webhook URL",
294-
});
295-
return;
296-
}
297-
298271
setIsSpamming(true);
299272
spamRef.current.stop = false;
300273
const payload: WebhookPayload = {};

0 commit comments

Comments
 (0)