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