mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-26 13:35:56 +00:00
Compare commits
No commits in common. "19d19cab9899e4af5c579c3cbd7841bbf2d0d457" and "f0eaa46a022d7e66fdbf0c56d95455c44ec49b31" have entirely different histories.
19d19cab98
...
f0eaa46a02
2 changed files with 32 additions and 26 deletions
|
@ -19,6 +19,7 @@ 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,
|
||||||
|
@ -33,11 +34,17 @@ class OneChat extends NotificationProvider {
|
||||||
bot_id: notification.botId,
|
bot_id: notification.botId,
|
||||||
type: "text",
|
type: "text",
|
||||||
message:
|
message:
|
||||||
`UptimeKuma Alert:
|
"UptimeKuma Alert:\n" +
|
||||||
[🔴 Down]
|
"[🔴 Down]\n" +
|
||||||
Name: ${monitorJSON["name"]}
|
"Name: " +
|
||||||
${heartbeatJSON["msg"]}
|
monitorJSON["name"] +
|
||||||
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
"\n" +
|
||||||
|
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) {
|
||||||
|
@ -46,11 +53,17 @@ Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
||||||
bot_id: notification.botId,
|
bot_id: notification.botId,
|
||||||
type: "text",
|
type: "text",
|
||||||
message:
|
message:
|
||||||
`UptimeKuma Alert:
|
"UptimeKuma Alert:\n" +
|
||||||
[🟢 Up]
|
"[🟢 Up]\n" +
|
||||||
Name: ${monitorJSON["name"]}
|
"Name: " +
|
||||||
${heartbeatJSON["msg"]}
|
monitorJSON["name"] +
|
||||||
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
"\n" +
|
||||||
|
heartbeatJSON["msg"] +
|
||||||
|
"\n" +
|
||||||
|
"Time (" +
|
||||||
|
heartbeatJSON["timezone"] +
|
||||||
|
"): " +
|
||||||
|
heartbeatJSON["localDateTime"],
|
||||||
};
|
};
|
||||||
await axios.post(url, upMessage, config);
|
await axios.post(url, upMessage, config);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +77,9 @@ Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
||||||
"Unknown API error occurred.";
|
"Unknown API error occurred.";
|
||||||
throw new Error(`OneChat API Error: ${errorMessage}`);
|
throw new Error(`OneChat API Error: ${errorMessage}`);
|
||||||
} else {
|
} else {
|
||||||
this.throwGeneralAxiosError(error);
|
throw new Error(
|
||||||
|
`Network or unexpected error: ${error.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
<!-- 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">
|
||||||
OneChat Access Token<span style="color: red;"><sup>*</sup></span>
|
Access Token<span style="color: red;"><sup>*</sup></span>
|
||||||
</label>
|
</label>
|
||||||
<HiddenInput
|
<input
|
||||||
id="onechat-access-token"
|
id="onechat-access-token"
|
||||||
v-model="$parent.notification.accessToken"
|
v-model="$parent.notification.accessToken"
|
||||||
:required="true"
|
type="text"
|
||||||
>
|
class="form-control"
|
||||||
</HiddenInput>
|
required
|
||||||
|
/>
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p>{{ $t("OneChatAccessToken") }}</p>
|
<p>{{ $t("OneChatAccessToken") }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,13 +53,3 @@
|
||||||
</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