diff --git a/api/controllers/actions.ts b/api/controllers/actions.ts index a6421a5..151dcc9 100644 --- a/api/controllers/actions.ts +++ b/api/controllers/actions.ts @@ -6,6 +6,8 @@ import * as rsa from '../crypto/rsa' import * as jsonUtils from '../utils/json' import * as socket from '../utils/socket' import { success, failure } from '../utils/res' +import * as tribes from '../utils/tribes' + /* hexdump -n 8 -e '4/4 "%08X" 1 "\n"' /dev/random @@ -52,15 +54,40 @@ export async function processAction(req, res) { } try { - const r = await finalAction(a) + const r = await finalAction(a,bot_id) success(res, r) } catch(e) { failure(res, e) } } -export async function finalAction(a:Action){ +export async function finalAction(a:Action, bot_id:string){ const {action,pubkey,amount,content,bot_name,chat_uuid} = a + if (!chat_uuid) throw 'no chat_uuid' + + const owner = await models.Contact.findOne({ where: { isOwner: true } }) + + let theChat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) + if(!theChat) { + // is this a bot member cmd res + const botMember = await models.BotMember.findOne({where:{ + tribeUuid: chat_uuid, botId: bot_id + }}) + if(!botMember) return console.log('no botMember') + + const dest = botMember.memberPubkey + if(!dest) return console.log('no dest to send to') + const topic = `${dest}/${chat_uuid}` + const data = { + ...a, + bot_id, + sender:{pub_key: owner.publicKey} // for verify sig + } + await tribes.publish(topic, data, function(){ + + }) + return + } if (action === 'keysend') { console.log('=> BOT KEYSEND') @@ -83,10 +110,8 @@ export async function finalAction(a:Action){ } else if (action === 'broadcast') { console.log('=> BOT BROADCAST') - if (!chat_uuid || !content) throw 'no chatID or content' - const owner = await models.Contact.findOne({ where: { isOwner: true } }) - const theChat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) - if (!theChat || !owner) throw 'no chat' + if (!content) throw 'no content' + if (!theChat) throw 'no chat' if (!theChat.type === constants.chat_types.tribe) throw 'not a tribe' const encryptedForMeText = rsa.encrypt(owner.contactKey, content) diff --git a/api/controllers/bots.ts b/api/controllers/bots.ts index ea56a2a..11a5f52 100644 --- a/api/controllers/bots.ts +++ b/api/controllers/bots.ts @@ -5,6 +5,8 @@ import { models } from '../models' import * as jsonUtils from '../utils/json' import { success, failure } from '../utils/res' import * as network from '../network' +import * as intercept from '../network/intercept' +import {finalAction} from './actions' const constants = require(path.join(__dirname, '../../config/constants.json')) @@ -32,7 +34,7 @@ export const createBot = async (req, res) => { try { const owner = await models.Contact.findOne({ where: { isOwner: true } }) const theBot = await models.Bot.create(newBot) - // post to bots.sphinx.chat + // post to tribes.sphinx.chat tribes.declare_bot({ uuid, owner_pubkey: owner.publicKey, @@ -73,8 +75,8 @@ export async function installBot(chatId:number, bot_json) { pricePerUse: price_per_use } console.log("installBot INSTALL BOT NOW",chatBot) - keysendBotInstall(chatBot) - await models.ChatBot.create(chatBot) + const succeeded = await keysendBotInstall(chatBot) + if(succeeded) models.ChatBot.create(chatBot) } export async function keysendBotInstall(b): Promise { @@ -88,24 +90,12 @@ export async function keysendBotCmd(msg, b): Promise { return await botKeysend( constants.message_types.bot_cmd, b.botUuid, b.botMakerPubkey, b.pricePerUse, - msg.message.content + msg.message.content, + msg.chat.uuid, ) } -export async function receiveBotInstall(payload) { - console.log('=> receiveBotInstall') - - // const dat = payload.content || payload - // const sender_pub_key = dat.sender.pub_key - // const bot_uuid = dat.bot_uuid - - // verify tribe ownership (verify signed timestamp) - - // CHECK PUBKEY - is it me? install it! (create botmember) - // if the pubkey=the botOwnerPubkey, (create chatbot) -} - -export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content?:string): Promise { +export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content?:string, chat_uuid?:string): Promise { const owner = await models.Contact.findOne({ where: { isOwner: true } }) const MIN_SATS = 3 const destkey = botmaker_pubkey @@ -117,10 +107,14 @@ export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_ message: {content: content||''}, sender: { pub_key: owner.publicKey, - } + }, + chat: {} }, amt: Math.max(price_per_use || MIN_SATS) } + if(chat_uuid) { + opts.data.chat = {uuid:chat_uuid} + } try { await network.signAndSend(opts) return true @@ -129,24 +123,70 @@ export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_ } } -// type BotCmdType = 'install' | 'message' | 'broadcast' | 'keysend' +export async function receiveBotInstall(payload) { + console.log('=> receiveBotInstall',payload) + + const dat = payload.content || payload + const sender_pub_key = dat.sender && dat.sender.pub_key + const bot_uuid = dat.bot_uuid + const chat_uuid = dat.chat && dat.chat.uuid + if(!chat_uuid || !sender_pub_key) return console.log('no chat uuid or sender pub key') + + const owner = await models.Contact.findOne({ where: { isOwner: true } }) + + const bot = await models.Bot.findOne({where:{ + uuid: bot_uuid + }}) + if(!bot) return + + const verifiedOwnerPubkey = await tribes.verifySignedTimestamp(bot_uuid) + if(verifiedOwnerPubkey===owner.publicKey){ + const botMember = { + botId: bot.id, + memberPubkey:sender_pub_key, + tribeUuid:chat_uuid, + msgCount:0, + } + console.log("CREATE bot MEMBER", botMember) + await models.BotMember.create(botMember) + } + + //- need to pub back MQTT bot_install?? + //- and if the pubkey=the botOwnerPubkey, confirm chatbot? +} export async function receiveBotCmd(payload) { - console.log("=> receiveBotCmd") - console.log(constants.message_types.bot_cmd) - // forward to the entire Action back + console.log("=> receiveBotCmd", payload) - // const dat = payload.content || payload + const dat = payload.content || payload // const sender_pub_key = dat.sender.pub_key - // const bot_uuid = dat.bot_uuid - // const content = dat.message.content - check prefix - // const amount = dat.message.amount + const bot_uuid = dat.bot_uuid + const chat_uuid = dat.chat && dat.chat.uuid + if(!chat_uuid) return console.log('no chat uuid') + // const amount = dat.message.amount - check price_per_use + + const bot = await models.Bot.findOne({where:{ + uuid: bot_uuid + }}) + if(!bot) return + + const botMember = await models.BotMember.findOne({ where:{ + botId: bot.id, + tribeUuid: chat_uuid, + }}) + if(!botMember) return + + botMember.update({ msgCount: (botMember||0)+1 }) + + console.log('=> post to remote BOT!!!!! bot owner') + return intercept.postToBotServer(payload, bot) + // forward to the entire Action back over MQTT } export async function receiveBotRes(payload) { - console.log("=> receiveBotRes") - console.log(constants.message_types.bot_res) + console.log("=> receiveBotRes", payload) // forward to the tribe // received the entire action? - + const bot_id = payload.bot_id + finalAction(payload, bot_id) } diff --git a/api/models/ts/botMember.ts b/api/models/ts/botMember.ts index 712080a..d0016f6 100644 --- a/api/models/ts/botMember.ts +++ b/api/models/ts/botMember.ts @@ -15,6 +15,9 @@ export default class BotMember extends Model { }) id: number + @Column + botId: string + @Column memberPubkey: string diff --git a/api/network/intercept.ts b/api/network/intercept.ts index d51fb75..a08d640 100644 --- a/api/network/intercept.ts +++ b/api/network/intercept.ts @@ -62,7 +62,10 @@ async function emitMessageToBot(msg, botInTribe): Promise { builtinBotEmit(msg) return true case constants.bot_types.local: - return postToBotServer(msg, botInTribe) + const bot = await models.Bot.findOne({where:{ + uuid: botInTribe.botUuid + }}) + return postToBotServer(msg, bot) case constants.bot_types.remote: return keysendBotCmd(msg, botInTribe) default: @@ -70,10 +73,8 @@ async function emitMessageToBot(msg, botInTribe): Promise { } } -async function postToBotServer(msg, botInTribe): Promise { - const bot = await models.Bot.findOne({where:{ - uuid: botInTribe.botUuid - }}) +export async function postToBotServer(msg, bot): Promise { + if(!bot) return false if(!bot.webhook || !bot.secret) return false const r = await fetch(bot.webhook, { method:'POST', diff --git a/api/network/receive.ts b/api/network/receive.ts index 39382e5..2a2af79 100644 --- a/api/network/receive.ts +++ b/api/network/receive.ts @@ -11,7 +11,6 @@ import {modifyPayloadAndSaveMediaKey,purchaseFromOriginalSender,sendFinalMemeIfF import {decryptMessage,encryptTribeBroadcast} from '../utils/msg' import { Op } from 'sequelize' import * as timers from '../utils/timers' -// import * as intercept from './intercept' /* delete type: @@ -34,14 +33,28 @@ const typesThatNeedPricePerMessage = [ export const typesToReplay=[ // should match typesToForward msgtypes.message, msgtypes.group_join, msgtypes.group_leave ] +const botTypes=[ + constants.message_types.bot_install, + constants.message_types.bot_cmd, + constants.message_types.bot_res +] async function onReceive(payload){ console.log('===> onReceive',JSON.stringify(payload,null,2)) + if(!payload.type) return console.log('no payload.type') + + if(botTypes.includes(payload.type)) { + console.log("=> got bot msg type!!!!") + if(!payload.bot_uuid) return console.log('no bot uuid') + return ACTIONS[payload.type](payload) + } + // if tribe, owner must forward to MQTT let doAction = true const toAddIn:{[k:string]:any} = {} let isTribe = false let isTribeOwner = false let chat + if(payload.chat&&payload.chat.uuid) { isTribe = payload.chat.type===constants.chat_types.tribe chat = await models.Chat.findOne({where:{uuid:payload.chat.uuid}}) diff --git a/api/utils/setup.ts b/api/utils/setup.ts index c556e0c..99b3579 100644 --- a/api/utils/setup.ts +++ b/api/utils/setup.ts @@ -69,6 +69,10 @@ async function migrate(){ )`) } catch(e){} + addTableColumn('sphinx_bot_members', 'bot_id') + + ////////// + try{ await sequelize.query(` CREATE TABLE sphinx_bots ( diff --git a/dist/api/controllers/actions.js b/dist/api/controllers/actions.js index f7e50c0..552b394 100644 --- a/dist/api/controllers/actions.js +++ b/dist/api/controllers/actions.js @@ -17,6 +17,7 @@ const rsa = require("../crypto/rsa"); const jsonUtils = require("../utils/json"); const socket = require("../utils/socket"); const res_1 = require("../utils/res"); +const tribes = require("../utils/tribes"); /* hexdump -n 8 -e '4/4 "%08X" 1 "\n"' /dev/random hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random @@ -53,7 +54,7 @@ function processAction(req, res) { bot_name: bot.name, chat_uuid }; try { - const r = yield finalAction(a); + const r = yield finalAction(a, bot_id); res_1.success(res, r); } catch (e) { @@ -62,9 +63,30 @@ function processAction(req, res) { }); } exports.processAction = processAction; -function finalAction(a) { +function finalAction(a, bot_id) { return __awaiter(this, void 0, void 0, function* () { const { action, pubkey, amount, content, bot_name, chat_uuid } = a; + if (!chat_uuid) + throw 'no chat_uuid'; + const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); + let theChat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); + if (!theChat) { + // is this a bot member cmd res + const botMember = yield models_1.models.BotMember.findOne({ where: { + tribeUuid: chat_uuid, botId: bot_id + } }); + if (!botMember) + return console.log('no botMember'); + const dest = botMember.memberPubkey; + if (!dest) + return console.log('no dest to send to'); + const topic = `${dest}/${chat_uuid}`; + const data = Object.assign(Object.assign({}, a), { bot_id, sender: { pub_key: owner.publicKey } // for verify sig + }); + yield tribes.publish(topic, data, function () { + }); + return; + } if (action === 'keysend') { console.log('=> BOT KEYSEND'); if (!(pubkey && pubkey.length === 66 && amount)) { @@ -87,11 +109,9 @@ function finalAction(a) { } else if (action === 'broadcast') { console.log('=> BOT BROADCAST'); - if (!chat_uuid || !content) - throw 'no chatID or content'; - const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); - const theChat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); - if (!theChat || !owner) + if (!content) + throw 'no content'; + if (!theChat) throw 'no chat'; if (!theChat.type === constants.chat_types.tribe) throw 'not a tribe'; diff --git a/dist/api/controllers/actions.js.map b/dist/api/controllers/actions.js.map index f10a467..cd4d49d 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,6BAA4B;AAC5B,sCAAqC;AACrC,sCAAkC;AAClC,oCAAmC;AACnC,qCAAoC;AACpC,2CAA0C;AAC1C,0CAAyC;AACzC,sCAA+C;AAE/C;;;EAGE;AAEF,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAA;AAW9E,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG;;QACxC,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACnB,IAAI,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACpE,IAAI,EAAE,uDAAuD;gBACzD,MAAM,QAAQ,GAA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MAAM,CAAC,QAAQ,CAAC;gBACZ,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC;aAC7D,CAAC,CAAA;YACF,MAAM,OAAO,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,OAAO;gBACb,MAAM,kCAAO,KAAK,CAAC,UAAU,KAAE,KAAK,EAAE,EAAE,EAAC,YAAY,GAAE;gBACvD,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;gBACjE,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO;gBACrC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBAClC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACX,MAAM,CAAC,CAAA;gBACX,CAAC;aACJ,CAAC,CAAA;SAEL;aAAM;YACH,MAAM,WAAW,CAAA;SACpB;IACL,CAAC;CAAA;AAtED,kCAsEC"} \ No newline at end of file +{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../api/controllers/actions.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,sCAAqC;AACrC,sCAAkC;AAClC,oCAAmC;AACnC,qCAAoC;AACpC,2CAA0C;AAC1C,0CAAyC;AACzC,sCAA+C;AAC/C,0CAAyC;AAGzC;;;EAGE;AAEF,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAA;AAW9E,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG;;QACxC,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACnB,IAAI,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC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AAE;gBACjE,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO;gBACrC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBAClC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACX,MAAM,CAAC,CAAA;gBACX,CAAC;aACJ,CAAC,CAAA;SAEL;aAAM;YACH,MAAM,WAAW,CAAA;SACpB;IACL,CAAC;CAAA;AA7FD,kCA6FC"} \ No newline at end of file diff --git a/dist/api/controllers/bots.js b/dist/api/controllers/bots.js index 3bc37ae..139df09 100644 --- a/dist/api/controllers/bots.js +++ b/dist/api/controllers/bots.js @@ -16,6 +16,8 @@ const models_1 = require("../models"); const jsonUtils = require("../utils/json"); const res_1 = require("../utils/res"); const network = require("../network"); +const intercept = require("../network/intercept"); +const actions_1 = require("./actions"); const constants = require(path.join(__dirname, '../../config/constants.json')); exports.getBots = (req, res) => __awaiter(void 0, void 0, void 0, function* () { try { @@ -40,7 +42,7 @@ exports.createBot = (req, res) => __awaiter(void 0, void 0, void 0, function* () try { const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); const theBot = yield models_1.models.Bot.create(newBot); - // post to bots.sphinx.chat + // post to tribes.sphinx.chat tribes.declare_bot({ uuid, owner_pubkey: owner.publicKey, @@ -83,8 +85,9 @@ function installBot(chatId, bot_json) { pricePerUse: price_per_use }; console.log("installBot INSTALL BOT NOW", chatBot); - keysendBotInstall(chatBot); - yield models_1.models.ChatBot.create(chatBot); + const succeeded = yield keysendBotInstall(chatBot); + if (succeeded) + models_1.models.ChatBot.create(chatBot); }); } exports.installBot = installBot; @@ -96,23 +99,11 @@ function keysendBotInstall(b) { exports.keysendBotInstall = keysendBotInstall; function keysendBotCmd(msg, b) { return __awaiter(this, void 0, void 0, function* () { - return yield botKeysend(constants.message_types.bot_cmd, b.botUuid, b.botMakerPubkey, b.pricePerUse, msg.message.content); + return yield botKeysend(constants.message_types.bot_cmd, b.botUuid, b.botMakerPubkey, b.pricePerUse, msg.message.content, msg.chat.uuid); }); } exports.keysendBotCmd = keysendBotCmd; -function receiveBotInstall(payload) { - return __awaiter(this, void 0, void 0, function* () { - console.log('=> receiveBotInstall'); - // const dat = payload.content || payload - // const sender_pub_key = dat.sender.pub_key - // const bot_uuid = dat.bot_uuid - // verify tribe ownership (verify signed timestamp) - // CHECK PUBKEY - is it me? install it! (create botmember) - // if the pubkey=the botOwnerPubkey, (create chatbot) - }); -} -exports.receiveBotInstall = receiveBotInstall; -function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content) { +function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content, chat_uuid) { return __awaiter(this, void 0, void 0, function* () { const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); const MIN_SATS = 3; @@ -125,10 +116,14 @@ function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content) message: { content: content || '' }, sender: { pub_key: owner.publicKey, - } + }, + chat: {} }, amt: Math.max(price_per_use || MIN_SATS) }; + if (chat_uuid) { + opts.data.chat = { uuid: chat_uuid }; + } try { yield network.signAndSend(opts); return true; @@ -139,26 +134,72 @@ function botKeysend(msg_type, bot_uuid, botmaker_pubkey, price_per_use, content) }); } exports.botKeysend = botKeysend; -// type BotCmdType = 'install' | 'message' | 'broadcast' | 'keysend' +function receiveBotInstall(payload) { + return __awaiter(this, void 0, void 0, function* () { + console.log('=> receiveBotInstall', payload); + const dat = payload.content || payload; + const sender_pub_key = dat.sender && dat.sender.pub_key; + const bot_uuid = dat.bot_uuid; + const chat_uuid = dat.chat && dat.chat.uuid; + if (!chat_uuid || !sender_pub_key) + return console.log('no chat uuid or sender pub key'); + const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); + const bot = yield models_1.models.Bot.findOne({ where: { + uuid: bot_uuid + } }); + if (!bot) + return; + const verifiedOwnerPubkey = yield tribes.verifySignedTimestamp(bot_uuid); + if (verifiedOwnerPubkey === owner.publicKey) { + const botMember = { + botId: bot.id, + memberPubkey: sender_pub_key, + tribeUuid: chat_uuid, + msgCount: 0, + }; + console.log("CREATE bot MEMBER", botMember); + yield models_1.models.BotMember.create(botMember); + } + //- need to pub back MQTT bot_install?? + //- and if the pubkey=the botOwnerPubkey, confirm chatbot? + }); +} +exports.receiveBotInstall = receiveBotInstall; function receiveBotCmd(payload) { return __awaiter(this, void 0, void 0, function* () { - console.log("=> receiveBotCmd"); - console.log(constants.message_types.bot_cmd); - // forward to the entire Action back - // const dat = payload.content || payload + console.log("=> receiveBotCmd", payload); + const dat = payload.content || payload; // const sender_pub_key = dat.sender.pub_key - // const bot_uuid = dat.bot_uuid - // const content = dat.message.content - check prefix - // const amount = dat.message.amount + const bot_uuid = dat.bot_uuid; + const chat_uuid = dat.chat && dat.chat.uuid; + if (!chat_uuid) + return console.log('no chat uuid'); + // const amount = dat.message.amount - check price_per_use + const bot = yield models_1.models.Bot.findOne({ where: { + uuid: bot_uuid + } }); + if (!bot) + return; + const botMember = yield models_1.models.BotMember.findOne({ where: { + botId: bot.id, + tribeUuid: chat_uuid, + } }); + if (!botMember) + return; + botMember.update({ msgCount: (botMember || 0) + 1 }); + console.log('=> post to remote BOT!!!!! bot owner'); + return intercept.postToBotServer(payload, bot); + // forward to the entire Action back over MQTT }); } exports.receiveBotCmd = receiveBotCmd; function receiveBotRes(payload) { return __awaiter(this, void 0, void 0, function* () { - console.log("=> receiveBotRes"); - console.log(constants.message_types.bot_res); + console.log("=> receiveBotRes", payload); // forward to the tribe // received the entire action? + const bot_id = payload.bot_id; + actions_1.finalAction(payload, bot_id); }); } exports.receiveBotRes = receiveBotRes; diff --git a/dist/api/controllers/bots.js.map b/dist/api/controllers/bots.js.map index 3dab637..2b2e74b 100644 --- a/dist/api/controllers/bots.js.map +++ b/dist/api/controllers/bots.js.map @@ -1 +1 @@ -{"version":3,"file":"bots.js","sourceRoot":"","sources":["../../../api/controllers/bots.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6B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I,EAAE,QAAQ;aACf,EAAC,CAAC,CAAA;QACH,IAAG,CAAC,GAAG;YAAE,OAAM;QAEf,MAAM,SAAS,GAAG,MAAM,eAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,EAAC;gBACvD,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,SAAS,EAAE,SAAS;aACrB,EAAC,CAAC,CAAA;QACH,IAAG,CAAC,SAAS;YAAE,OAAM;QAErB,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,IAAE,CAAC,CAAC,GAAC,CAAC,EAAE,CAAC,CAAA;QAEhD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;QACpD,OAAO,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QAC5C,8CAA8C;IACjD,CAAC;CAAA;AA1BD,sCA0BC;AAED,SAAsB,aAAa,CAAC,OAAO;;QACzC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;QACxC,uBAAuB;QACvB,8BAA8B;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC7B,qBAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC9B,CAAC;CAAA;AAND,sCAMC"} \ No newline at end of file diff --git a/dist/api/models/ts/botMember.js b/dist/api/models/ts/botMember.js index a1f33de..465dfa1 100644 --- a/dist/api/models/ts/botMember.js +++ b/dist/api/models/ts/botMember.js @@ -24,6 +24,10 @@ __decorate([ }), __metadata("design:type", Number) ], BotMember.prototype, "id", void 0); +__decorate([ + sequelize_typescript_1.Column, + __metadata("design:type", String) +], BotMember.prototype, "botId", void 0); __decorate([ sequelize_typescript_1.Column, __metadata("design:type", String) diff --git a/dist/api/models/ts/botMember.js.map b/dist/api/models/ts/botMember.js.map index ffd0395..289dd93 100644 --- a/dist/api/models/ts/botMember.js.map +++ b/dist/api/models/ts/botMember.js.map @@ -1 +1 @@ -{"version":3,"file":"botMember.js","sourceRoot":"","sources":["../../../../api/models/ts/botMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAEtE;;EAEE;AAGF,IAAqB,SAAS,GAA9B,MAAqB,SAAU,SAAQ,4BAAgB;CAyBtD,CAAA;AAjBC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;qCACQ;AAGV;IADC,6BAAM;;+CACa;AAGpB;IADC,6BAAM;;4CACU;AAGjB;IADC,6BAAM;;2CACS;AAGhB;IADC,6BAAM;8BACI,IAAI;4CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;4CAAA;AAvBI,SAAS;IAD7B,4BAAK,CAAC,EAAC,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACvC,SAAS,CAyB7B;kBAzBoB,SAAS"} \ No newline at end of file +{"version":3,"file":"botMember.js","sourceRoot":"","sources":["../../../../api/models/ts/botMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAEtE;;EAEE;AAGF,IAAqB,SAAS,GAA9B,MAAqB,SAAU,SAAQ,4BAAgB;CA4BtD,CAAA;AApBC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;qCACQ;AAGV;IADC,6BAAM;;wCACM;AAGb;IADC,6BAAM;;+CACa;AAGpB;IADC,6BAAM;;4CACU;AAGjB;IADC,6BAAM;;2CACS;AAGhB;IADC,6BAAM;8BACI,IAAI;4CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;4CAAA;AA1BI,SAAS;IAD7B,4BAAK,CAAC,EAAC,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACvC,SAAS,CA4B7B;kBA5BoB,SAAS"} \ No newline at end of file diff --git a/dist/api/network/intercept.js b/dist/api/network/intercept.js index ba8e489..525129f 100644 --- a/dist/api/network/intercept.js +++ b/dist/api/network/intercept.js @@ -71,7 +71,10 @@ function emitMessageToBot(msg, botInTribe) { bots_1.builtinBotEmit(msg); return true; case constants.bot_types.local: - return postToBotServer(msg, botInTribe); + const bot = yield models_1.models.Bot.findOne({ where: { + uuid: botInTribe.botUuid + } }); + return postToBotServer(msg, bot); case constants.bot_types.remote: return bots_2.keysendBotCmd(msg, botInTribe); default: @@ -79,11 +82,10 @@ function emitMessageToBot(msg, botInTribe) { } }); } -function postToBotServer(msg, botInTribe) { +function postToBotServer(msg, bot) { return __awaiter(this, void 0, void 0, function* () { - const bot = yield models_1.models.Bot.findOne({ where: { - uuid: botInTribe.botUuid - } }); + if (!bot) + return false; if (!bot.webhook || !bot.secret) return false; const r = yield node_fetch_1.default(bot.webhook, { @@ -97,6 +99,7 @@ function postToBotServer(msg, botInTribe) { return r.ok; }); } +exports.postToBotServer = postToBotServer; function asyncForEach(array, callback) { return __awaiter(this, void 0, void 0, function* () { for (let index = 0; index < array.length; index++) { diff --git a/dist/api/network/intercept.js.map b/dist/api/network/intercept.js.map index 73bd509..dc00300 100644 --- a/dist/api/network/intercept.js.map +++ b/dist/api/network/intercept.js.map @@ -1 +1 @@ -{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../api/network/intercept.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,sCAAkC;AAClC,kCAAsD;AACtD,8CAAiD;AACjD,6BAA4B;AAC5B,2CAA8B;AAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E;;;EAGE;AAEF,kDAAkD;AAClD,SAAsB,QAAQ,CAAC,GAAO,EAAE,QAAgB;;QACtD,MAAM,GAAG,GAAG,GAAG,CA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AAkB;aACnC;SACF,CAAC,CAAA;QACF,OAAO,CAAC,CAAC,EAAE,CAAA;IACb,CAAC;CAAA;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;IACF,CAAC;CAAA"} \ No newline at end of file +{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../api/network/intercept.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,sCAAkC;AAClC,kCAAsD;AACtD,8CAAiD;AACjD,6BAA4B;AAC5B,2CAA8B;AAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E;;;EAGE;AAEF,kDAAkD;AAClD,SAAsB,QAAQ,CAAC,GAAO,EAAE,QAAgB;;QACtD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;QAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAA;QACxB,IAAG,OAAO,KAAG,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE;YAC5C,OAAO,KAAK,CAAA,CAAC,sCAAsC;SACpD;QACD,MAAM,IAAI,GAAG,MAAM,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAC,KAAK,EAAC;gBAC5C,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;aACpB,EAAC,CAAC,CAAA;QACH,IAAG,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QAEtB,IAAI,OAAO,GAAG,KAAK,CAAA;QAEnB,IAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC1B,qBAAc,CAAC,GAAG,CAAC,CAAA;YACnB,OAA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AG,MAAM,eAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAC,KAAK,EAAC;wBAC1C,IAAI,EAAE,UAAU,CAAC,OAAO;qBACzB,EAAC,CAAC,CAAA;gBACH,OAAO,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAClC,KAAK,SAAS,CAAC,SAAS,CAAC,MAAM;gBAC7B,OAAO,oBAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;YACvC;gBACE,OAAO,KAAK,CAAA;SACf;IACH,CAAC;CAAA;AAED,SAAsB,eAAe,CAAC,GAAG,EAAE,GAAG;;QAC5C,IAAG,CAAC,GAAG;YAAE,OAAO,KAAK,CAAA;QACrB,IAAG,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,OAAO,KAAK,CAAA;QAC5C,MAAM,CAAC,GAAG,MAAM,oBAAK,CAAC,GAAG,CAAC,OAAO,EAAE;YACjC,MAAM,EAAC,MAAM;YACb,IAAI,EAAC,IAAI,CAAC,SAAS,CACjB,sBAAe,CAAC,GAAG,CAAC,CACrB;YACD,OAAO,EAAC;gBACN,UAAU,EAAE,GAAG,CAAC,MAAM;gBACtB,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAA;QACF,OAAO,CAAC,CAAC,EAAE,CAAA;IACb,CAAC;CAAA;AAdD,0CAcC;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/dist/api/network/receive.js b/dist/api/network/receive.js index 2ff597d..f703de8 100644 --- a/dist/api/network/receive.js +++ b/dist/api/network/receive.js @@ -22,7 +22,6 @@ const modify_1 = require("./modify"); const msg_1 = require("../utils/msg"); const sequelize_1 = require("sequelize"); const timers = require("../utils/timers"); -// import * as intercept from './intercept' /* delete type: owner needs to check that the delete is the one who made the msg @@ -42,9 +41,22 @@ const typesThatNeedPricePerMessage = [ exports.typesToReplay = [ msgtypes.message, msgtypes.group_join, msgtypes.group_leave ]; +const botTypes = [ + constants.message_types.bot_install, + constants.message_types.bot_cmd, + constants.message_types.bot_res +]; function onReceive(payload) { return __awaiter(this, void 0, void 0, function* () { console.log('===> onReceive', JSON.stringify(payload, null, 2)); + if (!payload.type) + return console.log('no payload.type'); + if (botTypes.includes(payload.type)) { + console.log("=> got bot msg type!!!!"); + if (!payload.bot_uuid) + return console.log('no bot uuid'); + return controllers_1.ACTIONS[payload.type](payload); + } // if tribe, owner must forward to MQTT let doAction = true; const toAddIn = {}; diff --git a/dist/api/network/receive.js.map b/dist/api/network/receive.js.map index cac2e6a..0f017c2 100644 --- a/dist/api/network/receive.js.map +++ b/dist/api/network/receive.js.map @@ -1 +1 @@ -{"version":3,"file":"receive.js","sourceRoot":"","sources":["../../../api/network/receive.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,sCAAqC;AACrC,kDAA0C;AAC1C,gDAAsC;AACtC,0CAAyC;AACzC,kDAA2D;AAC3D,0CAAyC;AACzC,sCAAkC;AAClC,iCAAkC;AAClC,qCAA8G;AAC9G,sCAAiE;AACjE,yCAA8B;AAC9B,0CAAyC;AACzC,2CAA2C;AAE3C;;;;EAIE;AAEF,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAC7E,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAA;AAE3B,QAAA,cAAc,GAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAA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CAAC,CAAC,CAAC,EAAC;QAClC,cAAc;QACd,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;QACtB,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAA,EAAE;YAC7C,OAAO,IAAI,GAAG,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;KACd;AACF,CAAC"} \ No newline at end of file diff --git a/dist/api/utils/setup.js b/dist/api/utils/setup.js index 794bf1c..3e66052 100644 --- a/dist/api/utils/setup.js +++ b/dist/api/utils/setup.js @@ -80,6 +80,8 @@ function migrate() { )`); } catch (e) { } + addTableColumn('sphinx_bot_members', 'bot_id'); + ////////// try { yield models_1.sequelize.query(` CREATE TABLE sphinx_bots ( diff --git a/dist/api/utils/setup.js.map b/dist/api/utils/setup.js.map index dd7ad7c..89bed57 100644 --- a/dist/api/utils/setup.js.map +++ b/dist/api/utils/setup.js.map @@ -1 +1 @@ -{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../api/utils/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA2C;AAC3C,sCAA2C;AAC3C,iDAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,gDAAwC;AACxC,8CAA0D;AAE1D,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,GAAS,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACxC,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI;QACF,MAAM,kBAAS,CAAC,IAAI,EAAE,CAAA;QACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC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;CAAA"} \ No newline at end of file +{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../api/utils/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA2C;AAC3C,sCAA2C;AAC3C,iDAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,gDAAwC;AACxC,8CAA0D;AAE1D,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,GAAS,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACxC,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI;QACF,MAAM,kBAAS,CAAC,IAAI,EAAE,CAAA;QACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;KACpC;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,CAAC,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,EAAE,CAAA;IACf,iBAAiB,EAAE,CAAA;IACnB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AACnC,CAAC,CAAA,CAAA;AA0JQ,sCAAa;AAxJtB,SAAe,UAAU;;QACvB,IAAI;YACF,MAAM,kBAAS,CAAC,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAA;SAC/D;QAAC,OAAM,CAAC,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAC,CAAC,CAAC,CAAA;SACtC;IACH,CAAC;CAAA;AAED,SAAe,OAAO;;QAEpB,IAAG;YACD,MAAM,kBAAS,CAAC,KAAK,CAAC;;;;;;;;;;;;;MAapB,CAAC,CAAA;SACJ;QAAC,OAAM,CAAC,EAAC,GAAE;QAEZ,IAAG;YACD,MAAM,kBAAS,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAA;SACpG;QAAA,OAAM,CAAC,EAAC,GAAE;QAEX,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QACxC,cAAc,CAAC,aA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