mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
chore(): rename website/src -> website/server and website/public -> website/client (#7199)
This commit is contained in:
24
website/server/libs/api-v2/webhook.js
Normal file
24
website/server/libs/api-v2/webhook.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var _ = require('lodash');
|
||||
var request = require('request');
|
||||
var validator = require('validator');
|
||||
|
||||
function sendTaskWebhook(webhooks, data) {
|
||||
_.each(webhooks, function(hook){
|
||||
if (!hook.enabled || !validator.isURL(hook.url)) return;
|
||||
|
||||
request.post({
|
||||
url: hook.url,
|
||||
body: {
|
||||
direction: data.task.direction,
|
||||
task: data.task.details,
|
||||
delta: data.task.delta,
|
||||
user: data.user
|
||||
},
|
||||
json: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendTaskWebhook: sendTaskWebhook
|
||||
};
|
||||
Reference in New Issue
Block a user