mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-26 05:25:56 +00:00
Compare commits
1 commit
fc355a360b
...
d195820ce5
Author | SHA1 | Date | |
---|---|---|---|
|
d195820ce5 |
2 changed files with 32 additions and 26 deletions
|
@ -19,6 +19,7 @@ class OneChat extends NotificationProvider {
|
|||
Authorization: "Bearer " + notification.accessToken,
|
||||
},
|
||||
};
|
||||
// Send a test message if the monitor is null
|
||||
if (heartbeatJSON == null) {
|
||||
const testMessage = {
|
||||
to: notification.recieverId,
|
||||
|
@ -33,11 +34,17 @@ class OneChat extends NotificationProvider {
|
|||
bot_id: notification.botId,
|
||||
type: "text",
|
||||
message:
|
||||
`UptimeKuma Alert:
|
||||
[🔴 Down]
|
||||
Name: ${monitorJSON["name"]}
|
||||
${heartbeatJSON["msg"]}
|
||||
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
||||
"UptimeKuma Alert:\n" +
|
||||
"[🔴 Down]\n" +
|
||||
"Name: " +
|
||||
monitorJSON["name"] +
|
||||
"\n" +
|
||||
heartbeatJSON["msg"] +
|
||||
"\n" +
|
||||
"Time (" +
|
||||
heartbeatJSON["timezone"] +
|
||||
"): " +
|
||||
heartbeatJSON["localDateTime"],
|
||||
};
|
||||
await axios.post(url, downMessage, config);
|
||||
} else if (heartbeatJSON["status"] === UP) {
|
||||
|
@ -46,11 +53,17 @@ Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
|||
bot_id: notification.botId,
|
||||
type: "text",
|
||||
message:
|
||||
`UptimeKuma Alert:
|
||||
[🟢 Up]
|
||||
Name: ${monitorJSON["name"]}
|
||||
${heartbeatJSON["msg"]}
|
||||
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
||||
"UptimeKuma Alert:\n" +
|
||||
"[🟢 Up]\n" +
|
||||
"Name: " +
|
||||
monitorJSON["name"] +
|
||||
"\n" +
|
||||
heartbeatJSON["msg"] +
|
||||
"\n" +
|
||||
"Time (" +
|
||||
heartbeatJSON["timezone"] +
|
||||
"): " +
|
||||
heartbeatJSON["localDateTime"],
|
||||
};
|
||||
await axios.post(url, upMessage, config);
|
||||
}
|
||||
|
@ -64,7 +77,9 @@ Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
|||
"Unknown API error occurred.";
|
||||
throw new Error(`OneChat API Error: ${errorMessage}`);
|
||||
} else {
|
||||
this.throwGeneralAxiosError(error);
|
||||
throw new Error(
|
||||
`Network or unexpected error: ${error.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
<!-- Access Token Input -->
|
||||
<div class="mb-3">
|
||||
<label for="onechat-access-token" class="form-label">
|
||||
OneChat Access Token<span style="color: red;"><sup>*</sup></span>
|
||||
Access Token<span style="color: red;"><sup>*</sup></span>
|
||||
</label>
|
||||
<HiddenInput
|
||||
<input
|
||||
id="onechat-access-token"
|
||||
v-model="$parent.notification.accessToken"
|
||||
:required="true"
|
||||
>
|
||||
</HiddenInput>
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">
|
||||
<p>{{ $t("OneChatAccessToken") }}</p>
|
||||
</div>
|
||||
|
@ -52,13 +53,3 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue