mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-24 02:15:59 +03:00
run eslint for #687
This commit is contained in:
parent
8ab4788f80
commit
f51156f18e
5 changed files with 24 additions and 24 deletions
|
@ -12,7 +12,7 @@ class AliyunSMS extends NotificationProvider {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
var msgBody = JSON.stringify({
|
let msgBody = JSON.stringify({
|
||||||
name: monitorJSON["name"],
|
name: monitorJSON["name"],
|
||||||
time: heartbeatJSON["time"],
|
time: heartbeatJSON["time"],
|
||||||
status: this.statusToString(heartbeatJSON["status"]),
|
status: this.statusToString(heartbeatJSON["status"]),
|
||||||
|
@ -22,7 +22,7 @@ class AliyunSMS extends NotificationProvider {
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var msgBody = JSON.stringify({
|
let msgBody = JSON.stringify({
|
||||||
name: "",
|
name: "",
|
||||||
time: "",
|
time: "",
|
||||||
status: "",
|
status: "",
|
||||||
|
@ -38,7 +38,7 @@ class AliyunSMS extends NotificationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendSms(notification, msgbody) {
|
async sendSms(notification, msgbody) {
|
||||||
var params = {
|
let params = {
|
||||||
PhoneNumbers: notification.phonenumber,
|
PhoneNumbers: notification.phonenumber,
|
||||||
TemplateCode: notification.templateCode,
|
TemplateCode: notification.templateCode,
|
||||||
SignName: notification.signName,
|
SignName: notification.signName,
|
||||||
|
@ -54,7 +54,7 @@ class AliyunSMS extends NotificationProvider {
|
||||||
};
|
};
|
||||||
|
|
||||||
params.Signature = this.sign(params, notification.secretAccessKey);
|
params.Signature = this.sign(params, notification.secretAccessKey);
|
||||||
var config = {
|
let config = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "http://dysmsapi.aliyuncs.com/",
|
url: "http://dysmsapi.aliyuncs.com/",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -63,7 +63,7 @@ class AliyunSMS extends NotificationProvider {
|
||||||
data: qs.stringify(params),
|
data: qs.stringify(params),
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await axios(config);
|
let result = await axios(config);
|
||||||
if (result.data.Message == "OK") {
|
if (result.data.Message == "OK") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,21 +72,21 @@ class AliyunSMS extends NotificationProvider {
|
||||||
|
|
||||||
/** Aliyun request sign */
|
/** Aliyun request sign */
|
||||||
sign(param, AccessKeySecret) {
|
sign(param, AccessKeySecret) {
|
||||||
var param2 = {},
|
let param2 = {};
|
||||||
data = [];
|
let data = [];
|
||||||
|
|
||||||
var oa = Object.keys(param).sort();
|
let oa = Object.keys(param).sort();
|
||||||
|
|
||||||
for (var i = 0; i < oa.length; i++) {
|
for (let i = 0; i < oa.length; i++) {
|
||||||
var key = oa[i];
|
let key = oa[i];
|
||||||
param2[key] = param[key];
|
param2[key] = param[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var key in param2) {
|
for (let key in param2) {
|
||||||
data.push(`${encodeURIComponent(key)}=${encodeURIComponent(param2[key])}`);
|
data.push(`${encodeURIComponent(key)}=${encodeURIComponent(param2[key])}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
var StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`;
|
let StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`;
|
||||||
return Crypto
|
return Crypto
|
||||||
.createHmac("sha1", `${AccessKeySecret}&`)
|
.createHmac("sha1", `${AccessKeySecret}&`)
|
||||||
.update(Buffer.from(StringToSign))
|
.update(Buffer.from(StringToSign))
|
||||||
|
|
|
@ -11,7 +11,7 @@ class DingDing extends NotificationProvider {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
var params = {
|
let params = {
|
||||||
msgtype: "markdown",
|
msgtype: "markdown",
|
||||||
markdown: {
|
markdown: {
|
||||||
title: monitorJSON["name"],
|
title: monitorJSON["name"],
|
||||||
|
@ -22,10 +22,10 @@ class DingDing extends NotificationProvider {
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var params = {
|
let params = {
|
||||||
msgtype: "text",
|
msgtype: "text",
|
||||||
text: {
|
text: {
|
||||||
content:msg
|
content: msg
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (this.sendToDingDing(notification, params)) {
|
if (this.sendToDingDing(notification, params)) {
|
||||||
|
@ -38,9 +38,9 @@ class DingDing extends NotificationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendToDingDing(notification, params) {
|
async sendToDingDing(notification, params) {
|
||||||
var timestamp=Date.now()
|
let timestamp = Date.now();
|
||||||
|
|
||||||
var config = {
|
let config = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -49,7 +49,7 @@ class DingDing extends NotificationProvider {
|
||||||
data: JSON.stringify(params),
|
data: JSON.stringify(params),
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await axios(config);
|
let result = await axios(config);
|
||||||
if (result.data.errmsg == "ok") {
|
if (result.data.errmsg == "ok") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ class DingDing extends NotificationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** DingDing sign */
|
/** DingDing sign */
|
||||||
sign(timestamp,secretKey) {
|
sign(timestamp, secretKey) {
|
||||||
return Crypto
|
return Crypto
|
||||||
.createHmac("sha256", Buffer.from(secretKey, 'utf8'))
|
.createHmac("sha256", Buffer.from(secretKey, "utf8"))
|
||||||
.update(Buffer.from(`${timestamp}\n${secretKey}`, 'utf8'))
|
.update(Buffer.from(`${timestamp}\n${secretKey}`, "utf8"))
|
||||||
.digest("base64");
|
.digest("base64");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<label for="signName" class="form-label">{{ $t("SignName") }}<span style="color: red;"><sup>*</sup></span></label>
|
<label for="signName" class="form-label">{{ $t("SignName") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
<input id="signName" v-model="$parent.notification.signName" type="text" class="form-control" required>
|
<input id="signName" v-model="$parent.notification.signName" type="text" class="form-control" required>
|
||||||
|
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p>Sms template must contain parameters: <br> <code>${name} ${time} ${status} ${msg}</code></p>
|
<p>Sms template must contain parameters: <br> <code>${name} ${time} ${status} ${msg}</code></p>
|
||||||
<i18n-t tag="p" keypath="Read more:">
|
<i18n-t tag="p" keypath="Read more:">
|
||||||
<a href="https://help.aliyun.com/document_detail/101414.html" target="_blank">https://help.aliyun.com/document_detail/101414.html</a>
|
<a href="https://help.aliyun.com/document_detail/101414.html" target="_blank">https://help.aliyun.com/document_detail/101414.html</a>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<label for="secretKey" class="form-label">{{ $t("SecretKey") }}<span style="color: red;"><sup>*</sup></span></label>
|
<label for="secretKey" class="form-label">{{ $t("SecretKey") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
<input id="secretKey" v-model="$parent.notification.secretKey" type="text" class="form-control" required>
|
<input id="secretKey" v-model="$parent.notification.secretKey" type="text" class="form-control" required>
|
||||||
|
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p>For safety, must use secret key</p>
|
<p>For safety, must use secret key</p>
|
||||||
<i18n-t tag="p" keypath="Read more:">
|
<i18n-t tag="p" keypath="Read more:">
|
||||||
<a href="https://developers.dingtalk.com/document/robots/custom-robot-access" target="_blank">https://developers.dingtalk.com/document/robots/custom-robot-access</a>
|
<a href="https://developers.dingtalk.com/document/robots/custom-robot-access" target="_blank">https://developers.dingtalk.com/document/robots/custom-robot-access</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
|
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
|
||||||
</div>
|
</div>
|
||||||
<i18n-t tag="div" keypath="wayToGetTeamsURL" class="form-text">
|
<i18n-t tag="div" keypath="wayToGetTeamsURL" class="form-text">
|
||||||
<a
|
<a
|
||||||
href="https://www.feishu.cn/hc/zh-CN/articles/360024984973"
|
href="https://www.feishu.cn/hc/zh-CN/articles/360024984973"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|
Loading…
Reference in a new issue