refer-service.js 410 Bytes
/**
 * 跳转白名单,只有这个才能正确跳转
 * Created by TaoHuang on 2016/11/29.
 */

'use strict';

const _ = require('lodash');
const url = require('url');
const config = global.yoho.config;

const allowedList = [/yohobuy\.com$/i, /yoho\.cn$/i];

module.exports = (refer) => {
    return _.some(allowedList, allowed => allowed.test(url.parse(refer || config.siteUrl, false, true).hostname));
};