Authored by htoooth

fix url parse

... ... @@ -6,9 +6,11 @@
'use strict';
const _ = require('lodash');
const allowedList = ['yohobuy.com', 'yoho.cn'];
const url = require('url');
const config = global.yoho.config;
const allowedList = [/yohobuy\.com$/i, /yoho\.cn$/i];
module.exports = (refer) => {
return _.some(allowedList, domain => refer.match(domain));
return _.some(allowedList, allowed => allowed.test(url.parse(refer || config.siteUrl).hostname));
};
... ...