58e384262b3a692a8b1eb45112d232bca70092bd
[motion.git] / server / api / setting / setting.controller.js
1 var _0xf534=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x65\x74\x74\x69\x6E\x67","\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\x41\x63\x63\x6F\x75\x6E\x74","\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","\x75\x74\x69\x6C","\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","\x63\x6F\x6E\x73\x6F\x6C\x65","\x74\x72\x69\x6D","\x63\x6F\x6D\x6D\x61\x6E\x64","\x62\x6F\x64\x79","\x25\x73\x3A\x25\x73","\x72\x6F\x6C\x65","\x75\x73\x65\x72","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x61\x6D\x69","\x6C\x6F\x63\x61\x6C\x73","\x61\x70\x70","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6C\x6F\x67\x73","","\x72\x65\x61\x64\x46\x69\x6C\x65","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\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","\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","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x61\x70","\x71\x75\x65\x72\x79","\x76\x61\x6C\x75\x65","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x73\x68\x69\x66\x74","\x66\x69\x6C\x74\x65\x72","\x72\x61\x6E\x67\x65","\x6D\x61\x78","\x6D\x69\x6E\x5F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x4D\x61\x69\x6C\x62\x6F\x78","\x6D\x61\x69\x6C\x62\x6F\x78","\x6D\x69\x6E\x5F\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","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65\x73","\x73\x68\x6F\x77","\x69\x64","\x73\x68\x6F\x77\x43\x75\x73\x74\x6F\x6D","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x73\x6C","\x73\x74\x61\x74\x65","\x73\x6F\x75\x72\x63\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x66\x69\x6E\x64\x4F\x6E\x65","\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","\x43\x4F\x4E\x4E\x45\x43\x54\x49\x4E\x47","\x61\x64\x64\x72\x65\x73\x73","\x73\x65\x72\x76\x69\x63\x65","\x73\x69\x67\x6E\x61\x74\x75\x72\x65","\x4C\x69\x73\x74\x49\x64","\x54\x65\x6D\x70\x6C\x61\x74\x65\x49\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xf534[0];var _=require(_0xf534[1]);var Setting=require(_0xf534[3])[_0xf534[2]];var system=require(_0xf534[4]);var Agent=require(_0xf534[3])[_0xf534[5]];var VoiceMail=require(_0xf534[3])[_0xf534[6]];var MailAccount=require(_0xf534[3])[_0xf534[7]];var MailServerOut=require(_0xf534[3])[_0xf534[8]];var Promise=require(_0xf534[9]);var UploadFile=require(_0xf534[10]);var path=require(_0xf534[11]);var sequelize=require(_0xf534[3])[_0xf534[12]];var config=require(_0xf534[13]);var sr=require(_0xf534[14]);var fs=require(_0xf534[15]);var util=require(_0xf534[16]);exports[_0xf534[17]]= function(_0xe179x10,_0xe179x11){return Setting[_0xf534[22]]()[_0xf534[21]](function(_0xe179x13){return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x13)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[23]]= function(_0xe179x10,_0xe179x11){return Promise[_0xf534[26]]([])[_0xf534[21]](system[_0xf534[25]]())[_0xf534[21]](function(_0xe179x14){return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x14)})[_0xf534[18]](function(_0xe179x12){console[_0xf534[24]](_0xe179x12);return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[27]]= function(_0xe179x10,_0xe179x11){_0xe179x10[_0xf534[39]][_0xf534[38]][_0xf534[37]][_0xf534[19]]({evt:_0xf534[28],command:_0xe179x10[_0xf534[31]][_0xf534[30]][_0xf534[29]](),socket:util[_0xf534[36]](_0xf534[32],_0xe179x10[_0xf534[34]][_0xf534[33]],_0xe179x10[_0xf534[34]][_0xf534[35]])});return _0xe179x11[_0xf534[40]](200)};exports[_0xf534[41]]= function(_0xe179x10,_0xe179x11){var _0xe179x15={output:_0xf534[42],errors:_0xf534[42]};var _0xe179x16=Promise[_0xf534[44]](fs[_0xf534[43]]);var _0xe179x17=Promise[_0xf534[44]](fs[_0xf534[45]]);return _0xe179x16(_0xf534[54],_0xf534[51])[_0xf534[21]](function(_0xe179x1a){_0xe179x15[_0xf534[52]]= _0xe179x1a})[_0xf534[18]](function(_0xe179x12){_0xe179x15[_0xf534[52]]= _0xf534[53]})[_0xf534[21]](function(){return _0xe179x16(_0xf534[50],_0xf534[51])})[_0xf534[21]](function(_0xe179x19){_0xe179x15[_0xf534[48]]= _0xe179x19})[_0xf534[18]](function(_0xe179x12){_0xe179x15[_0xf534[48]]= _0xf534[49]})[_0xf534[21]](function(_0xe179x18){return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x15)})[_0xf534[18]](function(_0xe179x12){console[_0xf534[24]](_0xf534[46],_0xe179x12[_0xf534[47]]);return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[55]]= function(_0xe179x10,_0xe179x11){changeLogo(_0xe179x10,_0xe179x11,_0xf534[56])};exports[_0xf534[57]]= function(_0xe179x10,_0xe179x11){changeLogo(_0xe179x10,_0xe179x11,_0xf534[58])};function changeLogo(_0xe179x10,_0xe179x11,_0xe179x1c){var _0xe179x1d= new UploadFile({dest:path[_0xf534[63]](config[_0xf534[59]],_0xf534[60],_0xf534[61],_0xf534[62]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0xe179x1e,_0xe179x1f){return sr()+ path[_0xf534[65]](_0xe179x1f[_0xf534[64]])},messages:{maxNumberOfFiles:_0xf534[66],acceptFileTypes:_0xf534[67],invalidRequest:_0xf534[68]}});_0xe179x1d[_0xf534[74]](_0xf534[69],function(_0xe179x20,_0xe179x21){if(!_0xe179x21[_0xf534[70]][_0xf534[64]]){return _0xe179x11[_0xf534[20]](500)[_0xf534[19]](_0xe179x1d)};return sequelize[_0xf534[73]](function(_0xe179x22){return Setting[_0xf534[72]](1)[_0xf534[21]](function(_0xe179x13){if(!_0xe179x13){return _0xe179x11[_0xf534[40]](404)};var _0xe179x24={};_0xe179x24[_0xe179x1c]= _0xe179x21[_0xf534[70]][_0xf534[64]];return _0xe179x13[_0xf534[71]](_0xe179x24,{transaction:_0xe179x22})})[_0xf534[21]](function(_0xe179x23){return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x23)})})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})});_0xe179x1d[_0xf534[74]](_0xf534[75],function(_0xe179x12){console[_0xf534[24]](_0xf534[76],_0xe179x12);return handleError(_0xe179x11,_0xe179x12)});_0xe179x1d[_0xf534[77]](_0xe179x10)}exports[_0xf534[78]]= function(_0xe179x10,_0xe179x11){getLogo(_0xe179x10,_0xe179x11,_0xf534[79])};exports[_0xf534[80]]= function(_0xe179x10,_0xe179x11){getLogo(_0xe179x10,_0xe179x11,_0xf534[81])};function getLogo(_0xe179x10,_0xe179x11,_0xe179x26){var _0xe179x27=path[_0xf534[63]](config[_0xf534[59]],_0xf534[60],_0xf534[61],_0xf534[62],_0xe179x10[_0xf534[82]][_0xf534[64]]);fs[_0xf534[45]](_0xe179x27,function(_0xe179x17){if(!_0xe179x17){_0xe179x27= path[_0xf534[63]](config[_0xf534[59]],_0xf534[60],_0xf534[61],_0xf534[62],_0xf534[83],_0xe179x26)};return _0xe179x11[_0xf534[84]](_0xe179x27)})}exports[_0xf534[85]]= function(_0xe179x10,_0xe179x11){var _0xe179x28;return Setting[_0xf534[72]](1)[_0xf534[21]](function(_0xe179x13){_0xe179x28= _0xe179x13;return Agent[_0xf534[22]]({attributes:[_0xf534[86]]})})[_0xf534[21]](function(_0xe179x29){var _0xe179x2a=_[_0xf534[87]](_0xe179x29,_0xf534[86]);var _0xe179x2b={value:0,range:0};var _0xe179x2c;if(_0xe179x10[_0xf534[88]][_0xf534[86]]){_0xe179x2b[_0xf534[89]]= Number(_0xe179x10[_0xf534[88]][_0xf534[86]]);while(_[_0xf534[90]](_0xe179x2a,_0xe179x2b[_0xf534[89]])){_0xe179x2b[_0xf534[89]]++};_0xe179x2c= _[_0xf534[92]](_0xe179x2a,function(_0xe179x2d){return _0xe179x2d> _0xe179x2b[_0xf534[89]]})[_0xf534[91]]();_0xe179x2b[_0xf534[93]]= _0xe179x2c- _0xe179x2b[_0xf534[89]]}else {var _0xe179x2e=_[_0xf534[94]](_0xe179x2a);_0xe179x2b[_0xf534[89]]= _0xe179x28[_0xf534[95]];if(_0xe179x2e&& _0xe179x2e>= _0xe179x28[_0xf534[95]]){while(_[_0xf534[90]](_0xe179x2a,_0xe179x2b[_0xf534[89]])){_0xe179x2b[_0xf534[89]]++};_0xe179x2c= _[_0xf534[92]](_0xe179x2a,function(_0xe179x2d){return _0xe179x2d> _0xe179x2b[_0xf534[89]]})[_0xf534[91]]();_0xe179x2b[_0xf534[93]]= _0xe179x2c- _0xe179x2b[_0xf534[89]]}};return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x2b)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[96]]= function(_0xe179x10,_0xe179x11){var _0xe179x28;return Setting[_0xf534[72]](1)[_0xf534[21]](function(_0xe179x13){_0xe179x28= _0xe179x13;return VoiceMail[_0xf534[22]]({attributes:[_0xf534[97]]})})[_0xf534[21]](function(_0xe179x2f){var _0xe179x30=_[_0xf534[87]](_0xe179x2f,function(_0xe179x2d){return Number(_0xe179x2d[_0xf534[97]])});var _0xe179x31={value:0,range:0};var _0xe179x2c;var _0xe179x32=_[_0xf534[94]](_0xe179x30);_0xe179x31[_0xf534[89]]= _0xe179x28[_0xf534[98]];if(_0xe179x32&& _0xe179x32>= _0xe179x28[_0xf534[98]]){while(_[_0xf534[90]](_0xe179x30,_0xe179x31[_0xf534[89]])){_0xe179x31[_0xf534[89]]++};_0xe179x2c= _[_0xf534[92]](_0xe179x30,function(_0xe179x2d){return _0xe179x2d> _0xe179x31[_0xf534[89]]})[_0xf534[91]]();_0xe179x31[_0xf534[93]]= _0xe179x2c- _0xe179x31[_0xf534[89]]};return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x31)})[_0xf534[18]](function(_0xe179x12){console[_0xf534[24]](_0xe179x12);return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[99]]= function(_0xe179x10,_0xe179x11){var _0xe179x33=require(_0xf534[100]);return _0xe179x11[_0xf534[20]](200)[_0xf534[19]]({name:_0xe179x33[_0xf534[35]],version:_0xe179x33[_0xf534[101]],engines:_0xe179x33[_0xf534[102]]})};exports[_0xf534[103]]= function(_0xe179x10,_0xe179x11){return Setting[_0xf534[72]](_0xe179x10[_0xf534[82]][_0xf534[104]])[_0xf534[21]](function(_0xe179x34){if(!_0xe179x34){return _0xe179x11[_0xf534[40]](404)};return _0xe179x11[_0xf534[19]](_0xe179x34)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[105]]= function(_0xe179x10,_0xe179x11,_0xe179x35){return MailAccount[_0xf534[114]]({where:{custom:true},include:[{model:MailServerOut,attributes:[_0xf534[104],_0xf534[106],_0xf534[107],_0xf534[108],_0xf534[109],_0xf534[110],_0xf534[111],_0xf534[112],_0xf534[113]]}]})[_0xf534[21]](function(_0xe179x36){if(!_0xe179x36){return _0xe179x11[_0xf534[40]](404)};return _0xe179x11[_0xf534[19]](_0xe179x36)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[115]]= function(_0xe179x10,_0xe179x11){return Setting[_0xf534[115]](_0xe179x10[_0xf534[31]])[_0xf534[21]](function(_0xe179x34){return _0xe179x11[_0xf534[20]](201)[_0xf534[19]](_0xe179x34)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[116]]= function(_0xe179x10,_0xe179x11,_0xe179x35){return MailAccount[_0xf534[115]](_0xe179x10[_0xf534[31]],{include:[{model:MailServerOut}]})[_0xf534[21]](function(_0xe179x36){return _0xe179x11[_0xf534[20]](201)[_0xf534[19]](_0xe179x36)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[117]]= function(_0xe179x10,_0xe179x11){var _0xe179x37;return MailAccount[_0xf534[72]](_0xe179x10[_0xf534[82]][_0xf534[104]])[_0xf534[21]](function(_0xe179x36){_0xe179x37= _0xe179x36;return _0xe179x37[_0xf534[71]]({name:_0xe179x10[_0xf534[31]][_0xf534[35]],address:_0xe179x10[_0xf534[31]][_0xf534[119]],service:_0xe179x10[_0xf534[31]][_0xf534[120]],signature:_0xe179x10[_0xf534[31]][_0xf534[121]],ListId:_0xe179x10[_0xf534[31]][_0xf534[122]],TemplateId:_0xe179x10[_0xf534[31]][_0xf534[123]]})})[_0xf534[21]](function(_0xe179x36){if(_0xe179x10[_0xf534[31]][_0xf534[8]]){_0xe179x10[_0xf534[31]][_0xf534[8]][_0xf534[111]]= _0xf534[118];_0xe179x10[_0xf534[31]][_0xf534[8]][_0xf534[112]]= null;return MailServerOut[_0xf534[71]](_0xe179x10[_0xf534[31]].MailServerOut,{where:{id:_0xe179x10[_0xf534[31]][_0xf534[8]][_0xf534[104]]},individualHooks:true})}})[_0xf534[21]](function(_0xe179x38){return _0xe179x11[_0xf534[40]](200)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[71]]= function(_0xe179x10,_0xe179x11){if(_0xe179x10[_0xf534[31]][_0xf534[104]]){delete _0xe179x10[_0xf534[31]][_0xf534[104]]};return Setting[_0xf534[72]](_0xe179x10[_0xf534[82]][_0xf534[104]])[_0xf534[21]](function(_0xe179x34){if(!_0xe179x34){return _0xe179x11[_0xf534[40]](404)};var _0xe179x39=_[_0xf534[124]](_0xe179x34,_0xe179x10[_0xf534[31]]);return _0xe179x39[_0xf534[125]]()})[_0xf534[21]](function(_0xe179x34){return _0xe179x11[_0xf534[20]](200)[_0xf534[19]](_0xe179x34)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};exports[_0xf534[126]]= function(_0xe179x10,_0xe179x11){return Setting[_0xf534[72]](_0xe179x10[_0xf534[82]][_0xf534[104]])[_0xf534[21]](function(_0xe179x34){if(!_0xe179x34){return _0xe179x11[_0xf534[40]](404)};return _0xe179x34[_0xf534[126]]()})[_0xf534[21]](function(){return _0xe179x11[_0xf534[40]](204)})[_0xf534[18]](function(_0xe179x12){return handleError(_0xe179x11,_0xe179x12)})};function handleError(_0xe179x11,_0xe179x12){return _0xe179x11[_0xf534[20]](500)[_0xf534[19]](_0xe179x12)}