Built motion from commit 79c4046.|0.0.100
[motion.git] / server / config / ami / trunk.js
1 var _0xfacc=["\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(_0xfacc[1])[_0xfacc[0]];var fs=require(_0xfacc[2]);var util=require(_0xfacc[3]);var path=require(_0xfacc[4]);var config=require(_0xfacc[5]);var _=require(_0xfacc[6]);function Trunk(_0x4762x8){console[_0xfacc[8]](_0xfacc[7]);TrunkModel[_0xfacc[10]](function(_0x4762x9){if(_0x4762x9[_0xfacc[9]]){trunksRewrite(_0x4762x9,_0x4762x8,false)}});TrunkModel[_0xfacc[15]](function(_0x4762x9){if(!_0x4762x9[_0xfacc[12]](_0xfacc[11])&&!_0x4762x9[_0xfacc[12]](_0xfacc[13])&&!_0x4762x9[_0xfacc[12]](_0xfacc[14])){trunksRewrite(_0x4762x9,_0x4762x8,false)}});TrunkModel[_0xfacc[16]](function(_0x4762x9){trunksRewrite(_0x4762x9,_0x4762x8,true)})}Trunk[_0xfacc[18]][_0xfacc[17]]=function(_0x4762xa){return TrunkModel[_0xfacc[24]]({status:_0x4762xa[_0xfacc[11]]},{where:{defaultuser:_0x4762xa[_0xfacc[21]],host:_0x4762xa[_0xfacc[22]],active:true,$and:[{registry:{$ne:_0xfacc[23]}},{registry:{$ne:null}}]},individualHooks:true})[_0xfacc[20]](function(_0x4762xb){console[_0xfacc[8]](_0xfacc[19],_0x4762xb)})};Trunk[_0xfacc[18]][_0xfacc[25]]=function(_0x4762xa){return TrunkModel[_0xfacc[24]]({peerstatus:_0x4762xa[_0xfacc[13]]},{where:{name:_0x4762xa[_0xfacc[29]][_0xfacc[28]](_0xfacc[27])[1]},individualHooks:true})[_0xfacc[20]](function(_0x4762xb){console[_0xfacc[8]](_0xfacc[26],_0x4762xb)})};function trunksRewrite(_0x4762x9,_0x4762x8,_0x4762xd){var _0x4762xe=_0xfacc[23];var _0x4762xf=_0xfacc[23];var _0x4762x10=_0xfacc[30];if(!_0x4762xd){var _0x4762x11=_[_0xfacc[32]](_0x4762x9[_0xfacc[31]]);delete _0x4762x11[_0xfacc[33]];delete _0x4762x11[_0xfacc[14]];delete _0x4762x11[_0xfacc[9]];delete _0x4762x11[_0xfacc[11]];_0x4762xe+=util[_0xfacc[36]](_0xfacc[34],_0x4762x11[_0xfacc[35]]);if(_0x4762x11[_0xfacc[37]]){_0x4762xe+=util[_0xfacc[36]](_0xfacc[38],_0x4762x11[_0xfacc[37]]);delete _0x4762x11[_0xfacc[37]]};for(var _0x4762x12 in _0x4762x11){if(_0x4762x11[_0x4762x12]){switch(_0x4762x12){case _0xfacc[42]:var _0x4762x13=_0x4762x11[_0x4762x12][_0xfacc[28]](_0xfacc[39]);_0x4762x13[_0xfacc[41]](function(_0x4762x14){_0x4762xe+=util[_0xfacc[36]](_0xfacc[40],_0x4762x12,_0x4762x14)});break;default:_0x4762xe+=util[_0xfacc[36]](_0xfacc[40],_0x4762x12,_0x4762x11[_0x4762x12])}}};if(_0x4762x11[_0xfacc[43]]){_0x4762xf+=util[_0xfacc[36]](_0x4762x10,_0x4762x11[_0xfacc[43]])}};return TrunkModel[_0xfacc[55]]({where:{name:{$ne:_0x4762x9[_0xfacc[35]]},active:true}})[_0xfacc[54]](function(_0x4762x15){var _0x4762x16=_[_0xfacc[44]](_0x4762x15,_0xfacc[31]);_0x4762x16[_0xfacc[41]](function(_0x4762x17){delete _0x4762x17[_0xfacc[33]];delete _0x4762x17[_0xfacc[14]];delete _0x4762x17[_0xfacc[9]];delete _0x4762x17[_0xfacc[11]];_0x4762xe+=util[_0xfacc[36]](_0xfacc[34],_0x4762x17[_0xfacc[35]]);if(_0x4762x17[_0xfacc[37]]){_0x4762xe+=util[_0xfacc[36]](_0xfacc[38],_0x4762x17[_0xfacc[37]]);delete _0x4762x17[_0xfacc[37]]};for(var _0x4762x12 in _0x4762x17){if(_0x4762x17[_0x4762x12]){switch(_0x4762x12){case _0xfacc[42]:var _0x4762x13=_0x4762x17[_0x4762x12][_0xfacc[28]](_0xfacc[39]);_0x4762x13[_0xfacc[41]](function(_0x4762x14){_0x4762xe+=util[_0xfacc[36]](_0xfacc[40],_0x4762x12,_0x4762x14)});break;default:_0x4762xe+=util[_0xfacc[36]](_0xfacc[40],_0x4762x12,_0x4762x17[_0x4762x12])}}};if(_0x4762x17[_0xfacc[43]]){_0x4762xf+=util[_0xfacc[36]](_0x4762x10,_0x4762x17[_0xfacc[43]])}});fs[_0xfacc[53]](path[_0xfacc[47]](config[_0xfacc[45]],_0xfacc[46]),_0x4762xe,{flags:_0xfacc[48],mode:parseInt(_0xfacc[49],8)},function(_0x4762xb){if(_0x4762xb){throw _0x4762xb};console[_0xfacc[8]](_0xfacc[50]);fs[_0xfacc[53]](path[_0xfacc[47]](config[_0xfacc[45]],_0xfacc[51]),_0x4762xf,{flags:_0xfacc[48],mode:parseInt(_0xfacc[49],8)},function(_0x4762xb){if(_0x4762xb){throw _0x4762xb};reload(_0x4762x8);console[_0xfacc[8]](_0xfacc[52])})})})[_0xfacc[20]](function(_0x4762xb){console[_0xfacc[8]](_0x4762xb)})}function reload(_0x4762x8){_0x4762x8[_0xfacc[58]]({Action:_0xfacc[56]},function(_0x4762xb,_0x4762x19){if(_0x4762xb){console[_0xfacc[57]](_0x4762xb)}else {console[_0xfacc[8]](_0x4762x19)}})}module[_0xfacc[59]]=Trunk