feat: fix provider test API's missing owner and name args for auth (#3676)

This commit is contained in:
WindSpiritSR 2025-03-22 17:53:20 +08:00 committed by GitHub
parent a11fe59704
commit 14ade8b7e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -51,6 +51,8 @@ function testEmailProvider(provider, email = "") {
receivers: email === "" ? ["TestSmtpServer"] : [email], receivers: email === "" ? ["TestSmtpServer"] : [email],
provider: provider.name, provider: provider.name,
providerObject: provider, providerObject: provider,
owner: provider.owner,
name: provider.name,
}; };
return fetch(`${Setting.ServerUrl}/api/send-email`, { return fetch(`${Setting.ServerUrl}/api/send-email`, {

View File

@ -16,7 +16,7 @@ import * as Setting from "../Setting";
import i18next from "i18next"; import i18next from "i18next";
export function sendTestNotification(provider) { export function sendTestNotification(provider) {
testNotificationProvider(provider.content, provider.name) testNotificationProvider(provider)
.then((res) => { .then((res) => {
if (res.status === "ok") { if (res.status === "ok") {
Setting.showMessage("success", i18next.t("general:Successfully sent")); Setting.showMessage("success", i18next.t("general:Successfully sent"));
@ -29,12 +29,14 @@ export function sendTestNotification(provider) {
}); });
} }
function testNotificationProvider(content, name) { function testNotificationProvider(provider) {
const notificationForm = { const notificationForm = {
content: content, content: provider.content,
owner: provider.owner,
name: provider.name,
}; };
return fetch(`${Setting.ServerUrl}/api/send-notification?provider=${name}`, { return fetch(`${Setting.ServerUrl}/api/send-notification?provider=${provider.name}`, {
method: "POST", method: "POST",
credentials: "include", credentials: "include",
body: JSON.stringify(notificationForm), body: JSON.stringify(notificationForm),

View File

@ -33,6 +33,8 @@ function testSmsProvider(provider, phone = "") {
const SmsForm = { const SmsForm = {
content: "123456", content: "123456",
receivers: [phone], receivers: [phone],
owner: provider.owner,
name: provider.name,
}; };
return fetch(`${Setting.ServerUrl}/api/send-sms?provider=` + provider.name, { return fetch(`${Setting.ServerUrl}/api/send-sms?provider=` + provider.name, {