Moved the cleanup to the backend. Also changed the helptext to make it better readable.

pull/4605/head
BothimTV 2 months ago
parent 103b47f17c
commit cb15ea01f2

@ -10,7 +10,9 @@ class CallMeBot extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
try {
await axios.get(`${notification.callMeBotEndpoint}&text=${encodeURIComponent(msg)}`);
const url = new URL(notification.callMeBotEndpoint);
url.searchParams.delete("text");
await axios.get(`${url}&text=${encodeURIComponent(msg)}`);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);

@ -1,45 +1,13 @@
<template>
<div class="mb-3">
<label for="callmebot-endpoint" class="form-label">{{ $t("Endpoint") }}</label>
<div class="input-group mb-3">
<input id="callmebot-endpoint" v-model="$parent.notification.callMeBotEndpoint" type="text" class="form-control" required>
<button v-if="$parent.notification.callMeBotEndpoint" class="btn btn-outline-secondary" type="button" @click="cleanupEndpoint">
{{ $t("Cleanup") }}
</button>
</div>
<input id="callmebot-endpoint" v-model="$parent.notification.callMeBotEndpoint" type="text" class="form-control" required>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/free-api-facebook-messenger/" target="_blank">Facebook Messenger</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/test-whatsapp-api/" target="_blank">WhatsApp</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/telegram-phone-call-using-your-browser/" target="_blank">Telegram Call</a>
<!--There is currently no documentation available. I contacted the support for further information.-->
<a href="https://www.callmebot.com/" target="_blank">CallMeBot documentation</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotInfo" class="form-text" />
</div>
</template>
<script>
export default {
methods: {
/**
* Remove the &text= param to be able to append one later
* @returns {Promise<void>}
* @throws The provided URL is invalid
*/
cleanupEndpoint() {
try {
const url = new URL(this.$parent.notification.callMeBotEndpoint);
url.searchParams.delete("text");
this.$parent.notification.callMeBotEndpoint = url;
this.$root.toastSuccess("URL was cleaned successfully");
} catch (e) {
this.$root.toastError("Invalid URL");
}
},
}
};
</script>

@ -888,7 +888,5 @@
"What is a Remote Browser?": "What is a Remote Browser?",
"wayToGetHeiiOnCallDetails": "How to get the Trigger ID and API Keys is explained in the {documentation}",
"documentationOf": "{0} Documentation",
"callMeBotGet": "Get the endpoint for {0}.",
"callMeBotInfo": "Note that you may get rate limited. Example: You are only allowed to send one Telegram call per 65 seconds! Please use the cleanup button to be able to use the URL.",
"callMeBotInvalidEndpoint": "The specifyed endpoint is invalid!"
"callMeBotGet": "Here you can generate an endpoint for {0}, {1} and {2}. Keep in mind that you might get rate limited. You can read more about ratelimits here: {3}"
}

Loading…
Cancel
Save