mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-26 02:52:20 +00:00
Add Telegram custom bot api server support (#5668)
Some checks are pending
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
validate / json-yaml-validate (push) Waiting to run
validate / validate (push) Waiting to run
Some checks are pending
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
validate / json-yaml-validate (push) Waiting to run
validate / validate (push) Waiting to run
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) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
const url = "https://api.telegram.org";
|
||||
const url = notification.telegramServerUrl ?? "https://api.telegram.org";
|
||||
|
||||
try {
|
||||
let params = {
|
||||
|
|
|
@ -32,6 +32,21 @@
|
|||
<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">
|
||||
<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 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: {
|
||||
/**
|
||||
* 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.",
|
||||
"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:",
|
||||
"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",
|
||||
"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.",
|
||||
|
|
Loading…
Add table
Reference in a new issue