Built motion from commit (unavailable).|2.3.4
[motion2.git] / server / api / voiceRecording / voiceRecording.rpc.js
index 805572f..6b1eacd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x906f=['request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','update','options','raw','where','attributes','limit','info','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','body','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bcf54,_0x35d098){var _0x42f877=function(_0x41d12c){while(--_0x41d12c){_0x2bcf54['push'](_0x2bcf54['shift']());}};_0x42f877(++_0x35d098);}(_0x906f,0xa1));var _0xf906=function(_0x43ea05,_0x24f1e3){_0x43ea05=_0x43ea05-0x0;var _0x31cac2=_0x906f[_0x43ea05];return _0x31cac2;};'use strict';var _=require(_0xf906('0x0'));var util=require(_0xf906('0x1'));var moment=require(_0xf906('0x2'));var BPromise=require(_0xf906('0x3'));var rs=require(_0xf906('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf906('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf906('0x6'))(_0xf906('0x7'));var config=require(_0xf906('0x8'));var jayson=require(_0xf906('0x9'));var client=jayson[_0xf906('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9881,_0xda0b26,_0x2fb506){return new BPromise(function(_0x2a6e1d,_0x3b998b){return client[_0xf906('0xb')](_0x1f9881,_0x2fb506)[_0xf906('0xc')](function(_0x2cc51d){logger['info']('VoiceRecording,\x20%s,\x20%s',_0xda0b26,_0xf906('0xd'));logger['debug'](_0xf906('0xe'),_0xda0b26,_0xf906('0xd'),JSON[_0xf906('0xf')](_0x2cc51d));if(_0x2cc51d[_0xf906('0x10')]){if(_0x2cc51d[_0xf906('0x10')][_0xf906('0x11')]===0x1f4){logger[_0xf906('0x10')](_0xf906('0x12'),_0xda0b26,_0x2cc51d[_0xf906('0x10')][_0xf906('0x13')]);return _0x3b998b(_0x2cc51d[_0xf906('0x10')][_0xf906('0x13')]);}logger[_0xf906('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xda0b26,_0x2cc51d[_0xf906('0x10')][_0xf906('0x13')]);return _0x2a6e1d(_0x2cc51d[_0xf906('0x10')][_0xf906('0x13')]);}else{logger['info'](_0xf906('0x12'),_0xda0b26,'request\x20sent');_0x2a6e1d(_0x2cc51d['result'][_0xf906('0x13')]);}})[_0xf906('0x14')](function(_0x4a2677){logger[_0xf906('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xda0b26,_0x4a2677);_0x3b998b(_0x4a2677);});});}exports[_0xf906('0x15')]=function(_0x273003){var _0x2b72b8=this;return new Promise(function(_0x8bf602,_0x12a5ba){return db['VoiceRecording'][_0xf906('0x16')](_0x273003['body'],{'raw':_0x273003[_0xf906('0x17')]?_0x273003[_0xf906('0x17')][_0xf906('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x273003[_0xf906('0x17')]?_0x273003[_0xf906('0x17')][_0xf906('0x19')]||null:null,'attributes':_0x273003['options']?_0x273003['options'][_0xf906('0x1a')]||null:null,'limit':_0x273003['options']?_0x273003[_0xf906('0x17')][_0xf906('0x1b')]||null:null})[_0xf906('0xc')](function(_0xe415ce){logger[_0xf906('0x1c')](_0xf906('0x15'),_0x273003);logger[_0xf906('0x1d')]('UpdateVoiceRecording',_0x273003,JSON[_0xf906('0xf')](_0xe415ce));_0x8bf602(_0xe415ce);})['catch'](function(_0xd6aead){logger[_0xf906('0x10')](_0xf906('0x15'),_0xd6aead[_0xf906('0x13')],_0x273003);_0x12a5ba(_0x2b72b8[_0xf906('0x10')](0x1f4,_0xd6aead[_0xf906('0x13')]));});});};exports[_0xf906('0x1e')]=function(_0x5504ad){var _0x1d4509=this;return new Promise(function(_0x138ea5,_0x59a848){var _0x1291e1=require('../../components/encryptor');var _0x54e521;return db[_0xf906('0x1f')][_0xf906('0x20')]({'attributes':['id',_0xf906('0x21')],'where':{'id':0x1},'raw':!![]})[_0xf906('0xc')](function(_0x46341e){_0x54e521=_0x46341e;return db['VoiceRecording']['create'](_0x5504ad[_0xf906('0x22')]);})[_0xf906('0xc')](function(_0x4d7108){if(_0x54e521[_0xf906('0x21')]&&fs[_0xf906('0x23')](_0x4d7108[_0xf906('0x24')])){var _0x3f39d0=util[_0xf906('0x25')](_0xf906('0x26'),_0x4d7108[_0xf906('0x24')]);return _0x1291e1[_0xf906('0x27')](_0x4d7108[_0xf906('0x24')],_0x3f39d0,config[_0xf906('0x28')][_0xf906('0x29')])[_0xf906('0xc')](function(){fs['unlink'](_0x4d7108[_0xf906('0x24')]);logger[_0xf906('0x1c')](_0xf906('0x2a'));return _0x4d7108;});}return _0x4d7108;})[_0xf906('0xc')](function(_0x1f495a){logger[_0xf906('0x1c')](_0xf906('0x1e'),_0x5504ad);logger[_0xf906('0x1d')]('CreateVoiceRecording',_0x5504ad,JSON['stringify'](_0x1f495a));_0x138ea5(_0x1f495a);})[_0xf906('0x14')](function(_0x2654cd){logger['error'](_0xf906('0x1e'),_0x2654cd[_0xf906('0x13')],_0x5504ad);_0x59a848(_0x1d4509[_0xf906('0x10')](0x1f4,_0x2654cd[_0xf906('0x13')]));});});};
\ No newline at end of file
+var _0x02fb=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','body','existsSync','value','format','%s.cypher','encryptFile','secrets','unlink','lodash','util'];(function(_0x2a8631,_0x474172){var _0xd24315=function(_0x4acaa7){while(--_0x4acaa7){_0x2a8631['push'](_0x2a8631['shift']());}};_0xd24315(++_0x474172);}(_0x02fb,0x1b6));var _0xb02f=function(_0x31be14,_0x519b23){_0x31be14=_0x31be14-0x0;var _0x4c8726=_0x02fb[_0x31be14];return _0x4c8726;};'use strict';var _=require(_0xb02f('0x0'));var util=require(_0xb02f('0x1'));var moment=require(_0xb02f('0x2'));var BPromise=require(_0xb02f('0x3'));var rs=require(_0xb02f('0x4'));var fs=require('fs');var Redis=require(_0xb02f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb02f('0x6'));var logger=require(_0xb02f('0x7'))('rpc');var config=require(_0xb02f('0x8'));var jayson=require(_0xb02f('0x9'));var client=jayson[_0xb02f('0xa')][_0xb02f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38b740,_0xd229c6,_0x501f28){return new BPromise(function(_0x2f40da,_0x5af82f){return client[_0xb02f('0xc')](_0x38b740,_0x501f28)['then'](function(_0x2874d4){logger[_0xb02f('0xd')]('VoiceRecording,\x20%s,\x20%s',_0xd229c6,'request\x20sent');logger[_0xb02f('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0xd229c6,'request\x20sent',JSON[_0xb02f('0xf')](_0x2874d4));if(_0x2874d4[_0xb02f('0x10')]){if(_0x2874d4[_0xb02f('0x10')][_0xb02f('0x11')]===0x1f4){logger[_0xb02f('0x10')](_0xb02f('0x12'),_0xd229c6,_0x2874d4[_0xb02f('0x10')][_0xb02f('0x13')]);return _0x5af82f(_0x2874d4['error'][_0xb02f('0x13')]);}logger[_0xb02f('0x10')](_0xb02f('0x12'),_0xd229c6,_0x2874d4[_0xb02f('0x10')][_0xb02f('0x13')]);return _0x2f40da(_0x2874d4[_0xb02f('0x10')][_0xb02f('0x13')]);}else{logger['info'](_0xb02f('0x12'),_0xd229c6,'request\x20sent');_0x2f40da(_0x2874d4[_0xb02f('0x14')]['message']);}})[_0xb02f('0x15')](function(_0xf7043d){logger[_0xb02f('0x10')](_0xb02f('0x12'),_0xd229c6,_0xf7043d);_0x5af82f(_0xf7043d);});});}exports['UpdateVoiceRecording']=function(_0x5e4823){var _0x18ae64=this;return new Promise(function(_0xfeef1a,_0x4a411a){return db[_0xb02f('0x16')][_0xb02f('0x17')](_0x5e4823['body'],{'raw':_0x5e4823[_0xb02f('0x18')]?_0x5e4823[_0xb02f('0x18')][_0xb02f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4823[_0xb02f('0x18')]?_0x5e4823[_0xb02f('0x18')][_0xb02f('0x1a')]||null:null,'attributes':_0x5e4823[_0xb02f('0x18')]?_0x5e4823[_0xb02f('0x18')][_0xb02f('0x1b')]||null:null,'limit':_0x5e4823[_0xb02f('0x18')]?_0x5e4823[_0xb02f('0x18')][_0xb02f('0x1c')]||null:null})['then'](function(_0x5c879d){logger[_0xb02f('0xd')](_0xb02f('0x1d'),_0x5e4823);logger[_0xb02f('0xe')]('UpdateVoiceRecording',_0x5e4823,JSON[_0xb02f('0xf')](_0x5c879d));_0xfeef1a(_0x5c879d);})['catch'](function(_0x428ef9){logger[_0xb02f('0x10')](_0xb02f('0x1d'),_0x428ef9[_0xb02f('0x13')],_0x5e4823);_0x4a411a(_0x18ae64['error'](0x1f4,_0x428ef9[_0xb02f('0x13')]));});});};exports[_0xb02f('0x1e')]=function(_0xfc9f88){var _0x1f94dc=this;return new Promise(function(_0x3dac1,_0x4af3d7){var _0x53ec17=require(_0xb02f('0x1f'));var _0x32cd80;return db[_0xb02f('0x20')][_0xb02f('0x21')]({'attributes':['id',_0xb02f('0x22')],'where':{'id':0x1},'raw':!![]})[_0xb02f('0x23')](function(_0x5acb8e){_0x32cd80=_0x5acb8e;return db['VoiceRecording']['create'](_0xfc9f88[_0xb02f('0x24')]);})[_0xb02f('0x23')](function(_0x92d3bd){if(_0x32cd80['callRecordingEncryption']&&fs[_0xb02f('0x25')](_0x92d3bd[_0xb02f('0x26')])){var _0x146cd4=util[_0xb02f('0x27')](_0xb02f('0x28'),_0x92d3bd[_0xb02f('0x26')]);return _0x53ec17[_0xb02f('0x29')](_0x92d3bd['value'],_0x146cd4,config[_0xb02f('0x2a')]['recording'])[_0xb02f('0x23')](function(){fs[_0xb02f('0x2b')](_0x92d3bd[_0xb02f('0x26')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x92d3bd;});}return _0x92d3bd;})['then'](function(_0x27fd6a){logger[_0xb02f('0xd')]('CreateVoiceRecording',_0xfc9f88);logger[_0xb02f('0xe')](_0xb02f('0x1e'),_0xfc9f88,JSON[_0xb02f('0xf')](_0x27fd6a));_0x3dac1(_0x27fd6a);})['catch'](function(_0x51b2d2){logger[_0xb02f('0x10')]('CreateVoiceRecording',_0x51b2d2[_0xb02f('0x13')],_0xfc9f88);_0x4af3d7(_0x1f94dc[_0xb02f('0x10')](0x1f4,_0x51b2d2[_0xb02f('0x13')]));});});};
\ No newline at end of file