mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-03 12:02:33 +02: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.";
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
let params = {
|
msg = `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
|
||||||
content: `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
|
}
|
||||||
};
|
|
||||||
if (await this.sendToYZJ(notification, params)) {
|
let params = {
|
||||||
return okMsg;
|
content: msg
|
||||||
}
|
};
|
||||||
} else {
|
|
||||||
let params = {
|
if (await this.sendToYZJ(notification, params)) {
|
||||||
content: msg
|
return okMsg;
|
||||||
};
|
|
||||||
if (await this.sendToYZJ(notification, params)) {
|
|
||||||
return okMsg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.throwGeneralAxiosError(error);
|
this.throwGeneralAxiosError(error);
|
||||||
|
@ -50,10 +47,9 @@ class YZJ extends NotificationProvider {
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await axios(config);
|
let result = await axios(config);
|
||||||
if (result.data.success === true) {
|
if (!result.data?.success) {
|
||||||
return true;
|
throw new Error(result.data?.errmsg);
|
||||||
}
|
}
|
||||||
throw new Error(result.data.errmsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,14 +2,23 @@
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="yzjWebHookUrl" class="form-label">{{ $t("YZJ Webhook URL") }}<span style="color: red;"><sup>*</sup></span></label>
|
<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 />
|
<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">
|
<i18n-t class="form-text" keypath="wayToGetTeamsURL">
|
||||||
<a href="https://www.yunzhijia.com/opendocs/docs.html#/tutorial/index/robot" target="_blank">{{ $t("here") }}</a>
|
<a href="https://www.yunzhijia.com/opendocs/docs.html#/tutorial/index/robot" target="_blank">{{ $t("here") }}</a>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</div>
|
</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>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import HiddenInput from "../HiddenInput.vue";
|
import HiddenInput from "../HiddenInput.vue";
|
||||||
|
|
|
@ -1054,5 +1054,6 @@
|
||||||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
|
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
|
||||||
"YZJ Webhook URL": "YZJ Webhook URL",
|
"YZJ Webhook URL": "YZJ Webhook URL",
|
||||||
"YZJ Robot Type": "YZJ Robot type",
|
"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