parent
							
								
									64dfe666d2
								
							
						
					
					
						commit
						9068f7edd1
					
				| @ -1,2 +1,43 @@ | ||||
| # tellme-bot | ||||
| 
 | ||||
| Small bot to handle Webhooks, Parse and Send them with Xmpp. This is a Prototype and only exists | ||||
| because (Kuma)[https://github.com/louislam/uptime-kuma] offers no Notifications for Xmpp. | ||||
| 
 | ||||
| ## Install | ||||
| 
 | ||||
| ``` | ||||
| yarn install | ||||
| 
 | ||||
| yarn start | ||||
| 
 | ||||
| or | ||||
| 
 | ||||
| pm2 start yarn start --name=tellme-bot | ||||
| ``` | ||||
| 
 | ||||
| ## Konfiguration | ||||
| 
 | ||||
| ``` | ||||
| APP_DEBUG=false | ||||
| APP_PORT= | ||||
| 
 | ||||
| APP_API_TOKEN= | ||||
| APP_API_ALLOWED_PARSERS=kuma | ||||
| 
 | ||||
| XMPP_SERVICE= | ||||
| XMPP_DOMAIN= | ||||
| XMPP_USERNAME= | ||||
| XMPP_PASSWORD= | ||||
| XMPP_TO= | ||||
| ``` | ||||
| 
 | ||||
| ## Webhook | ||||
| 
 | ||||
| <your-domain>/api/v1/webhook/<parser>/<api-token> | ||||
| 
 | ||||
| ## Parsers | ||||
| 
 | ||||
| There is only one Parser Class for Kuma, but it is possible to add Additional Classes. | ||||
| 
 | ||||
| Create a new Class, extends is with parser.js, add a parser-function and add the name of the file in the .env to | ||||
| APP_API_ALLOWED_PARSERS. | ||||
|  | ||||
| @ -1,15 +1,22 @@ | ||||
| import Parser from './parser.js' | ||||
| import DOMPurify from 'isomorphic-dompurify' | ||||
| 
 | ||||
| /** | ||||
|  *  Parser for Kuma, getting only error message | ||||
|  * | ||||
|  * | ||||
|  *  @author Björn Hase, Tentakelfabrik | ||||
|  *  @license hhttps://www.gnu.org/licenses/gpl-3.0.en.html GPL-3
 | ||||
|  *  @link https://gitea.tentakelfabrik.de:tentakelfabrik/tellme-bot.git
 | ||||
|  * | ||||
|  */ | ||||
| class Kuma extends Parser | ||||
| { | ||||
|     parse() | ||||
|     { | ||||
|         this.message = this.body.msg | ||||
|         // check for msg and clean it
 | ||||
|         if (this.body.msg) { | ||||
|             this.message = DOMPurify.sanitize(this.body.msg) | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue