Built motion from commit (unavailable).|2.4.3
[motion2.git] / server / api / voiceRecording / voiceRecording.rpc.js
index 5037fb8..e1d1eac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa715=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','VoiceRecording','create','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3b9aa1,_0x455e2a){var _0x188653=function(_0xcfe568){while(--_0xcfe568){_0x3b9aa1['push'](_0x3b9aa1['shift']());}};_0x188653(++_0x455e2a);}(_0xa715,0xdb));var _0x5a71=function(_0x40f47a,_0xa744f3){_0x40f47a=_0x40f47a-0x0;var _0x5a152c=_0xa715[_0x40f47a];return _0x5a152c;};'use strict';var _=require(_0x5a71('0x0'));var util=require(_0x5a71('0x1'));var moment=require(_0x5a71('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a71('0x3'));var db=require(_0x5a71('0x4'))['db'];var utils=require(_0x5a71('0x5'));var logger=require(_0x5a71('0x6'))(_0x5a71('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a71('0x8'));var client=jayson[_0x5a71('0x9')][_0x5a71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2061ad,_0x51f680,_0x216b38){return new BPromise(function(_0x2c267b,_0x444e94){return client[_0x5a71('0xb')](_0x2061ad,_0x216b38)[_0x5a71('0xc')](function(_0x56b02c){logger[_0x5a71('0xd')](_0x5a71('0xe'),_0x51f680,_0x5a71('0xf'));logger[_0x5a71('0x10')](_0x5a71('0x11'),_0x51f680,'request\x20sent',JSON[_0x5a71('0x12')](_0x56b02c));if(_0x56b02c[_0x5a71('0x13')]){if(_0x56b02c[_0x5a71('0x13')][_0x5a71('0x14')]===0x1f4){logger[_0x5a71('0x13')](_0x5a71('0xe'),_0x51f680,_0x56b02c[_0x5a71('0x13')][_0x5a71('0x15')]);return _0x444e94(_0x56b02c[_0x5a71('0x13')][_0x5a71('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x51f680,_0x56b02c[_0x5a71('0x13')][_0x5a71('0x15')]);return _0x2c267b(_0x56b02c['error'][_0x5a71('0x15')]);}else{logger[_0x5a71('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x51f680,_0x5a71('0xf'));_0x2c267b(_0x56b02c[_0x5a71('0x16')][_0x5a71('0x15')]);}})[_0x5a71('0x17')](function(_0x55c887){logger[_0x5a71('0x13')](_0x5a71('0xe'),_0x51f680,_0x55c887);_0x444e94(_0x55c887);});});}exports[_0x5a71('0x18')]=function(_0x4f9928){var _0x2a5a27=this;return new Promise(function(_0x510c0b,_0x5cb1f3){return db['VoiceRecording'][_0x5a71('0x19')](_0x4f9928[_0x5a71('0x1a')],{'raw':_0x4f9928[_0x5a71('0x1b')]?_0x4f9928['options'][_0x5a71('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f9928[_0x5a71('0x1b')]?_0x4f9928[_0x5a71('0x1b')][_0x5a71('0x1d')]||null:null,'attributes':_0x4f9928[_0x5a71('0x1b')]?_0x4f9928[_0x5a71('0x1b')][_0x5a71('0x1e')]||null:null,'limit':_0x4f9928[_0x5a71('0x1b')]?_0x4f9928['options'][_0x5a71('0x1f')]||null:null})[_0x5a71('0xc')](function(_0x100e6f){logger['info'](_0x5a71('0x18'),_0x4f9928);logger['debug'](_0x5a71('0x18'),_0x4f9928,JSON['stringify'](_0x100e6f));_0x510c0b(_0x100e6f);})['catch'](function(_0x27d2af){logger[_0x5a71('0x13')](_0x5a71('0x18'),_0x27d2af[_0x5a71('0x15')],_0x4f9928);_0x5cb1f3(_0x2a5a27[_0x5a71('0x13')](0x1f4,_0x27d2af[_0x5a71('0x15')]));});});};exports[_0x5a71('0x20')]=function(_0x503425){var _0x5eb1c8=this;return new Promise(function(_0x459bfe,_0x53c26e){var _0x465f05=require('../../components/encryptor');var _0x265a8b;return db[_0x5a71('0x21')][_0x5a71('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5a71('0xc')](function(_0x1e8649){_0x265a8b=_0x1e8649;return db[_0x5a71('0x23')][_0x5a71('0x24')](_0x503425[_0x5a71('0x1a')]);})[_0x5a71('0xc')](function(_0x5e50b7){if(_0x265a8b[_0x5a71('0x25')]&&fs[_0x5a71('0x26')](_0x5e50b7['value'])){var _0x2e6d11=util['format']('%s.cypher',_0x5e50b7[_0x5a71('0x27')]);return _0x465f05[_0x5a71('0x28')](_0x5e50b7[_0x5a71('0x27')],_0x2e6d11,config[_0x5a71('0x29')][_0x5a71('0x2a')])[_0x5a71('0xc')](function(){fs[_0x5a71('0x2b')](_0x5e50b7[_0x5a71('0x27')]);logger[_0x5a71('0xd')](_0x5a71('0x2c'));return _0x5e50b7;});}return _0x5e50b7;})['then'](function(_0xed4418){logger[_0x5a71('0xd')](_0x5a71('0x20'),_0x503425);logger[_0x5a71('0x10')](_0x5a71('0x20'),_0x503425,JSON[_0x5a71('0x12')](_0xed4418));_0x459bfe(_0xed4418);})[_0x5a71('0x17')](function(_0x235474){logger['error'](_0x5a71('0x20'),_0x235474['message'],_0x503425);_0x53c26e(_0x5eb1c8[_0x5a71('0x13')](0x1f4,_0x235474[_0x5a71('0x15')]));});});};
\ No newline at end of file
+var _0x547e=['rpc','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','value','%s.cypher','encryptFile','secrets','unlink','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1bf4c2,_0x4b5e69){var _0x366153=function(_0x514751){while(--_0x514751){_0x1bf4c2['push'](_0x1bf4c2['shift']());}};_0x366153(++_0x4b5e69);}(_0x547e,0xfd));var _0xe547=function(_0x5be1e7,_0x599b69){_0x5be1e7=_0x5be1e7-0x0;var _0x3d53cd=_0x547e[_0x5be1e7];return _0x3d53cd;};'use strict';var _=require(_0xe547('0x0'));var util=require('util');var moment=require(_0xe547('0x1'));var BPromise=require(_0xe547('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe547('0x3'));var db=require(_0xe547('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe547('0x5'))(_0xe547('0x6'));var config=require('../../config/environment');var jayson=require(_0xe547('0x7'));var client=jayson['client'][_0xe547('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4413f4,_0x5986ec,_0x13b966){return new BPromise(function(_0x35a74a,_0x14c678){return client[_0xe547('0x9')](_0x4413f4,_0x13b966)[_0xe547('0xa')](function(_0x338d71){logger[_0xe547('0xb')](_0xe547('0xc'),_0x5986ec,_0xe547('0xd'));logger[_0xe547('0xe')](_0xe547('0xf'),_0x5986ec,_0xe547('0xd'),JSON['stringify'](_0x338d71));if(_0x338d71[_0xe547('0x10')]){if(_0x338d71[_0xe547('0x10')]['code']===0x1f4){logger[_0xe547('0x10')](_0xe547('0xc'),_0x5986ec,_0x338d71['error']['message']);return _0x14c678(_0x338d71[_0xe547('0x10')]['message']);}logger['error'](_0xe547('0xc'),_0x5986ec,_0x338d71[_0xe547('0x10')][_0xe547('0x11')]);return _0x35a74a(_0x338d71[_0xe547('0x10')]['message']);}else{logger[_0xe547('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x5986ec,_0xe547('0xd'));_0x35a74a(_0x338d71['result'][_0xe547('0x11')]);}})[_0xe547('0x12')](function(_0xc23249){logger[_0xe547('0x10')](_0xe547('0xc'),_0x5986ec,_0xc23249);_0x14c678(_0xc23249);});});}exports[_0xe547('0x13')]=function(_0x11ad38){var _0x5a968d=this;return new Promise(function(_0x3f9fb0,_0x1af1e5){return db[_0xe547('0x14')][_0xe547('0x15')](_0x11ad38[_0xe547('0x16')],{'raw':_0x11ad38[_0xe547('0x17')]?_0x11ad38[_0xe547('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11ad38['options']?_0x11ad38[_0xe547('0x17')]['where']||null:null,'attributes':_0x11ad38[_0xe547('0x17')]?_0x11ad38['options'][_0xe547('0x18')]||null:null,'limit':_0x11ad38['options']?_0x11ad38[_0xe547('0x17')][_0xe547('0x19')]||null:null})['then'](function(_0x5a2e80){logger[_0xe547('0xb')](_0xe547('0x13'),_0x11ad38);logger['debug'](_0xe547('0x13'),_0x11ad38,JSON[_0xe547('0x1a')](_0x5a2e80));_0x3f9fb0(_0x5a2e80);})[_0xe547('0x12')](function(_0x44ac10){logger['error'](_0xe547('0x13'),_0x44ac10[_0xe547('0x11')],_0x11ad38);_0x1af1e5(_0x5a968d[_0xe547('0x10')](0x1f4,_0x44ac10[_0xe547('0x11')]));});});};exports[_0xe547('0x1b')]=function(_0x7a0db1){var _0x1975ba=this;return new Promise(function(_0x2e0075,_0x5083ca){var _0x4ff0ed=require(_0xe547('0x1c'));var _0x27f698;return db[_0xe547('0x1d')][_0xe547('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x254331){_0x27f698=_0x254331;return db[_0xe547('0x14')][_0xe547('0x1f')](_0x7a0db1[_0xe547('0x16')]);})[_0xe547('0xa')](function(_0xc8f420){if(_0x27f698['callRecordingEncryption']&&fs['existsSync'](_0xc8f420[_0xe547('0x20')])){var _0x113d4a=util['format'](_0xe547('0x21'),_0xc8f420[_0xe547('0x20')]);return _0x4ff0ed[_0xe547('0x22')](_0xc8f420['value'],_0x113d4a,config[_0xe547('0x23')]['recording'])[_0xe547('0xa')](function(){fs[_0xe547('0x24')](_0xc8f420[_0xe547('0x20')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xc8f420;});}return _0xc8f420;})[_0xe547('0xa')](function(_0x22ce86){logger['info']('CreateVoiceRecording',_0x7a0db1);logger[_0xe547('0xe')](_0xe547('0x1b'),_0x7a0db1,JSON[_0xe547('0x1a')](_0x22ce86));_0x2e0075(_0x22ce86);})[_0xe547('0x12')](function(_0x416f07){logger[_0xe547('0x10')](_0xe547('0x1b'),_0x416f07['message'],_0x7a0db1);_0x5083ca(_0x1975ba[_0xe547('0x10')](0x1f4,_0x416f07[_0xe547('0x11')]));});});};
\ No newline at end of file