@@ -647,7 +674,7 @@ class ProviderEditPage extends React.Component {
)
}
- {this.state.provider.category === "Storage" || this.state.provider.type === "Custom HTTP SMS" ? (
+ {this.state.provider.category === "Storage" ? (
{["Local File System"].includes(this.state.provider.type) ? null : (
@@ -661,7 +688,7 @@ class ProviderEditPage extends React.Component {
)}
- {["Custom HTTP SMS", "Local File System", "MinIO", "Tencent Cloud COS", "Google Cloud Storage", "Qiniu Cloud Kodo"].includes(this.state.provider.type) ? null : (
+ {["Local File System", "MinIO", "Tencent Cloud COS", "Google Cloud Storage", "Qiniu Cloud Kodo"].includes(this.state.provider.type) ? null : (
{Setting.getLabel(i18next.t("provider:Endpoint (Intranet)"), i18next.t("provider:Region endpoint for Intranet"))} :
@@ -673,7 +700,7 @@ class ProviderEditPage extends React.Component {
)}
- {["Custom HTTP SMS", "Local File System"].includes(this.state.provider.type) ? null : (
+ {["Local File System"].includes(this.state.provider.type) ? null : (
{Setting.getLabel(i18next.t("provider:Bucket"), i18next.t("provider:Bucket - Tooltip"))} :
@@ -685,19 +712,17 @@ class ProviderEditPage extends React.Component {
)}
- {["Custom HTTP SMS"].includes(this.state.provider.type) ? null : (
-
-
- {Setting.getLabel(i18next.t("provider:Path prefix"), i18next.t("provider:Path prefix - Tooltip"))} :
-
-
- {
- this.updateProviderField("pathPrefix", e.target.value);
- }} />
-
-
- )}
- {["Custom HTTP SMS", "MinIO", "Google Cloud Storage", "Qiniu Cloud Kodo"].includes(this.state.provider.type) ? null : (
+
+
+ {Setting.getLabel(i18next.t("provider:Path prefix"), i18next.t("provider:Path prefix - Tooltip"))} :
+
+
+ {
+ this.updateProviderField("pathPrefix", e.target.value);
+ }} />
+
+
+ {["MinIO", "Google Cloud Storage", "Qiniu Cloud Kodo"].includes(this.state.provider.type) ? null : (
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
@@ -723,56 +748,44 @@ class ProviderEditPage extends React.Component {
) : null}
) : null}
- {
- this.state.provider.type !== "Custom HTTP SMS" ? null : (
-
-
-
- {Setting.getLabel(i18next.t("general:Method"), i18next.t("provider:Method - Tooltip"))} :
-
-
-
-
-
-
-
- {Setting.getLabel(i18next.t("provider:Parameter name"), i18next.t("provider:Parameter name - Tooltip"))} :
-
-
- {
- this.updateProviderField("clientId", e.target.value);
- }} />
-
-
-
-
- {Setting.getLabel(i18next.t("provider:Content"), i18next.t("provider:Content - Tooltip"))} :
-
-
-
-
- )
- }
{this.getAppIdRow(this.state.provider)}
{
this.state.provider.category === "Notification" ? (
+ {["Custom HTTP"].includes(this.state.provider.type) ? (
+
+
+ {Setting.getLabel(i18next.t("general:Method"), i18next.t("provider:Method - Tooltip"))} :
+
+
+
+
+
+ ) : null}
+ {["Custom HTTP"].includes(this.state.provider.type) ? (
+
+
+ {Setting.getLabel(i18next.t("provider:Parameter"), i18next.t("provider:Parameter - Tooltip"))} :
+
+
+ {
+ this.updateProviderField("title", e.target.value);
+ }} />
+
+
+ ) : null}
- {Setting.getLabel(i18next.t("provider:Notification content"), i18next.t("provider:Notification content - Tooltip"))} :
+ {Setting.getLabel(i18next.t("provider:Content"), i18next.t("provider:Content - Tooltip"))} :
-
- {Setting.getLabel(i18next.t("provider:Chat Id"), i18next.t("provider:Chat Id - Tooltip"))} :
-
-
- {
- this.updateProviderField("receiver", e.target.value);
- }} />
-
+ {this.getReceiverRow(this.state.provider)}
) : this.state.provider.category === "SMS" ? (
- {["Custom HTTP SMS", "Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS"].includes(this.state.provider.type) ?
+ {["Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS"].includes(this.state.provider.type) ?
null :
(
@@ -882,7 +888,7 @@ class ProviderEditPage extends React.Component {
)
}
- {["Custom HTTP SMS", "Infobip SMS"].includes(this.state.provider.type) ?
+ {["Infobip SMS"].includes(this.state.provider.type) ?
null :
(
@@ -900,32 +906,27 @@ class ProviderEditPage extends React.Component {
{Setting.getLabel(i18next.t("provider:SMS Test"), i18next.t("provider:SMS Test - Tooltip"))} :
- {["Custom HTTP SMS"].includes(this.state.provider.type) ?
- null :
- (
-
-
- {
- this.updateProviderField("content", value);
- }}
- countryCodes={this.props.account.organization.countryCodes}
- />
- {
- this.updateProviderField("receiver", e.target.value);
- }} />
-
-
- )
- }
+
+
+ {
+ this.updateProviderField("content", value);
+ }}
+ countryCodes={this.props.account.organization.countryCodes}
+ />
+ {
+ this.updateProviderField("receiver", e.target.value);
+ }} />
+
+
diff --git a/web/src/Setting.js b/web/src/Setting.js
index 00d91992..fd8b8f68 100644
--- a/web/src/Setting.js
+++ b/web/src/Setting.js
@@ -96,10 +96,6 @@ export const OtherProviderInfo = {
logo: `${StaticBaseUrl}/img/social_azure.png`,
url: "https://azure.microsoft.com/en-us/products/communication-services",
},
- "Custom HTTP SMS": {
- logo: `${StaticBaseUrl}/img/email_default.png`,
- url: "https://casdoor.org/docs/provider/sms/overview",
- },
"Infobip SMS": {
logo: `${StaticBaseUrl}/img/social_infobip.png`,
url: "https://portal.infobip.com/homepage/",
@@ -276,6 +272,10 @@ export const OtherProviderInfo = {
logo: `${StaticBaseUrl}/img/social_telegram.png`,
url: "https://telegram.org/",
},
+ "Custom HTTP": {
+ logo: `${StaticBaseUrl}/img/email_default.png`,
+ url: "https://casdoor.org/docs/provider/sms/overview",
+ },
},
};
@@ -909,7 +909,6 @@ export function getProviderTypeOptions(category) {
{id: "Aliyun SMS", name: "Alibaba Cloud SMS"},
{id: "Amazon SNS", name: "Amazon SNS"},
{id: "Azure ACS", name: "Azure ACS"},
- {id: "Custom HTTP SMS", name: "Custom HTTP SMS"},
{id: "Infobip SMS", name: "Infobip SMS"},
{id: "Tencent Cloud SMS", name: "Tencent Cloud SMS"},
{id: "Baidu Cloud SMS", name: "Baidu Cloud SMS"},
@@ -966,6 +965,7 @@ export function getProviderTypeOptions(category) {
} else if (category === "Notification") {
return ([
{id: "Telegram", name: "Telegram"},
+ {id: "Custom HTTP", name: "Custom HTTP"},
]);
} else {
return [];
diff --git a/web/src/common/TestNotificationWidget.js b/web/src/common/TestNotificationWidget.js
index ac6afc95..a5e19ff8 100644
--- a/web/src/common/TestNotificationWidget.js
+++ b/web/src/common/TestNotificationWidget.js
@@ -15,8 +15,8 @@
import * as Setting from "../Setting";
import i18next from "i18next";
-export function sendTestNotification(provider, notification) {
- testNotificationProvider(provider, notification)
+export function sendTestNotification(provider) {
+ testNotificationProvider(provider.content, provider.name)
.then((res) => {
if (res.status === "ok") {
Setting.showMessage("success", i18next.t("general:Successfully sent"));
@@ -29,12 +29,12 @@ export function sendTestNotification(provider, notification) {
});
}
-function testNotificationProvider(provider, email = "") {
+function testNotificationProvider(content, name) {
const notificationForm = {
- content: provider.content,
+ content: content,
};
- return fetch(`${Setting.ServerUrl}/api/send-notification?provider=` + provider.name, {
+ return fetch(`${Setting.ServerUrl}/api/send-notification?provider=${name}`, {
method: "POST",
credentials: "include",
body: JSON.stringify(notificationForm),