be6a81fb90d0a7963f2faa08f2e8338b1507c4e0
[motion.git] / server / config / ami / trunk.js
1 var _0xcf0c=["\x54\x72\x75\x6E\x6B","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x72\x75\x6E\x6B\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x63\x74\x69\x76\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x63\x68\x61\x6E\x67\x65\x64","\x70\x65\x65\x72\x73\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x73\x74\x61\x74\x75\x73\x55\x70\x64\x61\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x54\x72\x75\x6E\x6B\x20\x73\x74\x61\x74\x75\x73\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72\x3A","\x63\x61\x74\x63\x68","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x64\x6F\x6D\x61\x69\x6E","","\x75\x70\x64\x61\x74\x65","\x70\x65\x65\x72\x73\x74\x61\x74\x75\x73\x55\x70\x64\x61\x74\x65","\x54\x72\x75\x6E\x6B\x20\x70\x65\x65\x72\x73\x74\x61\x74\x75\x73\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72\x3A","\x2F","\x73\x70\x6C\x69\x74","\x70\x65\x65\x72","\x72\x65\x67\x69\x73\x74\x65\x72\x20\x3D\x3E\x20\x25\x73\x0A","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x63\x6C\x6F\x6E\x65","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x5B\x25\x73\x5D\x0A","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x6F\x74\x68\x65\x72\x46\x69\x65\x6C\x64\x73","\x25\x73\x0A","\x3B","\x25\x73\x3D\x25\x73\x0A","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C\x6F\x77","\x72\x65\x67\x69\x73\x74\x72\x79","\x6D\x61\x70","\x61\x73\x74\x65\x72\x69\x73\x6B\x43\x6F\x6E\x66","\x73\x69\x70\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x74\x72\x75\x6E\x6B\x73\x2E\x63\x6F\x6E\x66","\x6A\x6F\x69\x6E","\x77","\x30\x37\x37\x37","\x54\x72\x75\x6E\x6B\x73\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x73\x69\x70\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x72\x65\x67\x69\x73\x74\x65\x72\x73\x2E\x63\x6F\x6E\x66","\x54\x72\x75\x6E\x6B\x73\x20\x72\x65\x67\x69\x73\x74\x65\x72\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x52\x65\x6C\x6F\x61\x64","\x65\x72\x72\x6F\x72","\x61\x63\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];var TrunkModel=require(_0xcf0c[1])[_0xcf0c[0]];var fs=require(_0xcf0c[2]);var util=require(_0xcf0c[3]);var path=require(_0xcf0c[4]);var config=require(_0xcf0c[5]);var _=require(_0xcf0c[6]);function Trunk(_0x49a3x8){console[_0xcf0c[8]](_0xcf0c[7]);TrunkModel[_0xcf0c[10]](function(_0x49a3x9){if(_0x49a3x9[_0xcf0c[9]]){trunksRewrite(_0x49a3x9,_0x49a3x8,false)}});TrunkModel[_0xcf0c[15]](function(_0x49a3x9){if(!_0x49a3x9[_0xcf0c[12]](_0xcf0c[11])&&!_0x49a3x9[_0xcf0c[12]](_0xcf0c[13])&&!_0x49a3x9[_0xcf0c[12]](_0xcf0c[14])){trunksRewrite(_0x49a3x9,_0x49a3x8,false)}});TrunkModel[_0xcf0c[16]](function(_0x49a3x9){trunksRewrite(_0x49a3x9,_0x49a3x8,true)})}Trunk[_0xcf0c[18]][_0xcf0c[17]]=function(_0x49a3xa){return TrunkModel[_0xcf0c[24]]({status:_0x49a3xa[_0xcf0c[11]]},{where:{defaultuser:_0x49a3xa[_0xcf0c[21]],host:_0x49a3xa[_0xcf0c[22]],active:true,$and:[{registry:{$ne:_0xcf0c[23]}},{registry:{$ne:null}}]},individualHooks:true})[_0xcf0c[20]](function(_0x49a3xb){console[_0xcf0c[8]](_0xcf0c[19],_0x49a3xb)})};Trunk[_0xcf0c[18]][_0xcf0c[25]]=function(_0x49a3xa){return TrunkModel[_0xcf0c[24]]({peerstatus:_0x49a3xa[_0xcf0c[13]]},{where:{name:_0x49a3xa[_0xcf0c[29]][_0xcf0c[28]](_0xcf0c[27])[1]},individualHooks:true})[_0xcf0c[20]](function(_0x49a3xb){console[_0xcf0c[8]](_0xcf0c[26],_0x49a3xb)})};function trunksRewrite(_0x49a3x9,_0x49a3x8,_0x49a3xd){var _0x49a3xe=_0xcf0c[23];var _0x49a3xf=_0xcf0c[23];var _0x49a3x10=_0xcf0c[30];if(!_0x49a3xd){var _0x49a3x11=_[_0xcf0c[32]](_0x49a3x9[_0xcf0c[31]]);delete _0x49a3x11[_0xcf0c[33]];delete _0x49a3x11[_0xcf0c[14]];delete _0x49a3x11[_0xcf0c[9]];delete _0x49a3x11[_0xcf0c[11]];_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[34],_0x49a3x11[_0xcf0c[35]]);if(_0x49a3x11[_0xcf0c[37]]){_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[38],_0x49a3x11[_0xcf0c[37]]);delete _0x49a3x11[_0xcf0c[37]]};for(var _0x49a3x12 in _0x49a3x11){if(_0x49a3x11[_0x49a3x12]){switch(_0x49a3x12){case _0xcf0c[42]:var _0x49a3x13=_0x49a3x11[_0x49a3x12][_0xcf0c[28]](_0xcf0c[39]);_0x49a3x13[_0xcf0c[41]](function(_0x49a3x14){_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[40],_0x49a3x12,_0x49a3x14)});break;default:_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[40],_0x49a3x12,_0x49a3x11[_0x49a3x12])}}};if(_0x49a3x11[_0xcf0c[43]]){_0x49a3xf+=util[_0xcf0c[36]](_0x49a3x10,_0x49a3x11[_0xcf0c[43]])}};return TrunkModel[_0xcf0c[55]]({where:{name:{$ne:_0x49a3x9[_0xcf0c[35]]},active:true}})[_0xcf0c[54]](function(_0x49a3x15){var _0x49a3x16=_[_0xcf0c[44]](_0x49a3x15,_0xcf0c[31]);_0x49a3x16[_0xcf0c[41]](function(_0x49a3x17){delete _0x49a3x17[_0xcf0c[33]];delete _0x49a3x17[_0xcf0c[14]];delete _0x49a3x17[_0xcf0c[9]];delete _0x49a3x17[_0xcf0c[11]];_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[34],_0x49a3x17[_0xcf0c[35]]);if(_0x49a3x17[_0xcf0c[37]]){_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[38],_0x49a3x17[_0xcf0c[37]]);delete _0x49a3x17[_0xcf0c[37]]};for(var _0x49a3x12 in _0x49a3x17){if(_0x49a3x17[_0x49a3x12]){switch(_0x49a3x12){case _0xcf0c[42]:var _0x49a3x13=_0x49a3x17[_0x49a3x12][_0xcf0c[28]](_0xcf0c[39]);_0x49a3x13[_0xcf0c[41]](function(_0x49a3x14){_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[40],_0x49a3x12,_0x49a3x14)});break;default:_0x49a3xe+=util[_0xcf0c[36]](_0xcf0c[40],_0x49a3x12,_0x49a3x17[_0x49a3x12])}}};if(_0x49a3x17[_0xcf0c[43]]){_0x49a3xf+=util[_0xcf0c[36]](_0x49a3x10,_0x49a3x17[_0xcf0c[43]])}});fs[_0xcf0c[53]](path[_0xcf0c[47]](config[_0xcf0c[45]],_0xcf0c[46]),_0x49a3xe,{flags:_0xcf0c[48],mode:parseInt(_0xcf0c[49],8)},function(_0x49a3xb){if(_0x49a3xb){throw _0x49a3xb};console[_0xcf0c[8]](_0xcf0c[50]);fs[_0xcf0c[53]](path[_0xcf0c[47]](config[_0xcf0c[45]],_0xcf0c[51]),_0x49a3xf,{flags:_0xcf0c[48],mode:parseInt(_0xcf0c[49],8)},function(_0x49a3xb){if(_0x49a3xb){throw _0x49a3xb};reload(_0x49a3x8);console[_0xcf0c[8]](_0xcf0c[52])})})})[_0xcf0c[20]](function(_0x49a3xb){console[_0xcf0c[8]](_0x49a3xb)})}function reload(_0x49a3x8){_0x49a3x8[_0xcf0c[58]]({Action:_0xcf0c[56]},function(_0x49a3xb,_0x49a3x19){if(_0x49a3xb){console[_0xcf0c[57]](_0x49a3xb)}else {console[_0xcf0c[8]](_0x49a3x19)}})}module[_0xcf0c[59]]=Trunk