diff --git a/api/controllers/actions.ts b/api/controllers/actions.ts index da2213c..177725f 100644 --- a/api/controllers/actions.ts +++ b/api/controllers/actions.ts @@ -13,6 +13,7 @@ hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random const constants = require(path.join(__dirname,'../../config/constants.json')) export async function processAction(req, res) { + console.log('=> process action') let body = req.body if(body.data && typeof body.data==='string' && body.data[1]==="'") { try { // parse out body from "data" for github webhook action @@ -24,8 +25,9 @@ export async function processAction(req, res) { } } const {action,bot_id,bot_secret,pubkey,amount,text} = body - + console.log('=> process action',JSON.stringify(body,null,2)) const bot = await models.Bot.findOne({where:{id:bot_id}}) + console.log('=> bot:',bot.dataValues) if(!bot) return failure(res,'no bot') if(!(bot.secret&&bot.secret===bot_secret)) { @@ -36,6 +38,7 @@ export async function processAction(req, res) { } if(action==='keysend') { + console.log('=> BOT KEYSEND') if(!(pubkey&&pubkey.length===66&&amount)) { return failure(res, 'wrong params') } @@ -53,6 +56,7 @@ export async function processAction(req, res) { return failure(res, e) } } else if (action==='broadcast') { + console.log('=> BOT BROADCAST') if(!bot.chat_id || !text) return failure(res,'no uuid or text') const owner = await models.Contact.findOne({ where: { isOwner: true } }) const theChat = await models.Chat.findOne({where:{id: bot.chat_id}}) diff --git a/dist/api/controllers/actions.js b/dist/api/controllers/actions.js index b63ec9c..f3e7e89 100644 --- a/dist/api/controllers/actions.js +++ b/dist/api/controllers/actions.js @@ -22,6 +22,7 @@ hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random const constants = require(path.join(__dirname, '../../config/constants.json')); function processAction(req, res) { return __awaiter(this, void 0, void 0, function* () { + console.log('=> process action'); let body = req.body; if (body.data && typeof body.data === 'string' && body.data[1] === "'") { try { // parse out body from "data" for github webhook action @@ -35,7 +36,9 @@ function processAction(req, res) { } } const { action, bot_id, bot_secret, pubkey, amount, text } = body; + console.log('=> process action', JSON.stringify(body, null, 2)); const bot = yield models_1.models.Bot.findOne({ where: { id: bot_id } }); + console.log('=> bot:', bot.dataValues); if (!bot) return res_1.failure(res, 'no bot'); if (!(bot.secret && bot.secret === bot_secret)) { @@ -45,6 +48,7 @@ function processAction(req, res) { return res_1.failure(res, 'no action'); } if (action === 'keysend') { + console.log('=> BOT KEYSEND'); if (!(pubkey && pubkey.length === 66 && amount)) { return res_1.failure(res, 'wrong params'); } @@ -64,6 +68,7 @@ function processAction(req, res) { } } else if (action === 'broadcast') { + console.log('=> BOT BROADCAST'); if (!bot.chat_id || !text) return res_1.failure(res, 'no uuid or text'); const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); diff --git a/dist/api/controllers/actions.js.map b/dist/api/controllers/actions.js.map index 290729c..2c3ddb7 100644 --- a/dist/api/controllers/actions.js.map +++ b/dist/api/controllers/actions.js.map @@ -1 +1 @@ -{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../api/controllers/actions.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,6BAA4B;AAC5B,sCAAqC;AACrC,sCAAkC;AAClC,oCAAmC;AACnC,qCAAoC;AAEpC;;;EAGE;AAEF,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG;;QACxC,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACnB,IAAG,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAG,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAG,GAAG,EAAE;YAC/D,IAAI,EAAE,uDAAuD;gBACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAC,GAAG,CAAC,CAAC,CAAA;gBACxD,IAAG,QAAQ;oBAAE,IAAI,GAAC,QAAQ,CAAA;aAC7B;YAAC,OAAM,CAAC,EAAE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C,EAAE;gBAClB,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE;gBACtB,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO;gBACrC,MAAM,EAAE,KAAK,CAAC,EAAE;gBAChB,MAAM,EAAE,MAAM,IAAE,CAAC;gBACjB,IAAI,EAAE,IAAI;gBACV,cAAc,EAAE,kBAAkB;gBAClC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBAC7C,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS;gBACpC,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,KAAK;aACrB,CAAA;YACD,MAAM,OAAO,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAChD,MAAM,OAAO,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,OAAO;gBACb,MAAM,kCAAM,KAAK,CAAC,UAAU,KAAE,KAAK,GAAC;gBACpC,OAAO,EAAE,EAAE,OAAO,EAAC,OAAO,EAAE,EAAE,EAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;gBAC/D,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO;gBACrC,OAAO,EAAE,GAAE,EAAE,CAAC,aAAO,CAAC,GAAG,EAAE,EAAC,OAAO,EAAC,IAAI,EAAC,CAAC;gBAC1C,OAAO,EAAE,GAAE,EAAE,CAAC,aAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;aACvC,CAAC,CAAA;SACL;aAAM;YACH,OAAO,aAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;SACnC;IACL,CAAC;CAAA;AA/ED,sCA+EC"} \ No newline at end of file +{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../api/controllers/actions.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,6BAA4B;AAC5B,sCAAqC;AACrC,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