a72dfa7f361e48e70b28dc5364ca41180b0c1552
[motion2.git] / server / api / chatWebsite / helpers / wildcard-expressions.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xedf1=['trim','([\x5cw]+)','localhost','../../../utils/misc','escapeRegExp','replace','test'];(function(_0x1e3a2e,_0x5131d0){var _0x3e6769=function(_0x3bf600){while(--_0x3bf600){_0x1e3a2e['push'](_0x1e3a2e['shift']());}};_0x3e6769(++_0x5131d0);}(_0xedf1,0xb2));var _0x1edf=function(_0xd69543,_0x5a1041){_0xd69543=_0xd69543-0x0;var _0x3588cb=_0xedf1[_0xd69543];return _0x3588cb;};var escapeRegExp=require(_0x1edf('0x0'))[_0x1edf('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0xdf58cf){var _0x462fc4=!![];try{new URL(_0xdf58cf[_0x1edf('0x2')]('*','localhost'));}catch(_0x224972){_0x462fc4=![];}return _0x462fc4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1edf('0x3')](_0xdf58cf);}function testWebsiteWithWildcard(_0x3a5efd,_0x5ec722){var _0x52238d;var _0x1b84af=escapeRegExp(_0x3a5efd[_0x1edf('0x4')]()[_0x1edf('0x2')](/\/$/,''))[_0x1edf('0x2')]('\x5c*',_0x1edf('0x5'));try{new URL(_0x3a5efd[_0x1edf('0x2')]('\x5c*',_0x1edf('0x6')));_0x52238d=new RegExp(_0x1b84af)[_0x1edf('0x3')](_0x5ec722);}catch(_0x30a13f){_0x52238d=![];}return _0x52238d;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};