c0a82a89048c0d0057e34ee58e30cbc2e24b4b62
[motion.git] / server / api / setting / setting.controller.js
1 var _0x1c37=["\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"];_0x1c37[0];var _=require(_0x1c37[1]);var Settings=require(_0x1c37[3])[_0x1c37[2]];var system=require(_0x1c37[4]);var Agent=require(_0x1c37[3])[_0x1c37[5]];var VoiceMail=require(_0x1c37[3])[_0x1c37[6]];var MailServerOut=require(_0x1c37[3])[_0x1c37[7]];var Promise=require(_0x1c37[8]);var UploadFile=require(_0x1c37[9]);var path=require(_0x1c37[10]);var sequelize=require(_0x1c37[3])[_0x1c37[11]];var config=require(_0x1c37[12]);var sr=require(_0x1c37[13]);var fs=require(_0x1c37[14]);exports[_0x1c37[15]]= function(_0x8662xe,_0x8662xf){return Settings[_0x1c37[20]]()[_0x1c37[19]](function(_0x8662x11){return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x11)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[21]]= function(_0x8662xe,_0x8662xf){return Promise[_0x1c37[24]]([])[_0x1c37[19]](system[_0x1c37[23]]())[_0x1c37[19]](function(_0x8662x12){return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x12)})[_0x1c37[16]](function(_0x8662x10){console[_0x1c37[22]](_0x8662x10);return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[25]]= function(_0x8662xe,_0x8662xf){changeLogo(_0x8662xe,_0x8662xf,_0x1c37[26])};exports[_0x1c37[27]]= function(_0x8662xe,_0x8662xf){changeLogo(_0x8662xe,_0x8662xf,_0x1c37[28])};function changeLogo(_0x8662xe,_0x8662xf,_0x8662x14){var _0x8662x15= new UploadFile({dest:path[_0x1c37[33]](config[_0x1c37[29]],_0x1c37[30],_0x1c37[31],_0x1c37[32]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0x8662x16,_0x8662x17){return sr()+ path[_0x1c37[35]](_0x8662x17[_0x1c37[34]])},messages:{maxNumberOfFiles:_0x1c37[36],acceptFileTypes:_0x1c37[37],invalidRequest:_0x1c37[38]}});_0x8662x15[_0x1c37[45]](_0x1c37[39],function(_0x8662x18,_0x8662x19){if(!_0x8662x19[_0x1c37[40]][_0x1c37[34]]){return _0x8662xf[_0x1c37[18]](500)[_0x1c37[17]](_0x8662x15)};return sequelize[_0x1c37[44]](function(_0x8662x1a){return Settings[_0x1c37[43]](1)[_0x1c37[19]](function(_0x8662x11){if(!_0x8662x11){return _0x8662xf[_0x1c37[41]](404)};var _0x8662x1c={};_0x8662x1c[_0x8662x14]= _0x8662x19[_0x1c37[40]][_0x1c37[34]];return _0x8662x11[_0x1c37[42]](_0x8662x1c,{transaction:_0x8662x1a})})[_0x1c37[19]](function(_0x8662x1b){return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x1b)})})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})});_0x8662x15[_0x1c37[45]](_0x1c37[46],function(_0x8662x10){console[_0x1c37[22]](_0x1c37[47],_0x8662x10);return handleError(_0x8662xf,_0x8662x10)});_0x8662x15[_0x1c37[48]](_0x8662xe)}exports[_0x1c37[49]]= function(_0x8662xe,_0x8662xf){getLogo(_0x8662xe,_0x8662xf,_0x1c37[50])};exports[_0x1c37[51]]= function(_0x8662xe,_0x8662xf){getLogo(_0x8662xe,_0x8662xf,_0x1c37[52])};function getLogo(_0x8662xe,_0x8662xf,_0x8662x1e){var _0x8662x1f=path[_0x1c37[33]](config[_0x1c37[29]],_0x1c37[30],_0x1c37[31],_0x1c37[32],_0x8662xe[_0x1c37[53]][_0x1c37[34]]);fs[_0x1c37[56]](_0x8662x1f,function(_0x8662x20){if(!_0x8662x20){_0x8662x1f= path[_0x1c37[33]](config[_0x1c37[29]],_0x1c37[30],_0x1c37[31],_0x1c37[32],_0x1c37[54],_0x8662x1e)};return _0x8662xf[_0x1c37[55]](_0x8662x1f)})}exports[_0x1c37[57]]= function(_0x8662xe,_0x8662xf){var _0x8662x21;return Settings[_0x1c37[43]](1)[_0x1c37[19]](function(_0x8662x11){_0x8662x21= _0x8662x11;return Agent[_0x1c37[61]](_0x1c37[60])})[_0x1c37[19]](function(_0x8662x22){var _0x8662x23={value:0};if(_0x8662x22){_0x8662x23[_0x1c37[58]]=  ++_0x8662x22}else {_0x8662x23[_0x1c37[58]]= _0x8662x21[_0x1c37[59]]};return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x23)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[62]]= function(_0x8662xe,_0x8662xf){var _0x8662x21;return Settings[_0x1c37[43]](1)[_0x1c37[19]](function(_0x8662x11){_0x8662x21= _0x8662x11;return VoiceMail[_0x1c37[61]](_0x1c37[64])})[_0x1c37[19]](function(_0x8662x24){var _0x8662x25={value:0};if(_0x8662x24){_0x8662x25[_0x1c37[58]]=  ++_0x8662x24}else {_0x8662x25[_0x1c37[58]]= _0x8662x21[_0x1c37[63]]};return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x25)})[_0x1c37[16]](function(_0x8662x10){console[_0x1c37[22]](_0x8662x10);return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[65]]= function(_0x8662xe,_0x8662xf){var _0x8662x26=require(_0x1c37[66]);return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]]({name:_0x8662x26[_0x1c37[67]],version:_0x8662x26[_0x1c37[68]],engines:_0x8662x26[_0x1c37[69]]})};exports[_0x1c37[70]]= function(_0x8662xe,_0x8662xf){return Settings[_0x1c37[43]](_0x8662xe[_0x1c37[53]][_0x1c37[71]])[_0x1c37[19]](function(_0x8662x27){if(!_0x8662x27){return _0x8662xf[_0x1c37[41]](404)};return _0x8662xf[_0x1c37[17]](_0x8662x27)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[72]]= function(_0x8662xe,_0x8662xf){return Settings[_0x1c37[72]](_0x8662xe[_0x1c37[73]])[_0x1c37[19]](function(_0x8662x27){return _0x8662xf[_0x1c37[18]](201)[_0x1c37[17]](_0x8662x27)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[74]]= function(_0x8662xe,_0x8662xf){var _0x8662x28;return MailServerOut[_0x1c37[72]](_0x8662xe[_0x1c37[73]])[_0x1c37[19]](function(_0x8662x29){_0x8662x28= _0x8662x29;return MailServerOut[_0x1c37[42]]({service:false},{where:{id:{$ne:_0x8662x29[_0x1c37[71]]}}})})[_0x1c37[19]](function(){return _0x8662xf[_0x1c37[18]](201)[_0x1c37[17]](_0x8662x28)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[75]]= function(_0x8662xe,_0x8662xf){return MailServerOut[_0x1c37[42]]({service:false},{where:{id:{$ne:_0x8662xe[_0x1c37[73]][_0x1c37[71]]}}})[_0x1c37[19]](function(){return MailServerOut[_0x1c37[42]](_0x8662xe[_0x1c37[73]],{where:{id:_0x8662xe[_0x1c37[73]][_0x1c37[71]]}})})[_0x1c37[19]](function(_0x8662x29){return _0x8662xf[_0x1c37[41]](200)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[42]]= function(_0x8662xe,_0x8662xf){if(_0x8662xe[_0x1c37[73]][_0x1c37[71]]){delete _0x8662xe[_0x1c37[73]][_0x1c37[71]]};return Settings[_0x1c37[43]](_0x8662xe[_0x1c37[53]][_0x1c37[71]])[_0x1c37[19]](function(_0x8662x27){if(!_0x8662x27){return _0x8662xf[_0x1c37[41]](404)};var _0x8662x2a=_[_0x1c37[76]](_0x8662x27,_0x8662xe[_0x1c37[73]]);return _0x8662x2a[_0x1c37[77]]()})[_0x1c37[19]](function(_0x8662x27){return _0x8662xf[_0x1c37[18]](200)[_0x1c37[17]](_0x8662x27)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};exports[_0x1c37[78]]= function(_0x8662xe,_0x8662xf){return Settings[_0x1c37[43]](_0x8662xe[_0x1c37[53]][_0x1c37[71]])[_0x1c37[19]](function(_0x8662x27){if(!_0x8662x27){return _0x8662xf[_0x1c37[41]](404)};return _0x8662x27[_0x1c37[78]]()})[_0x1c37[19]](function(){return _0x8662xf[_0x1c37[41]](204)})[_0x1c37[16]](function(_0x8662x10){return handleError(_0x8662xf,_0x8662x10)})};function handleError(_0x8662xf,_0x8662x10){return _0x8662xf[_0x1c37[18]](500)[_0x1c37[17]](_0x8662x10)}