Skip to content

Commit 88b9283

Browse files
Merge branch 'master' into websocket_test
2 parents 858820c + 23a8a40 commit 88b9283

8 files changed

Lines changed: 787 additions & 793 deletions

File tree

package-lock.json

Lines changed: 678 additions & 792 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@
121121
"nanoid": "~3.3.4",
122122
"net-snmp": "^3.11.2",
123123
"node-cloudflared-tunnel": "~1.0.9",
124-
"node-radius-utils": "~1.2.0",
125124
"node-fetch-cache": "^5.1.0",
125+
"node-radius-utils": "~1.2.0",
126126
"nodemailer": "~6.9.13",
127127
"nostr-tools": "^2.10.4",
128128
"notp": "~2.0.3",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const NotificationProvider = require("./notification-provider");
2+
const axios = require("axios");
3+
4+
class Resend extends NotificationProvider {
5+
name = "Resend";
6+
7+
/**
8+
* @inheritdoc
9+
*/
10+
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
11+
const okMsg = "Sent Successfully.";
12+
13+
try {
14+
let config = {
15+
headers: {
16+
Authorization: `Bearer ${notification.resendApiKey}`,
17+
"Content-Type": "application/json",
18+
},
19+
};
20+
config = this.getAxiosConfigWithProxy(config);
21+
const email = notification.resendFromEmail.trim();
22+
23+
const fromName = notification.resendFromName?.trim() || "Uptime Kuma";
24+
let data = {
25+
from: `${fromName} <${email}>`,
26+
to: notification.resendToEmail,
27+
subject: notification.resendSubject || "Notification from Your Uptime Kuma",
28+
// supplied text directly instead of html
29+
text: msg,
30+
};
31+
32+
let result = await axios.post(
33+
"https://api.resend.com/emails",
34+
data,
35+
config
36+
);
37+
if (result.status === 200) {
38+
return okMsg;
39+
} else {
40+
throw new Error(`Unexpected status code: ${result.status}`);
41+
}
42+
} catch (error) {
43+
this.throwGeneralAxiosError(error);
44+
}
45+
}
46+
}
47+
48+
module.exports = Resend;

server/notification.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const Onesender = require("./notification-providers/onesender");
7777
const Wpush = require("./notification-providers/wpush");
7878
const SendGrid = require("./notification-providers/send-grid");
7979
const Brevo = require("./notification-providers/brevo");
80+
const Resend = require("./notification-providers/resend");
8081
const YZJ = require("./notification-providers/yzj");
8182
const SMSPlanet = require("./notification-providers/sms-planet");
8283
const SpugPush = require("./notification-providers/spugpush");
@@ -174,6 +175,7 @@ class Notification {
174175
new Cellsynt(),
175176
new Wpush(),
176177
new Brevo(),
178+
new Resend(),
177179
new YZJ(),
178180
new SMSPlanet(),
179181
new SpugPush(),

src/components/NotificationDialog.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export default {
172172
"Cellsynt": "Cellsynt",
173173
"SendGrid": "SendGrid",
174174
"Brevo": "Brevo",
175+
"Resend": "Resend",
175176
"notifery": "Notifery",
176177
"Webpush": "Webpush",
177178
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<template>
2+
<div class="mb-3">
3+
<label for="resend-api-key" class="form-label">{{ $t("resendApiKey") }}</label>
4+
<HiddenInput id="resend-api-key" v-model="$parent.notification.resendApiKey" :required="true" autocomplete="new-password"></HiddenInput>
5+
<i18n-t tag="div" keypath="resendApiHelp" class="form-text">
6+
<a href="https://resend.com/api-keys" target="_blank">https://resend.com/api-keys</a>
7+
</i18n-t>
8+
</div>
9+
<div class="mb-3">
10+
<label for="resend-from-email" class="form-label">{{ $t("resendFromEmail") }}</label>
11+
<input id="resend-from-email" v-model="$parent.notification.resendFromEmail" type="text" class="form-control" required>
12+
</div>
13+
<div class="mb-3">
14+
<label for="resend-from-name" class="form-label">{{ $t("resendFromName") }}</label>
15+
<input id="resend-from-name" v-model="$parent.notification.resendFromName" type="text" class="form-control">
16+
<div class="form-text">{{ $t("resendLeaveBlankForDefaultName") }}</div>
17+
</div>
18+
<div class="mb-3">
19+
<label for="resend-to-email" class="form-label">{{ $t("resendToEmail") }}</label>
20+
<input id="resend-to-email" v-model="$parent.notification.resendToEmail" type="text" class="form-control" required>
21+
</div>
22+
<div class="mb-3">
23+
<label for="resend-subject" class="form-label">{{ $t("resendSubject") }}</label>
24+
<input id="resend-subject" v-model="$parent.notification.resendSubject" type="text" class="form-control">
25+
<small class="form-text text-muted">{{ $t("resendLeaveBlankForDefaultSubject") }}</small>
26+
</div>
27+
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
28+
<a href="https://resend.com/docs/dashboard/emails/introduction" target="_blank">https://resend.com/docs/dashboard/emails/introduction</a>
29+
</i18n-t>
30+
</template>
31+
32+
<script>
33+
import HiddenInput from "../HiddenInput.vue";
34+
35+
export default {
36+
components: {
37+
HiddenInput,
38+
},
39+
mounted() {
40+
if (typeof this.$parent.notification.resendSubject === "undefined") {
41+
this.$parent.notification.resendSubject = "Notification from Your Uptime Kuma";
42+
}
43+
if (typeof this.$parent.notification.resendFromName === "undefined") {
44+
this.$parent.notification.resendFromName = "Uptime Kuma";
45+
}
46+
},
47+
};
48+
</script>

src/components/notifications/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import YZJ from "./YZJ.vue";
8080
import SMSPlanet from "./SMSPlanet.vue";
8181
import SMSIR from "./SMSIR.vue";
8282
import Webpush from "./Webpush.vue";
83+
import Resend from "./Resend.vue";
8384

8485
/**
8586
* Manage all notification form.
@@ -165,6 +166,7 @@ const NotificationFormList = {
165166
"WPush": WPush,
166167
"SendGrid": SendGrid,
167168
"Brevo": Brevo,
169+
"Resend": Resend,
168170
"YZJ": YZJ,
169171
"SMSPlanet": SMSPlanet,
170172
"Webpush": Webpush,

src/lang/en.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,13 @@
11531153
"brevoSeparateMultipleEmails": "Separate multiple email addresses with commas",
11541154
"brevoSubject": "Subject",
11551155
"brevoLeaveBlankForDefaultSubject": "leave blank for default subject",
1156+
"resendApiKey": "Resend API Key",
1157+
"resendApiHelp": "Create an api key here {0}",
1158+
"resendFromName": "From Name",
1159+
"resendFromEmail": "From Email",
1160+
"resendLeaveBlankForDefaultName": "leave blank for default name",
1161+
"resendToEmail": "To Email",
1162+
"resendSubject": "Subject",
11561163
"pingCountLabel": "Max Packets",
11571164
"pingCountDescription": "Number of packets to send before stopping",
11581165
"pingNumericLabel": "Numeric Output",

0 commit comments

Comments
 (0)