Built motion from commit 832e619.|0.0.137
[motion.git] / server / api / setting / setting.controller.js
1 var _0x9ccc=["\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","\x61\x73\x74\x65\x72\x69\x73\x6B\x43\x6F\x6D\x6D\x61\x6E\x64","\x43\x6F\x6D\x6D\x61\x6E\x64","\x74\x72\x69\x6D","\x63\x6F\x6D\x6D\x61\x6E\x64","\x62\x6F\x64\x79","\x61\x63\x74\x69\x6F\x6E","\x61\x6D\x69","\x6C\x6F\x63\x61\x6C\x73","\x61\x70\x70","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x6C\x6F\x67\x73","","\x72\x65\x61\x64\x46\x69\x6C\x65","\x65\x78\x69\x73\x74\x73","\x6C\x6F\x67\x73\x20\x65\x72\x72\x6F\x72\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x6F\x75\x74\x70\x75\x74","\x4E\x6F\x20\x6F\x75\x74\x70\x75\x74\x20\x6C\x6F\x67\x20\x66\x69\x6C\x65\x20\x66\x6F\x75\x6E\x64\x21","\x2F\x76\x61\x72\x2F\x6C\x6F\x67\x2F\x78\x63\x61\x6C\x6C\x79\x2F\x6D\x6F\x74\x69\x6F\x6E\x2D\x6F\x75\x74\x2E\x6C\x6F\x67","\x75\x74\x66\x38","\x65\x72\x72\x6F\x72\x73","\x4E\x6F\x20\x65\x72\x72\x6F\x72\x20\x6C\x6F\x67\x20\x66\x69\x6C\x65\x20\x66\x6F\x75\x6E\x64\x21","\x2F\x76\x61\x72\x2F\x6C\x6F\x67\x2F\x78\x63\x61\x6C\x6C\x79\x2F\x6D\x6F\x74\x69\x6F\x6E\x2D\x65\x72\x72\x2E\x6C\x6F\x67","\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\x6F\x2D\x62\x69\x67\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","\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","\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"];_0x9ccc[0];var _=require(_0x9ccc[1]);var Settings=require(_0x9ccc[3])[_0x9ccc[2]];var system=require(_0x9ccc[4]);var Agent=require(_0x9ccc[3])[_0x9ccc[5]];var VoiceMail=require(_0x9ccc[3])[_0x9ccc[6]];var MailServerOut=require(_0x9ccc[3])[_0x9ccc[7]];var Promise=require(_0x9ccc[8]);var UploadFile=require(_0x9ccc[9]);var path=require(_0x9ccc[10]);var sequelize=require(_0x9ccc[3])[_0x9ccc[11]];var config=require(_0x9ccc[12]);var sr=require(_0x9ccc[13]);var fs=require(_0x9ccc[14]);exports[_0x9ccc[15]]= function(_0x152axe,_0x152axf){return Settings[_0x9ccc[20]]()[_0x9ccc[19]](function(_0x152ax11){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax11)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[21]]= function(_0x152axe,_0x152axf){return Promise[_0x9ccc[24]]([])[_0x9ccc[19]](system[_0x9ccc[23]]())[_0x9ccc[19]](function(_0x152ax12){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax12)})[_0x9ccc[16]](function(_0x152ax10){console[_0x9ccc[22]](_0x152ax10);return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[25]]= function(_0x152axe,_0x152axf){return Promise[_0x9ccc[34]](_0x152axe[_0x9ccc[33]][_0x9ccc[32]][_0x9ccc[31]][_0x9ccc[30]])({action:_0x9ccc[26],command:_0x152axe[_0x9ccc[29]][_0x9ccc[28]][_0x9ccc[27]]()})[_0x9ccc[19]](function(_0x152ax13){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax13)})[_0x9ccc[16]](function(_0x152ax10){console[_0x9ccc[22]](_0x152ax10);return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[35]]= function(_0x152axe,_0x152axf){var _0x152ax14={output:_0x9ccc[36],errors:_0x9ccc[36]};var _0x152ax15=Promise[_0x9ccc[34]](fs[_0x9ccc[37]]);var _0x152ax16=Promise[_0x9ccc[34]](fs[_0x9ccc[38]]);return _0x152ax15(_0x9ccc[47],_0x9ccc[44])[_0x9ccc[19]](function(_0x152ax18){_0x152ax14[_0x9ccc[45]]= _0x152ax18})[_0x9ccc[16]](function(_0x152ax10){_0x152ax14[_0x9ccc[45]]= _0x9ccc[46]})[_0x9ccc[19]](function(){return _0x152ax15(_0x9ccc[43],_0x9ccc[44])})[_0x9ccc[19]](function(_0x152ax17){_0x152ax14[_0x9ccc[41]]= _0x152ax17})[_0x9ccc[16]](function(_0x152ax10){_0x152ax14[_0x9ccc[41]]= _0x9ccc[42]})[_0x9ccc[19]](function(_0x152ax13){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax14)})[_0x9ccc[16]](function(_0x152ax10){console[_0x9ccc[22]](_0x9ccc[39],_0x152ax10[_0x9ccc[40]]);return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[48]]= function(_0x152axe,_0x152axf){changeLogo(_0x152axe,_0x152axf,_0x9ccc[49])};exports[_0x9ccc[50]]= function(_0x152axe,_0x152axf){changeLogo(_0x152axe,_0x152axf,_0x9ccc[51])};function changeLogo(_0x152axe,_0x152axf,_0x152ax1a){var _0x152ax1b= new UploadFile({dest:path[_0x9ccc[56]](config[_0x9ccc[52]],_0x9ccc[53],_0x9ccc[54],_0x9ccc[55]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0x152ax1c,_0x152ax1d){return sr()+ path[_0x9ccc[58]](_0x152ax1d[_0x9ccc[57]])},messages:{maxNumberOfFiles:_0x9ccc[59],acceptFileTypes:_0x9ccc[60],invalidRequest:_0x9ccc[61]}});_0x152ax1b[_0x9ccc[68]](_0x9ccc[62],function(_0x152ax1e,_0x152ax1f){if(!_0x152ax1f[_0x9ccc[63]][_0x9ccc[57]]){return _0x152axf[_0x9ccc[18]](500)[_0x9ccc[17]](_0x152ax1b)};return sequelize[_0x9ccc[67]](function(_0x152ax20){return Settings[_0x9ccc[66]](1)[_0x9ccc[19]](function(_0x152ax11){if(!_0x152ax11){return _0x152axf[_0x9ccc[64]](404)};var _0x152ax22={};_0x152ax22[_0x152ax1a]= _0x152ax1f[_0x9ccc[63]][_0x9ccc[57]];return _0x152ax11[_0x9ccc[65]](_0x152ax22,{transaction:_0x152ax20})})[_0x9ccc[19]](function(_0x152ax21){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax21)})})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})});_0x152ax1b[_0x9ccc[68]](_0x9ccc[69],function(_0x152ax10){console[_0x9ccc[22]](_0x9ccc[70],_0x152ax10);return handleError(_0x152axf,_0x152ax10)});_0x152ax1b[_0x9ccc[71]](_0x152axe)}exports[_0x9ccc[72]]= function(_0x152axe,_0x152axf){getLogo(_0x152axe,_0x152axf,_0x9ccc[73])};exports[_0x9ccc[74]]= function(_0x152axe,_0x152axf){getLogo(_0x152axe,_0x152axf,_0x9ccc[75])};function getLogo(_0x152axe,_0x152axf,_0x152ax24){var _0x152ax25=path[_0x9ccc[56]](config[_0x9ccc[52]],_0x9ccc[53],_0x9ccc[54],_0x9ccc[55],_0x152axe[_0x9ccc[76]][_0x9ccc[57]]);fs[_0x9ccc[38]](_0x152ax25,function(_0x152ax16){if(!_0x152ax16){_0x152ax25= path[_0x9ccc[56]](config[_0x9ccc[52]],_0x9ccc[53],_0x9ccc[54],_0x9ccc[55],_0x9ccc[77],_0x152ax24)};return _0x152axf[_0x9ccc[78]](_0x152ax25)})}exports[_0x9ccc[79]]= function(_0x152axe,_0x152axf){var _0x152ax26;return Settings[_0x9ccc[66]](1)[_0x9ccc[19]](function(_0x152ax11){_0x152ax26= _0x152ax11;return Agent[_0x9ccc[83]](_0x9ccc[82])})[_0x9ccc[19]](function(_0x152ax27){var _0x152ax28={value:0};if(_0x152ax27){_0x152ax28[_0x9ccc[80]]=  ++_0x152ax27}else {_0x152ax28[_0x9ccc[80]]= _0x152ax26[_0x9ccc[81]]};return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax28)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[84]]= function(_0x152axe,_0x152axf){var _0x152ax26;return Settings[_0x9ccc[66]](1)[_0x9ccc[19]](function(_0x152ax11){_0x152ax26= _0x152ax11;return VoiceMail[_0x9ccc[83]](_0x9ccc[86])})[_0x9ccc[19]](function(_0x152ax29){var _0x152ax2a={value:0};if(_0x152ax29){_0x152ax2a[_0x9ccc[80]]=  ++_0x152ax29}else {_0x152ax2a[_0x9ccc[80]]= _0x152ax26[_0x9ccc[85]]};return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax2a)})[_0x9ccc[16]](function(_0x152ax10){console[_0x9ccc[22]](_0x152ax10);return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[87]]= function(_0x152axe,_0x152axf){var _0x152ax2b=require(_0x9ccc[88]);return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]]({name:_0x152ax2b[_0x9ccc[89]],version:_0x152ax2b[_0x9ccc[90]],engines:_0x152ax2b[_0x9ccc[91]]})};exports[_0x9ccc[92]]= function(_0x152axe,_0x152axf){return Settings[_0x9ccc[66]](_0x152axe[_0x9ccc[76]][_0x9ccc[93]])[_0x9ccc[19]](function(_0x152ax2c){if(!_0x152ax2c){return _0x152axf[_0x9ccc[64]](404)};return _0x152axf[_0x9ccc[17]](_0x152ax2c)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[94]]= function(_0x152axe,_0x152axf){return Settings[_0x9ccc[94]](_0x152axe[_0x9ccc[29]])[_0x9ccc[19]](function(_0x152ax2c){return _0x152axf[_0x9ccc[18]](201)[_0x9ccc[17]](_0x152ax2c)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[95]]= function(_0x152axe,_0x152axf){var _0x152ax2d;return MailServerOut[_0x9ccc[94]](_0x152axe[_0x9ccc[29]])[_0x9ccc[19]](function(_0x152ax2e){_0x152ax2d= _0x152ax2e;return MailServerOut[_0x9ccc[65]]({service:false},{where:{id:{$ne:_0x152ax2e[_0x9ccc[93]]}}})})[_0x9ccc[19]](function(){return _0x152axf[_0x9ccc[18]](201)[_0x9ccc[17]](_0x152ax2d)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[96]]= function(_0x152axe,_0x152axf){return MailServerOut[_0x9ccc[65]]({service:false},{where:{id:{$ne:_0x152axe[_0x9ccc[29]][_0x9ccc[93]]}}})[_0x9ccc[19]](function(){return MailServerOut[_0x9ccc[65]](_0x152axe[_0x9ccc[29]],{where:{id:_0x152axe[_0x9ccc[29]][_0x9ccc[93]]}})})[_0x9ccc[19]](function(_0x152ax2e){return _0x152axf[_0x9ccc[64]](200)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[65]]= function(_0x152axe,_0x152axf){if(_0x152axe[_0x9ccc[29]][_0x9ccc[93]]){delete _0x152axe[_0x9ccc[29]][_0x9ccc[93]]};return Settings[_0x9ccc[66]](_0x152axe[_0x9ccc[76]][_0x9ccc[93]])[_0x9ccc[19]](function(_0x152ax2c){if(!_0x152ax2c){return _0x152axf[_0x9ccc[64]](404)};var _0x152ax2f=_[_0x9ccc[97]](_0x152ax2c,_0x152axe[_0x9ccc[29]]);return _0x152ax2f[_0x9ccc[98]]()})[_0x9ccc[19]](function(_0x152ax2c){return _0x152axf[_0x9ccc[18]](200)[_0x9ccc[17]](_0x152ax2c)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};exports[_0x9ccc[99]]= function(_0x152axe,_0x152axf){return Settings[_0x9ccc[66]](_0x152axe[_0x9ccc[76]][_0x9ccc[93]])[_0x9ccc[19]](function(_0x152ax2c){if(!_0x152ax2c){return _0x152axf[_0x9ccc[64]](404)};return _0x152ax2c[_0x9ccc[99]]()})[_0x9ccc[19]](function(){return _0x152axf[_0x9ccc[64]](204)})[_0x9ccc[16]](function(_0x152ax10){return handleError(_0x152axf,_0x152ax10)})};function handleError(_0x152axf,_0x152ax10){return _0x152axf[_0x9ccc[18]](500)[_0x9ccc[17]](_0x152ax10)}