mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Upgrade server deps (#10017)
* remove unused apn lib and upgrade moment-recur * upgrade validator * upgrade got * request -> got * fix validation * fix tests * upgrade nodemailer * fix unit tests * fix webhook tests, upgrade express-validator (using legacy api) * upgrade js2xmlparser * update misc packages * fix linting * update packages
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import { post } from 'request';
|
||||
import got from 'got';
|
||||
import { isURL } from 'validator';
|
||||
import logger from './logger';
|
||||
import nconf from 'nconf';
|
||||
|
||||
const IS_PRODUCTION = nconf.get('IS_PROD');
|
||||
|
||||
function sendWebhook (url, body) {
|
||||
post({
|
||||
url,
|
||||
got.post(url, {
|
||||
body,
|
||||
json: true,
|
||||
}, (err) => {
|
||||
if (err) {
|
||||
logger.error(err);
|
||||
}
|
||||
});
|
||||
}).catch(err => logger.error(err));
|
||||
}
|
||||
|
||||
function isValidWebhook (hook) {
|
||||
return hook.enabled && isURL(hook.url);
|
||||
return hook.enabled && isURL(hook.url, {
|
||||
require_tld: IS_PRODUCTION ? true : false, // eslint-disable-line camelcase
|
||||
});
|
||||
}
|
||||
|
||||
export class WebhookSender {
|
||||
|
||||
Reference in New Issue
Block a user