mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-14 12:11:01 +03:00
optimized
This commit is contained in:
parent
921ec647f5
commit
56c547f00a
3 changed files with 27 additions and 21 deletions
|
@ -12,20 +12,17 @@ class YZJ extends NotificationProvider {
|
|||
let okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
|
||||
if (heartbeatJSON != null) {
|
||||
let params = {
|
||||
content: `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
|
||||
};
|
||||
if (await this.sendToYZJ(notification, params)) {
|
||||
return okMsg;
|
||||
}
|
||||
} else {
|
||||
let params = {
|
||||
content: msg
|
||||
};
|
||||
if (await this.sendToYZJ(notification, params)) {
|
||||
return okMsg;
|
||||
}
|
||||
msg = `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
|
||||
}
|
||||
|
||||
let params = {
|
||||
content: msg
|
||||
};
|
||||
|
||||
if (await this.sendToYZJ(notification, params)) {
|
||||
return okMsg;
|
||||
}
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
|
@ -50,10 +47,9 @@ class YZJ extends NotificationProvider {
|
|||
};
|
||||
|
||||
let result = await axios(config);
|
||||
if (result.data.success === true) {
|
||||
return true;
|
||||
if (!result.data?.success) {
|
||||
throw new Error(result.data?.errmsg);
|
||||
}
|
||||
throw new Error(result.data.errmsg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,14 +2,23 @@
|
|||
<div class="mb-3">
|
||||
<label for="yzjWebHookUrl" class="form-label">{{ $t("YZJ Webhook URL") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||
<input id="yzjWebHookUrl" v-model="$parent.notification.yzjWebHookUrl" type="url" class="form-control" required />
|
||||
<label for="yzjType" class="form-label">{{ $t("YZJ Robot Type") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||
<input id="yzjType" v-model="$parent.notification.yzjType" type="text" class="form-control" required />
|
||||
<label for="yzjToken" class="form-label">{{ $t("YZJ Robot Token") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||
<hidden-input id="yzjToken" v-model="$parent.notification.yzjToken" type="text" class="form-control" required />
|
||||
<i18n-t class="form-text" keypath="wayToGetTeamsURL">
|
||||
<a href="https://www.yunzhijia.com/opendocs/docs.html#/tutorial/index/robot" target="_blank">{{ $t("here") }}</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="yzjType" class="form-label">{{ $t("YZJ Robot Type") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||
<select id="yzjType" v-model="$parent.notification.yzjType" class="form-control" required>
|
||||
<option :value="0">{{ $t("YZJ General Robot") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="yzjToken" class="form-label">{{ $t("YZJ Robot Token") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||
<hidden-input id="yzjToken" v-model="$parent.notification.yzjToken" type="text" class="form-control" required />
|
||||
<i18n-t class="form-text" keypath="wayToGetLineNotifyToken">
|
||||
<a href="https://www.yunzhijia.com/opendocs/docs.html#/server-api/im/index?id=%e6%8e%a5%e5%8f%a3%e5%9c%b0%e5%9d%80%e5%92%8c%e6%8e%88%e6%9d%83%e7%a0%81" target="_blank">{{ $t("here") }}</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
|
|
@ -1054,5 +1054,6 @@
|
|||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
|
||||
"YZJ Webhook URL": "YZJ Webhook URL",
|
||||
"YZJ Robot Type": "YZJ Robot type",
|
||||
"YZJ Robot Token": "YZJ Robot token"
|
||||
"YZJ Robot Token": "YZJ Robot token",
|
||||
"YZJ General Robot": "YZJ General Robot"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue