2021-06-29 08:06:20 +00:00
|
|
|
<template>
|
2021-07-09 06:14:03 +00:00
|
|
|
<form @submit.prevent="submit">
|
2021-07-27 17:47:13 +00:00
|
|
|
<div ref="modal" class="modal fade" tabindex="-1" data-bs-backdrop="static">
|
2021-07-09 06:14:03 +00:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2021-07-27 17:47:13 +00:00
|
|
|
<h5 id="exampleModalLabel" class="modal-title">
|
2021-08-24 10:26:44 +00:00
|
|
|
{{ $t("Setup Notification") }}
|
2021-07-27 17:47:13 +00:00
|
|
|
</h5>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
|
2021-07-09 06:14:03 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2021-07-18 10:51:58 +00:00
|
|
|
<div class="mb-3">
|
2021-08-24 10:26:44 +00:00
|
|
|
<label for="type" class="form-label">{{ $t("Notification Type") }}</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<select id="type" v-model="notification.type" class="form-select">
|
2021-07-31 05:37:42 +00:00
|
|
|
<option value="telegram">Telegram</option>
|
|
|
|
<option value="webhook">Webhook</option>
|
2021-08-24 10:26:44 +00:00
|
|
|
<option value="smtp">{{ $t("Email") }} (SMTP)</option>
|
2021-07-31 05:37:42 +00:00
|
|
|
<option value="discord">Discord</option>
|
|
|
|
<option value="signal">Signal</option>
|
|
|
|
<option value="gotify">Gotify</option>
|
|
|
|
<option value="slack">Slack</option>
|
|
|
|
<option value="pushover">Pushover</option>
|
2021-08-03 15:14:27 +00:00
|
|
|
<option value="pushy">Pushy</option>
|
2021-08-11 22:15:53 +00:00
|
|
|
<option value="octopush">Octopush</option>
|
2021-07-31 05:37:42 +00:00
|
|
|
<option value="lunasea">LunaSea</option>
|
|
|
|
<option value="apprise">Apprise (Support 50+ Notification services)</option>
|
2021-08-13 20:18:43 +00:00
|
|
|
<option value="pushbullet">Pushbullet</option>
|
2021-08-17 11:40:01 +00:00
|
|
|
<option value="line">Line Messenger</option>
|
2021-08-24 18:19:21 +00:00
|
|
|
<option value="mattermost">Mattermost</option>
|
2021-07-18 10:51:58 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
2021-08-24 10:26:44 +00:00
|
|
|
<label for="name" class="form-label">{{ $t("Friendly Name") }}</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="name" v-model="notification.name" type="text" class="form-control" required>
|
2021-07-18 10:51:58 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="notification.type === 'telegram'">
|
2021-07-09 06:14:03 +00:00
|
|
|
<div class="mb-3">
|
2021-07-18 10:51:58 +00:00
|
|
|
<label for="telegram-bot-token" class="form-label">Bot Token</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="telegram-bot-token" v-model="notification.telegramBotToken" type="text" class="form-control" required>
|
|
|
|
<div class="form-text">
|
|
|
|
You can get a token from <a href="https://t.me/BotFather" target="_blank">https://t.me/BotFather</a>.
|
|
|
|
</div>
|
2021-07-09 06:14:03 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
2021-07-18 10:51:58 +00:00
|
|
|
<label for="telegram-chat-id" class="form-label">Chat ID</label>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<div class="input-group mb-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="telegram-chat-id" v-model="notification.telegramChatID" type="text" class="form-control" required>
|
|
|
|
<button v-if="notification.telegramBotToken" class="btn btn-outline-secondary" type="button" @click="autoGetTelegramChatID">
|
|
|
|
Auto Get
|
|
|
|
</button>
|
2021-07-09 11:33:22 +00:00
|
|
|
</div>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<div class="form-text">
|
|
|
|
Support Direct Chat / Group / Channel's Chat ID
|
2021-07-09 11:33:22 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
You can get your chat id by sending message to the bot and go to this url to view the chat_id:
|
|
|
|
</p>
|
2021-07-09 09:55:48 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
<template v-if="notification.telegramBotToken">
|
2021-07-20 12:18:56 +00:00
|
|
|
<a :href="telegramGetUpdatesURL" target="_blank" style="word-break: break-word;">{{ telegramGetUpdatesURL }}</a>
|
2021-07-18 10:51:58 +00:00
|
|
|
</template>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<template v-else>
|
|
|
|
{{ telegramGetUpdatesURL }}
|
|
|
|
</template>
|
|
|
|
</p>
|
2021-07-09 11:33:22 +00:00
|
|
|
</div>
|
2021-07-18 10:51:58 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-09 11:33:22 +00:00
|
|
|
<template v-if="notification.type === 'webhook'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="webhook-url" class="form-label">Post URL</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="webhook-url" v-model="notification.webhookURL" type="url" pattern="https?://.+" class="form-control" required>
|
2021-07-09 11:33:22 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="webhook-content-type" class="form-label">Content Type</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<select id="webhook-content-type" v-model="notification.webhookContentType" class="form-select" required>
|
|
|
|
<option value="json">
|
|
|
|
application/json
|
|
|
|
</option>
|
|
|
|
<option value="form-data">
|
|
|
|
multipart/form-data
|
|
|
|
</option>
|
2021-07-09 11:33:22 +00:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<div class="form-text">
|
|
|
|
<p>"application/json" is good for any modern http servers such as express.js</p>
|
|
|
|
<p>"multipart/form-data" is good for PHP, you just need to parse the json by <strong>json_decode($_POST['data'])</strong></p>
|
2021-07-09 06:14:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-09 11:33:22 +00:00
|
|
|
</template>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-09 17:08:08 +00:00
|
|
|
<template v-if="notification.type === 'smtp'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="hostname" class="form-label">Hostname</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="hostname" v-model="notification.smtpHost" type="text" class="form-control" required>
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="port" class="form-label">Port</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="port" v-model="notification.smtpPort" type="number" class="form-control" required min="0" max="65535" step="1">
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
2021-07-10 03:38:00 +00:00
|
|
|
<div class="mb-3">
|
|
|
|
<div class="form-check">
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="secure" v-model="notification.smtpSecure" class="form-check-input" type="checkbox" value="">
|
2021-07-10 03:38:00 +00:00
|
|
|
<label class="form-check-label" for="secure">
|
|
|
|
Secure
|
|
|
|
</label>
|
|
|
|
</div>
|
2021-07-27 17:47:13 +00:00
|
|
|
<div class="form-text">
|
|
|
|
Generally, true for 465, false for other ports.
|
|
|
|
</div>
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="username" class="form-label">Username</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="username" v-model="notification.smtpUsername" type="text" class="form-control" autocomplete="false">
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="password" class="form-label">Password</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="password" v-model="notification.smtpPassword" type="password" class="form-control" autocomplete="false">
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="from-email" class="form-label">From Email</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="from-email" v-model="notification.smtpFrom" type="email" class="form-control" required autocomplete="false">
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="to-email" class="form-label">To Email</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="to-email" v-model="notification.smtpTo" type="email" class="form-control" required autocomplete="false">
|
2021-07-09 17:08:08 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-10 03:38:00 +00:00
|
|
|
<template v-if="notification.type === 'discord'">
|
|
|
|
<div class="mb-3">
|
2021-07-12 13:13:36 +00:00
|
|
|
<label for="discord-webhook-url" class="form-label">Discord Webhook URL</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="discord-webhook-url" v-model="notification.discordWebhookUrl" type="text" class="form-control" required autocomplete="false">
|
2021-08-09 13:03:22 +00:00
|
|
|
<div class="form-text">
|
|
|
|
You can get this by going to Server Settings -> Integrations -> Create Webhook
|
|
|
|
</div>
|
2021-08-08 03:03:22 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="discord-username" class="form-label">Bot Display Name</label>
|
|
|
|
<input id="discord-username" v-model="notification.discordUsername" type="text" class="form-control" autocomplete="false" :placeholder="$root.appName">
|
2021-07-10 03:38:00 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-07-12 20:06:03 +00:00
|
|
|
<template v-if="notification.type === 'signal'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="signal-url" class="form-label">Post URL</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="signal-url" v-model="notification.signalURL" type="url" pattern="https?://.+" class="form-control" required>
|
2021-07-12 20:06:03 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="signal-number" class="form-label">Number</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="signal-number" v-model="notification.signalNumber" type="text" class="form-control" required>
|
2021-07-12 20:06:03 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="signal-recipients" class="form-label">Recipients</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="signal-recipients" v-model="notification.signalRecipients" type="text" class="form-control" required>
|
2021-07-12 20:06:03 +00:00
|
|
|
|
|
|
|
<div class="form-text">
|
|
|
|
You need to have a signal client with REST API.
|
|
|
|
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
You can check this url to view how to setup one:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
<a href="https://github.com/bbernhard/signal-cli-rest-api" target="_blank">https://github.com/bbernhard/signal-cli-rest-api</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
IMPORTANT: You cannot mix groups and numbers in recipients!
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-07-14 09:25:10 +00:00
|
|
|
<template v-if="notification.type === 'gotify'">
|
2021-07-27 17:47:13 +00:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="gotify-application-token" class="form-label">Application Token</label>
|
|
|
|
<input id="gotify-application-token" v-model="notification.gotifyapplicationToken" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="gotify-server-url" class="form-label">Server URL</label>
|
|
|
|
<div class="input-group mb-3">
|
|
|
|
<input id="gotify-server-url" v-model="notification.gotifyserverurl" type="text" class="form-control" required>
|
2021-07-14 09:25:10 +00:00
|
|
|
</div>
|
2021-07-27 17:47:13 +00:00
|
|
|
</div>
|
2021-07-14 19:56:38 +00:00
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="gotify-priority" class="form-label">Priority</label>
|
|
|
|
<input id="gotify-priority" v-model="notification.gotifyPriority" type="number" class="form-control" required min="0" max="10" step="1">
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-15 17:44:51 +00:00
|
|
|
|
2021-07-14 15:38:38 +00:00
|
|
|
<template v-if="notification.type === 'slack'">
|
|
|
|
<div class="mb-3">
|
2021-08-24 15:38:25 +00:00
|
|
|
<label for="slack-webhook-url" class="form-label">Webhook URL<span style="color: red;"><sup>*</sup></span></label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="slack-webhook-url" v-model="notification.slackwebhookURL" type="text" class="form-control" required>
|
2021-07-17 07:18:42 +00:00
|
|
|
<label for="slack-username" class="form-label">Username</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="slack-username" v-model="notification.slackusername" type="text" class="form-control">
|
2021-07-17 07:18:42 +00:00
|
|
|
<label for="slack-iconemo" class="form-label">Icon Emoji</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="slack-iconemo" v-model="notification.slackiconemo" type="text" class="form-control">
|
2021-07-17 07:18:42 +00:00
|
|
|
<label for="slack-channel" class="form-label">Channel Name</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="slack-channel-name" v-model="notification.slackchannel" type="text" class="form-control">
|
2021-07-17 07:18:42 +00:00
|
|
|
<label for="slack-button-url" class="form-label">Uptime Kuma URL</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="slack-button" v-model="notification.slackbutton" type="text" class="form-control">
|
2021-07-17 07:18:42 +00:00
|
|
|
<div class="form-text">
|
2021-08-24 15:38:25 +00:00
|
|
|
<span style="color: red;"><sup>*</sup></span>Required
|
2021-07-17 07:18:42 +00:00
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
More info about webhooks on: <a href="https://api.slack.com/messaging/webhooks" target="_blank">https://api.slack.com/messaging/webhooks</a>
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
Enter the channel name on Slack Channel Name field if you want to bypass the webhook channel. Ex: #other-channel
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
If you leave the Uptime Kuma URL field blank, it will default to the Project Github page.
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
Emoji cheat sheet: <a href="https://www.webfx.com/tools/emoji-cheat-sheet/" target="_blank">https://www.webfx.com/tools/emoji-cheat-sheet/</a>
|
|
|
|
</p>
|
2021-07-18 05:47:04 +00:00
|
|
|
</div>
|
2021-07-14 15:38:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-18 10:51:58 +00:00
|
|
|
|
2021-08-24 18:19:21 +00:00
|
|
|
<template v-if="notification.type === 'mattermost'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="mattermost-webhook-url" class="form-label">Webhook URL<span style="color:red;"><sup>*</sup></span></label>
|
|
|
|
<input id="mattermost-webhook-url" v-model="notification.mattermostWebhookUrl" type="text" class="form-control" required>
|
|
|
|
<label for="mattermost-username" class="form-label">Username</label>
|
|
|
|
<input id="mattermost-username" v-model="notification.mattermostusername" type="text" class="form-control">
|
|
|
|
<label for="mattermost-iconurl" class="form-label">Icon URL</label>
|
|
|
|
<input id="mattermost-iconurl" v-model="notification.mattermosticonurl" type="text" class="form-control">
|
|
|
|
<label for="mattermost-iconemo" class="form-label">Icon Emoji</label>
|
|
|
|
<input id="mattermost-iconemo" v-model="notification.mattermosticonemo" type="text" class="form-control">
|
|
|
|
<label for="mattermost-channel" class="form-label">Channel Name</label>
|
|
|
|
<input id="mattermost-channel-name" v-model="notification.mattermostchannel" type="text" class="form-control">
|
|
|
|
<div class="form-text">
|
|
|
|
<span style="color:red;"><sup>*</sup></span>Required
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
More info about webhooks on: <a href="https://docs.mattermost.com/developer/webhooks-incoming.html" target="_blank">https://docs.mattermost.com/developer/webhooks-incoming.html</a>
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
You can override the default channel that webhook posts to by entering the channel name into "Channel Name" field. This needs to be enabled in Mattermost webhook settings. Ex: #other-channel
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
If you leave the Uptime Kuma URL field blank, it will default to the Project Github page.
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
You can provide a link to a picture in "Icon URL" to override the default profile picture. Will not be used if Icon Emoji is set.
|
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
Emoji cheat sheet: <a href="https://www.webfx.com/tools/emoji-cheat-sheet/" target="_blank">https://www.webfx.com/tools/emoji-cheat-sheet/</a> Note: emoji takes preference over Icon URL.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-08-03 15:14:27 +00:00
|
|
|
<template v-if="notification.type === 'pushy'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="pushy-app-token" class="form-label">API_KEY</label>
|
2021-08-08 03:03:22 +00:00
|
|
|
<input id="pushy-app-token" v-model="notification.pushyAPIKey" type="text" class="form-control" required>
|
2021-08-03 15:14:27 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="pushy-user-key" class="form-label">USER_TOKEN</label>
|
|
|
|
<div class="input-group mb-3">
|
2021-08-08 03:03:22 +00:00
|
|
|
<input id="pushy-user-key" v-model="notification.pushyToken" type="text" class="form-control" required>
|
2021-08-03 15:14:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p style="margin-top: 8px;">
|
2021-08-08 03:03:22 +00:00
|
|
|
More info on: <a href="https://pushy.me/docs/api/send-notifications" target="_blank">https://pushy.me/docs/api/send-notifications</a>
|
2021-08-03 15:14:27 +00:00
|
|
|
</p>
|
|
|
|
</template>
|
|
|
|
|
2021-08-11 22:15:53 +00:00
|
|
|
<template v-if="notification.type === 'octopush'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="octopush-key" class="form-label">API KEY</label>
|
|
|
|
<input id="octopush-key" v-model="notification.octopushAPIKey" type="text" class="form-control" required>
|
|
|
|
<label for="octopush-login" class="form-label">API LOGIN</label>
|
|
|
|
<input id="octopush-login" v-model="notification.octopushLogin" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="octopush-type-sms" class="form-label">SMS Type</label>
|
|
|
|
<select id="octopush-type-sms" v-model="notification.octopushSMSType" class="form-select">
|
|
|
|
<option value="sms_premium">Premium (Fast - recommended for alerting)</option>
|
|
|
|
<option value="sms_low_cost">Low Cost (Slow, sometimes blocked by operator)</option>
|
|
|
|
</select>
|
|
|
|
<div class="form-text">
|
|
|
|
Check octopush prices <a href="https://octopush.com/tarifs-sms-international/" target="_blank">https://octopush.com/tarifs-sms-international/</a>.
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="octopush-phone-number" class="form-label">Phone number (intl format, eg : +33612345678) </label>
|
|
|
|
<input id="octopush-phone-number" v-model="notification.octopushPhoneNumber" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="octopush-sender-name" class="form-label">SMS Sender Name : 3-11 alphanumeric characters and space (a-zA-Z0-9)</label>
|
|
|
|
<input id="octopush-sender-name" v-model="notification.octopushSenderName" type="text" minlength="3" maxlength="11" class="form-control">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
More info on: <a href="https://octopush.com/api-sms-documentation/envoi-de-sms/" target="_blank">https://octopush.com/api-sms-documentation/envoi-de-sms/</a>
|
|
|
|
</p>
|
|
|
|
</template>
|
|
|
|
|
2021-07-17 12:19:56 +00:00
|
|
|
<template v-if="notification.type === 'pushover'">
|
|
|
|
<div class="mb-3">
|
2021-08-24 15:38:25 +00:00
|
|
|
<label for="pushover-user" class="form-label">User Key<span style="color: red;"><sup>*</sup></span></label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="pushover-user" v-model="notification.pushoveruserkey" type="text" class="form-control" required>
|
2021-08-24 15:38:25 +00:00
|
|
|
<label for="pushover-app-token" class="form-label">Application Token<span style="color: red;"><sup>*</sup></span></label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="pushover-app-token" v-model="notification.pushoverapptoken" type="text" class="form-control" required>
|
2021-07-17 12:19:56 +00:00
|
|
|
<label for="pushover-device" class="form-label">Device</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="pushover-device" v-model="notification.pushoverdevice" type="text" class="form-control">
|
2021-07-17 12:19:56 +00:00
|
|
|
<label for="pushover-device" class="form-label">Message Title</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="pushover-title" v-model="notification.pushovertitle" type="text" class="form-control">
|
2021-07-17 12:19:56 +00:00
|
|
|
<label for="pushover-priority" class="form-label">Priority</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<select id="pushover-priority" v-model="notification.pushoverpriority" class="form-select">
|
2021-07-22 13:58:25 +00:00
|
|
|
<option>-2</option>
|
|
|
|
<option>-1</option>
|
|
|
|
<option>0</option>
|
|
|
|
<option>1</option>
|
|
|
|
<option>2</option>
|
|
|
|
</select>
|
2021-07-17 12:19:56 +00:00
|
|
|
<label for="pushover-sound" class="form-label">Notification Sound</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<select id="pushover-sound" v-model="notification.pushoversounds" class="form-select">
|
2021-07-17 12:19:56 +00:00
|
|
|
<option>pushover</option>
|
|
|
|
<option>bike</option>
|
|
|
|
<option>bugle</option>
|
|
|
|
<option>cashregister</option>
|
|
|
|
<option>classical</option>
|
|
|
|
<option>cosmic</option>
|
|
|
|
<option>falling</option>
|
|
|
|
<option>gamelan</option>
|
|
|
|
<option>incoming</option>
|
|
|
|
<option>intermission</option>
|
|
|
|
<option>mechanical</option>
|
|
|
|
<option>pianobar</option>
|
|
|
|
<option>siren</option>
|
|
|
|
<option>spacealarm</option>
|
|
|
|
<option>tugboat</option>
|
|
|
|
<option>alien</option>
|
|
|
|
<option>climb</option>
|
|
|
|
<option>persistent</option>
|
|
|
|
<option>echo</option>
|
|
|
|
<option>updown</option>
|
|
|
|
<option>vibrate</option>
|
|
|
|
<option>none</option>
|
|
|
|
</select>
|
|
|
|
<div class="form-text">
|
2021-08-24 15:38:25 +00:00
|
|
|
<span style="color: red;"><sup>*</sup></span>Required
|
2021-07-27 17:47:13 +00:00
|
|
|
<p style="margin-top: 8px;">
|
2021-07-17 13:12:54 +00:00
|
|
|
More info on: <a href="https://pushover.net/api" target="_blank">https://pushover.net/api</a>
|
2021-07-27 17:47:13 +00:00
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
2021-07-22 13:58:25 +00:00
|
|
|
Emergency priority (2) has default 30 second timeout between retries and will expire after 1 hour.
|
2021-07-27 17:47:13 +00:00
|
|
|
</p>
|
|
|
|
<p style="margin-top: 8px;">
|
2021-07-22 13:58:25 +00:00
|
|
|
If you want to send notifications to different devices, fill out Device field.
|
2021-07-27 17:47:13 +00:00
|
|
|
</p>
|
2021-07-17 12:19:56 +00:00
|
|
|
</div>
|
2021-07-14 15:38:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-14 09:25:10 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
<template v-if="notification.type === 'apprise'">
|
|
|
|
<div class="mb-3">
|
2021-07-22 13:58:25 +00:00
|
|
|
<label for="apprise-url" class="form-label">Apprise URL</label>
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="apprise-url" v-model="notification.appriseURL" type="text" class="form-control" required>
|
2021-07-18 10:51:58 +00:00
|
|
|
<div class="form-text">
|
|
|
|
<p>Example: twilio://AccountSid:AuthToken@FromPhoneNo</p>
|
|
|
|
<p>
|
|
|
|
Read more: <a href="https://github.com/caronc/apprise/wiki#notification-services" target="_blank">https://github.com/caronc/apprise/wiki#notification-services</a>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<p>
|
|
|
|
Status:
|
2021-07-27 17:47:13 +00:00
|
|
|
<span v-if="appriseInstalled" class="text-primary">Apprise is installed</span>
|
2021-08-08 05:47:29 +00:00
|
|
|
<span v-else class="text-danger">Apprise is not installed. <a href="https://github.com/caronc/apprise" target="_blank">Read more</a></span>
|
2021-07-18 10:51:58 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-31 05:35:18 +00:00
|
|
|
|
2021-07-31 05:01:41 +00:00
|
|
|
<template v-if="notification.type === 'lunasea'">
|
|
|
|
<div class="mb-3">
|
2021-08-24 15:38:25 +00:00
|
|
|
<label for="lunasea-device" class="form-label">LunaSea Device ID<span style="color: red;"><sup>*</sup></span></label>
|
2021-07-31 05:01:41 +00:00
|
|
|
<input id="lunasea-device" v-model="notification.lunaseaDevice" type="text" class="form-control" required>
|
|
|
|
<div class="form-text">
|
2021-08-24 15:38:25 +00:00
|
|
|
<p><span style="color: red;"><sup>*</sup></span>Required</p>
|
2021-07-31 05:01:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-08-13 20:18:43 +00:00
|
|
|
|
|
|
|
<template v-if="notification.type === 'pushbullet'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="pushbullet-access-token" class="form-label">Access Token</label>
|
|
|
|
<input id="pushbullet-access-token" v-model="notification.pushbulletAccessToken" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p style="margin-top: 8px;">
|
|
|
|
More info on: <a href="https://docs.pushbullet.com" target="_blank">https://docs.pushbullet.com</a>
|
|
|
|
</p>
|
|
|
|
</template>
|
2021-08-17 11:40:01 +00:00
|
|
|
|
|
|
|
<template v-if="notification.type === 'line'">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="line-channel-access-token" class="form-label">Channel access token</label>
|
|
|
|
<input id="line-channel-access-token" v-model="notification.lineChannelAccessToken" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-text">
|
|
|
|
Line Developers Console - <b>Basic Settings</b>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3" style="margin-top: 12px;">
|
|
|
|
<label for="line-user-id" class="form-label">User ID</label>
|
|
|
|
<input id="line-user-id" v-model="notification.lineUserID" type="text" class="form-control" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-text">
|
|
|
|
Line Developers Console - <b>Messaging API</b>
|
|
|
|
</div>
|
|
|
|
<div class="form-text" style="margin-top: 8px;">
|
|
|
|
First access the <a href="https://developers.line.biz/console/" target="_blank">Line Developers Console</a>, create a provider and channel (Messaging API), then you can get the channel access token and user id from the above mentioned menu items.
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-07-09 06:14:03 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2021-07-27 17:47:13 +00:00
|
|
|
<button v-if="id" type="button" class="btn btn-danger" :disabled="processing" @click="deleteConfirm">
|
2021-08-24 10:26:44 +00:00
|
|
|
{{ $t("Delete") }}
|
2021-07-27 17:47:13 +00:00
|
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-warning" :disabled="processing" @click="test">
|
2021-08-24 10:26:44 +00:00
|
|
|
{{ $t("Test") }}
|
2021-07-27 17:47:13 +00:00
|
|
|
</button>
|
|
|
|
<button type="submit" class="btn btn-primary" :disabled="processing">
|
2021-08-24 10:26:44 +00:00
|
|
|
{{ $t("Save") }}
|
2021-07-27 17:47:13 +00:00
|
|
|
</button>
|
2021-07-09 06:14:03 +00:00
|
|
|
</div>
|
2021-06-29 08:06:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-09 06:14:03 +00:00
|
|
|
</form>
|
2021-07-09 09:55:48 +00:00
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<Confirm ref="confirmDelete" btn-style="btn-danger" @yes="deleteNotification">
|
|
|
|
Are you sure want to delete this notification for all monitors?
|
|
|
|
</Confirm>
|
2021-06-29 08:06:20 +00:00
|
|
|
</template>
|
|
|
|
|
2021-07-30 03:23:04 +00:00
|
|
|
<script lang="ts">
|
2021-07-27 17:47:13 +00:00
|
|
|
import { Modal } from "bootstrap"
|
2021-07-30 03:23:04 +00:00
|
|
|
import { ucfirst } from "../util.ts"
|
2021-07-09 06:14:03 +00:00
|
|
|
import axios from "axios";
|
2021-07-27 17:47:13 +00:00
|
|
|
import { useToast } from "vue-toastification"
|
2021-07-09 09:55:48 +00:00
|
|
|
import Confirm from "./Confirm.vue";
|
2021-07-09 06:14:03 +00:00
|
|
|
const toast = useToast()
|
2021-06-29 08:06:20 +00:00
|
|
|
|
|
|
|
export default {
|
2021-07-27 17:47:13 +00:00
|
|
|
components: {
|
|
|
|
Confirm,
|
2021-06-29 08:06:20 +00:00
|
|
|
},
|
2021-07-27 17:47:13 +00:00
|
|
|
props: {},
|
2021-06-29 08:06:20 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
model: null,
|
2021-07-09 06:14:03 +00:00
|
|
|
processing: false,
|
|
|
|
id: null,
|
|
|
|
notification: {
|
|
|
|
name: "",
|
|
|
|
type: null,
|
2021-07-27 17:47:13 +00:00
|
|
|
gotifyPriority: 8,
|
2021-07-09 06:14:03 +00:00
|
|
|
},
|
2021-07-18 10:51:58 +00:00
|
|
|
appriseInstalled: false,
|
2021-06-29 08:06:20 +00:00
|
|
|
}
|
|
|
|
},
|
2021-07-27 17:47:13 +00:00
|
|
|
computed: {
|
|
|
|
telegramGetUpdatesURL() {
|
|
|
|
let token = "<YOUR BOT TOKEN HERE>"
|
|
|
|
|
|
|
|
if (this.notification.telegramBotToken) {
|
|
|
|
token = this.notification.telegramBotToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `https://api.telegram.org/bot${token}/getUpdates`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
"notification.type"(to, from) {
|
|
|
|
let oldName;
|
|
|
|
|
|
|
|
if (from) {
|
|
|
|
oldName = `My ${ucfirst(from)} Alert (1)`;
|
|
|
|
} else {
|
|
|
|
oldName = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! this.notification.name || this.notification.name === oldName) {
|
|
|
|
this.notification.name = `My ${ucfirst(to)} Alert (1)`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2021-06-29 08:06:20 +00:00
|
|
|
mounted() {
|
|
|
|
this.modal = new Modal(this.$refs.modal)
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-18 10:51:58 +00:00
|
|
|
this.$root.getSocket().emit("checkApprise", (installed) => {
|
|
|
|
this.appriseInstalled = installed;
|
2021-07-09 06:14:03 +00:00
|
|
|
})
|
2021-06-29 08:06:20 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-07-09 09:55:48 +00:00
|
|
|
deleteConfirm() {
|
|
|
|
this.modal.hide();
|
|
|
|
this.$refs.confirmDelete.show()
|
|
|
|
},
|
|
|
|
|
2021-07-09 06:14:03 +00:00
|
|
|
show(notificationID) {
|
|
|
|
if (notificationID) {
|
|
|
|
this.id = notificationID;
|
|
|
|
|
|
|
|
for (let n of this.$root.notificationList) {
|
|
|
|
if (n.id === notificationID) {
|
|
|
|
this.notification = JSON.parse(n.config);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.id = null;
|
|
|
|
this.notification = {
|
|
|
|
name: "",
|
2021-07-14 20:00:15 +00:00
|
|
|
type: null,
|
2021-07-09 06:14:03 +00:00
|
|
|
}
|
2021-07-15 17:44:51 +00:00
|
|
|
|
2021-07-09 06:14:03 +00:00
|
|
|
// Default set to Telegram
|
|
|
|
this.notification.type = "telegram"
|
2021-07-14 19:56:38 +00:00
|
|
|
this.notification.gotifyPriority = 8
|
2021-07-09 06:14:03 +00:00
|
|
|
}
|
|
|
|
|
2021-06-29 08:06:20 +00:00
|
|
|
this.modal.show()
|
|
|
|
},
|
2021-07-09 06:14:03 +00:00
|
|
|
|
2021-06-29 08:06:20 +00:00
|
|
|
submit() {
|
2021-07-09 06:14:03 +00:00
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("addNotification", this.notification, this.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.processing = false;
|
2021-06-29 08:06:20 +00:00
|
|
|
|
2021-07-09 06:14:03 +00:00
|
|
|
if (res.ok) {
|
|
|
|
this.modal.hide()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
test() {
|
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("testNotification", this.notification, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.processing = false;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
deleteNotification() {
|
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("deleteNotification", this.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.processing = false;
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
this.modal.hide()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
async autoGetTelegramChatID() {
|
|
|
|
try {
|
|
|
|
let res = await axios.get(this.telegramGetUpdatesURL)
|
|
|
|
|
|
|
|
if (res.data.result.length >= 1) {
|
|
|
|
let update = res.data.result[res.data.result.length - 1]
|
2021-07-09 09:55:48 +00:00
|
|
|
|
|
|
|
if (update.channel_post) {
|
|
|
|
this.notification.telegramChatID = update.channel_post.chat.id;
|
|
|
|
} else if (update.message) {
|
|
|
|
this.notification.telegramChatID = update.message.chat.id;
|
|
|
|
} else {
|
|
|
|
throw new Error("Chat ID is not found, please send a message to this bot first")
|
|
|
|
}
|
|
|
|
|
2021-07-09 06:14:03 +00:00
|
|
|
} else {
|
|
|
|
throw new Error("Chat ID is not found, please send a message to this bot first")
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
toast.error(error.message)
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
2021-06-29 08:06:20 +00:00
|
|
|
}
|
|
|
|
</script>
|
2021-08-08 05:47:29 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "../assets/vars.scss";
|
|
|
|
|
|
|
|
.dark {
|
|
|
|
.modal-dialog .form-text, .modal-dialog p {
|
|
|
|
color: $dark-font-color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|