mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-10-25 07:39:22 +08:00 
			
		
		
		
	Add Push by Techulus
This commit is contained in:
		
							
								
								
									
										23
									
								
								server/notification-providers/techulus-push.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								server/notification-providers/techulus-push.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | const NotificationProvider = require("./notification-provider"); | ||||||
|  | const axios = require("axios"); | ||||||
|  |  | ||||||
|  | class TechulusPush extends NotificationProvider { | ||||||
|  |  | ||||||
|  |     name = "PushByTechulus"; | ||||||
|  |  | ||||||
|  |     async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { | ||||||
|  |         let okMsg = "Sent Successfully."; | ||||||
|  |  | ||||||
|  |         try { | ||||||
|  |             await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, { | ||||||
|  |                 "title": "Uptime-Kuma", | ||||||
|  |                 "body": msg | ||||||
|  |             }) | ||||||
|  |             return okMsg; | ||||||
|  |         } catch (error) { | ||||||
|  |             this.throwGeneralAxiosError(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = TechulusPush; | ||||||
| @@ -12,6 +12,7 @@ const ClickSendSMS = require("./notification-providers/clicksendsms"); | |||||||
| const Pushbullet = require("./notification-providers/pushbullet"); | const Pushbullet = require("./notification-providers/pushbullet"); | ||||||
| const Pushover = require("./notification-providers/pushover"); | const Pushover = require("./notification-providers/pushover"); | ||||||
| const Pushy = require("./notification-providers/pushy"); | const Pushy = require("./notification-providers/pushy"); | ||||||
|  | const TechulusPush = require("./notification-providers/techulus-push"); | ||||||
| const RocketChat = require("./notification-providers/rocket-chat"); | const RocketChat = require("./notification-providers/rocket-chat"); | ||||||
| const Signal = require("./notification-providers/signal"); | const Signal = require("./notification-providers/signal"); | ||||||
| const Slack = require("./notification-providers/slack"); | const Slack = require("./notification-providers/slack"); | ||||||
| @@ -55,6 +56,7 @@ class Notification { | |||||||
|             new Pushbullet(), |             new Pushbullet(), | ||||||
|             new Pushover(), |             new Pushover(), | ||||||
|             new Pushy(), |             new Pushy(), | ||||||
|  |             new TechulusPush(), | ||||||
|             new RocketChat(), |             new RocketChat(), | ||||||
|             new Signal(), |             new Signal(), | ||||||
|             new Slack(), |             new Slack(), | ||||||
| @@ -90,6 +92,7 @@ class Notification { | |||||||
|      * Throw Error with fail msg |      * Throw Error with fail msg | ||||||
|      */ |      */ | ||||||
|     static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { |     static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { | ||||||
|  |         console.log("this.providerList[notification.type]", this.providerList[notification.type]) | ||||||
|         if (this.providerList[notification.type]) { |         if (this.providerList[notification.type]) { | ||||||
|             return this.providerList[notification.type].send(notification, msg, monitorJSON, heartbeatJSON); |             return this.providerList[notification.type].send(notification, msg, monitorJSON, heartbeatJSON); | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								src/components/notifications/TechulusPush.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/components/notifications/TechulusPush.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | <template> | ||||||
|  |     <div class="mb-3"> | ||||||
|  |         <label for="push-api-key" class="form-label">API_KEY</label> | ||||||
|  |         <HiddenInput id="push-api-key" v-model="$parent.notification.pushAPIKey" :required="true" autocomplete="one-time-code"></HiddenInput> | ||||||
|  |     </div> | ||||||
|  |  | ||||||
|  |     <i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;"> | ||||||
|  |         <a href="https://docs.push.techulus.com" target="_blank">https://docs.push.techulus.com</a> | ||||||
|  |     </i18n-t> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | import HiddenInput from "../HiddenInput.vue"; | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |     components: { | ||||||
|  |         HiddenInput, | ||||||
|  |     }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
| @@ -9,6 +9,7 @@ import RocketChat from "./RocketChat.vue"; | |||||||
| import Teams from "./Teams.vue"; | import Teams from "./Teams.vue"; | ||||||
| import Pushover from "./Pushover.vue"; | import Pushover from "./Pushover.vue"; | ||||||
| import Pushy from "./Pushy.vue"; | import Pushy from "./Pushy.vue"; | ||||||
|  | import TechulusPush from "./TechulusPush.vue"; | ||||||
| import Octopush from "./Octopush.vue"; | import Octopush from "./Octopush.vue"; | ||||||
| import PromoSMS from "./PromoSMS.vue"; | import PromoSMS from "./PromoSMS.vue"; | ||||||
| import ClickSendSMS from "./ClickSendSMS.vue"; | import ClickSendSMS from "./ClickSendSMS.vue"; | ||||||
| @@ -44,6 +45,7 @@ const NotificationFormList = { | |||||||
|     "rocket.chat": RocketChat, |     "rocket.chat": RocketChat, | ||||||
|     "pushover": Pushover, |     "pushover": Pushover, | ||||||
|     "pushy": Pushy, |     "pushy": Pushy, | ||||||
|  |     "PushByTechulus": TechulusPush, | ||||||
|     "octopush": Octopush, |     "octopush": Octopush, | ||||||
|     "promosms": PromoSMS, |     "promosms": PromoSMS, | ||||||
|     "clicksendsms": ClickSendSMS, |     "clicksendsms": ClickSendSMS, | ||||||
|   | |||||||
| @@ -238,6 +238,7 @@ export default { | |||||||
|     "rocket.chat": "Rocket.Chat", |     "rocket.chat": "Rocket.Chat", | ||||||
|     pushover: "Pushover", |     pushover: "Pushover", | ||||||
|     pushy: "Pushy", |     pushy: "Pushy", | ||||||
|  |     PushByTechulus: "Push by Techulus", | ||||||
|     octopush: "Octopush", |     octopush: "Octopush", | ||||||
|     promosms: "PromoSMS", |     promosms: "PromoSMS", | ||||||
|     clicksendsms: "ClickSend SMS", |     clicksendsms: "ClickSend SMS", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user