212a4987dae8d9f8cbde9aa8cdd67fa68e6c1245
[motion.git] / server / api / setting / setting.controller.js
1 var _0xe6c8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x74\x6F\x6F\x6C\x73\x2F\x73\x79\x73\x74\x65\x6D","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x70\x61\x74\x68","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x66\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x74\x61\x74\x73","\x6C\x6F\x67","\x63\x68\x65\x63\x6B\x53\x74\x61\x74\x75\x73","\x61\x6C\x6C","\x63\x68\x61\x6E\x67\x65\x4C\x6F\x67\x6F","\x6C\x6F\x67\x6F","\x63\x68\x61\x6E\x67\x65\x4C\x6F\x67\x69\x6E\x4C\x6F\x67\x6F","\x6C\x6F\x67\x69\x6E\x4C\x6F\x67\x6F","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x69\x6D\x61\x67\x65\x73","\x6A\x6F\x69\x6E","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x6A\x70\x65\x67\x20\x61\x6E\x64\x20\x70\x6E\x67\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x6F\x6E","\x65\x72\x72\x6F\x72","\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x20\x55\x70\x6C\x6F\x61\x64\x20\x65\x72\x72\x6F\x72\x20\x3A","\x70\x61\x72\x73\x65","\x67\x65\x74\x4C\x6F\x67\x6F","\x6C\x6F\x67\x6F\x2E\x70\x6E\x67","\x67\x65\x74\x4C\x6F\x67\x69\x6E\x4C\x6F\x67\x6F","\x6C\x6F\x67\x69\x6E\x4C\x6F\x67\x6F\x2E\x70\x6E\x67","\x70\x61\x72\x61\x6D\x73","\x64\x65\x66\x61\x75\x6C\x74","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x65\x78\x69\x73\x74\x73","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x76\x61\x6C\x75\x65","\x6D\x69\x6E\x5F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x61\x78","\x67\x65\x74\x4D\x61\x69\x6C\x62\x6F\x78","\x6D\x69\x6E\x5F\x6D\x61\x69\x6C\x62\x6F\x78","\x6D\x61\x69\x6C\x62\x6F\x78","\x67\x65\x74\x49\x6E\x66\x6F","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x70\x61\x63\x6B\x61\x67\x65\x2E\x6A\x73\x6F\x6E","\x6E\x61\x6D\x65","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65\x73","\x73\x68\x6F\x77","\x69\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x53\x6D\x74\x70","\x75\x70\x64\x61\x74\x65\x53\x6D\x74\x70","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xe6c8[0];var _=require(_0xe6c8[1]);var Settings=require(_0xe6c8[3])[_0xe6c8[2]];var system=require(_0xe6c8[4]);var Agent=require(_0xe6c8[3])[_0xe6c8[5]];var VoiceMail=require(_0xe6c8[3])[_0xe6c8[6]];var MailServerOut=require(_0xe6c8[3])[_0xe6c8[7]];var Promise=require(_0xe6c8[8]);var UploadFile=require(_0xe6c8[9]);var path=require(_0xe6c8[10]);var sequelize=require(_0xe6c8[3])[_0xe6c8[11]];var config=require(_0xe6c8[12]);var sr=require(_0xe6c8[13]);var fs=require(_0xe6c8[14]);exports[_0xe6c8[15]]= function(_0xe68fxe,_0xe68fxf){return Settings[_0xe6c8[20]]()[_0xe6c8[19]](function(_0xe68fx11){return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx11)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[21]]= function(_0xe68fxe,_0xe68fxf){return Promise[_0xe6c8[24]]([])[_0xe6c8[19]](system[_0xe6c8[23]]())[_0xe6c8[19]](function(_0xe68fx12){return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx12)})[_0xe6c8[16]](function(_0xe68fx10){console[_0xe6c8[22]](_0xe68fx10);return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[25]]= function(_0xe68fxe,_0xe68fxf){changeLogo(_0xe68fxe,_0xe68fxf,_0xe6c8[26])};exports[_0xe6c8[27]]= function(_0xe68fxe,_0xe68fxf){changeLogo(_0xe68fxe,_0xe68fxf,_0xe6c8[28])};function changeLogo(_0xe68fxe,_0xe68fxf,_0xe68fx14){var _0xe68fx15= new UploadFile({dest:path[_0xe6c8[33]](config[_0xe6c8[29]],_0xe6c8[30],_0xe6c8[31],_0xe6c8[32]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0xe68fx16,_0xe68fx17){return sr()+ path[_0xe6c8[35]](_0xe68fx17[_0xe6c8[34]])},messages:{maxNumberOfFiles:_0xe6c8[36],acceptFileTypes:_0xe6c8[37],invalidRequest:_0xe6c8[38]}});_0xe68fx15[_0xe6c8[45]](_0xe6c8[39],function(_0xe68fx18,_0xe68fx19){if(!_0xe68fx19[_0xe6c8[40]][_0xe6c8[34]]){return _0xe68fxf[_0xe6c8[18]](500)[_0xe6c8[17]](_0xe68fx15)};return sequelize[_0xe6c8[44]](function(_0xe68fx1a){return Settings[_0xe6c8[43]](1)[_0xe6c8[19]](function(_0xe68fx11){if(!_0xe68fx11){return _0xe68fxf[_0xe6c8[41]](404)};var _0xe68fx1c={};_0xe68fx1c[_0xe68fx14]= _0xe68fx19[_0xe6c8[40]][_0xe6c8[34]];return _0xe68fx11[_0xe6c8[42]](_0xe68fx1c,{transaction:_0xe68fx1a})})[_0xe6c8[19]](function(_0xe68fx1b){return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx1b)})})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})});_0xe68fx15[_0xe6c8[45]](_0xe6c8[46],function(_0xe68fx10){console[_0xe6c8[22]](_0xe6c8[47],_0xe68fx10);return handleError(_0xe68fxf,_0xe68fx10)});_0xe68fx15[_0xe6c8[48]](_0xe68fxe)}exports[_0xe6c8[49]]= function(_0xe68fxe,_0xe68fxf){getLogo(_0xe68fxe,_0xe68fxf,_0xe6c8[50])};exports[_0xe6c8[51]]= function(_0xe68fxe,_0xe68fxf){getLogo(_0xe68fxe,_0xe68fxf,_0xe6c8[52])};function getLogo(_0xe68fxe,_0xe68fxf,_0xe68fx1e){var _0xe68fx1f=path[_0xe6c8[33]](config[_0xe6c8[29]],_0xe6c8[30],_0xe6c8[31],_0xe6c8[32],_0xe68fxe[_0xe6c8[53]][_0xe6c8[34]]);fs[_0xe6c8[56]](_0xe68fx1f,function(_0xe68fx20){if(!_0xe68fx20){_0xe68fx1f= path[_0xe6c8[33]](config[_0xe6c8[29]],_0xe6c8[30],_0xe6c8[31],_0xe6c8[32],_0xe6c8[54],_0xe68fx1e)};return _0xe68fxf[_0xe6c8[55]](_0xe68fx1f)})}exports[_0xe6c8[57]]= function(_0xe68fxe,_0xe68fxf){var _0xe68fx21;return Settings[_0xe6c8[43]](1)[_0xe6c8[19]](function(_0xe68fx11){_0xe68fx21= _0xe68fx11;return Agent[_0xe6c8[61]](_0xe6c8[60])})[_0xe6c8[19]](function(_0xe68fx22){var _0xe68fx23={value:0};if(_0xe68fx22){_0xe68fx23[_0xe6c8[58]]=  ++_0xe68fx22}else {_0xe68fx23[_0xe6c8[58]]= _0xe68fx21[_0xe6c8[59]]};return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx23)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[62]]= function(_0xe68fxe,_0xe68fxf){var _0xe68fx21;return Settings[_0xe6c8[43]](1)[_0xe6c8[19]](function(_0xe68fx11){_0xe68fx21= _0xe68fx11;return VoiceMail[_0xe6c8[61]](_0xe6c8[64])})[_0xe6c8[19]](function(_0xe68fx24){var _0xe68fx25={value:0};if(_0xe68fx24){_0xe68fx25[_0xe6c8[58]]=  ++_0xe68fx24}else {_0xe68fx25[_0xe6c8[58]]= _0xe68fx21[_0xe6c8[63]]};return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx25)})[_0xe6c8[16]](function(_0xe68fx10){console[_0xe6c8[22]](_0xe68fx10);return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[65]]= function(_0xe68fxe,_0xe68fxf){var _0xe68fx26=require(_0xe6c8[66]);return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]]({name:_0xe68fx26[_0xe6c8[67]],version:_0xe68fx26[_0xe6c8[68]],engines:_0xe68fx26[_0xe6c8[69]]})};exports[_0xe6c8[70]]= function(_0xe68fxe,_0xe68fxf){return Settings[_0xe6c8[43]](_0xe68fxe[_0xe6c8[53]][_0xe6c8[71]])[_0xe6c8[19]](function(_0xe68fx27){if(!_0xe68fx27){return _0xe68fxf[_0xe6c8[41]](404)};return _0xe68fxf[_0xe6c8[17]](_0xe68fx27)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[72]]= function(_0xe68fxe,_0xe68fxf){return Settings[_0xe6c8[72]](_0xe68fxe[_0xe6c8[73]])[_0xe6c8[19]](function(_0xe68fx27){return _0xe68fxf[_0xe6c8[18]](201)[_0xe6c8[17]](_0xe68fx27)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[74]]= function(_0xe68fxe,_0xe68fxf){var _0xe68fx28;return MailServerOut[_0xe6c8[72]](_0xe68fxe[_0xe6c8[73]])[_0xe6c8[19]](function(_0xe68fx29){_0xe68fx28= _0xe68fx29;return MailServerOut[_0xe6c8[42]]({service:false},{where:{id:{$ne:_0xe68fx29[_0xe6c8[71]]}}})})[_0xe6c8[19]](function(){return _0xe68fxf[_0xe6c8[18]](201)[_0xe6c8[17]](_0xe68fx28)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[75]]= function(_0xe68fxe,_0xe68fxf){return MailServerOut[_0xe6c8[42]]({service:false},{where:{id:{$ne:_0xe68fxe[_0xe6c8[73]][_0xe6c8[71]]}}})[_0xe6c8[19]](function(){return MailServerOut[_0xe6c8[42]](_0xe68fxe[_0xe6c8[73]],{where:{id:_0xe68fxe[_0xe6c8[73]][_0xe6c8[71]]}})})[_0xe6c8[19]](function(_0xe68fx29){return _0xe68fxf[_0xe6c8[41]](200)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[42]]= function(_0xe68fxe,_0xe68fxf){if(_0xe68fxe[_0xe6c8[73]][_0xe6c8[71]]){delete _0xe68fxe[_0xe6c8[73]][_0xe6c8[71]]};return Settings[_0xe6c8[43]](_0xe68fxe[_0xe6c8[53]][_0xe6c8[71]])[_0xe6c8[19]](function(_0xe68fx27){if(!_0xe68fx27){return _0xe68fxf[_0xe6c8[41]](404)};var _0xe68fx2a=_[_0xe6c8[76]](_0xe68fx27,_0xe68fxe[_0xe6c8[73]]);return _0xe68fx2a[_0xe6c8[77]]()})[_0xe6c8[19]](function(_0xe68fx27){return _0xe68fxf[_0xe6c8[18]](200)[_0xe6c8[17]](_0xe68fx27)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};exports[_0xe6c8[78]]= function(_0xe68fxe,_0xe68fxf){return Settings[_0xe6c8[43]](_0xe68fxe[_0xe6c8[53]][_0xe6c8[71]])[_0xe6c8[19]](function(_0xe68fx27){if(!_0xe68fx27){return _0xe68fxf[_0xe6c8[41]](404)};return _0xe68fx27[_0xe6c8[78]]()})[_0xe6c8[19]](function(){return _0xe68fxf[_0xe6c8[41]](204)})[_0xe6c8[16]](function(_0xe68fx10){return handleError(_0xe68fxf,_0xe68fx10)})};function handleError(_0xe68fxf,_0xe68fx10){return _0xe68fxf[_0xe6c8[18]](500)[_0xe6c8[17]](_0xe68fx10)}