mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-29 20:42:20 +00:00
Add Telegram custom bot api server support (#5668)
This commit is contained in:
parent
6f8f8f955f
commit
b0610c02ac
3 changed files with 22 additions and 2 deletions
|
@ -9,7 +9,7 @@ class Telegram extends NotificationProvider {
|
||||||
*/
|
*/
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
const url = "https://api.telegram.org";
|
const url = notification.telegramServerUrl ?? "https://api.telegram.org";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let params = {
|
let params = {
|
||||||
|
|
|
@ -32,6 +32,21 @@
|
||||||
<label for="message_thread_id" class="form-label">{{ $t("telegramMessageThreadID") }}</label>
|
<label for="message_thread_id" class="form-label">{{ $t("telegramMessageThreadID") }}</label>
|
||||||
<input id="message_thread_id" v-model="$parent.notification.telegramMessageThreadID" type="text" class="form-control">
|
<input id="message_thread_id" v-model="$parent.notification.telegramMessageThreadID" type="text" class="form-control">
|
||||||
<p class="form-text">{{ $t("telegramMessageThreadIDDescription") }}</p>
|
<p class="form-text">{{ $t("telegramMessageThreadIDDescription") }}</p>
|
||||||
|
|
||||||
|
<label for="server_url" class="form-label">{{ $t("telegramServerUrl") }}</label>
|
||||||
|
<input id="server_url" v-model="$parent.notification.telegramServerUrl" type="text" class="form-control">
|
||||||
|
<div class="form-text">
|
||||||
|
<i18n-t keypath="telegramServerUrlDescription">
|
||||||
|
<a
|
||||||
|
href="https://core.telegram.org/bots/api#using-a-local-bot-api-server"
|
||||||
|
target="_blank"
|
||||||
|
>{{ $t("here") }}</a>
|
||||||
|
<a
|
||||||
|
href="https://api.telegram.org"
|
||||||
|
target="_blank"
|
||||||
|
>https://api.telegram.org</a>
|
||||||
|
</i18n-t>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
@ -111,6 +126,9 @@ Uptime Kuma Alert{% if monitorJSON %} - {{ monitorJSON['name'] }}{% endif %}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$parent.notification.telegramServerUrl ||= "https://api.telegram.org";
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Get the URL for telegram updates
|
* Get the URL for telegram updates
|
||||||
|
@ -128,7 +146,7 @@ Uptime Kuma Alert{% if monitorJSON %} - {{ monitorJSON['name'] }}{% endif %}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `https://api.telegram.org/bot${token}/getUpdates`;
|
return `${this.$parent.notification.telegramServerUrl}/bot${token}/getUpdates`;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -429,6 +429,8 @@
|
||||||
"telegramTemplateFormatDescription": "Telegram allows using different markup languages for messages, see Telegram {0} for specifc details.",
|
"telegramTemplateFormatDescription": "Telegram allows using different markup languages for messages, see Telegram {0} for specifc details.",
|
||||||
"supportTelegramChatID": "Support Direct Chat / Group / Channel's Chat ID",
|
"supportTelegramChatID": "Support Direct Chat / Group / Channel's Chat ID",
|
||||||
"wayToGetTelegramChatID": "You can get your chat ID by sending a message to the bot and going to this URL to view the chat_id:",
|
"wayToGetTelegramChatID": "You can get your chat ID by sending a message to the bot and going to this URL to view the chat_id:",
|
||||||
|
"telegramServerUrl": "(Optional) Server Url",
|
||||||
|
"telegramServerUrlDescription": "To lift Telegram's bot api limitations or gain access in blocked areas (China, Iran, etc). For more information click {0}. Default: {1}",
|
||||||
"YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE",
|
"YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE",
|
||||||
"chatIDNotFound": "Chat ID is not found; please send a message to this bot first",
|
"chatIDNotFound": "Chat ID is not found; please send a message to this bot first",
|
||||||
"disableCloudflaredNoAuthMsg": "You are in No Auth mode, a password is not required.",
|
"disableCloudflaredNoAuthMsg": "You are in No Auth mode, a password is not required.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue