Built motion from commit fe909640.|2.6.8
[motion2.git] / server / api / voiceRecording / voiceRecording.rpc.js
index ad69bfe..b37bdfd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2da6=['stringify','error','code','message','result','catch','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x129233,_0x4951e3){var _0x5dab6f=function(_0xc8d7f9){while(--_0xc8d7f9){_0x129233['push'](_0x129233['shift']());}};_0x5dab6f(++_0x4951e3);}(_0x2da6,0x1dd));var _0x62da=function(_0x5eeceb,_0x168c4f){_0x5eeceb=_0x5eeceb-0x0;var _0x29b938=_0x2da6[_0x5eeceb];return _0x29b938;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['UpdateVoiceRecording']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['update'](_0xa7050b[_0x62da('0x19')],{'raw':_0xa7050b['options']?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1c')]||null:null,'attributes':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1d')]||null:null,'limit':_0xa7050b[_0x62da('0x1a')]?_0xa7050b['options'][_0x62da('0x1e')]||null:null})[_0x62da('0xc')](function(_0x2fd925){logger[_0x62da('0xd')](_0x62da('0x1f'),_0xa7050b);logger[_0x62da('0xf')](_0x62da('0x1f'),_0xa7050b,JSON['stringify'](_0x2fd925));_0x4d6482(_0x2fd925);})['catch'](function(_0x509fd9){logger[_0x62da('0x13')](_0x62da('0x1f'),_0x509fd9[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x509fd9['message']));});});};exports[_0x62da('0x20')]=function(_0x3b9c06){var _0x5f0a9c=this;return new Promise(function(_0x3ccf96,_0x195dc4){var _0x1775ea=require('../../components/encryptor');var _0x41de3a;return db[_0x62da('0x21')][_0x62da('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3c6274){_0x41de3a=_0x3c6274;return db[_0x62da('0x18')][_0x62da('0x23')](_0x3b9c06['body']);})[_0x62da('0xc')](function(_0x2a4681){if(_0x41de3a[_0x62da('0x24')]&&fs[_0x62da('0x25')](_0x2a4681[_0x62da('0x26')])){var _0x1cf765=util['format'](_0x62da('0x27'),_0x2a4681['value']);return _0x1775ea[_0x62da('0x28')](_0x2a4681[_0x62da('0x26')],_0x1cf765,config[_0x62da('0x29')][_0x62da('0x2a')])[_0x62da('0xc')](function(){fs[_0x62da('0x2b')](_0x2a4681['value']);logger[_0x62da('0xd')](_0x62da('0x2c'));return _0x2a4681;});}return _0x2a4681;})[_0x62da('0xc')](function(_0x5107b1){logger[_0x62da('0xd')](_0x62da('0x20'),_0x3b9c06);logger[_0x62da('0xf')]('CreateVoiceRecording',_0x3b9c06,JSON[_0x62da('0x12')](_0x5107b1));_0x3ccf96(_0x5107b1);})[_0x62da('0x17')](function(_0x55eda7){logger[_0x62da('0x13')](_0x62da('0x20'),_0x55eda7['message'],_0x3b9c06);_0x195dc4(_0x5f0a9c[_0x62da('0x13')](0x1f4,_0x55eda7[_0x62da('0x15')]));});});};
\ No newline at end of file
+var _0x1967=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','debug','Setting','findOne','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x1967,0x173));var _0x7196=function(_0x5190a1,_0x4b50ee){_0x5190a1=_0x5190a1-0x0;var _0x44070c=_0x1967[_0x5190a1];return _0x44070c;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')](_0x32fe2b[_0x7196('0x1b')],{'raw':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b['options']['attributes']||null:null,'limit':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b[_0x7196('0x1c')]['limit']||null:null})[_0x7196('0xd')](function(_0x27ff84){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger[_0x7196('0x1e')]('UpdateVoiceRecording',_0x32fe2b,JSON[_0x7196('0x12')](_0x27ff84));_0x5b716a(_0x27ff84);})['catch'](function(_0x3ce9a0){logger[_0x7196('0x13')](_0x7196('0x18'),_0x3ce9a0[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d[_0x7196('0x13')](0x1f4,_0x3ce9a0[_0x7196('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x57c404){var _0x1482e5=this;return new Promise(function(_0x2d284f,_0x184c09){var _0x4e878f=require('../../components/encryptor');var _0x41cfd2;return db[_0x7196('0x1f')][_0x7196('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7196('0xd')](function(_0x4ecea1){_0x41cfd2=_0x4ecea1;return db[_0x7196('0x19')]['create'](_0x57c404[_0x7196('0x1b')]);})[_0x7196('0xd')](function(_0x1257ad){if(_0x41cfd2['callRecordingEncryption']&&fs[_0x7196('0x21')](_0x1257ad[_0x7196('0x22')])){var _0x2f9583=util[_0x7196('0x23')]('%s.cypher',_0x1257ad[_0x7196('0x22')]);return _0x4e878f[_0x7196('0x24')](_0x1257ad[_0x7196('0x22')],_0x2f9583,config[_0x7196('0x25')][_0x7196('0x26')])[_0x7196('0xd')](function(){fs[_0x7196('0x27')](_0x1257ad[_0x7196('0x22')]);logger[_0x7196('0xe')](_0x7196('0x28'));return _0x1257ad;});}return _0x1257ad;})[_0x7196('0xd')](function(_0x54e46b){logger[_0x7196('0xe')]('CreateVoiceRecording',_0x57c404);logger[_0x7196('0x1e')]('CreateVoiceRecording',_0x57c404,JSON[_0x7196('0x12')](_0x54e46b));_0x2d284f(_0x54e46b);})[_0x7196('0x17')](function(_0x5616ed){logger[_0x7196('0x13')](_0x7196('0x29'),_0x5616ed[_0x7196('0x15')],_0x57c404);_0x184c09(_0x1482e5[_0x7196('0x13')](0x1f4,_0x5616ed[_0x7196('0x15')]));});});};
\ No newline at end of file